Fix visual bugs

main
Hemanth S 2020-05-11 15:21:22 +05:30
parent 4bcf9b202e
commit 336f67fd48
15 changed files with 82 additions and 99 deletions

View File

@ -24,7 +24,7 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 425
versionCode 426
versionName '3.5.210'
multiDexEnabled true

View File

@ -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"
},

View File

@ -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)

View File

@ -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)

View File

@ -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 {

View File

@ -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);
});
}
}

View File

@ -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)

View File

@ -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<MaterialCardView>
private lateinit var behavior: RetroBottomSheetBehavior<FrameLayout>
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<CategoryInfo> = PreferenceUtil.getInstance(this).libraryCategoryInfos
val currentTabs: List<CategoryInfo> =
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)
}*/
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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()

View File

@ -48,7 +48,7 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/playerQueueSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:gravity="bottom"
app:behavior_hideable="false"
app:cardCornerRadius="0dp"
@ -58,7 +58,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<include
@ -69,7 +69,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical">
<com.google.android.material.textview.MaterialTextView

View File

@ -92,10 +92,8 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp"
android:textAppearance="@style/TextViewBody1"
android:textColor="?android:attr/textColorSecondary"
app:layout_constrainedWidth="true"
@ -111,10 +109,8 @@
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:paddingHorizontal="16dp"
android:paddingBottom="12dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/playPauseButton"

View File

@ -55,6 +55,7 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation_fall_down"
android:overScrollMode="never"
android:scrollbars="none"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />

View File

@ -19,17 +19,14 @@
android:focusable="true"
android:visibility="gone" />
<com.google.android.material.card.MaterialCardView
<FrameLayout
android:id="@+id/slidingPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:background="?attr/colorSurface"
app:behavior_hideable="false"
app:behavior_peekHeight="0dp"
app:cardCornerRadius="0dp"
app:cardElevation="12dp"
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior"
app:shapeAppearance="@style/ClassicThemeOverLay">
app:layout_behavior="code.name.monkey.retromusic.RetroBottomSheetBehavior">
<FrameLayout
android:id="@+id/playerFragmentContainer"
@ -43,7 +40,7 @@
android:layout_height="48dp"
tools:layout="@layout/fragment_mini_player" />
</com.google.android.material.card.MaterialCardView>
</FrameLayout>
<code.name.monkey.retromusic.views.BottomNavigationBarTinted
android:id="@+id/bottomNavigationView"