mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-11 21:41:46 +00:00
Merge branch 'dev' into utilise-dialog-dsl
This commit is contained in:
@@ -9,20 +9,15 @@ import androidx.preference.PreferenceViewHolder
|
||||
|
||||
class BlockedContactsPreference @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet? = null) : PreferenceCategory(context, attributeSet), View.OnClickListener {
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
if (v is BlockedContactsLayout) {
|
||||
val intent = Intent(context, BlockedContactsActivity::class.java)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
attributeSet: AttributeSet? = null
|
||||
) : PreferenceCategory(context, attributeSet) {
|
||||
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||
super.onBindViewHolder(holder)
|
||||
|
||||
val itemView = holder.itemView
|
||||
itemView.setOnClickListener(this)
|
||||
holder.itemView.setOnClickListener {
|
||||
val intent = Intent(context, BlockedContactsActivity::class.java)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.util
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlin.math.max
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
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
|
||||
return (px / scale)
|
||||
}
|
||||
|
||||
val RecyclerView.isScrolledToBottom: Boolean
|
||||
get() = computeVerticalScrollOffset().coerceAtLeast(0) +
|
||||
computeVerticalScrollExtent() +
|
||||
toPx(50, resources) >= computeVerticalScrollRange()
|
||||
|
||||
Reference in New Issue
Block a user