updating the widget config screen

This commit is contained in:
tibbi 2022-12-27 17:06:12 +01:00
parent c60a6bebec
commit 48f7e7ab89
6 changed files with 35 additions and 27 deletions

View File

@ -1,5 +1,6 @@
package com.simplemobiletools.voicerecorder.activities package com.simplemobiletools.voicerecorder.activities
import android.content.Intent
import android.media.MediaRecorder import android.media.MediaRecorder
import android.os.Bundle import android.os.Bundle
import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog
@ -7,10 +8,7 @@ import com.simplemobiletools.commons.dialogs.FeatureLockedDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.NavigationIcon import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.isNougatPlus
import com.simplemobiletools.commons.helpers.isQPlus
import com.simplemobiletools.commons.helpers.isTiramisuPlus
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.voicerecorder.R import com.simplemobiletools.voicerecorder.R
import com.simplemobiletools.voicerecorder.extensions.config import com.simplemobiletools.voicerecorder.extensions.config
@ -39,6 +37,7 @@ class SettingsActivity : SimpleActivity() {
setupPurchaseThankYou() setupPurchaseThankYou()
setupCustomizeColors() setupCustomizeColors()
setupCustomizeWidgetColors()
setupUseEnglish() setupUseEnglish()
setupLanguage() setupLanguage()
setupChangeDateTimeFormat() setupChangeDateTimeFormat()
@ -69,6 +68,15 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupCustomizeWidgetColors() {
settings_widget_color_customization_holder.setOnClickListener {
Intent(this, WidgetRecordDisplayConfigureActivity::class.java).apply {
putExtra(IS_CUSTOMIZING_COLORS, true)
startActivity(this)
}
}
}
private fun setupUseEnglish() { private fun setupUseEnglish() {
settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus()) settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
settings_use_english.isChecked = config.useEnglish settings_use_english.isChecked = config.useEnglish

View File

@ -58,7 +58,6 @@ class WidgetRecordDisplayConfigureActivity : SimpleActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
window.decorView.setBackgroundColor(0) window.decorView.setBackgroundColor(0)
setupToolbar(config_toolbar)
if (mFeatureLockedDialog != null && isOrWasThankYouInstalled()) { if (mFeatureLockedDialog != null && isOrWasThankYouInstalled()) {
mFeatureLockedDialog?.dismissDialog() mFeatureLockedDialog?.dismissDialog()
@ -67,6 +66,10 @@ class WidgetRecordDisplayConfigureActivity : SimpleActivity() {
private fun initVariables() { private fun initVariables() {
mWidgetColor = config.widgetBgColor mWidgetColor = config.widgetBgColor
if (mWidgetColor == resources.getColor(R.color.default_widget_bg_color) && config.isUsingSystemTheme) {
mWidgetColor = resources.getColor(R.color.you_primary_color, theme)
}
mWidgetAlpha = Color.alpha(mWidgetColor) / 255.toFloat() mWidgetAlpha = Color.alpha(mWidgetColor) / 255.toFloat()
mWidgetColorWithoutTransparency = Color.rgb(Color.red(mWidgetColor), Color.green(mWidgetColor), Color.blue(mWidgetColor)) mWidgetColorWithoutTransparency = Color.rgb(Color.red(mWidgetColor), Color.green(mWidgetColor), Color.blue(mWidgetColor))

View File

@ -52,6 +52,23 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/settings_widget_color_customization_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_widget_color_customization_label"
style="@style/SettingsTextLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/customize_widget_colors"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include <include
android:id="@+id/settings_color_customization_divider" android:id="@+id/settings_color_customization_divider"
layout="@layout/divider" /> layout="@layout/divider" />

View File

@ -1,25 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/config_coordinator" android:id="@+id/config_coordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/config_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/config_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_primary"
app:title="@string/app_launcher_name"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/config_holder" android:id="@+id/config_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -76,7 +60,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/small_margin" android:layout_marginTop="@dimen/tiny_margin"
android:text="@string/ok" /> android:text="@string/ok" />
</RelativeLayout> </RelativeLayout>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="default_widget_bg_color">#FFF57C00</color>
</resources> </resources>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="default_widget_bg_color">-571114496</integer> <!-- #DDF57C00 -->
</resources>