diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt index 9980d85b..2c5ab858 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/AlbumDetailsActivity.kt @@ -44,7 +44,6 @@ import com.afollestad.materialcab.MaterialCab import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.activity_album.* import kotlinx.android.synthetic.main.activity_album_content.* -import kotlinx.android.synthetic.main.status_bar.* import java.util.* import javax.inject.Inject import android.util.Pair as UtilPair @@ -203,7 +202,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C MaterialUtil.setTint(button = playAction, color = buttonColor) val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface) - status_bar.setBackgroundColor(toolbarColor) + //status_bar.setBackgroundColor(toolbarColor) toolbar.setBackgroundColor(toolbarColor) setSupportActionBar(toolbar) supportActionBar?.title = null @@ -266,14 +265,10 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C private fun setUpSortOrderMenu(sortOrder: SubMenu) { when (savedSortOrder) { - AlbumSongSortOrder.SONG_A_Z -> sortOrder.findItem(R.id.action_sort_order_title) - .isChecked = true - AlbumSongSortOrder.SONG_Z_A -> sortOrder.findItem(R.id.action_sort_order_title_desc) - .isChecked = true - AlbumSongSortOrder.SONG_TRACK_LIST -> sortOrder.findItem(R.id.action_sort_order_track_list) - .isChecked = true - AlbumSongSortOrder.SONG_DURATION -> sortOrder.findItem(R.id.action_sort_order_artist_song_duration) - .isChecked = true + AlbumSongSortOrder.SONG_A_Z -> sortOrder.findItem(R.id.action_sort_order_title).isChecked = true + AlbumSongSortOrder.SONG_Z_A -> sortOrder.findItem(R.id.action_sort_order_title_desc).isChecked = true + AlbumSongSortOrder.SONG_TRACK_LIST -> sortOrder.findItem(R.id.action_sort_order_track_list).isChecked = true + AlbumSongSortOrder.SONG_DURATION -> sortOrder.findItem(R.id.action_sort_order_artist_song_duration).isChecked = true } } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt index 7627bd2a..980e9865 100755 --- a/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/ArtistDetailActivity.kt @@ -38,7 +38,6 @@ import com.afollestad.materialcab.MaterialCab import com.bumptech.glide.Glide import kotlinx.android.synthetic.main.activity_artist_content.* import kotlinx.android.synthetic.main.activity_artist_details.* -import kotlinx.android.synthetic.main.status_bar.* import java.util.* import javax.inject.Inject import kotlin.collections.ArrayList @@ -243,7 +242,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, MaterialUtil.setTint(button = playAction, color = buttonColor) val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface) - status_bar.setBackgroundColor(toolbarColor) + //status_bar.setBackgroundColor(toolbarColor) toolbar.setBackgroundColor(toolbarColor) setSupportActionBar(toolbar) supportActionBar?.title = null diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt index 8a2c5309..96bace4d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsThemeActivity.kt @@ -90,7 +90,7 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable { val statusBar = window.decorView.rootView.findViewById(R.id.status_bar) if (statusBar != null) { when { - VersionUtils.hasMarshmallow() -> window.statusBarColor = color + VersionUtils.hasMarshmallow() -> statusBar.setBackgroundColor(color) VersionUtils.hasLollipop() -> statusBar.setBackgroundColor(ColorUtil.darkenColor(color)) else -> statusBar.setBackgroundColor(color) } @@ -105,7 +105,7 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable { fun setStatusbarColorAuto() { // we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat - //setStatusbarColor(ATHUtil.resolveColor(this, android.R.attr.windowBackground)) + setStatusbarColor(ATHUtil.resolveColor(this, R.attr.colorSurface)) setLightStatusbarAuto(ATHUtil.resolveColor(this, R.attr.colorSurface)) } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt index fc7b684c..3c064e4c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumAdapter.kt @@ -3,198 +3,195 @@ package code.name.monkey.retromusic.adapter.album import android.app.ActivityOptions import android.content.res.ColorStateList import android.graphics.drawable.Drawable -import android.view.* +import android.view.LayoutInflater +import android.view.MenuItem +import android.view.View +import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import code.name.monkey.appthemehelper.util.* +import code.name.monkey.appthemehelper.util.ColorUtil +import code.name.monkey.appthemehelper.util.MaterialValueHelper import code.name.monkey.retromusic.R -import code.name.monkey.retromusic.adapter.base.* -import code.name.monkey.retromusic.glide.* -import code.name.monkey.retromusic.helper.* +import code.name.monkey.retromusic.adapter.base.AbsMultiSelectAdapter +import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder +import code.name.monkey.retromusic.glide.RetroMusicColoredTarget +import code.name.monkey.retromusic.glide.SongGlideRequest +import code.name.monkey.retromusic.helper.MusicPlayerRemote +import code.name.monkey.retromusic.helper.SortOrder import code.name.monkey.retromusic.helper.menu.SongsMenuHelper import code.name.monkey.retromusic.interfaces.CabHolder -import code.name.monkey.retromusic.model.* -import code.name.monkey.retromusic.util.* +import code.name.monkey.retromusic.model.Album +import code.name.monkey.retromusic.model.Song +import code.name.monkey.retromusic.util.MusicUtil +import code.name.monkey.retromusic.util.NavigationUtil +import code.name.monkey.retromusic.util.PreferenceUtil import com.bumptech.glide.Glide import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView open class AlbumAdapter( - protected val activity: AppCompatActivity, - dataSet: ArrayList, - protected var itemLayoutRes: Int, - usePalette: Boolean, - cabHolder: CabHolder? + protected val activity: AppCompatActivity, + dataSet: ArrayList, + protected var itemLayoutRes: Int, + usePalette: Boolean, + cabHolder: CabHolder? ) : AbsMultiSelectAdapter( - activity, cabHolder, code.name.monkey.retromusic.R.menu.menu_media_selection + activity, + cabHolder, + R.menu.menu_media_selection ), FastScrollRecyclerView.SectionedAdapter { - var dataSet: ArrayList - protected set + var dataSet: ArrayList + protected set - protected var usePalette = false + protected var usePalette = false - init { - this.dataSet = dataSet - this.usePalette = usePalette - this.setHasStableIds(true) - } + init { + this.dataSet = dataSet + this.usePalette = usePalette + this.setHasStableIds(true) + } - fun useItemLayout(itemLayoutRes: Int) { - this.itemLayoutRes = itemLayoutRes - notifyDataSetChanged() - } + fun useItemLayout(itemLayoutRes: Int) { + this.itemLayoutRes = itemLayoutRes + notifyDataSetChanged() + } - fun usePalette(usePalette: Boolean) { - this.usePalette = usePalette - notifyDataSetChanged() - } + fun usePalette(usePalette: Boolean) { + this.usePalette = usePalette + notifyDataSetChanged() + } - fun swapDataSet(dataSet: ArrayList) { - this.dataSet = dataSet - notifyDataSetChanged() - } + fun swapDataSet(dataSet: ArrayList) { + this.dataSet = dataSet + notifyDataSetChanged() + } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false) - return createViewHolder(view, viewType) - } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false) + return createViewHolder(view, viewType) + } - protected open fun createViewHolder(view: View, viewType: Int): ViewHolder { - return ViewHolder(view) - } + protected open fun createViewHolder(view: View, viewType: Int): ViewHolder { + return ViewHolder(view) + } - private fun getAlbumTitle(album: Album): String? { - return album.title - } + private fun getAlbumTitle(album: Album): String? { + return album.title + } - protected open fun getAlbumText(album: Album): String? { - return album.artistName - } + protected open fun getAlbumText(album: Album): String? { + return album.artistName + } - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - val album = dataSet[position] - val isChecked = isChecked(album) - holder.itemView.isActivated = isChecked - holder.title?.text = getAlbumTitle(album) - holder.text?.text = getAlbumText(album) - holder.playSongs?.setOnClickListener { - album.songs?.let { songs -> - MusicPlayerRemote.openQueue( - songs, 0, true - ) - } - } - loadAlbumCover(album, holder) - } + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + val album = dataSet[position] + val isChecked = isChecked(album) + holder.itemView.isActivated = isChecked + holder.title?.text = getAlbumTitle(album) + holder.text?.text = getAlbumText(album) + holder.playSongs?.setOnClickListener { album.songs?.let { songs -> MusicPlayerRemote.openQueue(songs, 0, true) } } + loadAlbumCover(album, holder) + } - protected open fun setColors(color: Int, holder: ViewHolder) { - if (holder.paletteColorContainer != null) { - holder.title?.setTextColor( - MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)) - ) - holder.text?.setTextColor( - MaterialValueHelper.getSecondaryTextColor( - activity, ColorUtil.isColorLight( - color - ) - ) - ) - holder.paletteColorContainer?.setBackgroundColor(color) - } + protected open fun setColors(color: Int, holder: ViewHolder) { + if (holder.paletteColorContainer != null) { + holder.title?.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color))) + holder.text?.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color))) + holder.paletteColorContainer?.setBackgroundColor(color) + } + holder.mask?.backgroundTintList = ColorStateList.valueOf(color) + } - holder.mask?.backgroundTintList = ColorStateList.valueOf(color) - } + protected open fun loadAlbumCover(album: Album, holder: ViewHolder) { + if (holder.image == null) { + return + } - protected open fun loadAlbumCover(album: Album, holder: ViewHolder) { - if (holder.image == null) { - return - } + SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()) + .checkIgnoreMediaStore(activity).generatePalette(activity).build() + .into(object : RetroMusicColoredTarget(holder.image!!) { + override fun onLoadCleared(placeholder: Drawable?) { + super.onLoadCleared(placeholder) + setColors(defaultFooterColor, holder) + } - SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong()) - .checkIgnoreMediaStore(activity).generatePalette(activity).build() - .into(object : RetroMusicColoredTarget(holder.image!!) { - override fun onLoadCleared(placeholder: Drawable?) { - super.onLoadCleared(placeholder) - setColors(defaultFooterColor, holder) - } + override fun onColorReady(color: Int) { + setColors(color, holder) + } + }) + } - override fun onColorReady(color: Int) { - setColors(color, holder) - } - }) - } + override fun getItemCount(): Int { + return dataSet.size + } - override fun getItemCount(): Int { - return dataSet.size - } + override fun getItemId(position: Int): Long { + return dataSet[position].id.toLong() + } - override fun getItemId(position: Int): Long { - return dataSet[position].id.toLong() - } + override fun getIdentifier(position: Int): Album? { + return dataSet[position] + } - override fun getIdentifier(position: Int): Album? { - return dataSet[position] - } + override fun getName(album: Album): String { + return album.title!! + } - override fun getName(album: Album): String { - return album.title!! - } + override fun onMultipleItemAction( + menuItem: MenuItem, selection: ArrayList + ) { + SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.itemId) + } - override fun onMultipleItemAction( - menuItem: MenuItem, selection: ArrayList - ) { - SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.itemId) - } + private fun getSongList(albums: List): ArrayList { + val songs = ArrayList() + for (album in albums) { + songs.addAll(album.songs!!) + } + return songs + } - private fun getSongList(albums: List): ArrayList { - val songs = ArrayList() - for (album in albums) { - songs.addAll(album.songs!!) - } - return songs - } + override fun getSectionName(position: Int): String { + var sectionName: String? = null + when (PreferenceUtil.getInstance(activity).albumSortOrder) { + SortOrder.AlbumSortOrder.ALBUM_A_Z, SortOrder.AlbumSortOrder.ALBUM_Z_A -> sectionName = dataSet[position].title + SortOrder.AlbumSortOrder.ALBUM_ARTIST -> sectionName = dataSet[position].artistName + SortOrder.AlbumSortOrder.ALBUM_YEAR -> return MusicUtil.getYearString( + dataSet[position].year + ) + } - override fun getSectionName(position: Int): String { - var sectionName: String? = null - when (PreferenceUtil.getInstance(activity).albumSortOrder) { - SortOrder.AlbumSortOrder.ALBUM_A_Z, SortOrder.AlbumSortOrder.ALBUM_Z_A -> sectionName = dataSet[position].title - SortOrder.AlbumSortOrder.ALBUM_ARTIST -> sectionName = dataSet[position].artistName - SortOrder.AlbumSortOrder.ALBUM_YEAR -> return MusicUtil.getYearString( - dataSet[position].year - ) - } + return MusicUtil.getSectionName(sectionName) + } - return MusicUtil.getSectionName(sectionName) - } + inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { - inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { + init { + setImageTransitionName(activity.getString(R.string.transition_album_art)) + menu?.visibility = View.GONE + } - init { - setImageTransitionName(activity.getString(R.string.transition_album_art)) - menu?.visibility = View.GONE - } + override fun onClick(v: View?) { + super.onClick(v) + if (isInQuickSelectMode) { + toggleChecked(adapterPosition) + } else { + val activityOptions = ActivityOptions.makeSceneTransitionAnimation( + activity, image, activity.getString( + R.string.transition_album_art + ) + ) + NavigationUtil.goToAlbumOptions( + activity, dataSet[adapterPosition].id, activityOptions + ) + } + } - override fun onClick(v: View?) { - super.onClick(v) - if (isInQuickSelectMode) { - toggleChecked(adapterPosition) - } else { - val activityOptions = ActivityOptions.makeSceneTransitionAnimation( - activity, image, activity.getString( - R.string.transition_album_art - ) - ) - NavigationUtil.goToAlbumOptions( - activity, dataSet[adapterPosition].id, activityOptions - ) - } - } + override fun onLongClick(v: View?): Boolean { + toggleChecked(adapterPosition) + return super.onLongClick(v) + } + } - override fun onLongClick(v: View?): Boolean { - toggleChecked(adapterPosition) - return super.onLongClick(v) - } - } - - companion object { - val TAG: String = AlbumAdapter::class.java.simpleName - } + companion object { + val TAG: String = AlbumAdapter::class.java.simpleName + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt index f381a579..1a85231f 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/HorizontalAlbumAdapter.kt @@ -1,10 +1,13 @@ package code.name.monkey.retromusic.adapter.album import android.graphics.drawable.Drawable -import android.view.* +import android.view.View +import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import code.name.monkey.appthemehelper.util.* -import code.name.monkey.retromusic.glide.* +import code.name.monkey.appthemehelper.util.ColorUtil +import code.name.monkey.appthemehelper.util.MaterialValueHelper +import code.name.monkey.retromusic.glide.RetroMusicColoredTarget +import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.helper.HorizontalAdapterHelper import code.name.monkey.retromusic.interfaces.CabHolder import code.name.monkey.retromusic.model.Album @@ -28,22 +31,8 @@ class HorizontalAlbumAdapter( } override fun setColors(color: Int, holder: ViewHolder) { - holder.title?.setTextColor( - MaterialValueHelper.getPrimaryTextColor( - activity, - ColorUtil.isColorLight( - color - ) - ) - ) - holder.text?.setTextColor( - MaterialValueHelper.getSecondaryTextColor( - activity, - ColorUtil.isColorLight( - color - ) - ) - ) + holder.title?.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color))) + holder.text?.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color))) } override fun loadAlbumCover(album: Album, holder: ViewHolder) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt index b9b96f7f..7f926dad 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/AlbumsFragment.kt @@ -65,7 +65,7 @@ open class AlbumsFragment : AbsLibraryPagerRecyclerViewCustomGridSizeFragment fileComparator = (lhs, rhs) -> { @@ -151,6 +147,10 @@ public class FoldersFragment extends AbsMainActivityFragment implements } } + private String getEmojiByUnicode(int unicode) { + return new String(Character.toChars(unicode)); + } + private void initViews(View view) { coordinatorLayout = view.findViewById(R.id.coordinatorLayout); toolbarContainer = view.findViewById(R.id.toolbarContainer); @@ -159,6 +159,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements breadCrumbs = view.findViewById(R.id.breadCrumbs); toolbar = view.findViewById(R.id.toolbar); empty = view.findViewById(android.R.id.empty); + emojiText = view.findViewById(R.id.emptyEmoji); } private void setCrumb(BreadCrumbLayout.Crumb crumb, boolean addToHistory) { @@ -232,13 +233,14 @@ public class FoldersFragment extends AbsMainActivityFragment implements private void setUpAppbarColor() { int primaryColor = ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface); getMainActivity().setSupportActionBar(toolbar); - toolbar.setBackgroundTintList(ColorStateList.valueOf(ATHUtil.INSTANCE.resolveColor(requireContext(), R.attr.colorSurface))); + toolbar.setBackgroundTintList(ColorStateList.valueOf(primaryColor)); + toolbarContainer.setCardBackgroundColor(ColorStateList.valueOf(primaryColor)); toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp); toolbar.setNavigationOnClickListener(v -> { showMainMenu(OptionsSheetDialogFragment.FOLDER); }); - breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(requireActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor))); - breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(requireActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor))); + breadCrumbs.setActivatedContentColor(ATHUtil.INSTANCE.resolveColor(requireContext(), android.R.attr.textColorPrimary)); + breadCrumbs.setDeactivatedContentColor(ATHUtil.INSTANCE.resolveColor(requireContext(), android.R.attr.textColorSecondary)); appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(requireContext()))); toolbar.setOnClickListener(v -> { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(getMainActivity(), toolbarContainer, getString(R.string.transition_toolbar)); @@ -470,6 +472,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements } private void checkIsEmpty() { + emojiText.setText(getEmojiByUnicode(0x1F631)); if (empty != null) { empty.setVisibility(adapter == null || adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE); } @@ -491,8 +494,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements adapter.swapDataSet(files); BreadCrumbLayout.Crumb crumb = getActiveCrumb(); if (crumb != null && recyclerView != null) { - ((LinearLayoutManager) recyclerView.getLayoutManager()) - .scrollToPositionWithOffset(crumb.getScrollPosition(), 0); + ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(crumb.getScrollPosition(), 0); } } diff --git a/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt b/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt index 6ca232b0..6da19079 100644 --- a/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt +++ b/app/src/main/java/code/name/monkey/retromusic/glide/RetroMusicColoredTarget.kt @@ -28,10 +28,10 @@ import com.bumptech.glide.request.animation.GlideAnimation abstract class RetroMusicColoredTarget(view: ImageView) : BitmapPaletteTarget(view) { protected val defaultFooterColor: Int - get() = ATHUtil.resolveColor(getView().context, R.attr.defaultFooterColor) + get() = ATHUtil.resolveColor(getView().context, R.attr.colorSurface) protected val albumArtistFooterColor: Int - get() = ATHUtil.resolveColor(getView().context, R.attr.cardBackgroundColor) + get() = ATHUtil.resolveColor(getView().context, R.attr.colorSurface) abstract fun onColorReady(color: Int) diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistPresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistPresenter.kt index 6b0a0f96..7af0365e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistPresenter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/ArtistPresenter.kt @@ -48,9 +48,7 @@ interface ArtistsPresenter : Presenter { override fun loadArtists() { launch { when (val result = repository.allArtists()) { - is Result.Success -> withContext(Dispatchers.Main) { - view?.artists(result.data) - } + is Result.Success -> withContext(Dispatchers.Main) { view?.artists(result.data) } is Result.Error -> withContext(Dispatchers.Main) { view?.showEmptyView() } } } diff --git a/app/src/main/java/code/name/monkey/retromusic/views/ColorIconsImageView.kt b/app/src/main/java/code/name/monkey/retromusic/views/ColorIconsImageView.kt index 40f3101a..f6cb4862 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/ColorIconsImageView.kt +++ b/app/src/main/java/code/name/monkey/retromusic/views/ColorIconsImageView.kt @@ -48,7 +48,7 @@ class ColorIconsImageView : AppCompatImageView { attributes.recycle() } - private fun setIconBackgroundColor(color: Int) { + fun setIconBackgroundColor(color: Int) { setBackgroundResource(R.drawable.color_circle_gradient) if (ATHUtil.isWindowBackgroundDark(context) && PreferenceUtil.getInstance(context).desaturatedColor()) { val desaturatedColor = RetroColorUtil.desaturateColor(color, 0.4f) diff --git a/app/src/main/java/code/name/monkey/retromusic/views/SettingListItemView.kt b/app/src/main/java/code/name/monkey/retromusic/views/SettingListItemView.kt new file mode 100644 index 00000000..cca4c97e --- /dev/null +++ b/app/src/main/java/code/name/monkey/retromusic/views/SettingListItemView.kt @@ -0,0 +1,56 @@ +/* + * 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. + */ +package code.name.monkey.retromusic.views + +import android.content.Context +import android.graphics.Color +import android.util.AttributeSet +import android.view.View +import android.widget.FrameLayout +import code.name.monkey.retromusic.R +import kotlinx.android.synthetic.main.list_setting_item_view.view.* + +/** + * Created by hemanths on 2019-12-10. + */ +class SettingListItemView : FrameLayout { + 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) + } + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { + init(context, attrs) + } + + private fun init(context: Context, attributeSet: AttributeSet?) { + View.inflate(context, R.layout.list_setting_item_view, this) + val typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.SettingListItemView) + icon as ColorIconsImageView + if (typedArray.hasValue(R.styleable.SettingListItemView_settingListItemIcon)) { + icon.setImageDrawable(typedArray.getDrawable(R.styleable.SettingListItemView_settingListItemIcon)) + } + icon.setIconBackgroundColor(typedArray.getColor(R.styleable.SettingListItemView_settingListItemIconColor, Color.WHITE)) + title.text = typedArray.getText(R.styleable.SettingListItemView_settingListItemTitle) + text.text = typedArray.getText(R.styleable.SettingListItemView_settingListItemText) + typedArray.recycle() + } +} \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/views/StatusBarView.java b/app/src/main/java/code/name/monkey/retromusic/views/StatusBarView.java index 958c5121..8eaf325d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/views/StatusBarView.java +++ b/app/src/main/java/code/name/monkey/retromusic/views/StatusBarView.java @@ -16,7 +16,6 @@ package code.name.monkey.retromusic.views; import android.content.Context; import android.content.res.Resources; -import android.graphics.Canvas; import android.util.AttributeSet; import android.view.View; @@ -27,14 +26,17 @@ public class StatusBarView extends View { public StatusBarView(@NonNull Context context) { super(context); + init(context); } public StatusBarView(@NonNull Context context, @NonNull AttributeSet attrs) { super(context, attrs); + init(context); } public StatusBarView(@NonNull Context context, @NonNull AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); + init(context); } public static int getStatusBarHeight(@NonNull Resources r) { @@ -46,6 +48,10 @@ public class StatusBarView extends View { return result; } + private void init(Context context) { + + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), getStatusBarHeight(getResources())); diff --git a/app/src/main/res/drawable-v21/rect_selector.xml b/app/src/main/res/drawable-v21/rect_selector.xml deleted file mode 100644 index a36f34b0..00000000 --- a/app/src/main/res/drawable-v21/rect_selector.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/rect_selector_dark.xml b/app/src/main/res/drawable-v21/rect_selector_dark.xml deleted file mode 100644 index f76d5d15..00000000 --- a/app/src/main/res/drawable-v21/rect_selector_dark.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/rect_selector_strong_dark.xml b/app/src/main/res/drawable-v21/rect_selector_strong_dark.xml deleted file mode 100644 index fdeae459..00000000 --- a/app/src/main/res/drawable-v21/rect_selector_strong_dark.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/round_selector_mask.xml b/app/src/main/res/drawable-v21/round_selector_mask.xml deleted file mode 100644 index a6f3dfaa..00000000 --- a/app/src/main/res/drawable-v21/round_selector_mask.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/rect_selector.xml b/app/src/main/res/drawable/rect_selector.xml index 75e988c0..1f861848 100644 --- a/app/src/main/res/drawable/rect_selector.xml +++ b/app/src/main/res/drawable/rect_selector.xml @@ -1,9 +1,29 @@ - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rect_selector_dark.xml b/app/src/main/res/drawable/rect_selector_dark.xml deleted file mode 100644 index 68896bf4..00000000 --- a/app/src/main/res/drawable/rect_selector_dark.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/rect_selector_strong_dark.xml b/app/src/main/res/drawable/rect_selector_strong_dark.xml deleted file mode 100644 index faf5f5c8..00000000 --- a/app/src/main/res/drawable/rect_selector_strong_dark.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/retro.png b/app/src/main/res/drawable/retro.png deleted file mode 100644 index ca283b56..00000000 Binary files a/app/src/main/res/drawable/retro.png and /dev/null differ diff --git a/app/src/main/res/layout-land/activity_album.xml b/app/src/main/res/layout-land/activity_album.xml index 758acaf3..9b51c185 100644 --- a/app/src/main/res/layout-land/activity_album.xml +++ b/app/src/main/res/layout-land/activity_album.xml @@ -119,7 +119,8 @@ android:paddingTop="4dp" android:scrollHorizontally="true" android:singleLine="true" - android:textAppearance="@style/TextViewHeadline6" + android:textAppearance="@style/TextViewSubtitle2" + android:textColor="?android:attr/textColorSecondary" tools:ignore="MissingPrefix" tools:text="Album details name" /> diff --git a/app/src/main/res/layout-land/activity_artist_details.xml b/app/src/main/res/layout-land/activity_artist_details.xml index b29b3324..1bb443f9 100644 --- a/app/src/main/res/layout-land/activity_artist_details.xml +++ b/app/src/main/res/layout-land/activity_artist_details.xml @@ -97,6 +97,7 @@ android:layout_height="wrap_content" android:paddingTop="4dp" android:textAppearance="@style/TextViewSubtitle2" + android:textColor="?android:attr/textColorSecondary" tools:ignore="MissingPrefix" tools:text="Title" /> diff --git a/app/src/main/res/layout-xlarge-land/activity_album.xml b/app/src/main/res/layout-xlarge-land/activity_album.xml index 586b32c1..d31547b4 100644 --- a/app/src/main/res/layout-xlarge-land/activity_album.xml +++ b/app/src/main/res/layout-xlarge-land/activity_album.xml @@ -128,6 +128,7 @@ android:layout_height="wrap_content" android:paddingTop="4dp" android:textAppearance="@style/TextViewHeadline6" + android:textColor="?android:attr/textColorSecondary" tools:ignore="MissingPrefix" tools:text="Album details" /> diff --git a/app/src/main/res/layout-xlarge-land/activity_artist_details.xml b/app/src/main/res/layout-xlarge-land/activity_artist_details.xml index d4d8f50c..8607d1ca 100644 --- a/app/src/main/res/layout-xlarge-land/activity_artist_details.xml +++ b/app/src/main/res/layout-xlarge-land/activity_artist_details.xml @@ -106,6 +106,7 @@ android:scrollHorizontally="true" android:singleLine="true" android:textAppearance="@style/TextViewHeadline6" + android:textColor="?android:attr/textColorSecondary" tools:ignore="MissingPrefix" tools:text="Title" /> diff --git a/app/src/main/res/layout-xlarge/activity_album.xml b/app/src/main/res/layout-xlarge/activity_album.xml index 279bd81c..23ecc5ea 100644 --- a/app/src/main/res/layout-xlarge/activity_album.xml +++ b/app/src/main/res/layout-xlarge/activity_album.xml @@ -126,7 +126,7 @@ diff --git a/app/src/main/res/layout-xlarge/item_image.xml b/app/src/main/res/layout-xlarge/item_image.xml index 16034b08..c941ee09 100644 --- a/app/src/main/res/layout-xlarge/item_image.xml +++ b/app/src/main/res/layout-xlarge/item_image.xml @@ -6,29 +6,22 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:layout_margin="8dp" + android:orientation="vertical" + app:cardCornerRadius="6dp" + app:cardElevation="4dp" + app:cardPreventCornerOverlap="true"> - - - - - - + android:scaleType="centerCrop" + tools:srcCompat="@tools:sample/backgrounds/scenic[17]" /> + - diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 75ba4cd0..d707a252 100755 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -10,7 +10,6 @@ android:id="@+id/status_bar" android:layout_width="match_parent" android:layout_height="0dp" - android:background="?attr/colorSurface" tools:ignore="UnusedAttribute" /> + android:paddingEnd="4dp"> @@ -41,7 +41,7 @@ android:gravity="center_vertical|right|end" android:paddingRight="8dp" android:singleLine="true" - android:textColor="?colorOnSecondary" + android:textColor="?android:attr/textColorSecondary" android:textSize="12sp" tools:ignore="RtlHardcoded,RtlSymmetry" tools:text="00:22" /> diff --git a/app/src/main/res/layout/fragment_folder.xml b/app/src/main/res/layout/fragment_folder.xml index 91edc244..3a9c9ba3 100644 --- a/app/src/main/res/layout/fragment_folder.xml +++ b/app/src/main/res/layout/fragment_folder.xml @@ -18,9 +18,9 @@ + android:layout_height="match_parent" + android:background="?attr/colorSurface"> @@ -56,7 +55,6 @@ android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="@dimen/toolbar_height" - android:background="?colorSurface" app:contentInsetStart="0dp" app:contentInsetStartWithNavigation="0dp" app:popupTheme="?toolbarPopupTheme" @@ -77,7 +75,6 @@ android:layout_height="@dimen/tab_height" android:paddingStart="60dp" android:paddingEnd="8dp" - app:cardBackgroundColor="?colorSurface" app:layout_collapseMode="pin" /> @@ -92,15 +89,34 @@ android:scrollbars="none" app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> - + android:gravity="center" + android:orientation="vertical" + android:visibility="gone" + tools:visibility="visible"> + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index bd0307ca..e9a78714 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -17,7 +17,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?attr/colorSurface" + android:background="?colorSurface" android:orientation="vertical"> - + app:settingListItemIcon="@drawable/ic_theme_palette_white_24dp" + app:settingListItemIconColor="@color/md_blue_A400" + app:settingListItemText="@string/general_settings_summary" + app:settingListItemTitle="@string/general_settings_title" /> - - - - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_play_circle_filled_white_24dp" + app:settingListItemIconColor="@color/md_red_A400" + app:settingListItemText="@string/now_playing_summary" + app:settingListItemTitle="@string/now_playing" /> - - - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_volume_up_white_24dp" + app:settingListItemIconColor="@color/md_deep_purple_A400" + app:settingListItemText="@string/audio_settings_summary" + app:settingListItemTitle="@string/pref_header_audio" /> - - - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_hdr_strong_white_24dp" + app:settingListItemIconColor="@color/md_teal_A400" + app:settingListItemText="@string/personalize_settings_summary" + app:settingListItemTitle="@string/personalize" /> - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_image_white_24dp" + app:settingListItemIconColor="@color/md_deep_orange_A400" + app:settingListItemText="@string/image_settings_summary" + app:settingListItemTitle="@string/pref_header_images" /> - - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_notifications_active_white_24dp" + app:settingListItemIconColor="@color/md_yellow_A400" + app:settingListItemText="@string/notification_settings_summary" + app:settingListItemTitle="@string/notification" /> - - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_notifications_active_white_24dp" + app:settingListItemIconColor="@color/md_indigo_A400" + app:settingListItemText="@string/other_settings_summary" + app:settingListItemTitle="@string/others" /> - - - - - - - - - - + app:settingListItemIcon="@drawable/ic_info_outline_white_24dp" + app:settingListItemIconColor="@color/md_light_green_A400" + app:settingListItemText="@string/about_settings_summary" + app:settingListItemTitle="@string/action_about" /> - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_volume.xml b/app/src/main/res/layout/fragment_volume.xml index a92c7e42..0e621cab 100755 --- a/app/src/main/res/layout/fragment_volume.xml +++ b/app/src/main/res/layout/fragment_volume.xml @@ -8,7 +8,6 @@ android:gravity="center_vertical" android:orientation="horizontal" android:paddingStart="8dp" - android:paddingBottom="14dp" android:paddingEnd="8dp" > + tools:text="@tools:sample/full_names" /> + tools:text="@tools:sample/lorem/random" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_image.xml b/app/src/main/res/layout/item_image.xml index 16517c62..f463a98e 100644 --- a/app/src/main/res/layout/item_image.xml +++ b/app/src/main/res/layout/item_image.xml @@ -6,28 +6,23 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:layout_margin="8dp" + android:orientation="vertical" + app:cardCornerRadius="8dp" + app:cardPreventCornerOverlap="true"> - + android:scaleType="centerCrop" + tools:srcCompat="@tools:sample/backgrounds/scenic[16]" /> - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/list_item_view.xml b/app/src/main/res/layout/list_item_view.xml index 7459be7b..454563c6 100644 --- a/app/src/main/res/layout/list_item_view.xml +++ b/app/src/main/res/layout/list_item_view.xml @@ -55,6 +55,7 @@ app:layout_constraintStart_toStartOf="@+id/guideline_front_margin" app:layout_constraintTop_toBottomOf="@android:id/title" app:lineHeightHint="24sp" + android:textColor="?android:attr/textColorSecondary" tools:maxLines="2" tools:text="@tools:sample/lorem/random" /> diff --git a/app/src/main/res/layout/list_item_view_seekbar.xml b/app/src/main/res/layout/list_item_view_seekbar.xml index 49b8c6ec..35130138 100644 --- a/app/src/main/res/layout/list_item_view_seekbar.xml +++ b/app/src/main/res/layout/list_item_view_seekbar.xml @@ -50,6 +50,7 @@ android:id="@android:id/summary" android:layout_width="0dp" android:layout_height="wrap_content" + android:textColor="?android:attr/textColorSecondary" app:layout_constrainedWidth="true" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="@+id/guideline_front_margin" diff --git a/app/src/main/res/layout/list_item_view_switch.xml b/app/src/main/res/layout/list_item_view_switch.xml index 160cdfa8..2b338374 100644 --- a/app/src/main/res/layout/list_item_view_switch.xml +++ b/app/src/main/res/layout/list_item_view_switch.xml @@ -52,6 +52,7 @@ android:layout_height="wrap_content" android:paddingStart="0dp" android:paddingEnd="16dp" + android:textColor="?android:attr/textColorSecondary" app:layout_constrainedWidth="true" app:layout_constraintEnd_toStartOf="@android:id/checkbox" app:layout_constraintStart_toStartOf="@+id/guideline_front_margin" diff --git a/app/src/main/res/layout/list_setting_item_view.xml b/app/src/main/res/layout/list_setting_item_view.xml new file mode 100644 index 00000000..142e5c88 --- /dev/null +++ b/app/src/main/res/layout/list_setting_item_view.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml index 489db133..bb871f65 100644 --- a/app/src/main/res/values-land/dimens.xml +++ b/app/src/main/res/values-land/dimens.xml @@ -1,4 +1,4 @@ - 52dp + 8dp \ No newline at end of file diff --git a/app/src/main/res/values-v27/styles_parents.xml b/app/src/main/res/values-v27/styles_parents.xml index a73fb3a9..0d326447 100644 --- a/app/src/main/res/values-v27/styles_parents.xml +++ b/app/src/main/res/values-v27/styles_parents.xml @@ -1,5 +1,4 @@ - - + @color/darkColorSurface