Fixed colors

This commit is contained in:
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.core.app.ShareCompat
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK import code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK
import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK import code.name.monkey.retromusic.Constants.APP_TELEGRAM_LINK
@ -68,7 +69,12 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
loadContributors() loadContributors()
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
toolbar.apply {
setTitleTextColor(ATHUtil.resolveColor(this@AboutActivity, R.attr.colorOnPrimary))
setBackgroundColor(ATHUtil.resolveColor(this@AboutActivity, R.attr.colorPrimary))
setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar) ToolbarContentTintHelper.colorBackButton(toolbar)
}
version.setSummary(getAppVersion()) version.setSummary(getAppVersion())
setUpView() setUpView()
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,6 @@ package code.name.monkey.retromusic.fragments.mainactivity;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityOptions; import android.app.ActivityOptions;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; 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.CabHolder;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks; import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.util.NavigationUtil; 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.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil; import code.name.monkey.retromusic.util.RetroUtil;
import io.reactivex.disposables.CompositeDisposable; 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"; public static final String TAG = "LibraryFragment";
private static final String CURRENT_TAB_ID = "current_tab_id"; private static final String CURRENT_TAB_ID = "current_tab_id";
@ -75,19 +73,18 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
disposable.dispose(); disposable.dispose();
PreferenceUtil.getInstance(requireActivity()).unregisterOnSharedPreferenceChangedListener(this);
} }
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) { @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_library, container, false); View view = inflater.inflate(R.layout.fragment_library, container, false);
disposable = new CompositeDisposable(); disposable = new CompositeDisposable();
appBarLayout = view.findViewById(R.id.appBarLayout); appBarLayout = view.findViewById(R.id.appBarLayout);
toolbarContainer = view.findViewById(R.id.toolbarContainer); toolbarContainer = view.findViewById(R.id.toolbarContainer);
toolbar = view.findViewById(R.id.toolbar); toolbar = view.findViewById(R.id.toolbar);
PreferenceUtil.getInstance(requireActivity()).registerOnSharedPreferenceChangedListener(this);
return view; return view;
} }
@ -457,11 +454,4 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
} }
return false; 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 package code.name.monkey.retromusic.fragments.player.color
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup 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.MaterialValueHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R 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.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song 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.RetroColorUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.request.animation.GlideAnimation import com.bumptech.glide.request.animation.GlideAnimation
import kotlinx.android.synthetic.main.fragment_color_player.* import kotlinx.android.synthetic.main.fragment_color_player.*
class ColorFragment : AbsPlayerFragment() { 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 { override fun playerToolbar(): Toolbar {
return playerToolbar 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() { override fun onShow() {
playbackControlsFragment!!.show() playbackControlsFragment!!.show()
} }
@ -102,7 +89,6 @@ class ColorFragment : AbsPlayerFragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
setUpSubFragments() setUpSubFragments()
setUpPlayerToolbar() setUpPlayerToolbar()
setupViews()
} }
private fun setUpSubFragments() { private fun setUpSubFragments() {
@ -113,7 +99,7 @@ class ColorFragment : AbsPlayerFragment() {
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
playerToolbar.apply { playerToolbar.apply {
inflateMenu(R.menu.menu_player) inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { activity!!.onBackPressed() } setNavigationOnClickListener { requireActivity().onBackPressed() }
setOnMenuItemClickListener(this@ColorFragment) setOnMenuItemClickListener(this@ColorFragment)
ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.iconColor), activity) ToolbarContentTintHelper.colorizeToolbar(this, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
} }
@ -122,18 +108,14 @@ class ColorFragment : AbsPlayerFragment() {
override fun onPlayingMetaChanged() { override fun onPlayingMetaChanged() {
super.onPlayingMetaChanged() super.onPlayingMetaChanged()
updateSong() updateSong()
updateLyricsLocal()
} }
override fun onServiceConnected() { override fun onServiceConnected() {
super.onServiceConnected() super.onServiceConnected()
updateSong() updateSong()
updateLyricsLocal()
} }
private fun updateSong() { private fun updateSong() {
SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong) SongGlideRequest.Builder.from(Glide.with(requireActivity()), MusicPlayerRemote.currentSong)
.checkIgnoreMediaStore(requireContext()) .checkIgnoreMediaStore(requireContext())
.generatePalette(requireContext()) .generatePalette(requireContext())
@ -148,7 +130,6 @@ class ColorFragment : AbsPlayerFragment() {
resource?.let { resource?.let {
val background = resource.palette.getColor() val background = resource.palette.getColor()
val palette = resource.palette val palette = resource.palette
val swatch = RetroColorUtil.getSwatch(palette) val swatch = RetroColorUtil.getSwatch(palette)
@ -175,85 +156,12 @@ class ColorFragment : AbsPlayerFragment() {
private fun setColors(backgroundColor: Int, textColor: Int) { private fun setColors(backgroundColor: Int, textColor: Int) {
playbackControlsFragment!!.setDark(textColor, backgroundColor) playbackControlsFragment!!.setDark(textColor, backgroundColor)
colorGradientBackground?.setBackgroundColor(backgroundColor) colorGradientBackground?.setBackgroundColor(backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColor, activity) ToolbarContentTintHelper.colorizeToolbar(playerToolbar, textColor, activity)
lastColor = textColor lastColor = textColor
this.backgroundColor = backgroundColor this.backgroundColor = backgroundColor
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(backgroundColor))
if (playerActivity != null) { callbacks?.onPaletteColorChanged()
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)) }
} }
companion object { companion object {

View file

@ -36,7 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.cardview.widget.CardView <com.google.android.material.card.MaterialCardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="12dp" android:layout_margin="12dp"
@ -52,41 +52,7 @@
android:scaleType="centerCrop" android:scaleType="centerCrop"
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" /> tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
<ScrollView </com.google.android.material.card.MaterialCardView>
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>
</code.name.monkey.retromusic.views.HeightFitSquareLayout> </code.name.monkey.retromusic.views.HeightFitSquareLayout>

View file

@ -15,9 +15,9 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp" 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> </com.google.android.material.appbar.AppBarLayout>

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@
<include layout="@layout/status_bar" /> <include layout="@layout/status_bar" />
</FrameLayout> </FrameLayout>
<com.google.android.material.card.MaterialCardView <code.name.monkey.retromusic.views.WidthFitSquareCardView
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_marginStart="16dp"
@ -37,11 +37,6 @@
app:cardPreventCornerOverlap="false" app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/playerImage" android:id="@+id/playerImage"
@ -51,43 +46,7 @@
tools:ignore="ContentDescription,UnusedAttribute" tools:ignore="ContentDescription,UnusedAttribute"
tools:srcCompat="@tools:sample/backgrounds/scenic[10]" /> tools:srcCompat="@tools:sample/backgrounds/scenic[10]" />
<ScrollView </code.name.monkey.retromusic.views.WidthFitSquareCardView>
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>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -161,4 +161,17 @@
<item name="cornerSize">8dp</item> <item name="cornerSize">8dp</item>
</style> </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> </resources>

View file

@ -27,7 +27,7 @@
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat</item> <item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat</item>
<!-- just in case--> <!-- 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--> <!-- necessary to find the overflow button later in the layout-->
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item> <item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
@ -40,6 +40,7 @@
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item> <item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="colorPrimary">@color/darkColorPrimary</item> <item name="colorPrimary">@color/darkColorPrimary</item>
<item name="colorSecondary">@color/darkColorSecondary</item> <item name="colorSecondary">@color/darkColorSecondary</item>
@ -49,7 +50,7 @@
<item name="colorAccent">@color/md_deep_purple_A200</item> <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="colorSurface">@color/darkColorSurface</item>
<item name="colorOnSurface">@color/mi_text_color_primary_dark</item> <item name="colorOnSurface">@color/mi_text_color_primary_dark</item>
<item name="colorOnBackground">@color/mi_text_color_secondary_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="android:fontFamily">@font/circular</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</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="colorPrimary">@color/lightColorPrimary</item>
<item name="colorSecondary">@color/lightColorSecondary</item> <item name="colorSecondary">@color/lightColorSecondary</item>
@ -167,4 +169,14 @@
<style name="MaterialAlertDialogTheme" parent="@style/ThemeOverlay.MaterialComponents.Dialog"> <style name="MaterialAlertDialogTheme" parent="@style/ThemeOverlay.MaterialComponents.Dialog">
<item name="android:dialogCornerRadius" tools:targetApi="p">12dp</item> <item name="android:dialogCornerRadius" tools:targetApi="p">12dp</item>
</style> </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> </resources>

View file

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