Disable PreferenceViews instead of hiding them

This commit is contained in:
moezbhatti
2019-09-15 22:37:57 -04:00
parent d6beabfb10
commit 04cdc0c2ce
16 changed files with 176 additions and 33 deletions
@@ -119,13 +119,12 @@ class TextViewStyler @Inject constructor(
else -> return
}
setTextColor(when (colorAttr) {
COLOR_THEME -> colors.theme().theme
COLOR_PRIMARY_ON_THEME -> colors.theme().textPrimary
COLOR_SECONDARY_ON_THEME -> colors.theme().textSecondary
COLOR_TERTIARY_ON_THEME -> colors.theme().textTertiary
else -> currentTextColor
})
when (colorAttr) {
COLOR_THEME -> setTextColor(colors.theme().theme)
COLOR_PRIMARY_ON_THEME -> setTextColor(colors.theme().textPrimary)
COLOR_SECONDARY_ON_THEME -> setTextColor(colors.theme().textSecondary)
COLOR_TERTIARY_ON_THEME -> setTextColor(colors.theme().textTertiary)
}
setTextSize(textView, textSizeAttr)
}
@@ -26,8 +26,6 @@ import android.widget.TextView
import androidx.appcompat.widget.LinearLayoutCompat
import com.moez.QKSMS.R
import com.moez.QKSMS.common.util.extensions.resolveThemeAttribute
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
import com.moez.QKSMS.common.util.extensions.setTint
import com.moez.QKSMS.common.util.extensions.setVisible
import com.moez.QKSMS.injection.appComponent
import kotlinx.android.synthetic.main.preference_view.view.*
@@ -73,9 +71,6 @@ class PreferenceView @JvmOverloads constructor(
orientation = HORIZONTAL
gravity = Gravity.CENTER_VERTICAL
val textSecondary = context.resolveThemeColor(android.R.attr.textColorSecondary)
icon.setTint(textSecondary)
context.obtainStyledAttributes(attrs, R.styleable.PreferenceView)?.run {
title = getString(R.styleable.PreferenceView_title)
summary = getString(R.styleable.PreferenceView_summary)
@@ -19,7 +19,6 @@
package com.moez.QKSMS.feature.blocking
import android.view.View
import androidx.core.view.isVisible
import com.bluelinelabs.conductor.RouterTransaction
import com.jakewharton.rxbinding2.view.clicks
import com.moez.QKSMS.R
@@ -66,7 +65,7 @@ class BlockingController : QkController<BlockingView, BlockingState, BlockingPre
override fun render(state: BlockingState) {
blockingManager.summary = state.blockingManager
drop.checkbox.isChecked = state.dropEnabled
blockedMessages.isVisible = !state.dropEnabled
blockedMessages.isEnabled = !state.dropEnabled
}
override fun openBlockedNumbers() {
@@ -120,11 +120,11 @@ class ConversationInfoController(
name.setVisible(state.recipients?.size ?: 0 >= 2)
name.summary = state.name
notifications.setVisible(!state.blocked)
notifications.isEnabled = !state.blocked
themePrefs.setVisible(!state.blocked)
themePrefs.isEnabled = !state.blocked
archive.setVisible(!state.blocked)
archive.isEnabled = !state.blocked
archive.title = activity?.getString(when (state.archived) {
true -> R.string.info_unarchive
false -> R.string.info_archive
@@ -55,7 +55,9 @@ class NotificationPrefsActivity : QkThemedActivity(), NotificationPrefsView {
override val ringtoneSelectedIntent: Subject<String> = PublishSubject.create()
override val actionsSelectedIntent by lazy { actionsDialog.adapter.menuItemClicks }
private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[NotificationPrefsViewModel::class.java] }
private val viewModel by lazy {
ViewModelProviders.of(this, viewModelFactory)[NotificationPrefsViewModel::class.java]
}
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
@@ -112,7 +114,8 @@ class NotificationPrefsActivity : QkThemedActivity(), NotificationPrefsView {
qkreplyTitle.isVisible = state.threadId == 0L
qkreply.checkbox.isChecked = state.qkReplyEnabled
qkreply.isVisible = state.threadId == 0L
qkreplyTapDismiss.setVisible(state.threadId == 0L && state.qkReplyEnabled)
qkreplyTapDismiss.isVisible = state.threadId == 0L
qkreplyTapDismiss.isEnabled = state.qkReplyEnabled
qkreplyTapDismiss.checkbox.isChecked = state.qkReplyTapDismiss
}
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textPrimaryDisabledDark" android:state_enabled="false" />
<item android:color="@color/textPrimaryDark" />
</selector>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textSecondaryDisabledDark" android:state_enabled="false" />
<item android:color="@color/textSecondaryDark" />
</selector>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textTertiaryDark" />
</selector>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textPrimaryDisabled" android:state_enabled="false" />
<item android:color="@color/textPrimary" />
</selector>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textSecondaryDisabled" android:state_enabled="false" />
<item android:color="@color/textSecondary" />
</selector>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textTertiary" />
</selector>
@@ -31,12 +31,15 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="24dp"
android:duplicateParentState="true"
android:tint="?android:attr/textColorSecondary"
android:visibility="invisible" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:duplicateParentState="true"
android:orientation="vertical"
android:paddingLeft="24dp"
android:paddingTop="16dp"
@@ -48,6 +51,7 @@
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:duplicateParentState="true"
tools:text="Default SMS App" />
<com.moez.QKSMS.common.widget.QkTextView
@@ -56,6 +60,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:duplicateParentState="true"
tools:text="QKSMS is your default SMS app" />
</LinearLayout>
@@ -64,6 +69,7 @@
android:id="@+id/widgetFrame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="16dp" />
android:layout_marginEnd="16dp"
android:duplicateParentState="true" />
</merge>
@@ -22,4 +22,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false" />
android:clickable="false"
android:duplicateParentState="true" />
@@ -26,9 +26,9 @@
<item name="android:navigationBarColor">@color/backgroundDark</item>
<item name="android:queryBackground">@color/toolbarSearchBackgroundDark</item>
<item name="android:statusBarColor">@color/statusBarDark</item>
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
<item name="android:textColorTertiary">@color/textTertiaryDark</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColorSecondary">@color/text_secondary</item>
<item name="android:textColorTertiary">@color/text_tertiary</item>
<item name="android:windowBackground">@color/backgroundDark</item>
<item name="android:windowContentTransitions">true</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
@@ -45,9 +45,9 @@
</style>
<style name="AppThemeDialog" parent="Theme.AppCompat.Dialog">
<item name="android:textColorPrimary">@color/textPrimaryDark</item>
<item name="android:textColorSecondary">@color/textSecondaryDark</item>
<item name="android:textColorTertiary">@color/textTertiaryDark</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColorSecondary">@color/text_secondary</item>
<item name="android:textColorTertiary">@color/text_tertiary</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
<item name="bubbleColor">@color/bubbleDark</item>
@@ -37,11 +37,15 @@
<color name="backgroundDark">#192025</color>
<color name="textPrimary">#49555F</color>
<color name="textPrimaryDisabled">#4C49555F</color>
<color name="textSecondary">#70808D</color>
<color name="textSecondaryDisabled">#4C70808D</color>
<color name="textTertiary">#B7B9C0</color>
<color name="textPrimaryDark">#FFFFFFFF</color>
<color name="textPrimaryDisabledDark">#7FFFFFFF</color>
<color name="textSecondaryDark">#ccffffff</color>
<color name="textSecondaryDisabledDark">#67ffffff</color>
<color name="textTertiaryDark">#80ffffff</color>
<color name="bubbleLight">#FFFFFF</color>
+6 -6
View File
@@ -38,9 +38,9 @@
<item name="android:divider">@color/separatorLight</item>
<item name="android:queryBackground">@color/toolbarSearchBackgroundLight</item>
<item name="android:statusBarColor">@color/black</item>
<item name="android:textColorPrimary">@color/textPrimary</item>
<item name="android:textColorSecondary">@color/textSecondary</item>
<item name="android:textColorTertiary">@color/textTertiary</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColorSecondary">@color/text_secondary</item>
<item name="android:textColorTertiary">@color/text_tertiary</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:windowContentTransitions">true</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
@@ -57,9 +57,9 @@
</style>
<style name="AppThemeDialog" parent="Theme.AppCompat.Light.Dialog">
<item name="android:textColorPrimary">@color/textPrimary</item>
<item name="android:textColorSecondary">@color/textSecondary</item>
<item name="android:textColorTertiary">@color/textTertiary</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColorSecondary">@color/text_secondary</item>
<item name="android:textColorTertiary">@color/text_tertiary</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="actionBarPopupTheme">@style/PopupTheme</item>
<item name="bubbleColor">@color/bubbleLight</item>