Loading app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt +12 −0 Original line number Diff line number Diff line package com.simplemobiletools.flashlight.activities import android.content.Intent import android.os.Bundle import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.extensions.config import kotlinx.android.synthetic.main.activity_settings.* Loading @@ -18,6 +20,7 @@ class SettingsActivity : SimpleActivity() { super.onResume() setupCustomizeColors() setupCustomizeWidgetColors() setupUseEnglish() setupAvoidWhatsNew() setupTurnFlashlightOn() Loading @@ -33,6 +36,15 @@ class SettingsActivity : SimpleActivity() { } } private fun setupCustomizeWidgetColors() { settings_customize_widget_colors_holder.setOnClickListener { Intent(this, WidgetConfigureActivity::class.java).apply { putExtra(IS_CUSTOMIZING_COLORS, true) startActivity(this) } } } private fun setupUseEnglish() { settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en") settings_use_english.isChecked = config.useEnglish Loading app/src/main/kotlin/com/simplemobiletools/flashlight/activities/WidgetConfigureActivity.kt +5 −4 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.helpers.MyWidgetProvider Loading @@ -28,12 +29,12 @@ class WidgetConfigureActivity : SimpleActivity() { setContentView(R.layout.widget_config) initVariables() val extras = intent.extras if (extras != null) mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID) val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !isCustomizingColors) { finish() } config_save.setOnClickListener { saveConfig() } config_widget_color.setOnClickListener { pickBackgroundColor() } Loading app/src/main/res/layout/activity_settings.xml +22 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,28 @@ </RelativeLayout> <RelativeLayout android:id="@+id/settings_customize_widget_colors_holder" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" android:paddingRight="@dimen/normal_margin" android:paddingTop="@dimen/activity_margin"> <com.simplemobiletools.commons.views.MyTextView android:id="@+id/settings_customize_widget_colors_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin" android:text="@string/customize_widget_colors"/> </RelativeLayout> <RelativeLayout android:id="@+id/settings_use_english_holder" android:layout_width="match_parent" Loading Loading
app/src/main/kotlin/com/simplemobiletools/flashlight/activities/SettingsActivity.kt +12 −0 Original line number Diff line number Diff line package com.simplemobiletools.flashlight.activities import android.content.Intent import android.os.Bundle import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.extensions.config import kotlinx.android.synthetic.main.activity_settings.* Loading @@ -18,6 +20,7 @@ class SettingsActivity : SimpleActivity() { super.onResume() setupCustomizeColors() setupCustomizeWidgetColors() setupUseEnglish() setupAvoidWhatsNew() setupTurnFlashlightOn() Loading @@ -33,6 +36,15 @@ class SettingsActivity : SimpleActivity() { } } private fun setupCustomizeWidgetColors() { settings_customize_widget_colors_holder.setOnClickListener { Intent(this, WidgetConfigureActivity::class.java).apply { putExtra(IS_CUSTOMIZING_COLORS, true) startActivity(this) } } } private fun setupUseEnglish() { settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en") settings_use_english.isChecked = config.useEnglish Loading
app/src/main/kotlin/com/simplemobiletools/flashlight/activities/WidgetConfigureActivity.kt +5 −4 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.extensions.adjustAlpha import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import com.simplemobiletools.flashlight.R import com.simplemobiletools.flashlight.extensions.config import com.simplemobiletools.flashlight.helpers.MyWidgetProvider Loading @@ -28,12 +29,12 @@ class WidgetConfigureActivity : SimpleActivity() { setContentView(R.layout.widget_config) initVariables() val extras = intent.extras if (extras != null) mWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID) val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !isCustomizingColors) { finish() } config_save.setOnClickListener { saveConfig() } config_widget_color.setOnClickListener { pickBackgroundColor() } Loading
app/src/main/res/layout/activity_settings.xml +22 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,28 @@ </RelativeLayout> <RelativeLayout android:id="@+id/settings_customize_widget_colors_holder" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" android:paddingRight="@dimen/normal_margin" android:paddingTop="@dimen/activity_margin"> <com.simplemobiletools.commons.views.MyTextView android:id="@+id/settings_customize_widget_colors_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin" android:text="@string/customize_widget_colors"/> </RelativeLayout> <RelativeLayout android:id="@+id/settings_use_english_holder" android:layout_width="match_parent" Loading