Made Navigation Bar transparent and added some MD3 themes

This commit is contained in:
Prathamesh More 2021-09-12 01:28:33 +05:30
parent 6cc0985ab6
commit 15a86f0f5b
58 changed files with 542 additions and 608 deletions

View file

@ -1,107 +0,0 @@
/*
* 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.activities;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
/** Created by hemanths on 2019-09-27. */
public class LicenseActivity extends AbsBaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_license);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setLightNavigationBar(true);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ToolbarContentTintHelper.colorBackButton(toolbar);
toolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
WebView webView = findViewById(R.id.license);
try {
StringBuilder buf = new StringBuilder();
InputStream json = getAssets().open("oldindex.html");
BufferedReader in = new BufferedReader(new InputStreamReader(json, StandardCharsets.UTF_8));
String str;
while ((str = in.readLine()) != null) {
buf.append(str);
}
in.close();
// Inject color values for WebView body background and links
final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this);
final String backgroundColor =
colorToCSS(
ATHUtil.INSTANCE.resolveColor(
this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
final String changeLog =
buf.toString()
.replace(
"{style-placeholder}",
String.format(
"body { background-color: %s; color: %s; }", backgroundColor, contentColor))
.replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this)))
.replace(
"{link-color-active}",
colorToCSS(
ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));
webView.loadData(changeLog, "text/html", "UTF-8");
} catch (Throwable e) {
webView.loadData(
"<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
}
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
private String colorToCSS(int color) {
return String.format(
"rgb(%d, %d, %d)",
Color.red(color),
Color.green(color),
Color.blue(color)); // on API 29, WebView doesn't load with hex colors
}
}

View file

@ -0,0 +1,99 @@
/*
* 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.activities
import android.graphics.Color
import android.os.Bundle
import android.view.MenuItem
import android.webkit.WebView
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
import code.name.monkey.appthemehelper.util.ATHUtil.isWindowBackgroundDark
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
import code.name.monkey.appthemehelper.util.ColorUtil.lightenColor
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import java.io.BufferedReader
import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
/** Created by hemanths on 2019-09-27. */
class LicenseActivity : AbsBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_license)
val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)
ToolbarContentTintHelper.colorBackButton(toolbar)
toolbar.setBackgroundColor(resolveColor(this, R.attr.colorSurface))
val webView = findViewById<WebView>(R.id.license)
try {
val buf = StringBuilder()
val json = assets.open("oldindex.html")
val br = BufferedReader(InputStreamReader(json, StandardCharsets.UTF_8))
var str: String?
while (br.readLine().also { str = it } != null) {
buf.append(str)
}
br.close()
// Inject color values for WebView body background and links
val isDark = isWindowBackgroundDark(this)
val backgroundColor = colorToCSS(
resolveColor(
this,
R.attr.colorSurface,
Color.parseColor(if (isDark) "#424242" else "#ffffff")
)
)
val contentColor = colorToCSS(Color.parseColor(if (isDark) "#ffffff" else "#000000"))
val changeLog = buf.toString()
.replace(
"{style-placeholder}", String.format(
"body { background-color: %s; color: %s; }", backgroundColor, contentColor
)
)
.replace("{link-color}", colorToCSS(accentColor(this)))
.replace(
"{link-color-active}",
colorToCSS(
lightenColor(accentColor(this))
)
)
webView.loadData(changeLog, "text/html", "UTF-8")
} catch (e: Throwable) {
webView.loadData(
"<h1>Unable to load</h1><p>" + e.localizedMessage + "</p>", "text/html", "UTF-8"
)
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
onBackPressed()
return true
}
return super.onOptionsItemSelected(item)
}
private fun colorToCSS(color: Int): String {
return String.format(
"rgb(%d, %d, %d)",
Color.red(color),
Color.green(color),
Color.blue(color)
) // on API 29, WebView doesn't load with hex colors
}
}

View file

@ -48,9 +48,7 @@ class LockScreenActivity : AbsMusicServiceActivity() {
setContentView(binding.root)
hideStatusBar()
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
val config = SlidrConfig.Builder().listener(object : SlidrListener {
override fun onSlideStateChanged(state: Int) {

View file

@ -94,7 +94,6 @@ class LyricsActivity : AbsMusicServiceActivity() {
ViewCompat.setTransitionName(binding.container, "lyrics")
setStatusbarColorAuto()
setTaskDescriptionColorAuto()
setNavigationbarColorAuto()
setupWakelock()

View file

@ -37,6 +37,7 @@ import code.name.monkey.retromusic.repository.PlaylistSongsLoader
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.AppRater
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import org.koin.android.ext.android.get
@ -55,8 +56,6 @@ class MainActivity : AbsCastActivity(), OnSharedPreferenceChangeListener {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
setTaskDescriptionColorAuto()
hideStatusBar()
updateTabs()

View file

@ -41,8 +41,6 @@ class PermissionActivity : AbsMusicServiceActivity() {
binding = ActivityPermissionBinding.inflate(layoutInflater)
setContentView(binding.root)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
setTaskDescriptionColorAuto()
setupTitle()

View file

@ -19,6 +19,7 @@ import android.os.Bundle
import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.retromusic.R
@ -26,7 +27,6 @@ import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
import code.name.monkey.retromusic.databinding.ActivityPlayingQueueBinding
import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.surfaceColor
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.ThemedFastScroller
@ -59,10 +59,8 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
super.onCreate(savedInstanceState)
binding = ActivityPlayingQueueBinding.inflate(layoutInflater)
setContentView(binding.root)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightStatusbarAuto(ATHUtil.resolveColor(this, R.attr.colorSurface))
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setupToolbar()
setUpRecyclerView()
@ -191,7 +189,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
private fun setupToolbar() {
binding.toolbar.subtitle = getUpNextAndQueueTime()
binding.toolbar.setBackgroundColor(surfaceColor())
//binding.toolbar.setBackgroundColor(surfaceColor())
setSupportActionBar(binding.toolbar)
binding.clearQueue.backgroundTintList = ColorStateList.valueOf(accentColor())
ColorStateList.valueOf(

View file

@ -47,8 +47,6 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
setContentView(binding.root)
setStatusbarColor(Color.TRANSPARENT)
setLightStatusbar(false)
setNavigationbarColor(Color.BLACK)
setLightNavigationBar(false)
binding.toolbar.navigationIcon?.setTint(Color.WHITE)
binding.toolbar.setNavigationOnClickListener { onBackPressed() }

View file

@ -19,6 +19,7 @@ import android.view.MenuItem
import androidx.navigation.NavController
import androidx.navigation.NavDestination
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
@ -36,9 +37,7 @@ class SettingsActivity : AbsBaseActivity(), ColorCallback {
super.onCreate(savedInstanceState)
binding = ActivitySettingsBinding.inflate(layoutInflater)
setContentView(binding.root)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setLightNavigationBar(true)
setLightStatusbarAuto(ATHUtil.resolveColor(this, R.attr.colorSurface))
setupToolbar()
}

View file

@ -61,7 +61,6 @@ class ShareInstagramStory : AbsBaseActivity() {
binding = ActivityShareInstagramBinding.inflate(layoutInflater)
setContentView(binding.root)
setStatusbarColor(Color.TRANSPARENT)
setNavigationbarColor(Color.BLACK)
binding.toolbar.setBackgroundColor(Color.TRANSPARENT)
setSupportActionBar(binding.toolbar)

View file

@ -78,9 +78,7 @@ class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingH
setContentView(R.layout.activity_donation)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
setupToolbar()

View file

@ -61,9 +61,7 @@ class UserInfoActivity : AbsBaseActivity() {
binding = ActivityUserInfoBinding.inflate(layoutInflater)
setContentView(binding.root)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
setLightNavigationBar(true)
applyToolbar(binding.toolbar)
binding.nameContainer.accentColor()

View file

@ -1,128 +0,0 @@
package code.name.monkey.retromusic.activities;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.widget.NestedScrollView;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
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.MaterialValueHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.databinding.ActivityWhatsNewBinding;
import code.name.monkey.retromusic.extensions.ColorExtKt;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil;
public class WhatsNewActivity extends AbsBaseActivity {
private static String colorToCSS(int color) {
return String.format(
Locale.getDefault(),
"rgba(%d, %d, %d, %d)",
Color.red(color),
Color.green(color),
Color.blue(color),
Color.alpha(color)); // on API 29, WebView doesn't load with hex colors
}
private static void setChangelogRead(@NonNull Context context) {
try {
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
int currentVersion = pInfo.versionCode;
PreferenceUtil.INSTANCE.setLastVersion(currentVersion);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
ActivityWhatsNewBinding binding = ActivityWhatsNewBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
binding.toolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface));
binding.toolbar.setNavigationOnClickListener(v -> onBackPressed());
ToolbarContentTintHelper.colorBackButton(binding.toolbar);
try {
StringBuilder buf = new StringBuilder();
InputStream json = getAssets().open("retro-changelog.html");
BufferedReader in = new BufferedReader(new InputStreamReader(json, StandardCharsets.UTF_8));
String str;
while ((str = in.readLine()) != null) {
buf.append(str);
}
in.close();
// Inject color values for WebView body background and links
final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this);
final int accentColor = ThemeStore.Companion.accentColor(this);
final String backgroundColor =
colorToCSS(
ATHUtil.INSTANCE.resolveColor(
this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
final String textColor = colorToCSS(Color.parseColor(isDark ? "#60FFFFFF" : "#80000000"));
final String accentColorString = colorToCSS(ThemeStore.Companion.accentColor(this));
final String cardBackgroundColor = colorToCSS(Color.parseColor(isDark ? "#353535" : "#ffffff"));
final String accentTextColor =
colorToCSS(
MaterialValueHelper.getPrimaryTextColor(
this, ColorUtil.INSTANCE.isColorLight(accentColor)));
final String changeLog =
buf.toString()
.replace(
"{style-placeholder}",
String.format(
"body { background-color: %s; color: %s; } li {color: %s;} h3 {color: %s;} .tag {color: %s;} div{background-color: %s;}",
backgroundColor,
contentColor,
textColor,
accentColorString,
accentColorString,
cardBackgroundColor))
.replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this)))
.replace(
"{link-color-active}",
colorToCSS(
ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));
binding.webView.loadData(changeLog, "text/html", "UTF-8");
} catch (Throwable e) {
binding.webView.loadData(
"<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
}
setChangelogRead(this);
binding.tgFab.setOnClickListener(v -> RetroUtil.openUrl(this, Constants.TELEGRAM_CHANGE_LOG));
ColorExtKt.accentColor(binding.tgFab);
binding.tgFab.shrink();
binding.container.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
int dy = scrollY - oldScrollY;
if (dy > 0) {
binding.tgFab.shrink();
} else if (dy < 0) {
binding.tgFab.extend();
}
});
}
}

View file

@ -0,0 +1,132 @@
package code.name.monkey.retromusic.activities
import android.content.Context
import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Bundle
import androidx.core.widget.NestedScrollView
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
import code.name.monkey.appthemehelper.util.ATHUtil.isWindowBackgroundDark
import code.name.monkey.appthemehelper.util.ATHUtil.resolveColor
import code.name.monkey.appthemehelper.util.ColorUtil.isColorLight
import code.name.monkey.appthemehelper.util.ColorUtil.lightenColor
import code.name.monkey.appthemehelper.util.MaterialValueHelper.getPrimaryTextColor
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.Constants
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.databinding.ActivityWhatsNewBinding
import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.util.PreferenceUtil.lastVersion
import code.name.monkey.retromusic.util.RetroUtil
import java.io.BufferedReader
import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
import java.util.*
class WhatsNewActivity : AbsBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityWhatsNewBinding.inflate(layoutInflater)
setContentView(binding.root)
setLightStatusbarAuto(resolveColor(this, R.attr.colorSurface))
setTaskDescriptionColorAuto()
binding.toolbar.setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(binding.toolbar)
try {
val buf = StringBuilder()
val json = assets.open("retro-changelog.html")
val br = BufferedReader(InputStreamReader(json, StandardCharsets.UTF_8))
var str: String?
while (br.readLine().also { str = it } != null) {
buf.append(str)
}
br.close()
// Inject color values for WebView body background and links
val isDark = isWindowBackgroundDark(this)
val accentColor = accentColor(this)
val backgroundColor = colorToCSS(
resolveColor(
this,
R.attr.colorSurface,
Color.parseColor(if (isDark) "#424242" else "#ffffff")
)
)
val contentColor = colorToCSS(Color.parseColor(if (isDark) "#ffffff" else "#000000"))
val textColor = colorToCSS(Color.parseColor(if (isDark) "#60FFFFFF" else "#80000000"))
val accentColorString = colorToCSS(accentColor(this))
val cardBackgroundColor =
colorToCSS(Color.parseColor(if (isDark) "#353535" else "#ffffff"))
val accentTextColor = colorToCSS(
getPrimaryTextColor(
this, isColorLight(accentColor)
)
)
val changeLog = buf.toString()
.replace(
"{style-placeholder}", String.format(
"body { background-color: %s; color: %s; } li {color: %s;} h3 {color: %s;} .tag {color: %s;} div{background-color: %s;}",
backgroundColor,
contentColor,
textColor,
accentColorString,
accentColorString,
cardBackgroundColor
)
)
.replace("{link-color}", colorToCSS(accentColor(this)))
.replace(
"{link-color-active}",
colorToCSS(
lightenColor(accentColor(this))
)
)
binding.webView.loadData(changeLog, "text/html", "UTF-8")
} catch (e: Throwable) {
binding.webView.loadData(
"<h1>Unable to load</h1><p>" + e.localizedMessage + "</p>", "text/html", "UTF-8"
)
}
setChangelogRead(this)
binding.tgFab.setOnClickListener {
RetroUtil.openUrl(
this,
Constants.TELEGRAM_CHANGE_LOG
)
}
binding.tgFab.accentColor()
binding.tgFab.shrink()
binding.container.setOnScrollChangeListener { _: NestedScrollView?, _: Int, scrollY: Int, _: Int, oldScrollY: Int ->
val dy = scrollY - oldScrollY
if (dy > 0) {
binding.tgFab.shrink()
} else if (dy < 0) {
binding.tgFab.extend()
}
}
}
companion object {
private fun colorToCSS(color: Int): String {
return String.format(
Locale.getDefault(),
"rgba(%d, %d, %d, %d)",
Color.red(color),
Color.green(color),
Color.blue(color),
Color.alpha(color)
) // on API 29, WebView doesn't load with hex colors
}
private fun setChangelogRead(context: Context) {
try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
val currentVersion = pInfo.versionCode
lastVersion = currentVersion
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
}
}
}

View file

@ -22,9 +22,10 @@ import android.view.ViewTreeObserver
import android.widget.FrameLayout
import androidx.core.view.ViewCompat
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
import androidx.fragment.app.Fragment
import androidx.fragment.app.commit
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.RetroBottomSheetBehavior
@ -56,7 +57,8 @@ import code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
import code.name.monkey.retromusic.util.RetroUtil
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.bottomsheet.BottomSheetBehavior.*
import org.koin.androidx.viewmodel.ext.android.viewModel
@ -71,18 +73,14 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
private var playerFragment: AbsPlayerFragment? = null
private var miniPlayerFragment: MiniPlayerFragment? = null
private var nowPlayingScreen: NowPlayingScreen? = null
private var navigationBarColor: Int = 0
private var taskColor: Int = 0
private var lightStatusBar: Boolean = false
private var lightNavigationBar: Boolean = false
private var paletteColor: Int = Color.WHITE
protected abstract fun createContentView(): SlidingMusicPanelLayoutBinding
private val panelState: Int
get() = bottomSheetBehavior.state
private lateinit var binding: SlidingMusicPanelLayoutBinding
private val bottomSheetCallbackList = object : BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) {
setMiniPlayerAlphaProgress(slideOffset)
binding.dimBackground.show()
@ -123,7 +121,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
chooseFragmentForTheme()
setupSlidingUpPanel()
setupBottomSheet()
updateColor()
val themeColor = resolveColor(android.R.attr.windowBackground, Color.GRAY)
binding.dimBackground.setBackgroundColor(ColorUtil.withAlpha(themeColor, 0.5f))
@ -131,12 +128,18 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
println("dimBackground")
collapsePanel()
}
binding.bottomNavigationView.apply {
val navbarHeight = RetroUtil.getNavigationBarHeight()
updatePadding(bottom = navbarHeight)
binding.bottomNavigationView.updateLayoutParams {
height = dip(R.dimen.mini_player_height) + navbarHeight
}
}
}
private fun setupBottomSheet() {
bottomSheetBehavior = from(binding.slidingPanel) as RetroBottomSheetBehavior
bottomSheetBehavior.addBottomSheetCallback(bottomSheetCallbackList)
bottomSheetBehavior.maxWidth = resources.displayMetrics.widthPixels
}
override fun onResume() {
@ -179,18 +182,16 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
miniPlayerFragment?.view?.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
binding.bottomNavigationView.translationY = progress * 500
binding.bottomNavigationView.alpha = alpha
binding.playerFragmentContainer.alpha = (progress - 0.2F) / 0.2F
}
open fun onPanelCollapsed() {
// restore values
super.setLightStatusbar(lightStatusBar)
super.setTaskDescriptionColor(taskColor)
super.setNavigationbarColor(navigationBarColor)
super.setLightNavigationBar(lightNavigationBar)
}
open fun onPanelExpanded() {
onPaletteColorChanged()
}
private fun setupSlidingUpPanel() {
@ -214,7 +215,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
})
}
fun getBottomNavigationView(): BottomNavigationBarTinted {
fun getBottomNavigationView(): BottomNavigationView {
return binding.bottomNavigationView
}
@ -250,43 +251,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
return false
}
private fun onPaletteColorChanged() {
if (panelState == STATE_EXPANDED) {
super.setTaskDescriptionColor(paletteColor)
val isColorLight = ColorUtil.isColorLight(paletteColor)
if (PreferenceUtil.isAdaptiveColor && (nowPlayingScreen == Normal || nowPlayingScreen == Flat)) {
super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight)
} else if (nowPlayingScreen == Card || nowPlayingScreen == Blur || nowPlayingScreen == BlurCard) {
super.setLightStatusbar(false)
super.setLightNavigationBar(true)
super.setNavigationbarColor(Color.BLACK)
} else if (nowPlayingScreen == Color || nowPlayingScreen == Tiny || nowPlayingScreen == Gradient) {
super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(isColorLight)
} else if (nowPlayingScreen == Full) {
super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(false)
} else if (nowPlayingScreen == Classic) {
super.setLightStatusbar(false)
} else if (nowPlayingScreen == Fit) {
super.setLightStatusbar(false)
} else {
super.setLightStatusbar(
ColorUtil.isColorLight(
ATHUtil.resolveColor(
this,
android.R.attr.windowBackground
)
)
)
super.setLightNavigationBar(true)
}
}
}
override fun setLightStatusbar(enabled: Boolean) {
lightStatusBar = enabled
if (panelState == STATE_COLLAPSED) {
@ -294,20 +258,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
}
}
override fun setLightNavigationBar(enabled: Boolean) {
lightNavigationBar = enabled
if (panelState == STATE_COLLAPSED) {
super.setLightNavigationBar(enabled)
}
}
override fun setNavigationbarColor(color: Int) {
navigationBarColor = color
if (panelState == STATE_COLLAPSED) {
super.setNavigationbarColor(color)
}
}
override fun setTaskDescriptionColor(color: Int) {
taskColor = color
if (panelState == STATE_COLLAPSED) {
@ -330,22 +280,15 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
}
}
private fun updateColor() {
libraryViewModel.paletteColor.observe(this, { color ->
this.paletteColor = color
onPaletteColorChanged()
})
}
fun setBottomBarVisibility(visible: Boolean) {
binding.bottomNavigationView.isVisible = visible
hideBottomBar(MusicPlayerRemote.playingQueue.isEmpty())
}
private fun hideBottomBar(hide: Boolean) {
val heightOfBar =
val heightOfBar = RetroUtil.getNavigationBarHeight() +
if (MusicPlayerRemote.isCasting) dip(R.dimen.cast_mini_player_height) else dip(R.dimen.mini_player_height)
val heightOfBarWithTabs =
val heightOfBarWithTabs = RetroUtil.getNavigationBarHeight() +
if (MusicPlayerRemote.isCasting) dip(R.dimen.mini_cast_player_height_expanded) else dip(
R.dimen.mini_player_height_expanded
)

View file

@ -49,6 +49,7 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
setImmersiveFullscreen()
registerSystemUiVisibility()
toggleScreenOn()
setDrawUnderNavigationBar()
//MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this)
}
@ -91,7 +92,7 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
RetroUtil.setAllowDrawUnderStatusBar(window)
}
fun setDrawUnderNavigationBar() {
private fun setDrawUnderNavigationBar() {
RetroUtil.setAllowDrawUnderNavigationBar(window)
}

View file

@ -74,12 +74,10 @@ open class BugReportActivity : AbsThemeActivity() {
private var deviceInfo: DeviceInfo? = null
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
super.onCreate(savedInstanceState)
binding = ActivityBugReportBinding.inflate(layoutInflater)
setContentView(binding.root)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
initViews()

View file

@ -196,7 +196,6 @@ abstract class AbsTagEditorActivity<VB : ViewBinding> : AbsBaseActivity() {
_binding = bindingInflater.invoke(layoutInflater)
setContentView(binding.root)
setStatusbarColorAuto()
setNavigationbarColorAuto()
setTaskDescriptionColorAuto()
saveFab = findViewById(R.id.saveTags)

View file

@ -34,10 +34,7 @@ abstract class AbsMainActivityFragment(@LayoutRes layout: Int) : AbsMusicService
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setHasOptionsMenu(true)
mainActivity.setNavigationbarColorAuto()
mainActivity.setLightNavigationBar(true)
mainActivity.setTaskDescriptionColorAuto()
mainActivity.hideStatusBar()
}
private fun setStatusBarColor(view: View, color: Int) {

View file

@ -28,6 +28,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
class AdaptiveFragment : AbsPlayerFragment(R.layout.fragment_adaptive_player) {
@ -46,6 +47,7 @@ class AdaptiveFragment : AbsPlayerFragment(R.layout.fragment_adaptive_player) {
_binding = FragmentAdaptivePlayerBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(binding.root)
}
private fun setUpSubFragments() {

View file

@ -32,6 +32,7 @@ import code.name.monkey.retromusic.glide.RetroGlideExtension
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
class BlurPlayerFragment : AbsPlayerFragment(R.layout.fragment_blur),
@ -54,6 +55,7 @@ class BlurPlayerFragment : AbsPlayerFragment(R.layout.fragment_blur),
_binding = FragmentBlurBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(binding.playerToolbar)
}
private fun setUpSubFragments() {

View file

@ -26,6 +26,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
class CardFragment : AbsPlayerFragment(R.layout.fragment_card_player) {
@ -82,6 +83,7 @@ class CardFragment : AbsPlayerFragment(R.layout.fragment_card_player) {
_binding = FragmentCardPlayerBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(binding.playbackControlsFragment.parent as View)
}
private fun setUpSubFragments() {

View file

@ -33,7 +33,9 @@ import code.name.monkey.retromusic.glide.RetroGlideExtension
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import org.koin.android.ext.android.bind
class CardBlurFragment : AbsPlayerFragment(R.layout.fragment_card_blur_player),
SharedPreferences.OnSharedPreferenceChangeListener {
@ -92,6 +94,7 @@ class CardBlurFragment : AbsPlayerFragment(R.layout.fragment_card_blur_player),
_binding = FragmentCardBlurPlayerBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(binding.cardContainer)
}
private fun setUpSubFragments() {

View file

@ -29,6 +29,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
class ColorFragment : AbsPlayerFragment(R.layout.fragment_color_player) {
@ -61,7 +62,6 @@ class ColorFragment : AbsPlayerFragment(R.layout.fragment_color_player) {
_binding?.root?.setBackgroundColor(color.backgroundColor)
}
animator.start()
serviceActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor))
Handler().post {
ToolbarContentTintHelper.colorizeToolbar(
binding.playerToolbar,
@ -116,6 +116,7 @@ class ColorFragment : AbsPlayerFragment(R.layout.fragment_color_player) {
val playerAlbumCoverFragment =
childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
playerAlbumCoverFragment.setCallbacks(this)
RetroUtil.drawAboveNavBar(playerToolbar())
}
private fun setUpSubFragments() {

View file

@ -25,6 +25,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
class FitFragment : AbsPlayerFragment(R.layout.fragment_fit) {
@ -85,6 +86,7 @@ class FitFragment : AbsPlayerFragment(R.layout.fragment_fit) {
_binding = FragmentFitBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(playerToolbar())
}
private fun setUpSubFragments() {

View file

@ -31,6 +31,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import code.name.monkey.retromusic.views.DrawableGradient
@ -90,6 +91,7 @@ class FlatPlayerFragment : AbsPlayerFragment(R.layout.fragment_flat_player) {
_binding = FragmentFlatPlayerBinding.bind(view)
setUpPlayerToolbar()
setUpSubFragments()
RetroUtil.drawAboveNavBar(binding.playbackControlsFragment)
}
override fun onShow() {

View file

@ -55,6 +55,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.google.android.material.bottomsheet.BottomSheetBehavior.*

View file

@ -36,6 +36,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
/**

View file

@ -26,6 +26,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
/**
@ -93,6 +94,7 @@ class MaterialFragment : AbsPlayerFragment(R.layout.fragment_material) {
_binding = FragmentMaterialBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(playerToolbar())
}
private fun setUpSubFragments() {

View file

@ -29,6 +29,7 @@ import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import code.name.monkey.retromusic.views.DrawableGradient
@ -120,6 +121,7 @@ class PlayerFragment : AbsPlayerFragment(R.layout.fragment_player) {
_binding = FragmentPlayerBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(playerToolbar())
}
override fun onDestroyView() {

View file

@ -27,6 +27,7 @@ import code.name.monkey.retromusic.fragments.base.goToArtist
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
class PlainPlayerFragment : AbsPlayerFragment(R.layout.fragment_plain_player) {
@ -84,6 +85,7 @@ class PlainPlayerFragment : AbsPlayerFragment(R.layout.fragment_plain_player) {
binding.text.setOnClickListener {
goToArtist(requireActivity())
}
RetroUtil.drawAboveNavBar(playerToolbar())
}
private fun setUpSubFragments() {

View file

@ -25,6 +25,7 @@ import code.name.monkey.retromusic.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
/**
@ -51,6 +52,7 @@ class SimplePlayerFragment : AbsPlayerFragment(R.layout.fragment_simple_player)
_binding = FragmentSimplePlayerBinding.bind(view)
setUpSubFragments()
setUpPlayerToolbar()
RetroUtil.drawAboveNavBar(playerToolbar())
}
private fun setUpSubFragments() {

View file

@ -39,6 +39,7 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.ViewUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import kotlin.math.abs
@ -147,6 +148,7 @@ class TinyPlayerFragment : AbsPlayerFragment(R.layout.fragment_tiny_player),
binding.text.setOnClickListener {
goToArtist(requireActivity())
}
RetroUtil.drawAboveNavBar(playerToolbar())
}
private fun setUpSubFragments() {

View file

@ -32,6 +32,7 @@ import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
@ -40,6 +41,8 @@ import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
import java.net.InetAddress;
@ -115,6 +118,18 @@ public class RetroUtil {
return result;
}
public static int getNavigationBarHeight() {
int result = 0;
int resourceId =
App.Companion.getContext()
.getResources()
.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
result = App.Companion.getContext().getResources().getDimensionPixelSize(resourceId);
}
return result;
}
@Nullable
public static Drawable getTintedVectorDrawable(
@NonNull Context context, @DrawableRes int id, @ColorInt int color) {
@ -213,6 +228,32 @@ public class RetroUtil {
.getDecorView()
.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
window.setStatusBarColor(Color.TRANSPARENT);
}
/**
* This will draw our view above the navigation bar instead of behind it by adding margins.
*
* @param view view to draw above Navigation Bar
*/
public static void drawAboveNavBar(View view) {
ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
params.bottomMargin = insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
return WindowInsetsCompat.CONSUMED;
});
}
/**
* This will draw our view above the navigation bar instead of behind it by adding padding.
*
* @param view view to draw above Navigation Bar
*/
public static void drawAboveNavBarWithPadding(View view) {
ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom);
return WindowInsetsCompat.CONSUMED;
});
}
public static String getIpAddress(boolean useIPv4) {

View file

@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="@android:color/transparent"
android:endColor="#60000000"
android:centerColor="#80000000"
android:startColor="#BB000000" />
</shape>

View file

@ -1,25 +1,18 @@
<LinearLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/status_bar" />
</FrameLayout>
tools:ignore="UnusedAttribute"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
app:liftOnScroll="true"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -163,4 +156,4 @@
android:layout_height="52dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,22 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.retromusic.views.StatusBarView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurface"
tools:ignore="UnusedAttribute" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
@ -26,6 +13,7 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:background="@color/transparent"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black"
app:title="@string/report_bug"
@ -73,4 +61,3 @@
android:layout_margin="16dp"
app:srcCompat="@drawable/ic_send" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -4,13 +4,15 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">
android:background="?attr/colorSurface"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
app:liftOnScroll="true"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"

View file

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:transitionName="@string/transition_lyrics">
android:fitsSystemWindows="true">
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/appBarLayout"
@ -26,7 +25,7 @@
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:gravity="start"
android:navigationIcon="@drawable/ic_keyboard_arrow_down_black"
app:contentInsetLeft="0dp"

View file

@ -1,28 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical"
tools:ignore="UnusedAttribute">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/status_bar" />
</FrameLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:liftOnScroll="true">
<com.google.android.material.appbar.MaterialToolbar
@ -68,7 +56,4 @@
android:text="@string/clear_playing_queue"
android:textAppearance="@style/TextViewHeadline6"
app:icon="@drawable/ic_clear_all" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -1,27 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.retromusic.views.StatusBarView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="0dp"
tools:ignore="UnusedAttribute" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/colorSurface"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
app:liftOnScroll="true"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
@ -39,8 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:defaultNavHost="true"
app:navGraph="@navigation/settings_graph"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/>
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
app:navGraph="@navigation/settings_graph" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -3,15 +3,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:focusable="true"
android:focusableInTouchMode="true">
android:focusableInTouchMode="true"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:liftOnScroll="true">
app:liftOnScroll="true"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"

View file

@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"

View file

@ -57,42 +57,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_album_full_card_cover" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:clipToPadding="false"
android:elevation="20dp"
android:padding="16dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/player_lyrics_line1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:shadowColor="@color/md_black_1000"
android:shadowRadius="4"
android:textAlignment="center"
android:textColor="@color/md_white_1000"
android:textSize="22sp"
android:visibility="gone" />
<TextView
android:id="@+id/player_lyrics_line2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:shadowColor="@color/md_black_1000"
android:shadowRadius="4"
android:textAlignment="center"
android:textColor="@color/md_white_1000"
android:textSize="22sp" />
</FrameLayout>
</FrameLayout>
<FrameLayout

View file

@ -26,6 +26,7 @@
<FrameLayout
android:id="@+id/cardContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">

View file

@ -49,8 +49,7 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="8dp"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
app:cardCornerRadius="8dp">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/playbackControlsFragment"

View file

@ -62,7 +62,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/playerQueueSheet"
style="@style/Widget.BottomSheet"
style="@style/BottomSheetStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:behavior_hideable="false"

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?attr/colorSurface"
android:background="@null"
android:clickable="true"
android:focusable="true"
tools:ignore="UnusedAttribute">

View file

@ -21,7 +21,7 @@
<FrameLayout
android:id="@+id/slidingPanel"
style="@style/Widget.BottomSheet"
style="@style/BottomSheetStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_hideable="true"

View file

@ -14,7 +14,7 @@
<resources>
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">?attr/colorSurface</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
@ -29,5 +29,7 @@
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
<item name="android:windowLightNavigationBar">false</item>
<item name="colorSurface">@color/darkColorSurface</item>
<item name="materialCardViewStyle">@style/Widget.MaterialComponents.CardView</item>
<item name="bottomSheetTint">@color/darkColorSurface</item>
</style>
</resources>

View file

@ -14,7 +14,7 @@
<resources>
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">?attr/colorSurface</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
@ -29,5 +29,8 @@
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
<item name="colorPrimary">@color/darkColorPrimary</item>
<item name="colorSurface">@color/darkColorSurface</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/darkColorSurface</item>
</style>
</resources>

View file

@ -10,6 +10,7 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowSharedElementsUseOverlay">false</item>
<item name="android:textViewStyle">@style/TextViewStyleIm</item>
<item name="bottomSheetTint">@color/window_color_light</item>
</style>
<style name="Theme.RetroMusic.Black" parent="Theme.RetroMusic.Base.Black">
@ -17,6 +18,7 @@
<item name="android:windowSharedElementsUseOverlay">false</item>
<item name="android:textViewStyle">@style/TextViewStyleIm</item>
<item name="android:windowBackground">@color/window_color_dark</item>
<item name="bottomSheetTint">@color/window_color_dark</item>
</style>
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive">
@ -24,6 +26,7 @@
<item name="android:windowSharedElementsUseOverlay">false</item>
<item name="android:textViewStyle">@style/TextViewStyleIm</item>
<item name="android:windowBackground">@color/window_color</item>
<item name="bottomSheetTint">?colorSurface</item>
</style>
<style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.Material.Notification" />

View file

@ -14,7 +14,7 @@
<resources>
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
<item name="windowActionBarOverlay">true</item>
@ -24,12 +24,14 @@
<item name="roundSelector">@drawable/round_selector</item>
<item name="rectSelector">@drawable/rect_selector</item>
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="bottomNavigationStyle">@style/Widget.Material3.BottomNavigationView</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/darkColorSurface</item>
</style>
<style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar">
<style name="Theme.RetroMusic.Base" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">@color/darkColorPrimary</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
@ -43,13 +45,15 @@
<item name="windowActionBar">false</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="android:windowLightNavigationBar">false</item>
<!--Manual setting colors-->
<item name="colorSurface">@color/darkColorSurface</item>
<item name="bottomNavigationStyle">@style/Widget.Material3.BottomNavigationView</item>
<item name="android:windowBackground">@color/window_color_dark</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/darkColorSurface</item>
</style>
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="Theme.RetroMusic.Base.Light" parent="Theme.Material3.Light.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="roundSelector">@drawable/round_selector</item>
@ -62,6 +66,8 @@
<item name="windowActionBar">false</item>
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="android:windowLightNavigationBar">false</item>
<item name="bottomNavigationStyle">@style/Widget.Material3.BottomNavigationView</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/window_color_light</item>
</style>
</resources>

View file

@ -6,6 +6,7 @@
<attr name="defaultFooterColor" format="color" />
<attr name="toolbarPopupTheme" format="reference" />
<attr name="lineHeightHint" format="dimension" />
<attr name="bottomSheetTint" format="reference" />
<declare-styleable name="NetworkImageView">
<attr name="url_link" format="string" />

View file

@ -15,6 +15,9 @@
<color name="darkColorPrimary">#202124</color>
<color name="darkColorSurface">#202124</color>
<color name="darkerColorSurface">#353535</color>
<color name="lighterColorSurface">#dddddd</color>
<color name="blackColorSurface">#000000</color>
<color name="transparent">#00000000</color>

View file

@ -7,6 +7,7 @@
<item name="android:scrollbars">none</item>
<item name="dialogCornerRadius">16dp</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="bottomSheetTint">@color/window_color_light</item>
</style>
<style name="Theme.RetroMusic.Black" parent="Theme.RetroMusic.Base.Black">
@ -14,6 +15,7 @@
<item name="android:scrollbars">none</item>
<item name="dialogCornerRadius">16dp</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="bottomSheetTint">@color/window_color_dark</item>
</style>
<style name="Theme.RetroMusic.FollowSystem" parent="Theme.RetroMusic.Base.Adaptive">
@ -21,6 +23,7 @@
<item name="android:scrollbars">none</item>
<item name="dialogCornerRadius">16dp</item>
<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="bottomSheetTint">?colorSurface</item>
</style>
<style name="Theme.RetroMusic.Notification" parent="@android:style/TextAppearance.StatusBar.EventContent" />
@ -41,7 +44,7 @@
<item name="android:thumbOffset">0dp</item>
</style>
<style name="Toolbar" parent="Widget.MaterialComponents.Toolbar">
<style name="Toolbar" parent="Widget.Material3.Toolbar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="popupTheme">?toolbarPopupTheme</item>
@ -50,7 +53,6 @@
<item name="contentInsetStartWithNavigation">0dp</item>
<item name="contentInsetStart">0dp</item>
<item name="titleMarginStart">16dp</item>
</style>
@ -181,9 +183,9 @@
</style>
<style name="Widget.BottomSheet" parent="Widget.MaterialComponents.BottomSheet">
<item name="gestureInsetBottomIgnored">true</item>
<item name="enableEdgeToEdge">true</item>
<style name="BottomSheetStyle" parent="Widget.MaterialComponents.BottomSheet">
<item name="android:maxWidth">@empty</item>
<item name="backgroundTint">?bottomSheetTint</item>
</style>
<style name="MaterialCardViewStroke">

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<style name="Theme.RetroMusic.Base.Adaptive" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
<item name="windowActionBarOverlay">true</item>
@ -15,9 +15,10 @@
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="popupWindowStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
</style>
<style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar">
<style name="Theme.RetroMusic.Base" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">@color/darkColorSurface</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowActivityTransitions">true</item>
@ -34,9 +35,11 @@
<item name="colorSurface">@color/darkColorSurface</item>
<item name="android:windowBackground">@color/window_color_dark</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/darkColorSurface</item>
</style>
<style name="Theme.RetroMusic.Base.Black" parent="Theme.MaterialComponents.NoActionBar">
<style name="Theme.RetroMusic.Base.Black" parent="Theme.Material3.DayNight.NoActionBar">
<item name="md_background_color">@color/blackColorSurface</item>
<item name="roundSelector">@drawable/round_selector</item>
<item name="rectSelector">@drawable/rect_selector</item>
@ -51,9 +54,11 @@
<item name="toolbarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="mcab_popup_theme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/blackColorSurface</item>
</style>
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
<style name="Theme.RetroMusic.Base.Light" parent="Theme.Material3.Light.NoActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="roundSelector">@drawable/round_selector</item>
@ -67,6 +72,8 @@
<item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item>
<item name="materialButtonStyle">@style/MaterialButtonTheme</item>
<item name="popupMenuStyle">@style/MaterialPopupMenuStyle</item>
<item name="materialCardViewStyle">@style/Widget.Material3.CardView.Elevated</item>
<item name="bottomSheetTint">@color/window_color_light</item>
</style>