From b0605ff183e44a55b3d20ae69a2ad2256d30fd68 Mon Sep 17 00:00:00 2001 From: h4h13 Date: Sat, 20 Apr 2019 15:35:31 +0530 Subject: [PATCH] Added new style for switch --- .../settings/NowPlayingSettingsFragment.kt | 2 +- .../res/layout/fragment_main_settings.xml | 44 ++++++++++--------- .../main/res/xml/pref_now_playing_screen.xml | 43 +++++++++--------- .../prefs/supportv7/ATESwitchPreference.kt | 1 - .../appthemehelper/common/views/ATESwitch.kt | 7 ++- .../src/main/res/drawable/ate_track.xml | 30 +++++++++++++ .../src/main/res/drawable/toggle_switch.xml | 24 ++++++++++ .../main/res/layout/ate_preference_switch.xml | 10 ----- .../layout/ate_preference_switch_support.xml | 4 +- .../layout/two_lines_list_preference_row.xml | 6 +-- 10 files changed, 108 insertions(+), 63 deletions(-) create mode 100644 appthemehelper/src/main/res/drawable/ate_track.xml create mode 100644 appthemehelper/src/main/res/drawable/toggle_switch.xml delete mode 100755 appthemehelper/src/main/res/layout/ate_preference_switch.xml diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt index 5563f10d..64daa9d4 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt @@ -25,7 +25,7 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh showProToastAndNavigate(activity!!.getString(R.string.pref_title_toggle_carousel_effect)) return@setOnPreferenceChangeListener false } - true + return@setOnPreferenceChangeListener true } } diff --git a/app/src/main/res/layout/fragment_main_settings.xml b/app/src/main/res/layout/fragment_main_settings.xml index 58301c83..529f7ffa 100644 --- a/app/src/main/res/layout/fragment_main_settings.xml +++ b/app/src/main/res/layout/fragment_main_settings.xml @@ -10,7 +10,8 @@ android:id="@+id/container" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical"> + android:orientation="vertical" + tools:background="@color/md_black_1000"> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + + android:textSize="@dimen/ate_default_textsize_subheading" + app:fontFamily="@font/circular_std_medium" /> + app:defaultValue="false" + app:iconSpaceReserved="false" + app:key="carousel_effect" + app:summary="@string/pref_summary_carousel_effect" + app:title="@string/pref_title_toggle_carousel_effect" /> + + + + + - - - - + app:iconSpaceReserved="false" + app:showSeekBarValue="true" /> \ No newline at end of file diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt index 625c6f3f..589d1cae 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATESwitchPreference.kt @@ -30,7 +30,6 @@ class ATESwitchPreference : CheckBoxPreference { } private fun init() { - layoutResource = R.layout.ate_preference_custom_support widgetLayoutResource = R.layout.ate_preference_switch_support } } \ No newline at end of file diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESwitch.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESwitch.kt index 64ba8d0a..f35ba546 100755 --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESwitch.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/views/ATESwitch.kt @@ -1,11 +1,11 @@ package code.name.monkey.appthemehelper.common.views import android.content.Context -import androidx.appcompat.widget.SwitchCompat import android.util.AttributeSet import android.view.View - +import androidx.appcompat.widget.SwitchCompat import code.name.monkey.appthemehelper.ATH +import code.name.monkey.appthemehelper.R import code.name.monkey.appthemehelper.ThemeStore @@ -27,6 +27,9 @@ class ATESwitch : SwitchCompat { } private fun init(context: Context, attrs: AttributeSet?) { + setThumbResource(R.drawable.toggle_switch) + setTrackResource(R.drawable.ate_track) + background = null ATH.setTint(this, ThemeStore.accentColor(context)) } diff --git a/appthemehelper/src/main/res/drawable/ate_track.xml b/appthemehelper/src/main/res/drawable/ate_track.xml new file mode 100644 index 00000000..6b97353e --- /dev/null +++ b/appthemehelper/src/main/res/drawable/ate_track.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/appthemehelper/src/main/res/drawable/toggle_switch.xml b/appthemehelper/src/main/res/drawable/toggle_switch.xml new file mode 100644 index 00000000..2341c5fc --- /dev/null +++ b/appthemehelper/src/main/res/drawable/toggle_switch.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/appthemehelper/src/main/res/layout/ate_preference_switch.xml b/appthemehelper/src/main/res/layout/ate_preference_switch.xml deleted file mode 100755 index 6765a3ca..00000000 --- a/appthemehelper/src/main/res/layout/ate_preference_switch.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/appthemehelper/src/main/res/layout/ate_preference_switch_support.xml b/appthemehelper/src/main/res/layout/ate_preference_switch_support.xml index c464508a..50d68fce 100755 --- a/appthemehelper/src/main/res/layout/ate_preference_switch_support.xml +++ b/appthemehelper/src/main/res/layout/ate_preference_switch_support.xml @@ -3,7 +3,5 @@ android:id="@android:id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@null" android:clickable="false" - android:focusable="false" - android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1" /> \ No newline at end of file + android:focusable="false" /> \ No newline at end of file diff --git a/appthemehelper/src/main/res/layout/two_lines_list_preference_row.xml b/appthemehelper/src/main/res/layout/two_lines_list_preference_row.xml index c52cc405..e9cdd922 100644 --- a/appthemehelper/src/main/res/layout/two_lines_list_preference_row.xml +++ b/appthemehelper/src/main/res/layout/two_lines_list_preference_row.xml @@ -1,6 +1,5 @@ + android:textColor="#000000" />