mirror of
				https://github.com/SimpleMobileTools/Simple-Flashlight.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	redesigning some screens
This commit is contained in:
		| @@ -62,7 +62,7 @@ android { | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|     implementation 'com.github.SimpleMobileTools:Simple-Commons:31cb0b37cf' | ||||
|     implementation 'com.github.SimpleMobileTools:Simple-Commons:a6032f9c07' | ||||
|     implementation 'org.greenrobot:eventbus:3.3.1' | ||||
|     implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||||
| } | ||||
|   | ||||
| @@ -39,12 +39,16 @@ class MainActivity : SimpleActivity() { | ||||
|     private var reTurnFlashlightOn = true | ||||
|  | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         isMaterialActivity = true | ||||
|         super.onCreate(savedInstanceState) | ||||
|         setContentView(R.layout.activity_main) | ||||
|         appLaunched(BuildConfig.APPLICATION_ID) | ||||
|         setupOptionsMenu() | ||||
|         refreshMenuItems() | ||||
|  | ||||
|         updateMaterialActivityViews(main_coordinator, main_holder) | ||||
|         setupMaterialScrollListener(main_nested_scrollview, main_toolbar) | ||||
|  | ||||
|         mBus = EventBus.getDefault() | ||||
|         changeIconColor(getContrastColor(), stroboscope_btn) | ||||
|  | ||||
|   | ||||
| @@ -14,8 +14,12 @@ import kotlin.system.exitProcess | ||||
|  | ||||
| class SettingsActivity : SimpleActivity() { | ||||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         isMaterialActivity = true | ||||
|         super.onCreate(savedInstanceState) | ||||
|         setContentView(R.layout.activity_settings) | ||||
|  | ||||
|         updateMaterialActivityViews(settings_coordinator, settings_holder) | ||||
|         setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar) | ||||
|     } | ||||
|  | ||||
|     override fun onResume() { | ||||
| @@ -34,38 +38,27 @@ class SettingsActivity : SimpleActivity() { | ||||
|         setupForcePortrait() | ||||
|         updateTextColors(settings_holder) | ||||
|  | ||||
|         arrayOf(settings_color_customization_label, settings_general_settings_label).forEach { | ||||
|         arrayOf(settings_color_customization_section_label, settings_general_settings_label).forEach { | ||||
|             it.setTextColor(getProperPrimaryColor()) | ||||
|         } | ||||
|  | ||||
|         arrayOf(settings_color_customization_holder, settings_general_settings_holder).forEach { | ||||
|             it.background.applyColorFilter(getProperBackgroundColor().getContrastColor()) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun setupPurchaseThankYou() { | ||||
|         settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled()) | ||||
|  | ||||
|         // make sure the corners at ripple fit the stroke rounded corners | ||||
|         if (settings_purchase_thank_you_holder.isGone()) { | ||||
|             settings_use_english_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) | ||||
|             settings_language_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) | ||||
|         } | ||||
|  | ||||
|         settings_purchase_thank_you_holder.setOnClickListener { | ||||
|             launchPurchaseThankYouIntent() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun setupCustomizeColors() { | ||||
|         settings_customize_colors_label.text = getCustomizeColorsString() | ||||
|         settings_customize_colors_holder.setOnClickListener { | ||||
|         settings_color_customization_label.text = getCustomizeColorsString() | ||||
|         settings_color_customization_holder.setOnClickListener { | ||||
|             handleCustomizeColorsClick() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun setupCustomizeWidgetColors() { | ||||
|         settings_customize_widget_colors_holder.setOnClickListener { | ||||
|         settings_widget_color_customization_holder.setOnClickListener { | ||||
|             Intent(this, WidgetTorchConfigureActivity::class.java).apply { | ||||
|                 putExtra(IS_CUSTOMIZING_COLORS, true) | ||||
|                 startActivity(this) | ||||
| @@ -86,11 +79,6 @@ class SettingsActivity : SimpleActivity() { | ||||
|     private fun setupLanguage() { | ||||
|         settings_language.text = Locale.getDefault().displayLanguage | ||||
|         settings_language_holder.beVisibleIf(isTiramisuPlus()) | ||||
|  | ||||
|         if (settings_use_english_holder.isGone() && settings_language_holder.isGone() && settings_purchase_thank_you_holder.isGone()) { | ||||
|             settings_turn_flashlight_on_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) | ||||
|         } | ||||
|  | ||||
|         settings_language_holder.setOnClickListener { | ||||
|             launchChangeAppLanguageIntent() | ||||
|         } | ||||
|   | ||||
| @@ -5,29 +5,21 @@ | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent"> | ||||
|  | ||||
|     <com.google.android.material.appbar.AppBarLayout | ||||
|         android:id="@+id/main_app_bar_layout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content"> | ||||
|  | ||||
|     <com.google.android.material.appbar.MaterialToolbar | ||||
|         android:id="@+id/main_toolbar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="?attr/actionBarSize" | ||||
|         android:background="@color/color_primary" | ||||
|         app:menu="@menu/menu" | ||||
|             app:title="@string/app_launcher_name" | ||||
|         app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> | ||||
|  | ||||
|     </com.google.android.material.appbar.AppBarLayout> | ||||
|  | ||||
|     <androidx.core.widget.NestedScrollView | ||||
|         android:id="@+id/main_scrollview" | ||||
|         android:id="@+id/main_nested_scrollview" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:layout_marginTop="?attr/actionBarSize" | ||||
|         android:fillViewport="true" | ||||
|         android:scrollbars="none" | ||||
|         app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||||
|         android:scrollbars="none"> | ||||
|  | ||||
|         <androidx.constraintlayout.widget.ConstraintLayout | ||||
|             android:id="@+id/main_holder" | ||||
|   | ||||
| @@ -6,29 +6,21 @@ | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent"> | ||||
|  | ||||
|     <com.google.android.material.appbar.AppBarLayout | ||||
|         android:id="@+id/settings_app_bar_layout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content"> | ||||
|  | ||||
|     <com.google.android.material.appbar.MaterialToolbar | ||||
|         android:id="@+id/settings_toolbar" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="?attr/actionBarSize" | ||||
|         android:background="@color/color_primary" | ||||
|             app:layout_scrollFlags="scroll|enterAlways" | ||||
|         app:title="@string/settings" | ||||
|         app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> | ||||
|  | ||||
|     </com.google.android.material.appbar.AppBarLayout> | ||||
|  | ||||
|     <androidx.core.widget.NestedScrollView | ||||
|         android:id="@+id/settings_nested_scrollview" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:layout_marginTop="?attr/actionBarSize" | ||||
|         android:fillViewport="true" | ||||
|         android:scrollbars="none" | ||||
|         app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||||
|         android:scrollbars="none"> | ||||
|  | ||||
|         <LinearLayout | ||||
|             android:id="@+id/settings_holder" | ||||
| @@ -37,52 +29,49 @@ | ||||
|             android:orientation="vertical"> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/settings_color_customization_label" | ||||
|                 android:id="@+id/settings_color_customization_section_label" | ||||
|                 style="@style/SettingsSectionLabelStyle" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:text="@string/color_customization" /> | ||||
|  | ||||
|             <LinearLayout | ||||
|             <androidx.constraintlayout.widget.ConstraintLayout | ||||
|                 android:id="@+id/settings_color_customization_holder" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_margin="@dimen/medium_margin" | ||||
|                 android:background="@drawable/section_holder_stroke" | ||||
|                 android:orientation="vertical"> | ||||
|  | ||||
|                 <RelativeLayout | ||||
|                     android:id="@+id/settings_customize_colors_holder" | ||||
|                 style="@style/SettingsHolderTextViewOneLinerStyle" | ||||
|                 android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_top_corners"> | ||||
|                 android:layout_height="wrap_content"> | ||||
|  | ||||
|                 <com.simplemobiletools.commons.views.MyTextView | ||||
|                         android:id="@+id/settings_customize_colors_label" | ||||
|                     android:id="@+id/settings_color_customization_label" | ||||
|                     style="@style/SettingsTextLabelStyle" | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                         android:text="@string/customize_colors" /> | ||||
|                     android:text="@string/customize_colors" | ||||
|                     app:layout_constraintStart_toStartOf="parent" | ||||
|                     app:layout_constraintTop_toTopOf="parent" /> | ||||
|  | ||||
|                 </RelativeLayout> | ||||
|             </androidx.constraintlayout.widget.ConstraintLayout> | ||||
|  | ||||
|                 <RelativeLayout | ||||
|                     android:id="@+id/settings_customize_widget_colors_holder" | ||||
|                     style="@style/SettingsHolderTextViewStyle" | ||||
|             <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" | ||||
|                     android:background="@drawable/ripple_bottom_corners"> | ||||
|                 android:layout_height="wrap_content"> | ||||
|  | ||||
|                 <com.simplemobiletools.commons.views.MyTextView | ||||
|                         android:id="@+id/settings_customize_widget_colors_label" | ||||
|                     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" /> | ||||
|                     android:text="@string/customize_widget_colors" | ||||
|                     app:layout_constraintStart_toStartOf="parent" | ||||
|                     app:layout_constraintTop_toTopOf="parent" /> | ||||
|  | ||||
|                 </RelativeLayout> | ||||
|             </LinearLayout> | ||||
|             </androidx.constraintlayout.widget.ConstraintLayout> | ||||
|  | ||||
|             <include | ||||
|                 android:id="@+id/settings_color_customization_divider" | ||||
|                 layout="@layout/divider" /> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/settings_general_settings_label" | ||||
| @@ -95,16 +84,13 @@ | ||||
|                 android:id="@+id/settings_general_settings_holder" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_margin="@dimen/medium_margin" | ||||
|                 android:background="@drawable/section_holder_stroke" | ||||
|                 android:orientation="vertical"> | ||||
|  | ||||
|                 <RelativeLayout | ||||
|                     android:id="@+id/settings_purchase_thank_you_holder" | ||||
|                     style="@style/SettingsHolderTextViewStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_top_corners"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyTextView | ||||
|                         android:id="@+id/settings_purchase_thank_you" | ||||
| @@ -119,8 +105,7 @@ | ||||
|                     android:id="@+id/settings_use_english_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_use_english" | ||||
| @@ -135,8 +120,7 @@ | ||||
|                     android:id="@+id/settings_language_holder" | ||||
|                     style="@style/SettingsHolderTextViewStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyTextView | ||||
|                         android:id="@+id/settings_language_label" | ||||
| @@ -159,8 +143,7 @@ | ||||
|                     android:id="@+id/settings_turn_flashlight_on_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_turn_flashlight_on" | ||||
| @@ -175,8 +158,7 @@ | ||||
|                     android:id="@+id/settings_force_portrait_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_force_portrait" | ||||
| @@ -191,8 +173,7 @@ | ||||
|                     android:id="@+id/settings_bright_display_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_bright_display" | ||||
| @@ -207,8 +188,7 @@ | ||||
|                     android:id="@+id/settings_sos_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_sos" | ||||
| @@ -223,8 +203,7 @@ | ||||
|                     android:id="@+id/settings_stroboscope_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_bottom_corners"> | ||||
|                     android:layout_height="wrap_content"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_stroboscope" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user