Colored settings

main
h4h13 2019-02-17 23:33:12 +05:30
parent 01a4119a8d
commit a5a27e62aa
9 changed files with 114 additions and 51 deletions

View File

@ -154,7 +154,7 @@ abstract class AbsSlidingMusicPanelActivity protected constructor() : AbsMusicSe
} }
override fun onPanelSlide(panel: View?, slideOffset: Float) { override fun onPanelSlide(panel: View?, slideOffset: Float) {
bottomNavigationView.translationY = slideOffset * 400
setMiniPlayerAlphaProgress(slideOffset) setMiniPlayerAlphaProgress(slideOffset)
} }
@ -197,6 +197,9 @@ abstract class AbsSlidingMusicPanelActivity protected constructor() : AbsMusicSe
miniPlayerFragment!!.view!!.alpha = alpha miniPlayerFragment!!.view!!.alpha = alpha
// necessary to make the views below clickable // necessary to make the views below clickable
miniPlayerFragment!!.view!!.visibility = if (alpha == 0f) View.GONE else View.VISIBLE miniPlayerFragment!!.view!!.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
bottomNavigationView.translationY = progress * 500
bottomNavigationView.alpha = alpha
} }
private fun chooseFragmentForTheme() { private fun chooseFragmentForTheme() {

View File

@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.animation.LinearInterpolator import android.view.animation.LinearInterpolator
import android.widget.SeekBar import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.appthemehelper.util.MaterialValueHelper
@ -105,16 +104,12 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
updateShuffleState() updateShuffleState()
val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { if (PreferenceUtil.getInstance().adaptiveColor) {
color lastPlaybackControlsColor = color
} else { text.setTextColor(color)
ThemeStore.accentColor(context!!) TintHelper.setTintAuto(progressSlider, color, false)
} }
lastPlaybackControlsColor = colorFinal
text.setTextColor(colorFinal)
TintHelper.setTintAuto(progressSlider, colorFinal, false)
updatePlayPauseColor() updatePlayPauseColor()
updatePrevNextColor() updatePrevNextColor()
} }

View File

@ -46,9 +46,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
settingsIcons.forEach {
view.findViewById<ImageView>(it).setColorFilter(ThemeStore.accentColor(context!!))
}
generalSettings.setOnClickListener(this) generalSettings.setOnClickListener(this)
audioSettings.setOnClickListener(this) audioSettings.setOnClickListener(this)
nowPlayingSettings.setOnClickListener(this) nowPlayingSettings.setOnClickListener(this)

View File

@ -0,0 +1,39 @@
package code.name.monkey.retromusic.views
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
class ColorIconsImageView : AppCompatImageView {
constructor(context: Context) : super(context) {
init(context, null)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init(context, attrs)
}
private fun init(context: Context, attrs: AttributeSet?) {
// Load the styled attributes and set their properties
val attributes = context.obtainStyledAttributes(attrs, R.styleable.ColorIconsImageView, 0, 0)
setIconBackgroundColor(attributes.getColor(R.styleable.ColorIconsImageView_iconBackgroundColor, Color.RED))
attributes.recycle()
}
private fun setIconBackgroundColor(color: Int) {
setBackgroundResource(R.drawable.color_circle_gradient)
backgroundTintList = ColorStateList.valueOf(ColorUtil.adjustAlpha(color, 0.3f))
imageTintList = ColorStateList.valueOf(color)
requestLayout()
invalidate()
}
}

View File

@ -10,7 +10,7 @@
<scale android:scaleWidth="100%"> <scale android:scaleWidth="100%">
<shape> <shape>
<corners android:radius="8dp" /> <corners android:radius="8dp" />
<solid android:color="@color/md_red_400" /> <solid android:color="@color/md_black_1000" />
</shape> </shape>
</scale> </scale>
</item> </item>

View File

@ -16,25 +16,24 @@
android:id="@+id/userInfoContainer" android:id="@+id/userInfoContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:gravity="center_vertical"
android:paddingStart="12dp" android:minHeight="72dp"
android:paddingTop="12dp" android:orientation="horizontal">
android:paddingEnd="8dp"
android:paddingBottom="12dp">
<code.name.monkey.retromusic.views.CircularImageView <code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage" android:id="@+id/userImage"
android:layout_width="38dp" android:layout_width="42dp"
android:layout_height="38dp" android:layout_height="42dp"
android:layout_marginStart="16dp"
android:layout_weight="0" android:layout_weight="0"
app:civ_border="false" /> app:civ_border="false" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="18dp"
android:paddingEnd="12dp" android:paddingEnd="12dp"
android:paddingBottom="8dp"> android:paddingBottom="8dp">
@ -66,21 +65,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/general_settings_icon" android:id="@+id/general_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_blue_A400"
app:srcCompat="@drawable/ic_theme_palette_white_24dp" /> app:srcCompat="@drawable/ic_theme_palette_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginStart="16dp"
android:padding="12dp"> android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -109,21 +111,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/now_playing_settings_icon" android:id="@+id/now_playing_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_red_A400"
app:srcCompat="@drawable/ic_play_circle_filled_white_24dp" /> app:srcCompat="@drawable/ic_play_circle_filled_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginStart="16dp"
android:padding="12dp"> android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -150,21 +155,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/audio_settings_icon" android:id="@+id/audio_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_deep_purple_A400"
app:srcCompat="@drawable/ic_volume_up_white_24dp" /> app:srcCompat="@drawable/ic_volume_up_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginStart="16dp"
android:padding="12dp"> android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -191,21 +199,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/personalize_settings_icon" android:id="@+id/personalize_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_teal_A400"
app:srcCompat="@drawable/ic_hdr_strong_white_24dp" /> app:srcCompat="@drawable/ic_hdr_strong_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginStart="16dp"
android:padding="12dp"> android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -231,21 +242,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/image_settings_icon" android:id="@+id/image_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_orange_A400"
app:srcCompat="@drawable/ic_image_white_24dp" /> app:srcCompat="@drawable/ic_image_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginStart="16dp"
android:padding="12dp"> android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -271,21 +285,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical"
android:minHeight="72dp" android:minHeight="72dp"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/notification_settings_icon" android:id="@+id/notification_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_yellow_A400"
app:srcCompat="@drawable/ic_notifications_active_white_24dp" /> app:srcCompat="@drawable/ic_notifications_active_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginStart="16dp"
android:padding="12dp"> android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -310,24 +327,27 @@
android:id="@+id/otherSettings" android:id="@+id/otherSettings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="72dp"
android:background="?rectSelector" android:background="?rectSelector"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView <code.name.monkey.retromusic.views.ColorIconsImageView
android:id="@+id/other_settings_icon" android:id="@+id/other_settings_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="16dp" android:layout_marginStart="16dp"
android:padding="10dp"
app:iconBackgroundColor="@color/md_indigo_A400"
app:srcCompat="@drawable/ic_settings_white_24dp" /> app:srcCompat="@drawable/ic_settings_white_24dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical">
android:padding="12dp">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView <code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -54,5 +54,8 @@
<declare-styleable name="InsettableFrameLayout_Layout"> <declare-styleable name="InsettableFrameLayout_Layout">
<attr name="layout_ignoreInsets" format="boolean" /> <attr name="layout_ignoreInsets" format="boolean" />
</declare-styleable> </declare-styleable>
<declare-styleable name="ColorIconsImageView">
<attr name="iconBackgroundColor" format="color" />
<attr name="icon" format="reference" />
</declare-styleable>
</resources> </resources>

View File

@ -4,4 +4,6 @@
<color name="eighty_percent_black_overlay">#80000000</color> <color name="eighty_percent_black_overlay">#80000000</color>
<color name="app_shortcut_default_foreground">#607d8b</color> <color name="app_shortcut_default_foreground">#607d8b</color>
<color name="app_shortcut_default_background">#f5f5f5</color> <color name="app_shortcut_default_background">#f5f5f5</color>
<color name="md_indigo_A400">#3D5AFE</color>
</resources> </resources>

View File

@ -53,4 +53,7 @@
<color name="md_black_1000">#000000</color> <color name="md_black_1000">#000000</color>
<color name="md_white_1000">#FFFFFF</color> <color name="md_white_1000">#FFFFFF</color>
<color name="md_teal_A400">#1DE9B6</color>
<color name="md_orange_A400">#FF3D00</color>
</resources> </resources>