Skip to content

Commit

Permalink
Merge branch 'release/v4.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Nov 16, 2019
2 parents d115c36 + eb7c422 commit e2a84f7
Show file tree
Hide file tree
Showing 39 changed files with 211 additions and 143 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [mikepenz]
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ android:
components:
- tools
- platform-tools
- build-tools-29.0.0
- build-tools-29.0.2
- android-29
- sys-img-armeabi-v7a-android-18
before_install:
- yes | sdkmanager "platforms;android-29"
- yes | sdkmanager "build-tools;29.0.0"
- yes | sdkmanager "build-tools;29.0.2"
jdk:
- oraclejdk8
script:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can try it out here [Google Play](https://play.google.com/store/apps/details
# Include in your project
## Latest releases

- Kotlin | [v4.1.0](https://github.com/mikepenz/FastAdapter/tree/v4.1.0)
- Kotlin | [v4.1.1](https://github.com/mikepenz/FastAdapter/tree/v4.1.1)
- Java && AndroidX | [v3.3.1](https://github.com/mikepenz/FastAdapter/tree/v3.3.1)
- Java && AppCompat | [v3.2.9](https://github.com/mikepenz/FastAdapter/tree/v3.2.9)

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ buildscript {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:5.11.0"
classpath "io.realm:realm-gradle-plugin:6.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode
import androidx.core.view.LayoutInflaterCompat
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
Expand All @@ -21,7 +20,6 @@ import com.mikepenz.fastadapter.app.items.expandable.SimpleSubItem
import com.mikepenz.fastadapter.expandable.getExpandableExtension
import com.mikepenz.fastadapter.helpers.ActionModeHelper
import com.mikepenz.fastadapter.select.getSelectExtension
import com.mikepenz.iconics.context.IconicsLayoutInflater2
import com.mikepenz.materialize.MaterializeBuilder
import com.mikepenz.materialize.util.UIUtils
import com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration
Expand All @@ -44,9 +42,6 @@ class AdvancedSampleActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
findViewById<View>(android.R.id.content).systemUiVisibility = findViewById<View>(android.R.id.content).systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory2(layoutInflater, IconicsLayoutInflater2(delegate))
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)

Expand All @@ -65,7 +60,7 @@ class AdvancedSampleActivity : AppCompatActivity() {
//we also want the expandable feature

//create our FastAdapter
val adapters: Collection<ItemAdapter<out GenericItem>> = Arrays.asList(mHeaderAdapter, mItemAdapter)
val adapters: Collection<ItemAdapter<out GenericItem>> = listOf(mHeaderAdapter, mItemAdapter)
mFastAdapter = FastAdapter.with(adapters)

mFastAdapter.getExpandableExtension()
Expand All @@ -85,7 +80,7 @@ class AdvancedSampleActivity : AppCompatActivity() {

mFastAdapter.onPreLongClickListener = { _: View, _: GenericAdapter, item: GenericItem, position: Int ->
//we do not want expandable items to be selected
if (item is IExpandable<*> && item.subItems != null) {
if (item is IExpandable<*> && item.subItems.isNotEmpty()) {
true
} else {
//handle the longclick actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class EndlessScrollListActivity : AppCompatActivity(), ItemTouchCallback, ItemFi
fastItemAdapter.itemFilter.filterPredicate = { item: GenericItem, constraint: CharSequence? ->
if (item is SimpleItem) {
//return true if we should filter it out
item.name?.text.toString().toLowerCase().contains(constraint.toString().toLowerCase())
item.name?.text.toString().contains(constraint.toString(), ignoreCase = true)
} else {
//return false to keep it
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode
import androidx.core.view.LayoutInflaterCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.michaelflisar.dragselectrecyclerview.DragSelectTouchListener
import com.mikepenz.fastadapter.*
Expand All @@ -22,7 +21,6 @@ import com.mikepenz.fastadapter.helpers.RangeSelectorHelper
import com.mikepenz.fastadapter.select.SelectExtension
import com.mikepenz.fastadapter.select.getSelectExtension
import com.mikepenz.fastadapter.utils.SubItemUtil
import com.mikepenz.iconics.context.IconicsLayoutInflater
import com.mikepenz.itemanimators.SlideDownAlphaAnimator
import com.mikepenz.materialize.MaterializeBuilder
import com.mikepenz.materialize.util.UIUtils
Expand All @@ -40,9 +38,6 @@ class ExpandableMultiselectDeleteSampleActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
findViewById<View>(android.R.id.content).systemUiVisibility = findViewById<View>(android.R.id.content).systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory(layoutInflater, IconicsLayoutInflater(delegate))
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)

Expand Down Expand Up @@ -159,7 +154,7 @@ class ExpandableMultiselectDeleteSampleActivity : AppCompatActivity() {
mExpandableExtension.expand()

mSelectExtension.selectionListener = object : ISelectionListener<IItem<*>> {
override fun onSelectionChanged(item: IItem<*>?, selected: Boolean) {
override fun onSelectionChanged(item: IItem<*>, selected: Boolean) {
if (item is SimpleSubItem) {
val headerItem = item.parent
if (headerItem != null) {
Expand Down Expand Up @@ -213,7 +208,7 @@ class ExpandableMultiselectDeleteSampleActivity : AppCompatActivity() {

// delete the selected items with the SubItemUtil to correctly handle sub items
// this will even delete empty headers if you want to
SubItemUtil.deleteSelected(fastItemAdapter, mSelectExtension, mExpandableExtension, true, true)
SubItemUtil.deleteSelected(fastItemAdapter, mSelectExtension, mExpandableExtension, notifyParent = true, deleteEmptyHeaders = true)
//as we no longer have a selection so the actionMode can be finished
mode.finish()
//we consume the event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.LayoutInflaterCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.mikepenz.fastadapter.GenericItem
import com.mikepenz.fastadapter.adapters.FastItemAdapter
Expand All @@ -13,7 +12,6 @@ import com.mikepenz.fastadapter.app.items.expandable.SimpleSubExpandableItem
import com.mikepenz.fastadapter.app.items.expandable.SimpleSubItem
import com.mikepenz.fastadapter.expandable.getExpandableExtension
import com.mikepenz.fastadapter.select.getSelectExtension
import com.mikepenz.iconics.context.IconicsLayoutInflater2
import com.mikepenz.itemanimators.SlideDownAlphaAnimator
import com.mikepenz.materialize.MaterializeBuilder
import kotlinx.android.synthetic.main.activity_sample.*
Expand All @@ -26,9 +24,6 @@ class ExpandableSampleActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
findViewById<View>(android.R.id.content).systemUiVisibility = findViewById<View>(android.R.id.content).systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory2(layoutInflater, IconicsLayoutInflater2(delegate))
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.LayoutInflaterCompat
import androidx.recyclerview.widget.GridLayoutManager
import com.mikepenz.fastadapter.adapters.FastItemAdapter
import com.mikepenz.fastadapter.adapters.GenericFastItemAdapter
import com.mikepenz.fastadapter.app.items.IconItem
import com.mikepenz.fastadapter.app.items.expandable.SimpleSubExpandableItem
import com.mikepenz.fastadapter.expandable.getExpandableExtension
import com.mikepenz.iconics.Iconics
import com.mikepenz.iconics.context.IconicsLayoutInflater2
import com.mikepenz.itemanimators.SlideDownAlphaAnimator
import com.mikepenz.materialize.MaterializeBuilder
import kotlinx.android.synthetic.main.activity_sample.*
Expand All @@ -25,9 +23,6 @@ class IconGridActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
findViewById<View>(android.R.id.content).systemUiVisibility = findViewById<View>(android.R.id.content).systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory2(layoutInflater, IconicsLayoutInflater2(delegate))

super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import com.mikepenz.itemanimators.SlideDownAlphaAnimator
import com.mikepenz.materialize.MaterializeBuilder
import com.turingtechnologies.materialscrollbar.CustomIndicator
import com.turingtechnologies.materialscrollbar.DragScrollBar
import kotlinx.android.synthetic.main.activity_sample.*
import kotlinx.android.synthetic.main.activity_sample.rv
import kotlinx.android.synthetic.main.activity_sample.toolbar
import java.util.ArrayList
import java.util.Arrays
import kotlin.Comparator

class ModelItemActivity : AppCompatActivity() {
Expand All @@ -45,7 +45,7 @@ class ModelItemActivity : AppCompatActivity() {
}

//create our FastAdapter which will manage everything
fastAdapter = FastAdapter.with(Arrays.asList(itemAdapter))
fastAdapter = FastAdapter.with(listOf(itemAdapter))
val selectExtension = fastAdapter.getSelectExtension()
selectExtension.isSelectable = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MultiTypeModelItemActivity : AppCompatActivity() {
}

//create our FastAdapter which will manage everything
fastAdapter = FastAdapter.with(Arrays.asList(itemAdapter))
fastAdapter = FastAdapter.with(listOf(itemAdapter))
val selectExtension = fastAdapter.getSelectExtension()
selectExtension.isSelectable = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MultiselectSampleActivity : AppCompatActivity() {
multiSelect = true
selectOnLongClick = true
selectionListener = object : ISelectionListener<SimpleItem> {
override fun onSelectionChanged(item: SimpleItem?, selected: Boolean) {
override fun onSelectionChanged(item: SimpleItem, selected: Boolean) {
Log.i("FastAdapter", "SelectedCount: " + selectExtension.selections.size + " ItemsCount: " + selectExtension.selectedItems.size)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ class RealmActivity : AppCompatActivity() {

//configure our fastAdapter
mFastItemAdapter.onClickListener = { v: View?, _: IAdapter<RealmSampleUserItem>, item: RealmSampleUserItem, _: Int ->
v?.let { v ->
Toast.makeText(v.context, item.name, Toast.LENGTH_SHORT).show()
}
v?.let { Toast.makeText(it.context, item.name, Toast.LENGTH_SHORT).show() }
false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ import com.mikepenz.iconics.IconicsColor
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.materialdesigniconic.MaterialDesignIconic
import com.mikepenz.materialize.MaterializeBuilder
import kotlinx.android.synthetic.main.activity_sort.*
import kotlinx.android.synthetic.main.activity_sort.toolbar
import java.io.Serializable
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.util.*

/**
Expand Down Expand Up @@ -128,7 +126,6 @@ class SortActivity : AppCompatActivity() {
super.onSaveInstanceState(outState)
}


override fun onCreateOptionsMenu(menu: Menu): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.sort, menu)
Expand Down Expand Up @@ -216,7 +213,7 @@ class SortActivity : AppCompatActivity() {
return result.withDescription("$description letter in the alphabet")
}

@Retention(RetentionPolicy.SOURCE)
@Retention(AnnotationRetention.SOURCE)
@IntDef(SORT_NONE, SORT_ASCENDING, SORT_DESCENDING)
annotation class SortingStrategy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class SwipeListActivity : AppCompatActivity(), ItemTouchCallback, SimpleSwipeCal

//configure the itemAdapter
fastItemAdapter.itemFilter.filterPredicate = { item: SwipeableItem, constraint: CharSequence? ->
item.name?.text.toString().toLowerCase().contains(constraint.toString().toLowerCase())
item.name?.text.toString().contains(constraint.toString(), ignoreCase = true)
}

//get our recyclerView and do basic setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FastScrollIndicatorAdapter<Item : GenericItem> : RecyclerView.Adapter<Recy

override fun getCustomStringForElement(position: Int): String {
val item = getItem(position)
return if (item is ModelIconItem && item.model.icon.name != null) {
return if (item is ModelIconItem && item.model.icon.name.isNotEmpty()) {
//based on the position we set the headers text
item.model.icon.name
} else ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ object ImageDummyData {
)

private fun toList(vararg imageItems: ImageItem): List<ImageItem> {
return listOf(*imageItems)
return imageItems.toList()
}

private fun toList(vararg imageItems: SimpleImageItem): List<SimpleImageItem> {
return listOf(*imageItems)
return imageItems.toList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ open class HeaderSelectionItem : SimpleSubExpandableItem() {
this.mSubSelectionProvider = subSelectionProvider
}

override fun bindView(viewHolder: ViewHolder, payloads: MutableList<Any>) {
super.bindView(viewHolder, payloads)
override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) {
super.bindView(holder, payloads)

//get the context
val ctx = viewHolder.itemView.context
val ctx = holder.itemView.context

//set the background for the item
viewHolder.view.clearAnimation()
ViewCompat.setBackground(viewHolder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true))
holder.view.clearAnimation()
ViewCompat.setBackground(holder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true))
//set the text for the name
StringHolder.applyTo(name, viewHolder.name)
StringHolder.applyTo(name, holder.name)
//set the text for the description or hide

var selectedSubItems = 0
Expand All @@ -37,8 +37,8 @@ open class HeaderSelectionItem : SimpleSubExpandableItem() {
val descr = StringHolder(description?.text)
if (selectedSubItems > 0)
descr.setText("Selected children: " + selectedSubItems + "/" + subItems.size)
StringHolder.applyToOrHide(descr, viewHolder.description)
StringHolder.applyToOrHide(descr, holder.description)

viewHolder.description.setTextColor(if (selectedSubItems == 0) Color.BLACK else Color.RED)
holder.description.setTextColor(if (selectedSubItems == 0) Color.BLACK else Color.RED)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class IconItem : AbstractItem<IconItem.ViewHolder>(), IExpandable<IconItem.ViewH

override var subItems: MutableList<ISubItem<*>>
get() = mutableListOf()
set(list) {
set(_) {
}

override val isAutoExpanding: Boolean
Expand Down Expand Up @@ -83,7 +83,7 @@ class IconItem : AbstractItem<IconItem.ViewHolder>(), IExpandable<IconItem.ViewH
/**
* our ViewHolder
*/
class ViewHolder(protected var view: View) : RecyclerView.ViewHolder(view) {
class ViewHolder(var view: View) : RecyclerView.ViewHolder(view) {
var name: TextView = view.findViewById(R.id.name)
var image: IconicsImageView = view.findViewById(R.id.icon)
}
Expand Down
Loading

0 comments on commit e2a84f7

Please sign in to comment.