Replaced material progress with Materia Design components
This commit is contained in:
parent
06a52b1323
commit
0e81e3cb48
7 changed files with 26 additions and 143 deletions
|
@ -149,9 +149,6 @@ dependencies {
|
|||
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
|
||||
transitive = true
|
||||
}
|
||||
/*UI Library*/
|
||||
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
|
||||
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
def kotlin_coroutines_version = "1.3.3"
|
||||
|
|
|
@ -15,14 +15,12 @@ import code.name.monkey.retromusic.extensions.show
|
|||
import code.name.monkey.retromusic.extensions.textColorPrimary
|
||||
import code.name.monkey.retromusic.extensions.textColorSecondary
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
|
||||
import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.android.synthetic.main.fragment_mini_player.*
|
||||
import kotlin.math.abs
|
||||
|
||||
|
@ -97,19 +95,6 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
|
|||
|
||||
miniPlayerTitle.isSelected = true
|
||||
miniPlayerTitle.text = builder
|
||||
|
||||
if (RetroUtil.isTablet()) {
|
||||
image?.let {
|
||||
SongGlideRequest.Builder.from(
|
||||
Glide.with(requireContext()),
|
||||
MusicPlayerRemote.currentSong
|
||||
).checkIgnoreMediaStore(requireContext())
|
||||
.ignoreMediaStore(PreferenceUtil.isAllowedToDownloadMetadata())
|
||||
.asBitmap()
|
||||
.build()
|
||||
.into(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onServiceConnected() {
|
||||
|
|
|
@ -27,6 +27,7 @@ import androidx.core.view.ViewCompat
|
|||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import com.google.android.material.progressindicator.ProgressIndicator
|
||||
|
||||
object ViewUtil {
|
||||
|
||||
|
@ -76,6 +77,10 @@ object ViewUtil {
|
|||
)
|
||||
}
|
||||
|
||||
fun setProgressDrawable(progressIndicator: ProgressIndicator, newColor: Int) {
|
||||
progressIndicator.progressTintList = ColorStateList.valueOf(newColor)
|
||||
}
|
||||
|
||||
fun hitTest(v: View, x: Int, y: Int): Boolean {
|
||||
val tx = (ViewCompat.getTranslationX(v) + 0.5f).toInt()
|
||||
val ty = (ViewCompat.getTranslationY(v) + 0.5f).toInt()
|
||||
|
|
|
@ -17,8 +17,12 @@
|
|||
android:height="64dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M8 5v14l11-7L8 5z" />
|
||||
<group
|
||||
android:pivotX="12"
|
||||
android:pivotY="12"
|
||||
android:rotation="90">
|
||||
<path
|
||||
android:fillColor="@color/md_white_1000"
|
||||
android:pathData="M8 5v14l11-7L8 5z" />
|
||||
</group>
|
||||
</vector>
|
|
@ -1,109 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:id="@+id/miniPlayerContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/mini_player_height"
|
||||
android:background="?attr/colorSurface"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:transitionName="@string/transition_mini_player"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/imageContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="centerCrop"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@drawable/default_album_art" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/miniPlayerTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:freezesText="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/actionPrevious"
|
||||
app:layout_constraintStart_toEndOf="@id/imageContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Song name and details" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actionPrevious"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?roundSelector"
|
||||
android:padding="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/miniPlayerPlayPauseButton"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_skip_previous_white_24dp"
|
||||
app:tint="?attr/colorControlNormal" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/miniPlayerPlayPauseButton"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?roundSelector"
|
||||
android:scaleType="center"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/actionNext"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_pause_white_24dp"
|
||||
app:tint="?attr/colorControlNormal"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:tint="?attr/colorControlNormal" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actionNext"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?roundSelector"
|
||||
android:padding="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_skip_next_white_24dp"
|
||||
app:tint="?attr/colorControlNormal" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="3dp"
|
||||
android:progress="20"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -62,6 +62,16 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical">
|
||||
|
||||
<com.google.android.material.progressindicator.ProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:circularRadius="16dp"
|
||||
app:indicatorType="circular"
|
||||
app:indicatorWidth="2dp"
|
||||
app:linearSeamless="true"
|
||||
tools:progress="10" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/miniPlayerPlayPauseButton"
|
||||
android:layout_width="40dp"
|
||||
|
@ -72,17 +82,6 @@
|
|||
app:srcCompat="@drawable/ic_pause_white_24dp"
|
||||
app:tint="?attr/colorControlNormal"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="false"
|
||||
android:progressDrawable="@drawable/circle_progress"
|
||||
android:rotation="270"
|
||||
tools:progress="80" />
|
||||
</FrameLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
@ -95,4 +94,6 @@
|
|||
app:srcCompat="@drawable/ic_skip_next_white_24dp"
|
||||
app:tint="?attr/colorControlNormal" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
|
@ -27,7 +27,7 @@ android {
|
|||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.2.0-alpha05'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha01'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
// Used for the list preference classes
|
||||
|
|
Loading…
Reference in a new issue