From 336f67fd481c789891a0bfe7ca34913dff7e5b46 Mon Sep 17 00:00:00 2001 From: Hemanth S Date: Mon, 11 May 2020 15:21:22 +0530 Subject: [PATCH] Fix visual bugs --- app/build.gradle | 2 +- app/src/main/assets/contributors.json | 2 +- .../activities/AlbumDetailsActivity.kt | 2 +- .../activities/ArtistDetailActivity.kt | 2 +- .../activities/GenreDetailsActivity.kt | 3 +- .../retromusic/activities/MainActivity.java | 15 +--- .../activities/PlaylistDetailActivity.kt | 2 +- .../base/AbsSlidingMusicPanelActivity.kt | 83 +++++++++---------- .../adapter/album/HorizontalAlbumAdapter.kt | 4 +- .../fragments/base/AbsMainActivityFragment.kt | 2 - .../player/classic/ClassicPlayerFragment.kt | 33 +++++--- .../res/layout/fragment_clasic_player.xml | 7 +- .../res/layout/fragment_classic_controls.xml | 12 +-- app/src/main/res/layout/fragment_folder.xml | 1 + .../res/layout/sliding_music_panel_layout.xml | 11 +-- 15 files changed, 82 insertions(+), 99 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6c73663a..beb358ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ android { vectorDrawables.useSupportLibrary = true applicationId "code.name.monkey.retromusic" - versionCode 425 + versionCode 426 versionName '3.5.210' multiDexEnabled true diff --git a/app/src/main/assets/contributors.json b/app/src/main/assets/contributors.json index 639b7553..1a743f4d 100644 --- a/app/src/main/assets/contributors.json +++ b/app/src/main/assets/contributors.json @@ -7,7 +7,7 @@ }, { "name": "Lennart Glamann", - "summary": "Designer", + "summary": "Play Store banner and Images", "link": "https://t.me/FlixbusLennart", "profile_image": "https://i.imgur.com/Q5Nsx1R.jpg" }, 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 fbb0fe18..2a574355 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 @@ -94,11 +94,11 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C override fun onCreate(savedInstanceState: Bundle?) { setDrawUnderStatusBar() super.onCreate(savedInstanceState) - toggleBottomNavigationView(true) setStatusbarColorAuto() setNavigationbarColorAuto() setTaskDescriptionColorAuto() setLightNavigationBar(true) + setBottomBarVisibility(View.GONE) window.sharedElementsUseOverlay = true App.musicComponent.inject(this) 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 08c3f68f..2823c590 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 @@ -88,11 +88,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView, override fun onCreate(savedInstanceState: Bundle?) { setDrawUnderStatusBar() super.onCreate(savedInstanceState) - toggleBottomNavigationView(true) setStatusbarColorAuto() setNavigationbarColorAuto() setTaskDescriptionColorAuto() setLightNavigationBar(true) + setBottomBarVisibility(View.GONE) window.sharedElementsUseOverlay = true App.musicComponent.inject(this) diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt index 3f57ac58..97ecbcc9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/GenreDetailsActivity.kt @@ -60,8 +60,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder, GenreDet setNavigationbarColorAuto() setTaskDescriptionColorAuto() setLightNavigationBar(true) - toggleBottomNavigationView(true) - + setBottomBarVisibility(View.GONE) if (intent.extras != null) { genre = intent?.extras?.getParcelable(EXTRA_GENRE_ID)!! } else { diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java index 1ef34973..a28a9a52 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/activities/MainActivity.java @@ -23,11 +23,8 @@ import android.content.IntentSender; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; -import android.content.res.ColorStateList; -import android.graphics.Color; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.provider.MediaStore; import android.util.Log; import android.view.Menu; @@ -39,14 +36,11 @@ import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; -import androidx.transition.TransitionManager; import com.afollestad.materialcab.MaterialCab; import com.afollestad.materialcab.MaterialCab.Callback; import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.card.MaterialCardView; import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.textview.MaterialTextView; import com.google.android.play.core.appupdate.AppUpdateInfo; import com.google.android.play.core.appupdate.AppUpdateManager; import com.google.android.play.core.appupdate.AppUpdateManagerFactory; @@ -93,7 +87,6 @@ import code.name.monkey.retromusic.service.MusicService; import code.name.monkey.retromusic.util.AppRater; import code.name.monkey.retromusic.util.NavigationUtil; import code.name.monkey.retromusic.util.PreferenceUtil; -import code.name.monkey.retromusic.util.PremiumShow; import code.name.monkey.retromusic.util.RetroColorUtil; import code.name.monkey.retromusic.util.RetroUtil; @@ -184,8 +177,10 @@ public class MainActivity extends AbsSlidingMusicPanelActivity //PremiumShow.launch(this); setupToolbar(); checkUpdate(); + updateTabs(); } + private void checkUpdate() { appUpdateManager = AppUpdateManagerFactory.create(this); appUpdateManager.registerListener(listener); @@ -832,11 +827,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity private void setupToolbar() { setTitle(null); mToolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface)); + mAppBarLayout.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface)); setSupportActionBar(mToolbar); - mToolbar.setOnClickListener(v -> { - ActivityOptions options = ActivityOptions - .makeSceneTransitionAnimation(this, mToolbar, getString(R.string.transition_toolbar)); - NavigationUtil.goToSearch(this, options); - }); } } diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt index 2026237a..6adffeae 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/PlaylistDetailActivity.kt @@ -49,7 +49,7 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli setNavigationbarColorAuto() setTaskDescriptionColorAuto() setLightNavigationBar(true) - toggleBottomNavigationView(true) + setBottomBarVisibility(View.GONE) App.musicComponent.inject(this) playlistSongsPresenter.attachView(this) diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt index 70709792..63afa385 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt @@ -1,11 +1,13 @@ package code.name.monkey.retromusic.activities.base import android.animation.ValueAnimator +import android.content.Context import android.graphics.Color import android.os.Bundle import android.view.View import android.view.ViewGroup import android.view.ViewTreeObserver +import android.widget.FrameLayout import androidx.annotation.LayoutRes import androidx.fragment.app.Fragment import code.name.monkey.appthemehelper.util.ATHUtil @@ -40,7 +42,6 @@ import code.name.monkey.retromusic.util.DensityUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.views.BottomNavigationBarTinted import com.google.android.material.bottomsheet.BottomSheetBehavior -import com.google.android.material.card.MaterialCardView import com.google.android.material.shape.MaterialShapeDrawable import com.google.android.material.shape.ShapeAppearanceModel import kotlinx.android.synthetic.main.sliding_music_panel_layout.* @@ -51,7 +52,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), val TAG: String = AbsSlidingMusicPanelActivity::class.java.simpleName } - private lateinit var bottomSheetBehavior: RetroBottomSheetBehavior + private lateinit var behavior: RetroBottomSheetBehavior private var miniPlayerFragment: MiniPlayerFragment? = null private var playerFragment: AbsPlayerFragment? = null private var cps: NowPlayingScreen? = null @@ -63,7 +64,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), protected abstract fun createContentView(): View private lateinit var shapeDrawable: MaterialShapeDrawable private val panelState: Int - get() = bottomSheetBehavior.state + get() = behavior.state private val bottomSheetCallbackList = object : BottomSheetBehavior.BottomSheetCallback() { @@ -90,18 +91,17 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), } } - fun getBottomSheetBehavior() = bottomSheetBehavior + fun getBottomSheetBehavior() = behavior override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(createContentView()) - chooseFragmentForTheme() setupSlidingUpPanel() - updateTabs() - bottomSheetBehavior = BottomSheetBehavior.from(slidingPanel) as RetroBottomSheetBehavior + + behavior = BottomSheetBehavior.from(slidingPanel) as RetroBottomSheetBehavior val themeColor = ATHUtil.resolveColor(this, android.R.attr.windowBackground, Color.GRAY) dimBackground.setBackgroundColor(ColorUtil.withAlpha(themeColor, 0.5f)) @@ -120,16 +120,16 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), if (cps != PreferenceUtil.getInstance(this).nowPlayingScreen) { postRecreate() } - bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallbackList) + behavior.addBottomSheetCallback(bottomSheetCallbackList) - if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) { + if (behavior.state == BottomSheetBehavior.STATE_EXPANDED) { setMiniPlayerAlphaProgress(1f) } } override fun onDestroy() { super.onDestroy() - bottomSheetBehavior.removeBottomSheetCallback(bottomSheetCallbackList) + behavior.removeBottomSheetCallback(bottomSheetCallbackList) if (navigationBarColorAnimator != null) navigationBarColorAnimator?.cancel() // just in case } @@ -143,11 +143,11 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), } private fun collapsePanel() { - bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED + behavior.state = BottomSheetBehavior.STATE_COLLAPSED } fun expandPanel() { - bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED + behavior.state = BottomSheetBehavior.STATE_EXPANDED setMiniPlayerAlphaProgress(1f) } @@ -204,40 +204,40 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), }) } - fun toggleBottomNavigationView(toggle: Boolean) { - bottomNavigationView.visibility = if (toggle) View.GONE else View.VISIBLE - } - fun getBottomNavigationView(): BottomNavigationBarTinted { return bottomNavigationView } + fun setBottomBarVisibility(visible: Int) { + bottomNavigationView.visibility = visible + hideBottomBar(MusicPlayerRemote.playingQueue.isEmpty()) + } + private fun hideBottomBar(hide: Boolean) { val heightOfBar = resources.getDimensionPixelSize(R.dimen.mini_player_height) val heightOfBarWithTabs = resources.getDimensionPixelSize(R.dimen.mini_player_height_expanded) if (hide) { - bottomSheetBehavior.isHideable = true - bottomSheetBehavior.peekHeight = 0 - collapsePanel() + behavior.isHideable = true + behavior.peekHeight = 0 bottomNavigationView.elevation = DensityUtil.dip2px(this, 10f).toFloat() + playerFragmentContainer.removeAllViews() } else { if (MusicPlayerRemote.playingQueue.isNotEmpty()) { slidingPanel.elevation = DensityUtil.dip2px(this, 10f).toFloat() bottomNavigationView.elevation = DensityUtil.dip2px(this, 10f).toFloat() - bottomSheetBehavior.isHideable = false - bottomSheetBehavior.peekHeight = - if (bottomNavigationView.visibility == View.VISIBLE) heightOfBarWithTabs else heightOfBar + behavior.isHideable = false + behavior.peekHeight = + if (bottomNavigationView.visibility == View.VISIBLE) { + heightOfBarWithTabs + } else { + heightOfBar + } } } } - fun setBottomBarVisibility(gone: Int) { - bottomNavigationView.visibility = gone - hideBottomBar(false) - } - private fun chooseFragmentForTheme() { cps = PreferenceUtil.getInstance(this).nowPlayingScreen @@ -260,7 +260,8 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), CLASSIC -> ClassicPlayerFragment() else -> PlayerFragment() } // must implement AbsPlayerFragment - supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment) + supportFragmentManager.beginTransaction() + .replace(R.id.playerFragmentContainer, fragment) .commit() supportFragmentManager.executePendingTransactions() @@ -294,7 +295,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), } open fun handleBackPress(): Boolean { - if (bottomSheetBehavior.peekHeight != 0 && playerFragment!!.onBackPressed()) return true + if (behavior.peekHeight != 0 && playerFragment!!.onBackPressed()) return true if (panelState == BottomSheetBehavior.STATE_EXPANDED) { collapsePanel() return true @@ -371,30 +372,22 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), } } - private fun updateTabs() { + fun updateTabs() { bottomNavigationView.menu.clear() - val currentTabs: List = PreferenceUtil.getInstance(this).libraryCategoryInfos + val currentTabs: List = + PreferenceUtil.getInstance(this).libraryCategoryInfos for (tab in currentTabs) { if (tab.visible) { val menu = tab.category bottomNavigationView.menu.add(0, menu.id, 0, menu.stringRes).setIcon(menu.icon) } } - if (currentTabs.size <= 1) { - toggleBottomNavigationView(true) + if (bottomNavigationView.menu.size() == 1) { + bottomNavigationView.hide() } } +} + +fun Context.dim(dimen: Int) { - /*override fun dispatchTouchEvent(ev: MotionEvent?): Boolean { - if (ev?.action == MotionEvent.ACTION_DOWN) { - if (panelState == BottomSheetBehavior.STATE_EXPANDED) { - val outRect = Rect() - slidingPanel.getGlobalVisibleRect(outRect) - if (!outRect.contains(ev.rawX.toInt(), ev.rawY.toInt())) { - bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED - } - } - } - return super.dispatchTouchEvent(ev) - }*/ } \ No newline at end of file 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 93bdfb68..c19221de 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 @@ -28,7 +28,7 @@ class HorizontalAlbumAdapter( return ViewHolder(view) } - fun setColors(color: Int, holder: ViewHolder) { + override fun setColors(color: MediaNotificationProcessor, holder: ViewHolder) { holder.title?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorPrimary)) holder.text?.setTextColor(ATHUtil.resolveColor(activity, android.R.attr.textColorSecondary)) } @@ -42,7 +42,7 @@ class HorizontalAlbumAdapter( .into(object : RetroMusicColoredTarget(holder.image!!) { override fun onLoadCleared(placeholder: Drawable?) { super.onLoadCleared(placeholder) - setColors(albumArtistFooterColor, holder) + //setColors(albumArtistFooterColor, holder) } override fun onColorReady(colors: MediaNotificationProcessor) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsMainActivityFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsMainActivityFragment.kt index 09aae32c..86be7db0 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsMainActivityFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/base/AbsMainActivityFragment.kt @@ -16,12 +16,10 @@ abstract class AbsMainActivityFragment : AbsMusicServiceFragment() { override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) setHasOptionsMenu(true) - mainActivity.setNavigationbarColorAuto() mainActivity.setLightNavigationBar(true) mainActivity.setTaskDescriptionColorAuto() mainActivity.hideStatusBar() - mainActivity.setBottomBarVisibility(View.VISIBLE) } private fun setStatusBarColor(view: View, color: Int) { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt index 9a2b1751..456ca61c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerFragment.kt @@ -11,10 +11,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar import androidx.core.view.ViewCompat import androidx.recyclerview.widget.LinearLayoutManager -import code.name.monkey.appthemehelper.util.ATHUtil -import code.name.monkey.appthemehelper.util.ColorUtil -import code.name.monkey.appthemehelper.util.TintHelper -import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper +import code.name.monkey.appthemehelper.util.* import code.name.monkey.retromusic.R import code.name.monkey.retromusic.RetroBottomSheetBehavior import code.name.monkey.retromusic.activities.base.AbsSlidingMusicPanelActivity @@ -118,6 +115,10 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener, 0 ).build() ) + shapeDrawable.fillColor = + ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface)) + playerQueueSheet.background = shapeDrawable + ToolbarContentTintHelper.colorizeToolbar( playerToolbar, Color.WHITE, @@ -253,23 +254,29 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener, lastColor = color.backgroundColor lastPlaybackControlsColor = color.primaryTextColor lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f) - shapeDrawable.fillColor = ColorStateList.valueOf(color.backgroundColor) - playerQueueSheet.background = shapeDrawable + title.setTextColor(color.primaryTextColor) - text.setTextColor(color.secondaryTextColor) - songInfo.setTextColor(color.secondaryTextColor) - songCurrentProgress.setTextColor(lastPlaybackControlsColor) songTotalTime.setTextColor(lastPlaybackControlsColor) ViewUtil.setProgressDrawable(progressSlider, color.primaryTextColor, true) - volumeFragment?.setTintableColor(color.primaryTextColor) - - player_queue_sub_header.setTextColor(color.secondaryTextColor) + volumeFragment?.setTintableColor( + ATHUtil.resolveColor( + requireContext(), + android.R.attr.textColorPrimary + ) + ) TintHelper.setTintAuto(playPauseButton, color.primaryTextColor, true) - TintHelper.setTintAuto(playPauseButton, color.backgroundColor, false) + TintHelper.setTintAuto( + playPauseButton, + MaterialValueHelper.getPrimaryTextColor( + requireContext(), + ColorUtil.isColorLight(color.primaryTextColor) + ), + false + ) updateRepeatState() updateShuffleState() updatePrevNextColor() diff --git a/app/src/main/res/layout/fragment_clasic_player.xml b/app/src/main/res/layout/fragment_clasic_player.xml index 1c24548c..ac26cf58 100644 --- a/app/src/main/res/layout/fragment_clasic_player.xml +++ b/app/src/main/res/layout/fragment_clasic_player.xml @@ -48,7 +48,7 @@ diff --git a/app/src/main/res/layout/sliding_music_panel_layout.xml b/app/src/main/res/layout/sliding_music_panel_layout.xml index e1b9dfd2..8dad22c2 100644 --- a/app/src/main/res/layout/sliding_music_panel_layout.xml +++ b/app/src/main/res/layout/sliding_music_panel_layout.xml @@ -19,17 +19,14 @@ android:focusable="true" android:visibility="gone" /> - + app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior"> - +