Added new style for switch

This commit is contained in:
h4h13 2019-04-20 15:35:31 +05:30
parent 39b0b4c931
commit b0605ff183
10 changed files with 108 additions and 63 deletions

View file

@ -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
}
}

View file

@ -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">
<LinearLayout
android:id="@+id/userInfoContainer"
@ -42,11 +43,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
app:fontFamily="@font/circular_std_medium"
android:fadingEdge="horizontal"
android:singleLine="true"
android:text="@string/general_settings_title"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:id="@+id/text"
@ -91,9 +92,9 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
app:fontFamily="@font/circular_std_medium"
android:text="@string/general_settings_title"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -138,9 +139,9 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
app:fontFamily="@font/circular_std_medium"
android:text="@string/now_playing"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -184,8 +185,8 @@
android:fadingEdge="horizontal"
android:singleLine="true"
android:text="@string/pref_header_audio"
app:fontFamily="@font/circular_std_medium"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -228,9 +229,9 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
app:fontFamily="@font/circular_std_medium"
android:text="@string/personalize"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -273,8 +274,8 @@
android:fadingEdge="horizontal"
android:singleLine="true"
android:text="@string/pref_header_images"
app:fontFamily="@font/circular_std_medium"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -316,9 +317,9 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
app:fontFamily="@font/circular_std_medium"
android:text="@string/notification"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -334,9 +335,9 @@
android:id="@+id/otherSettings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="72dp"
android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.ColorIconsImageView
@ -361,10 +362,10 @@
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
app:fontFamily="@font/circular_std_medium"
android:singleLine="true"
android:text="@string/others"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"
@ -375,13 +376,14 @@
android:textSize="@dimen/ate_default_textsize_body" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/aboutSettings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="72dp"
android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.ColorIconsImageView
@ -406,10 +408,10 @@
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
app:fontFamily="@font/circular_std_medium"
android:singleLine="true"
android:text="@string/action_about"
android:textSize="@dimen/ate_default_textsize_subheading" />
android:textSize="@dimen/ate_default_textsize_subheading"
app:fontFamily="@font/circular_std_medium" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:layout_width="wrap_content"

View file

@ -21,33 +21,34 @@
app:iconSpaceReserved="false" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="carousel_effect"
android:summary="@string/pref_summary_carousel_effect"
android:title="@string/pref_title_toggle_carousel_effect"
app:iconSpaceReserved="false" />
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" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="toggle_add_controls"
app:summary="@string/pref_summary_extra_controls"
app:title="@string/pref_title_extra_controls" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="toggle_volume"
app:summary="@string/pref_summary_toggle_volume"
app:title="@string/pref_title_toggle_volume" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESeekBarPreference
android:defaultValue="12"
android:key="new_blur_amount"
android:max="25"
app:showSeekBarValue="true"
android:summary="@string/pref_blur_amount_summary"
android:title="@string/pref_blur_amount_title"
app:iconSpaceReserved="false" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="toggle_add_controls"
android:summary="@string/pref_summary_extra_controls"
android:title="@string/pref_title_extra_controls"
app:iconSpaceReserved="false" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="toggle_volume"
android:summary="@string/pref_summary_toggle_volume"
android:title="@string/pref_title_toggle_volume"
app:iconSpaceReserved="false" />
app:iconSpaceReserved="false"
app:showSeekBarValue="true" />
</androidx.preference.PreferenceScreen>

View file

@ -30,7 +30,6 @@ class ATESwitchPreference : CheckBoxPreference {
}
private fun init() {
layoutResource = R.layout.ate_preference_custom_support
widgetLayoutResource = R.layout.ate_preference_switch_support
}
}

View file

@ -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))
}

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<solid android:color="@color/md_deep_purple_A700" />
<corners android:radius="25dp" />
<size android:width="2dp" />
</shape>
</item>
<item android:state_checked="false">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<solid android:color="@color/md_white_1000" />
<corners android:radius="25dp" />
<size android:width="2dp" />
</shape>
</item>
</selector>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2019 Hemanth Savarala.
~
~ Licensed under the GNU General Public License v3
~
~ This is free software: you can redistribute it and/or modify it under
~ the terms of the GNU General Public License as published by
~ the Free Software Foundation either version 3 of the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~ See the GNU General Public License for more details.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<solid android:color="@color/md_white_1000" />
<corners android:radius="10dp" />
<size android:width="20dp" android:height="20dp" />
<stroke android:width="6dp" android:color="#0000ffff" />
</shape>
</item>
</selector>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<code.name.monkey.appthemehelper.common.views.ATESwitch xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:button="@drawable/ate_switch"
android:clickable="false"
android:focusable="false"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1" />

View file

@ -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" />
android:focusable="false" />

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/custom_list_view_row_table_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -27,12 +26,11 @@
<TextView
android:id="@+id/custom_list_view_row_text_view"
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="fill_parent"
android:layout_height="22dip"
android:gravity="center_vertical"
android:textColor="#000000"
style="@style/TextAppearance.MaterialComponents.Subtitle1"
/>
android:textColor="#000000" />
<TextView
android:id="@+id/custom_list_view_row_subtext_view"