Fixed colors

main
h4h13 2019-11-15 22:00:10 +05:30
commit 9672a8a23d
23 changed files with 101 additions and 290 deletions

View File

@ -9,6 +9,7 @@ import android.view.View
import androidx.core.app.ShareCompat
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK
@ -68,8 +69,13 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
loadContributors()
setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar )
version.setSummary ( getAppVersion())
toolbar.apply {
setTitleTextColor(ATHUtil.resolveColor(this@AboutActivity, R.attr.colorOnPrimary))
setBackgroundColor(ATHUtil.resolveColor(this@AboutActivity, R.attr.colorPrimary))
setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar)
}
version.setSummary(getAppVersion())
setUpView()
}

View File

@ -30,6 +30,7 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@ -61,11 +62,11 @@ public class LicenseActivity extends AbsBaseActivity {
setContentView(R.layout.activity_license);
setStatusbarColorAuto();
setNavigationBarColorPrimary();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ToolbarContentTintHelper.colorBackButton(toolbar );
ToolbarContentTintHelper.colorBackButton(toolbar);
toolbar.setBackgroundColor(INSTANCE.resolveColor(this, R.attr.colorPrimary));
WebView webView = findViewById(R.id.license);
try {
StringBuilder buf = new StringBuilder();

View File

@ -29,7 +29,6 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
setTheme(ThemeManager.getThemeResValue(this))
hideStatusBar()
super.onCreate(savedInstanceState)
//MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this)
changeBackgroundShape()
setImmersiveFullscreen()

View File

@ -3,8 +3,6 @@ package code.name.monkey.retromusic.adapter.song
import android.view.View
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.CabHolder
@ -27,13 +25,11 @@ class ShuffleButtonSongAdapter(activity: AppCompatActivity,
if (holder.itemViewType == OFFSET_ITEM) {
val viewHolder = holder as ViewHolder
viewHolder.playAction?.let {
MaterialUtil.setTint(it, color = ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor))
it.setOnClickListener {
MusicPlayerRemote.openQueue(dataSet, 0, true)
}
}
viewHolder.shuffleAction?.let {
MaterialUtil.setTint(button = it, color = ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor))
it.setOnClickListener {
MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
}

View File

@ -31,7 +31,6 @@ abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A : RecyclerVie
* @see .getGridSize
*/
protected val itemLayoutRes: Int
@LayoutRes
get() = if (getGridSize() > maxGridSizeForList) {
R.layout.item_grid
} else R.layout.item_list
@ -124,13 +123,11 @@ abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A : RecyclerVie
applyRecyclerViewPaddingForLayoutRes(recyclerView(), currentLayoutRes)
}
private fun applyRecyclerViewPaddingForLayoutRes(recyclerView: RecyclerView,
@LayoutRes res: Int) {
val padding: Int
if (res == R.layout.item_grid) {
padding = (resources.displayMetrics.density * 2).toInt()
private fun applyRecyclerViewPaddingForLayoutRes(recyclerView: RecyclerView, res: Int) {
val padding: Int = if (res == R.layout.item_grid) {
(resources.displayMetrics.density * 2).toInt()
} else {
padding = 0
0
}
recyclerView.setPadding(padding, padding, padding, padding)
}

View File

@ -6,8 +6,6 @@ import android.view.View
import androidx.fragment.app.Fragment
import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
/**
* Created by hemanths on 18/08/17.
@ -34,13 +32,13 @@ open class AbsMusicServiceFragment : Fragment(), MusicServiceEventListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
playerActivity!!.addMusicServiceEventListener(this)
playerActivity?.addMusicServiceEventListener(this)
}
override fun onDestroyView() {
super.onDestroyView()
playerActivity!!.removeMusicServiceEventListener(this)
playerActivity?.removeMusicServiceEventListener(this)
}
override fun onPlayingMetaChanged() {

View File

@ -2,7 +2,6 @@ package code.name.monkey.retromusic.fragments.mainactivity;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -38,12 +37,11 @@ import code.name.monkey.retromusic.helper.SortOrder;
import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import io.reactivex.disposables.CompositeDisposable;
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder, MainActivityFragmentCallbacks, SharedPreferences.OnSharedPreferenceChangeListener {
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder, MainActivityFragmentCallbacks {
public static final String TAG = "LibraryFragment";
private static final String CURRENT_TAB_ID = "current_tab_id";
@ -75,19 +73,18 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
public void onDestroyView() {
super.onDestroyView();
disposable.dispose();
PreferenceUtil.getInstance(requireActivity()).unregisterOnSharedPreferenceChangedListener(this);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_library, container, false);
disposable = new CompositeDisposable();
appBarLayout = view.findViewById(R.id.appBarLayout);
toolbarContainer = view.findViewById(R.id.toolbarContainer);
toolbar = view.findViewById(R.id.toolbar);
PreferenceUtil.getInstance(requireActivity()).registerOnSharedPreferenceChangedListener(this);
return view;
}
@ -457,11 +454,4 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
}
return false;
}
@Override
public void onSharedPreferenceChanged(@NonNull SharedPreferences sharedPreferences,
@NonNull String key) {
}
}

View File

@ -1,14 +1,9 @@
package code.name.monkey.retromusic.fragments.player.color
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.AsyncTask
import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -19,22 +14,24 @@ import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.LyricsActivity
import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.RetroColorUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.bumptech.glide.Glide
import com.bumptech.glide.request.animation.GlideAnimation
import kotlinx.android.synthetic.main.fragment_color_player.*
class ColorFragment : AbsPlayerFragment() {
private var lastColor: Int = 0
private var backgroundColor: Int = 0
private var playbackControlsFragment: ColorPlaybackControlsFragment? = null
private var valueAnimator: ValueAnimator? = null
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -50,16 +47,6 @@ class ColorFragment : AbsPlayerFragment() {
}
private var lastColor: Int = 0
private var backgroundColor: Int = 0
private var playbackControlsFragment: ColorPlaybackControlsFragment? = null
private var valueAnimator: ValueAnimator? = null
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
private var lyricsColor: Lyrics? = null
override fun onShow() {
playbackControlsFragment!!.show()
}
@ -102,7 +89,6 @@ class ColorFragment : AbsPlayerFragment() {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()
setUpPlayerToolbar()
setupViews()
}
private fun setUpSubFragments() {
@ -113,7 +99,7 @@ class ColorFragment : AbsPlayerFragment() {
private fun setUpPlayerToolbar() {
playerToolbar.apply {
inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { activity!!.onBackPressed() }
setNavigationOnClickListener { requireActivity().onBackPressed() }
setOnMenuItemClickListener(this@ColorFragment)
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
}
@ -122,18 +108,14 @@ class ColorFragment : AbsPlayerFragment() {
override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged()
updateSong()
updateLyricsLocal()
}
override fun onServiceConnected() {
super.onServiceConnected()
updateSong()
updateLyricsLocal()
}
private fun updateSong() {
SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong)
.checkIgnoreMediaStore(requireContext())
.generatePalette(requireContext())
@ -148,7 +130,6 @@ class ColorFragment : AbsPlayerFragment() {
resource?.let {
val background = resource.palette.getColor()
val palette = resource.palette
val swatch = RetroColorUtil.getSwatch(palette)
@ -175,85 +156,12 @@ class ColorFragment : AbsPlayerFragment() {
private fun setColors(backgroundColor: Int, textColor: Int) {
playbackControlsFragment!!.setDark(textColor, backgroundColor)
colorGradientBackground?.setBackgroundColor(backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColor, activity)
lastColor = textColor
this.backgroundColor = backgroundColor
if (playerActivity != null) {
playerActivity!!.setLightNavigationBar(ColorUtil.isColorLight(backgroundColor))
}
callbacks!!.onPaletteColorChanged()
}
private fun colorize(i: Int) {
if (valueAnimator != null) {
valueAnimator!!.cancel()
}
valueAnimator = ValueAnimator.ofObject(ArgbEvaluator(), paletteColor, i)
valueAnimator!!.addUpdateListener { animation ->
colorGradientBackground?.setBackgroundColor(animation.animatedValue as Int)
}
valueAnimator!!.setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME.toLong()).start()
}
@SuppressLint("StaticFieldLeak")
private fun updateLyricsLocal() {
if (updateLyricsAsyncTask != null) {
updateLyricsAsyncTask!!.cancel(false)
}
val song = MusicPlayerRemote.currentSong
updateLyricsAsyncTask = object : AsyncTask<Void?, Void?, Lyrics?>() {
override fun onPreExecute() {
super.onPreExecute()
lyricsColor = null
playerToolbar.menu.removeItem(R.id.action_show_lyrics)
}
override fun doInBackground(vararg params: Void?): Lyrics? {
val data = MusicUtil.getLyrics(song)
return if (TextUtils.isEmpty(data)) {
null
} else Lyrics.parse(song, data!!)
}
override fun onPostExecute(l: Lyrics?) {
lyricsColor = l
if (lyricsColor == null) {
lyricsView?.setText(R.string.no_lyrics_found)
} else {
lyricsView?.text = lyricsColor!!.text
}
}
override fun onCancelled(s: Lyrics?) {
onPostExecute(null)
}
}.execute()
}
private fun setupViews() {
lyricsView.setOnClickListener {
if (lyricsContainer!!.visibility == View.GONE) {
lyricsContainer!!.visibility = View.VISIBLE
} else {
lyricsContainer!!.visibility = View.GONE
}
}
playerImage.setOnClickListener {
if (lyricsContainer!!.visibility == View.GONE) {
lyricsContainer!!.visibility = View.VISIBLE
} else {
lyricsContainer!!.visibility = View.GONE
}
}
expand.setOnClickListener { startActivity(Intent(context, LyricsActivity::class.java)) }
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(backgroundColor))
callbacks?.onPaletteColorChanged()
}
companion object {

View File

@ -36,7 +36,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="12dp"
@ -52,41 +52,7 @@
android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
<ScrollView
android:id="@+id/lyricsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/twenty_percent_black_overlay"
android:visibility="gone"
tools:visibility="visible">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/lyricsView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:lineSpacingExtra="4dp"
android:lineSpacingMultiplier="1.5"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="@color/md_white_1000" />
</FrameLayout>
</ScrollView>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/expand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:padding="16dp"
app:srcCompat="@drawable/ic_unfold_more_black_24dp"
app:tint="@color/md_white_1000" />
</androidx.cardview.widget.CardView>
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.HeightFitSquareLayout>

View File

@ -15,9 +15,9 @@
android:id="@+id/toolbar"
style="@style/Toolbar"
app:layout_collapseMode="pin"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/action_about" />
app:title="@string/action_about"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal" />
</com.google.android.material.appbar.AppBarLayout>

View File

@ -14,14 +14,8 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:layout_marginBottom="8dp"
android:paddingTop="@dimen/button_padding_vertical"
android:paddingBottom="@dimen/button_padding_vertical"
android:text="@string/action_play_all"
android:textAllCaps="false"
android:textAppearance="@style/TextViewNormal"
app:cornerRadius="@dimen/button_corner"
app:icon="@drawable/ic_play_arrow_white_24dp"
app:iconGravity="textStart"
app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
@ -35,14 +29,8 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:layout_marginBottom="8dp"
android:paddingTop="@dimen/button_padding_vertical"
android:paddingBottom="@dimen/button_padding_vertical"
android:text="@string/shuffle"
android:textAllCaps="false"
android:textAppearance="@style/TextViewNormal"
app:cornerRadius="@dimen/button_corner"
app:icon="@drawable/ic_shuffle_white_24dp"
app:iconGravity="textStart"
app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -13,14 +13,8 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/button_margin_horizontal"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:paddingTop="@dimen/button_padding_vertical"
android:paddingBottom="@dimen/button_padding_vertical"
android:text="@string/action_play_all"
android:textAllCaps="false"
android:textAppearance="@style/TextViewNormal"
app:cornerRadius="@dimen/button_corner"
app:icon="@drawable/ic_play_arrow_white_24dp"
app:iconGravity="textStart"
app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
@ -32,14 +26,8 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/button_margin_horizontal"
android:layout_marginEnd="@dimen/button_margin_horizontal"
android:paddingTop="@dimen/button_padding_vertical"
android:paddingBottom="@dimen/button_padding_vertical"
android:text="@string/shuffle"
android:textAllCaps="false"
android:textAppearance="@style/TextViewNormal"
app:cornerRadius="@dimen/button_corner"
app:icon="@drawable/ic_shuffle_white_24dp"
app:iconGravity="textStart"
app:layout_constraintBottom_toBottomOf="@+id/playAction"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
@ -85,6 +73,7 @@
android:nestedScrollingEnabled="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/albumTitle"
tools:itemCount="3"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listitem="@layout/item_album_card"
tools:spanCount="3" />

View File

@ -2,7 +2,6 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -27,7 +27,7 @@
<include layout="@layout/status_bar" />
</FrameLayout>
<com.google.android.material.card.MaterialCardView
<code.name.monkey.retromusic.views.WidthFitSquareCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@ -37,57 +37,16 @@
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/playerImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription,UnusedAttribute"
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/playerImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription,UnusedAttribute"
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
<ScrollView
android:id="@+id/lyricsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/twenty_percent_black_overlay"
android:visibility="gone"
tools:visibility="visible">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/lyricsView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:lineSpacingExtra="4dp"
android:lineSpacingMultiplier="1.5"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="@color/md_white_1000" />
</FrameLayout>
</ScrollView>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/expand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:padding="16dp"
app:srcCompat="@drawable/ic_unfold_more_black_24dp"
app:tint="@color/md_white_1000" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</com.google.android.material.card.MaterialCardView>
</code.name.monkey.retromusic.views.WidthFitSquareCardView>
<FrameLayout
android:layout_width="match_parent"

View File

@ -15,7 +15,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@ -31,7 +30,6 @@
</FrameLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -7,7 +7,7 @@
android:layout_height="48dp"
android:background="?colorSecondary"
android:clickable="true"
android:focusable="false"
android:focusable="true"
tools:ignore="UnusedAttribute">
<LinearLayout

View File

@ -27,14 +27,8 @@
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:paddingTop="@dimen/button_padding_vertical"
android:paddingBottom="@dimen/button_padding_vertical"
android:text="@string/action_play_all"
android:textAllCaps="false"
android:textAppearance="@style/TextViewNormal"
app:cornerRadius="@dimen/button_corner"
app:icon="@drawable/ic_play_arrow_white_24dp"
app:iconGravity="textStart" />
app:icon="@drawable/ic_play_arrow_white_24dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/shuffleAction"
@ -43,13 +37,7 @@
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:paddingTop="@dimen/button_padding_vertical"
android:paddingBottom="@dimen/button_padding_vertical"
android:text="@string/shuffle"
android:textAllCaps="false"
android:textAppearance="@style/TextViewNormal"
app:cornerRadius="@dimen/button_corner"
app:icon="@drawable/ic_shuffle_white_24dp"
app:iconGravity="textStart" />
app:icon="@drawable/ic_shuffle_white_24dp" />
</LinearLayout>

View File

@ -27,6 +27,7 @@
android:fontFeatureSettings="onum"
android:gravity="center"
android:maxLines="1"
tools:text="@tools:sample/date/hhmm"
android:minHeight="40dp"
android:textAppearance="@style/TextViewNormal"
android:textColor="?colorOnSecondary" />
@ -45,7 +46,7 @@
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/imageContainer"
app:layout_constraintTop_toTopOf="parent"
tools:text="Song title" />
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/time"
@ -58,7 +59,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/menu"
app:layout_constraintTop_toTopOf="parent"
tools:text="22:00" />
tools:text="@tools:sample/date/hhmm" />
<androidx.appcompat.widget.AppCompatImageView

View File

@ -25,10 +25,10 @@
android:layout_height="wrap_content"
app:behavior_hideable="false"
app:behavior_peekHeight="0dp"
app:cardUseCompatPadding="false"
app:cardBackgroundColor="?colorSecondary"
app:cardUseCompatPadding="false"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
app:shapeAppearanceOverlay="@style/TopCornerCardView">
app:strokeWidth="0dp">
<FrameLayout

View File

@ -5,10 +5,10 @@
<color name="app_shortcut_default_foreground">#607d8b</color>
<color name="app_shortcut_default_background">#f5f5f5</color>
<color name="md_indigo_A400">#3D5AFE</color>
<color name="dark_color">#212121</color>
<color name="dark_grey">#121212</color>
<color name="card_dark_color">#2C2D30</color>
<color name="black_color">#121212</color>
<color name="dark_color">#202124</color>
<color name="dark_grey">#17181a</color>
<color name="card_dark_color">#222326</color>
<color name="black_color">#202124</color>
<color name="lightColorPrimary">#FFFFFF</color>
<color name="lightColorOnPrimary">#202020</color>
@ -16,15 +16,17 @@
<color name="lightColorBackground">#FFFFFF</color>
<color name="lightColorSurface">#FEFEFE</color>
<color name="darkColorPrimary">#121212</color>
<color name="darkColorSecondary">#181818</color>
<color name="darkColorBackground">#333333</color>
<color name="darkColorSurface">#1F1F1F</color>
<color name="darkColorPrimary">#202124</color>
<color name="darkColorOnPrimary">#ffffff</color>
<color name="darkColorSecondary">#202124</color>
<color name="darkColorBackground">#121212</color>
<color name="darkColorSurface">#3C4043</color>
<color name="blackColorPrimary">#000000</color>
<color name="blackColorOnPrimary">#ffffff</color>
<color name="blackColorSecondary">#000000</color>
<color name="blackColorBackground">#000000</color>
<color name="blackColorSurface">#121212</color>
<color name="blackColorSurface">#17181a</color>
<color name="transparent">#00000000</color>
<!-- card colors -->

View File

@ -161,4 +161,17 @@
<item name="cornerSize">8dp</item>
</style>
<style name="TopCornerCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlayCardViewTopCorners</item>
</style>
<style name="ShapeAppearanceOverlayCardViewTopCorners" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">16dp</item>
<item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
</style>
</resources>

View File

@ -27,7 +27,7 @@
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<!-- just in case-->
<item name="android:windowBackground">@color/dark_color</item>
<item name="android:windowBackground">@color/md_red_500</item>
<!-- necessary to find the overflow button later in the layout-->
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
@ -40,6 +40,7 @@
<item name="windowActionBar">false</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="colorPrimary">@color/darkColorPrimary</item>
<item name="colorSecondary">@color/darkColorSecondary</item>
@ -49,7 +50,7 @@
<item name="colorAccent">@color/md_deep_purple_A200</item>
<item name="android:colorBackground">@color/darkColorBackground</item>
<item name="android:colorBackground">@color/md_red_500</item>
<item name="colorSurface">@color/darkColorSurface</item>
<item name="colorOnSurface">@color/mi_text_color_primary_dark</item>
<item name="colorOnBackground">@color/mi_text_color_secondary_dark</item>
@ -124,8 +125,9 @@
<item name="android:fontFamily">@font/circular</item>
<item name="windowActionBar">false</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<!--<item name="android:textColorPrimary">@color/md_grey_900</item>-->
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="colorPrimary">@color/lightColorPrimary</item>
<item name="colorSecondary">@color/lightColorSecondary</item>
@ -167,4 +169,14 @@
<style name="MaterialAlertDialogTheme" parent="@style/ThemeOverlay.MaterialComponents.Dialog">
<item name="android:dialogCornerRadius" tools:targetApi="p">12dp</item>
</style>
<style name="MaterialButtonTheme" parent="Widget.MaterialComponents.Button">
<item name="cornerRadius">24dp</item>
<item name="android:textAppearance">@style/TextViewNormal</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingTop">@dimen/button_padding_vertical</item>
<item name="android:paddingBottom">@dimen/button_padding_vertical</item>
<item name="iconGravity">textStart</item>
<item name="backgroundTint">?colorSurface</item>
</style>
</resources>

View File

@ -1,9 +1,10 @@
package code.name.monkey.appthemehelper.common;
import android.graphics.drawable.ColorDrawable;
import android.view.Menu;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import code.name.monkey.appthemehelper.ATHActivity;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
@ -12,6 +13,15 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
public class ATHToolbarActivity extends ATHActivity {
private Toolbar toolbar;
public static int getToolbarBackgroundColor(Toolbar toolbar) {
if (toolbar != null) {
if (toolbar.getBackground() instanceof ColorDrawable) {
return ((ColorDrawable) toolbar.getBackground()).getColor();
}
}
return 0;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Toolbar toolbar = getATHToolbar();
@ -34,13 +44,4 @@ public class ATHToolbarActivity extends ATHActivity {
protected Toolbar getATHToolbar() {
return toolbar;
}
public static int getToolbarBackgroundColor(Toolbar toolbar) {
if (toolbar != null) {
if (toolbar.getBackground() instanceof ColorDrawable) {
return ((ColorDrawable) toolbar.getBackground()).getColor();
}
}
return 0;
}
}