mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
Merge remote-tracking branch 'upstream/dev' into libsession-integration
This commit is contained in:
commit
b9708eea61
@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.util
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.annotation.ColorRes
|
import androidx.annotation.ColorRes
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import kotlin.math.max
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
fun Resources.getColorWithID(@ColorRes id: Int, theme: Resources.Theme?): Int {
|
fun Resources.getColorWithID(@ColorRes id: Int, theme: Resources.Theme?): Int {
|
||||||
@ -30,3 +32,8 @@ fun toDp(px: Float, resources: Resources): Float {
|
|||||||
val scale = resources.displayMetrics.density
|
val scale = resources.displayMetrics.density
|
||||||
return (px / scale)
|
return (px / scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val RecyclerView.isScrolledToBottom: Boolean
|
||||||
|
get() = computeVerticalScrollOffset().coerceAtLeast(0) +
|
||||||
|
computeVerticalScrollExtent() +
|
||||||
|
toPx(50, resources) >= computeVerticalScrollRange()
|
||||||
|
@ -4,8 +4,6 @@ import android.content.Context
|
|||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import androidx.annotation.AttrRes
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import kotlin.math.max
|
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
fun Context.getColorFromAttr(
|
fun Context.getColorFromAttr(
|
||||||
@ -16,6 +14,3 @@ fun Context.getColorFromAttr(
|
|||||||
theme.resolveAttribute(attrColor, typedValue, resolveRefs)
|
theme.resolveAttribute(attrColor, typedValue, resolveRefs)
|
||||||
return typedValue.data
|
return typedValue.data
|
||||||
}
|
}
|
||||||
|
|
||||||
val RecyclerView.isScrolledToBottom: Boolean
|
|
||||||
get() = max(0, computeVerticalScrollOffset()) + computeVerticalScrollExtent() >= computeVerticalScrollRange()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user