some setting UI tweak, lets show textual values below their labels

This commit is contained in:
tibbi 2021-11-15 15:21:09 +01:00
parent 938ba2b20c
commit 081c979535
4 changed files with 56 additions and 13 deletions

View File

@ -56,7 +56,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:c615eda325' implementation 'com.github.SimpleMobileTools:Simple-Commons:5e4cf928a7'
implementation 'org.greenrobot:eventbus:3.2.0' implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.klinkerapps:android-smsmms:5.2.6' implementation 'com.klinkerapps:android-smsmms:5.2.6'
implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a' implementation 'com.github.tibbi:IndicatorFastScroll:c3de1d040a'

View File

@ -13,6 +13,8 @@ import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.extensions.config
import com.simplemobiletools.smsmessenger.extensions.getLockScreenVisibilityText
import com.simplemobiletools.smsmessenger.extensions.getMMSFileLimitText
import com.simplemobiletools.smsmessenger.helpers.* import com.simplemobiletools.smsmessenger.helpers.*
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
import java.util.* import java.util.*
@ -176,6 +178,7 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupLockScreenVisibility() { private fun setupLockScreenVisibility() {
settings_lock_screen_visibility.text = getLockScreenVisibilityText(config.lockScreenVisibilitySetting)
settings_lock_screen_visibility_holder.setOnClickListener { settings_lock_screen_visibility_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(LOCK_SCREEN_SENDER_MESSAGE, getString(R.string.sender_and_message)), RadioItem(LOCK_SCREEN_SENDER_MESSAGE, getString(R.string.sender_and_message)),
@ -185,11 +188,13 @@ class SettingsActivity : SimpleActivity() {
RadioGroupDialog(this@SettingsActivity, items, config.lockScreenVisibilitySetting) { RadioGroupDialog(this@SettingsActivity, items, config.lockScreenVisibilitySetting) {
config.lockScreenVisibilitySetting = it as Int config.lockScreenVisibilitySetting = it as Int
settings_lock_screen_visibility.text = getLockScreenVisibilityText(config.lockScreenVisibilitySetting)
} }
} }
} }
private fun setupMMSFileSizeLimit() { private fun setupMMSFileSizeLimit() {
settings_mms_file_size_limit.text = getMMSFileLimitText(config.mmsFileSizeLimit)
settings_mms_file_size_limit_holder.setOnClickListener { settings_mms_file_size_limit_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
RadioItem(1, getString(R.string.mms_file_size_limit_100kb), FILE_SIZE_100_KB), RadioItem(1, getString(R.string.mms_file_size_limit_100kb), FILE_SIZE_100_KB),
@ -204,6 +209,7 @@ class SettingsActivity : SimpleActivity() {
val checkedItemId = items.find { it.value == config.mmsFileSizeLimit }?.id ?: 7 val checkedItemId = items.find { it.value == config.mmsFileSizeLimit }?.id ?: 7
RadioGroupDialog(this@SettingsActivity, items, checkedItemId) { RadioGroupDialog(this@SettingsActivity, items, checkedItemId) {
config.mmsFileSizeLimit = it as Long config.mmsFileSizeLimit = it as Long
settings_mms_file_size_limit.text = getMMSFileLimitText(config.mmsFileSizeLimit)
} }
} }
} }

View File

@ -771,6 +771,14 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
notificationManager.notify(threadId.hashCode(), builder.build()) notificationManager.notify(threadId.hashCode(), builder.build())
} }
fun Context.getLockScreenVisibilityText(type: Int) = getString(
when (type) {
LOCK_SCREEN_SENDER_MESSAGE -> R.string.sender_and_message
LOCK_SCREEN_SENDER -> R.string.sender_only
else -> R.string.nothing
}
)
fun Context.removeDiacriticsIfNeeded(text: String): String { fun Context.removeDiacriticsIfNeeded(text: String): String {
return if (config.useSimpleCharacters) text.normalizeString() else text return if (config.useSimpleCharacters) text.normalizeString() else text
} }
@ -846,6 +854,18 @@ fun Context.deleteSmsDraft(threadId: Long) {
} }
} }
fun Context.getMMSFileLimitText(size: Long) = getString(
when (size) {
FILE_SIZE_100_KB -> R.string.mms_file_size_limit_100kb
FILE_SIZE_200_KB -> R.string.mms_file_size_limit_200kb
FILE_SIZE_300_KB -> R.string.mms_file_size_limit_300kb
FILE_SIZE_600_KB -> R.string.mms_file_size_limit_600kb
FILE_SIZE_1_MB -> R.string.mms_file_size_limit_1mb
FILE_SIZE_2_MB -> R.string.mms_file_size_limit_2mb
else -> R.string.mms_file_size_limit_none
}
)
fun Context.updateLastConversationMessage(threadId: Long) { fun Context.updateLastConversationMessage(threadId: Long) {
val uri = Threads.CONTENT_URI val uri = Threads.CONTENT_URI
val selection = "${Threads._ID} = ?" val selection = "${Threads._ID} = ?"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settings_scrollview" android:id="@+id/settings_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -34,7 +35,7 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_customize_colors_label" android:id="@+id/settings_customize_colors_label"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/customize_colors" /> android:text="@string/customize_colors" />
@ -66,7 +67,7 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_customize_notifications_label" android:id="@+id/settings_customize_notifications_label"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/customize_notifications" /> android:text="@string/customize_notifications" />
@ -82,11 +83,19 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_lock_screen_visibility_label" android:id="@+id/settings_lock_screen_visibility_label"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/lock_screen_visibility" /> android:text="@string/lock_screen_visibility" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_lock_screen_visibility"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_lock_screen_visibility_label"
tools:text="@string/sender_and_message" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
@ -114,7 +123,7 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_purchase_thank_you" android:id="@+id/settings_purchase_thank_you"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/purchase_simple_thank_you" /> android:text="@string/purchase_simple_thank_you" />
@ -146,7 +155,7 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_change_date_time_format" android:id="@+id/settings_change_date_time_format"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/change_date_and_time_format" /> android:text="@string/change_date_and_time_format" />
@ -162,7 +171,7 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_blocked_numbers" android:id="@+id/settings_manage_blocked_numbers"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/manage_blocked_numbers" /> android:text="@string/manage_blocked_numbers" />
@ -178,17 +187,17 @@
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_font_size_label" android:id="@+id/settings_font_size_label"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/font_size" /> android:text="@string/font_size" />
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_font_size" android:id="@+id/settings_font_size"
style="@style/SettingsRightTextualValueStyle" style="@style/SettingsTextValueStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toEndOf="@+id/settings_font_size_label" /> android:layout_below="@+id/settings_font_size_label" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
@ -258,18 +267,26 @@
<RelativeLayout <RelativeLayout
android:id="@+id/settings_mms_file_size_limit_holder" android:id="@+id/settings_mms_file_size_limit_holder"
style="@style/SettingsHolderTextViewStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/ripple_bottom_corners"> android:background="@drawable/ripple_bottom_corners"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_mms_file_size_limit_label" android:id="@+id/settings_mms_file_size_limit_label"
style="@style/SettingsLeftLabelStyle" style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/mms_file_size_limit" /> android:text="@string/mms_file_size_limit" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_mms_file_size_limit"
style="@style/SettingsTextValueStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/settings_mms_file_size_limit_label"
tools:text="@string/mms_file_size_limit_none" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>