This file contains 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.graphics.drawable.Drawable | |
import com.bumptech.glide.request.transition.Transition | |
class PaddingTransition<T : Drawable>(private val realTransition: Transition<in T>) : Transition<T> { | |
override fun transition(current: T, adapter: Transition.ViewAdapter): Boolean { | |
val width = current.intrinsicWidth | |
val height = current.intrinsicHeight | |
return realTransition.transition(current, PaddingViewAdapter(adapter, width, height)) | |
} |
This file contains 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 com.bumptech.glide.manager.Lifecycle | |
import com.bumptech.glide.manager.LifecycleListener | |
import com.bumptech.glide.util.Util | |
import java.util.* | |
/** | |
* A [com.bumptech.glide.manager.Lifecycle] implementation for tracking and notifying | |
* listeners of [com.bluelinelabs.conductor.Controller] lifecycle events. | |
*/ | |
class ControllerLifecycle : Lifecycle { |
This file contains 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
class ParcelSortedMapAdapter<K, V>( | |
private val keyAdapter: TypeAdapter<K>, | |
private val valueAdapter: TypeAdapter<V> | |
) : TypeAdapter<@JvmSuppressWildcards SortedMap<K, V>> { | |
override fun readFromParcel(source: Parcel): SortedMap<K, V> { | |
val size = source.readInt() | |
val map = TreeMap<K, V>() | |
for (ignored in 1..size) { | |
val key = keyAdapter.readFromParcel(source) |
This file contains 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
class HorizontalPaddingItemDecoration( | |
private val paddingStart: Int = 0, | |
private val paddingEnd: Int = 0 | |
) : RecyclerView.ItemDecoration() { | |
private var isRtl: Boolean? = null | |
fun isRTL(ctx: Context): Boolean { | |
val config = ctx.resources.configuration | |
return config.layoutDirection == View.LAYOUT_DIRECTION_RTL |
This file contains 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
public class LMBindingAdapter { | |
// TODO the creation and modification of a layout manager must be done in one class. The creation is in a factory, but the modification is here. | |
@BindingAdapter(value = {"viewMode", "orientation", "reverseLayout", "spanCount", "spanSizeLookup"}, requireAll = false) | |
public static void setLayoutManager(RecyclerView recyclerView, | |
RecyclerViewMode viewMode, | |
@LayoutManagers.Orientation int orientation, | |
boolean reverseLayout, | |
int spanCount, | |
final SpanSizeLookup spanSizeLookup) { | |
if (viewMode == null) { |
This file contains 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
final VarColumnGridLayoutManager layoutManager | |
= new VarColumnGridLayoutManager(getContext(), OrientationHelper.VERTICAL, false); | |
VarColumnGridLayoutManager.ColumnCountProvider columnProvider | |
= new VarColumnGridLayoutManager.DefaultColumnCountProvider(getContext()); | |
layoutManager.setColumnCountProvider(columnProvider); | |
mRecyclerView.setLayoutManager(layoutManager); |
This file contains 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 java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import android.content.Context; | |
import android.database.DataSetObserver; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.Adapter; | |
import android.widget.LinearLayout; |