This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.widget.ArrayAdapter | |
import android.widget.Filter | |
import androidx.annotation.LayoutRes | |
open class NoFilterArrayAdapter<T>(context: Context, @LayoutRes resource: Int, items: List<T>) : | |
ArrayAdapter<T>(context, resource, items) { | |
override fun getFilter(): Filter { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use these classes to implement pagination without paging libs | |
*/ | |
import android.annotation.SuppressLint | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Kotlin extensions you can use in any project that solves common problems in Android | |
*/ | |
fun Checkable.setOnCheckableSafeClick(view: View, listener: () -> Unit) { | |
view.setOnTouchListener { _, event -> | |
if (event.action == MotionEvent.ACTION_UP) | |
listener() | |
true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* You can use this helper class in your fragment using composition to select files from gallery/camera | |
*/ | |
import android.Manifest | |
import android.app.Activity | |
import android.content.Intent | |
import android.content.pm.PackageManager | |
import android.graphics.Bitmap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.Manifest | |
import android.net.Uri | |
import android.os.Build | |
import androidx.activity.result.ActivityResultLauncher | |
import androidx.activity.result.contract.ActivityResultContracts | |
import androidx.fragment.app.Fragment | |
class FileMultipleSelectorHelper( | |
fragment: Fragment, |