Code refactor
This commit is contained in:
parent
1941086b4a
commit
c81d0c17fb
13 changed files with 58 additions and 58 deletions
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"version": 1,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "code.name.monkey.retromusic",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"properties": [],
|
||||
"versionCode": 10438,
|
||||
"versionName": "3.5.650_0812",
|
||||
"enabled": true,
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -10,6 +10,11 @@
|
|||
<item name="fontFamily">@font/sans</item>
|
||||
</style>
|
||||
|
||||
<style name="TextViewHeadline4.Compress" parent="TextAppearance.MaterialComponents.Headline4">
|
||||
<item name="fontFamily">@font/sans</item>
|
||||
<item name="android:textSize">32sp</item>
|
||||
</style>
|
||||
|
||||
<style name="TextViewHeadline5" parent="TextAppearance.MaterialComponents.Headline5">
|
||||
<item name="fontFamily">@font/sans</item>
|
||||
</style>
|
||||
|
@ -54,4 +59,21 @@
|
|||
<item name="fontFamily">@font/sans</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTextAppearance.MaterialAlertDialog.Button" parent="Widget.MaterialComponents.Button.TextButton">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="fontFamily">@font/sans</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTextAppearance.MaterialAlertDialog.Body" parent="MaterialAlertDialog.MaterialComponents.Body.Text">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="fontFamily">@font/sans</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTextAppearance.MaterialAlertDialog.Title" parent="MaterialAlertDialog.MaterialComponents.Title.Text">
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="fontFamily">@font/sans</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -15,7 +15,6 @@ import code.name.monkey.appthemehelper.util.ColorUtil
|
|||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.RetroBottomSheetBehavior
|
||||
import code.name.monkey.retromusic.extensions.hide
|
||||
import code.name.monkey.retromusic.extensions.show
|
||||
import code.name.monkey.retromusic.extensions.whichFragment
|
||||
import code.name.monkey.retromusic.fragments.LibraryViewModel
|
||||
import code.name.monkey.retromusic.fragments.MiniPlayerFragment
|
||||
|
@ -51,8 +50,6 @@ abstract class AbsSlidingMusicPanelActivity() : AbsMusicServiceActivity() {
|
|||
|
||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
||||
setMiniPlayerAlphaProgress(slideOffset)
|
||||
dimBackground.show()
|
||||
dimBackground.alpha = slideOffset
|
||||
}
|
||||
|
||||
override fun onStateChanged(bottomSheet: View, newState: Int) {
|
||||
|
@ -62,7 +59,6 @@ abstract class AbsSlidingMusicPanelActivity() : AbsMusicServiceActivity() {
|
|||
}
|
||||
BottomSheetBehavior.STATE_COLLAPSED -> {
|
||||
onPanelCollapsed()
|
||||
dimBackground.hide()
|
||||
}
|
||||
else -> {
|
||||
|
||||
|
@ -81,9 +77,6 @@ abstract class AbsSlidingMusicPanelActivity() : AbsMusicServiceActivity() {
|
|||
|
||||
setupBottomSheet()
|
||||
|
||||
val themeColor = ATHUtil.resolveColor(this, android.R.attr.windowBackground, Color.GRAY)
|
||||
dimBackground.setBackgroundColor(ColorUtil.withAlpha(themeColor, 0.5f))
|
||||
|
||||
libraryViewModel.paletteColorLiveData.observe(this, Observer {
|
||||
this.paletteColor = it
|
||||
onPaletteColorChanged()
|
||||
|
|
|
@ -33,6 +33,7 @@ import code.name.monkey.retromusic.App
|
|||
import code.name.monkey.retromusic.R
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
|
||||
|
@ -107,6 +108,15 @@ fun ExtendedFloatingActionButton.accentColor() {
|
|||
iconTint = textColorStateList
|
||||
}
|
||||
|
||||
fun FloatingActionButton.accentColor() {
|
||||
val color = ThemeStore.accentColor(context)
|
||||
val textColor = MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color))
|
||||
val colorStateList = ColorStateList.valueOf(color)
|
||||
val textColorStateList = ColorStateList.valueOf(textColor)
|
||||
backgroundTintList = colorStateList
|
||||
imageTintList = textColorStateList
|
||||
}
|
||||
|
||||
fun MaterialButton.applyColor(color: Int) {
|
||||
val backgroundColorStateList = ColorStateList.valueOf(color)
|
||||
val textColorColorStateList = ColorStateList.valueOf(
|
||||
|
|
|
@ -10,6 +10,7 @@ import code.name.monkey.appthemehelper.common.ATHToolbarActivity.getToolbarBackg
|
|||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.dialogs.CreateRetroPlaylist
|
||||
import code.name.monkey.retromusic.extensions.accentColor
|
||||
import code.name.monkey.retromusic.extensions.findNavController
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
import kotlinx.android.synthetic.main.fragment_library.*
|
||||
|
@ -29,9 +30,12 @@ class LibraryFragment : AbsMainActivityFragment(R.layout.fragment_library) {
|
|||
navOptions
|
||||
)
|
||||
}
|
||||
addPlaylist.setOnClickListener {
|
||||
addPlaylist.apply {
|
||||
accentColor()
|
||||
setOnClickListener {
|
||||
CreateRetroPlaylist().show(childFragmentManager, "ShowCreatePlaylistDialog")
|
||||
}
|
||||
}
|
||||
setupNavigationController()
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/albumCoverContainer"
|
||||
|
@ -83,7 +83,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="@style/TextViewHeadline5"
|
||||
android:textAppearance="@style/TextViewHeadline4.Compress"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
@ -98,10 +98,9 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextViewSubtitle2"
|
||||
android:textAppearance="@style/TextViewHeadline6"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxLines="2"
|
||||
android:textAppearance="@style/TextViewHeadline5"
|
||||
android:textAppearance="@style/TextViewHeadline4.Compress"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -85,9 +85,8 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:textAppearance="@style/TextViewSubtitle2"
|
||||
android:textAppearance="@style/TextViewHeadline6"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -44,17 +44,16 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/addPlaylist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:id="@+id/addPlaylist"
|
||||
android:layout_marginBottom="117dp"
|
||||
android:contentDescription="@string/add_playlist_title"
|
||||
android:src="@drawable/ic_playlist_add"
|
||||
app:useCompatPadding="true"
|
||||
app:layout_anchor="@id/fragment_container"
|
||||
app:layout_anchorGravity="end|bottom"
|
||||
android:contentDescription="@string/add_playlist_title" />
|
||||
app:layout_dodgeInsetEdges="all"
|
||||
app:useCompatPadding="true" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment_container"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:layoutAnimation="@anim/layout_animation_fall_down"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layout_dodgeInsetEdges="bottom"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout 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="126dp"
|
||||
android:layout_width="156dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/rectSelector"
|
||||
android:orientation="vertical"
|
||||
|
@ -10,13 +10,13 @@
|
|||
|
||||
<code.name.monkey.retromusic.views.RetroShapeableImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="112dp"
|
||||
android:layout_height="112dp"
|
||||
android:layout_width="144dp"
|
||||
android:layout_height="144dp"
|
||||
android:background="@android:color/transparent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:retroCornerSize="56dp"
|
||||
app:retroCornerSize="72dp"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
|
@ -26,8 +26,8 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:textAppearance="@style/TextViewBody1"
|
||||
android:paddingTop="12dp"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -33,13 +33,12 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:padding="8dp"
|
||||
android:maxLines="2"
|
||||
android:padding="12dp"
|
||||
android:textAppearance="@style/TextViewBody1"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/imageContainer"
|
||||
tools:text="Song name" />
|
||||
tools:text="@tools:sample/full_names" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -11,13 +11,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dimBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/slidingPanel"
|
||||
|
|
|
@ -216,6 +216,7 @@
|
|||
|
||||
<style name="AppTextAppearance.MaterialAlertDialog.Button" parent="Widget.MaterialComponents.Button.TextButton">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTextAppearance.MaterialAlertDialog.Body" parent="MaterialAlertDialog.MaterialComponents.Body.Text">
|
||||
|
|
Loading…
Reference in a new issue