forked from upstream-mirrors/quik
Fix padding/layout in blocking screen
This commit is contained in:
@@ -69,6 +69,9 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
|
||||
// Internal
|
||||
val night = rxPrefs.getBoolean("night", false)
|
||||
val canUseSubId = rxPrefs.getBoolean("canUseSubId", true)
|
||||
@Deprecated("This should only be accessed when migrating to @blockingManager")
|
||||
val sia = rxPrefs.getBoolean("sia", false)
|
||||
|
||||
|
||||
// User configurable
|
||||
val nightMode = rxPrefs.getInteger("nightMode", when (Build.VERSION.SDK_INT >= 29) {
|
||||
@@ -80,8 +83,6 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
|
||||
val black = rxPrefs.getBoolean("black", false)
|
||||
val systemFont = rxPrefs.getBoolean("systemFont", false)
|
||||
val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL)
|
||||
@Deprecated("This should only be accessed when migrating to @blockingManager")
|
||||
val sia = rxPrefs.getBoolean("sia", false)
|
||||
val blockingManager = rxPrefs.getInteger("blockingManager", BLOCKING_MANAGER_QKSMS)
|
||||
val drop = rxPrefs.getBoolean("drop", false)
|
||||
val notifAction1 = rxPrefs.getInteger("notifAction1", NOTIFICATION_ACTION_READ)
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.base.QkPresenter
|
||||
import com.moez.QKSMS.extensions.asObservable
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
@@ -31,13 +32,14 @@ import javax.inject.Inject
|
||||
|
||||
class BlockingPresenter @Inject constructor(
|
||||
context: Context,
|
||||
private val conversationRepo: ConversationRepository,
|
||||
conversationRepo: ConversationRepository,
|
||||
private val navigator: Navigator,
|
||||
private val prefs: Preferences
|
||||
) : QkPresenter<BlockingView, BlockingState>(BlockingState()) {
|
||||
|
||||
init {
|
||||
newState { copy(data = conversationRepo.getBlockedConversations()) }
|
||||
val blockedConversations = conversationRepo.getBlockedConversations()
|
||||
newState { copy(data = blockedConversations) }
|
||||
|
||||
disposables += prefs.blockingManager.asObservable()
|
||||
.map { client ->
|
||||
@@ -52,6 +54,14 @@ class BlockingPresenter @Inject constructor(
|
||||
|
||||
disposables += prefs.drop.asObservable()
|
||||
.subscribe { enabled -> newState { copy(dropEnabled = enabled) } }
|
||||
|
||||
// Trigger a refresh if we go between having some/no blocked conversations, otherwise the header won't update
|
||||
disposables += blockedConversations
|
||||
.asObservable()
|
||||
.filter { it.isValid && it.isLoaded }
|
||||
.map { it.isEmpty() }
|
||||
.distinctUntilChanged()
|
||||
.subscribe { newState { copy() } }
|
||||
}
|
||||
|
||||
override fun bindIntents(view: BlockingView) {
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
android:clipToPadding="false">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/parent"
|
||||
@@ -36,6 +34,7 @@
|
||||
android:id="@+id/blockingManager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:title="@string/blocking_manager_title"
|
||||
@@ -45,9 +44,7 @@
|
||||
android:id="@+id/drop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/blockingManager"
|
||||
app:layout_constraintTop_toBottomOf="@+id/blockingManager"
|
||||
app:summary="@string/blocking_drop_summary"
|
||||
app:title="@string/blocking_drop_title"
|
||||
app:widget="@layout/settings_switch_widget" />
|
||||
@@ -56,8 +53,9 @@
|
||||
android:id="@+id/conversationsDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="?android:attr/divider"
|
||||
app:layout_constraintTop_toBottomOf="@id/drop" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/drop" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/blockedLabel"
|
||||
@@ -69,7 +67,7 @@
|
||||
android:text="@string/blocking_conversations"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintTop_toBottomOf="@id/conversationsDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/conversationsDivider"
|
||||
app:textSize="secondary" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
@@ -80,7 +78,7 @@
|
||||
android:gravity="center"
|
||||
android:padding="56dp"
|
||||
android:text="@string/blocking_empty"
|
||||
app:layout_constraintTop_toBottomOf="@id/blockedLabel" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/blockedLabel" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/conversations"
|
||||
@@ -89,7 +87,7 @@
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintTop_toBottomOf="@id/blockedLabel"
|
||||
app:layout_constraintTop_toBottomOf="@+id/blockedLabel"
|
||||
tools:listitem="@layout/blocked_list_item" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -275,12 +275,12 @@
|
||||
<string name="blocked_numbers_dialog_block">Block</string>
|
||||
|
||||
<plurals name="blocking_block_external">
|
||||
<item quantity="one">Would you also like to block this number in %s?</item>
|
||||
<item quantity="other">Would you also like to block these numbers in %s?</item>
|
||||
<item quantity="one">Continue to %s to block this number</item>
|
||||
<item quantity="other">Continue to %s to block these numbers</item>
|
||||
</plurals>
|
||||
<plurals name="blocking_unblock_external">
|
||||
<item quantity="one">Would you also like to unblock this number in %s?</item>
|
||||
<item quantity="other">Would you also like to unblock these numbers in %s?</item>
|
||||
<item quantity="one">Continue to %s to unblock this number</item>
|
||||
<item quantity="other">Continue to %s to unblock these numbers</item>
|
||||
</plurals>
|
||||
|
||||
<string name="about_title">About</string>
|
||||
|
||||
Reference in New Issue
Block a user