Separated attrs
This commit is contained in:
parent
fac9d00f47
commit
ccad96dd41
12 changed files with 137 additions and 85 deletions
|
@ -177,8 +177,16 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadAlbumCover() {
|
private fun loadAlbumCover() {
|
||||||
|
/* Glide.with(this).load(RetroUtil.getAlbumArtUri(album.id)).placeholder(R.drawable.default_album_art)
|
||||||
|
.error(R.drawable.default_album_art)
|
||||||
|
.dontTransform()
|
||||||
|
.dontAnimate().into(image)*/
|
||||||
|
|
||||||
SongGlideRequest.Builder.from(Glide.with(this), album.safeGetFirstSong())
|
SongGlideRequest.Builder.from(Glide.with(this), album.safeGetFirstSong())
|
||||||
.checkIgnoreMediaStore(this).generatePalette(this).build().dontAnimate().dontTransform()
|
.checkIgnoreMediaStore(this)
|
||||||
|
.ignoreMediaStore(PreferenceUtil.getInstance(this).ignoreMediaStoreArtwork())
|
||||||
|
.generatePalette(this)
|
||||||
|
.build().dontAnimate().dontTransform()
|
||||||
.into(object : RetroMusicColoredTarget(image) {
|
.into(object : RetroMusicColoredTarget(image) {
|
||||||
override fun onColorReady(color: Int) {
|
override fun onColorReady(color: Int) {
|
||||||
setColors(color)
|
setColors(color)
|
||||||
|
|
|
@ -41,15 +41,16 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||||
*/
|
*/
|
||||||
public class SongGlideRequest {
|
public class SongGlideRequest {
|
||||||
|
|
||||||
public static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE;
|
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.NONE;
|
||||||
public static final int DEFAULT_ERROR_IMAGE = R.drawable.default_album_art;
|
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_album_art;
|
||||||
public static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
final RequestManager requestManager;
|
final RequestManager requestManager;
|
||||||
final Song song;
|
final Song song;
|
||||||
boolean ignoreMediaStore;
|
boolean ignoreMediaStore;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public static Builder from(@NonNull RequestManager requestManager, Song song) {
|
public static Builder from(@NonNull RequestManager requestManager, Song song) {
|
||||||
return new Builder(requestManager, song);
|
return new Builder(requestManager, song);
|
||||||
}
|
}
|
||||||
|
@ -59,23 +60,28 @@ public class SongGlideRequest {
|
||||||
this.song = song;
|
this.song = song;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaletteBuilder generatePalette(Context context) {
|
@NonNull
|
||||||
|
public PaletteBuilder generatePalette(@NonNull Context context) {
|
||||||
return new PaletteBuilder(this, context);
|
return new PaletteBuilder(this, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public BitmapBuilder asBitmap() {
|
public BitmapBuilder asBitmap() {
|
||||||
return new BitmapBuilder(this);
|
return new BitmapBuilder(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder checkIgnoreMediaStore(Context context) {
|
@NonNull
|
||||||
|
public Builder checkIgnoreMediaStore(@NonNull Context context) {
|
||||||
return ignoreMediaStore(PreferenceUtil.getInstance(context).ignoreMediaStoreArtwork());
|
return ignoreMediaStore(PreferenceUtil.getInstance(context).ignoreMediaStoreArtwork());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public Builder ignoreMediaStore(boolean ignoreMediaStore) {
|
public Builder ignoreMediaStore(boolean ignoreMediaStore) {
|
||||||
this.ignoreMediaStore = ignoreMediaStore;
|
this.ignoreMediaStore = ignoreMediaStore;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public DrawableRequestBuilder<GlideDrawable> build() {
|
public DrawableRequestBuilder<GlideDrawable> build() {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return createBaseRequest(requestManager, song, ignoreMediaStore)
|
return createBaseRequest(requestManager, song, ignoreMediaStore)
|
||||||
|
@ -125,7 +131,10 @@ public class SongGlideRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Song song, boolean ignoreMediaStore) {
|
@NonNull
|
||||||
|
private static DrawableTypeRequest createBaseRequest(@NonNull RequestManager requestManager,
|
||||||
|
@NonNull Song song,
|
||||||
|
boolean ignoreMediaStore) {
|
||||||
if (ignoreMediaStore) {
|
if (ignoreMediaStore) {
|
||||||
return requestManager.load(new AudioFileCover(song.getData()));
|
return requestManager.load(new AudioFileCover(song.getData()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,7 +142,8 @@ public class SongGlideRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Key createSignature(Song song) {
|
@NonNull
|
||||||
|
private static Key createSignature(@NonNull Song song) {
|
||||||
return new MediaStoreSignature("", song.getDateModified(), 0);
|
return new MediaStoreSignature("", song.getDateModified(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,9 @@ public class MusicUtil {
|
||||||
public static final String TAG = MusicUtil.class.getSimpleName();
|
public static final String TAG = MusicUtil.class.getSimpleName();
|
||||||
private static Playlist playlist;
|
private static Playlist playlist;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public static Uri getMediaStoreAlbumCoverUri(int albumId) {
|
public static Uri getMediaStoreAlbumCoverUri(int albumId) {
|
||||||
final Uri sArtworkUri = Uri
|
final Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
|
||||||
.parse("content://media/external/audio/albumart");
|
|
||||||
|
|
||||||
return ContentUris.withAppendedId(sArtworkUri, albumId);
|
return ContentUris.withAppendedId(sArtworkUri, albumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,6 @@ public class RetroUtil {
|
||||||
return (int) (dpWidth / 180);
|
return (int) (dpWidth / 180);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri getAlbumArtUri(long paramInt) {
|
|
||||||
return ContentUris.withAppendedId(Uri.parse("content://media/external/audio/albumart"), paramInt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isTablet() {
|
public static boolean isTablet() {
|
||||||
return App.Companion.getContext().getResources().getConfiguration().smallestScreenWidthDp >= 600;
|
return App.Companion.getContext().getResources().getConfiguration().smallestScreenWidthDp >= 600;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 19 KiB |
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@ -41,8 +40,7 @@
|
||||||
android:text="@string/history"
|
android:text="@string/history"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/v1"
|
app:layout_constraintTop_toBottomOf="@+id/v1" />
|
||||||
tools:text="@tools:sample/lorem" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -78,8 +76,7 @@
|
||||||
android:text="@string/last_added"
|
android:text="@string/last_added"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/v2"
|
app:layout_constraintTop_toBottomOf="@+id/v2" />
|
||||||
tools:text="@tools:sample/lorem" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -115,8 +112,7 @@
|
||||||
android:text="@string/my_top_tracks"
|
android:text="@string/my_top_tracks"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/v3"
|
app:layout_constraintTop_toBottomOf="@+id/v3" />
|
||||||
tools:text="@tools:sample/lorem" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
@ -152,8 +148,7 @@
|
||||||
android:text="@string/shuffle"
|
android:text="@string/shuffle"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/v4"
|
app:layout_constraintTop_toBottomOf="@+id/v4" />
|
||||||
tools:text="@tools:sample/lorem" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:textColor="?colorOnBackground"
|
|
||||||
tools:text="Text" />
|
tools:text="Text" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -5,73 +5,14 @@
|
||||||
<attr name="rectSelector" format="reference" />
|
<attr name="rectSelector" format="reference" />
|
||||||
<attr name="defaultFooterColor" format="color" />
|
<attr name="defaultFooterColor" format="color" />
|
||||||
<attr name="toolbarPopupTheme" format="reference" />
|
<attr name="toolbarPopupTheme" format="reference" />
|
||||||
<attr name="dividerColor" format="color" />
|
<attr name="lineHeightHint" format="dimension" />
|
||||||
|
|
||||||
<declare-styleable name="BlurLayout">
|
|
||||||
<attr name="blk_downscaleFactor" format="float" />
|
|
||||||
<attr name="blk_blurRadius" format="integer" />
|
|
||||||
<attr name="blk_fps" format="integer" />
|
|
||||||
<attr name="blk_cornerRadius" format="dimension" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="NetworkImageView">
|
<declare-styleable name="NetworkImageView">
|
||||||
<attr name="url_link" format="string" />
|
<attr name="url_link" format="string" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="ContributorsView">
|
|
||||||
<attr name="profile_url" format="string" />
|
|
||||||
<attr name="profile_name" format="string" />
|
|
||||||
<attr name="profile_summary" format="string" />
|
|
||||||
<attr name="profile_link" format="string" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="InsettableFrameLayout_Layout">
|
|
||||||
<attr name="layout_ignoreInsets" format="boolean" />
|
|
||||||
</declare-styleable>
|
|
||||||
<declare-styleable name="ColorIconsImageView">
|
|
||||||
<attr name="iconBackgroundColor" format="color" />
|
|
||||||
<attr name="colorIconColor" format="color" />
|
|
||||||
<attr name="icon" format="reference" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="OptionMenuItemView">
|
<declare-styleable name="OptionMenuItemView">
|
||||||
<attr name="optionTitle" format="reference" />
|
<attr name="optionTitle" format="reference" />
|
||||||
<attr name="optionIcon" format="reference" />
|
<attr name="optionIcon" format="reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
|
||||||
<declare-styleable name="LrcView">
|
|
||||||
<attr name="lrcTextSize" format="dimension" />
|
|
||||||
<attr name="lrcLineSpaceSize" format="dimension" />
|
|
||||||
<attr name="lrcNormalTextColor" format="reference|color" />
|
|
||||||
<attr name="lrcCurrentTextColor" format="reference|color" />
|
|
||||||
<attr name="lrcTouchDelay" format="integer" />
|
|
||||||
<attr name="noLrcTextSize" format="dimension" />
|
|
||||||
<attr name="noLrcTextColor" format="reference|color" />
|
|
||||||
<attr name="indicatorLineHeight" format="dimension" />
|
|
||||||
<attr name="indicatorTextSize" format="dimension" />
|
|
||||||
<attr name="indicatorTextColor" format="reference|color" />
|
|
||||||
<attr name="currentIndicateLrcColor" format="reference|color" />
|
|
||||||
<attr name="indicatorTouchDelay" format="integer" />
|
|
||||||
<attr name="indicatorLineColor" format="reference|color" />
|
|
||||||
<attr name="indicatorStartEndMargin" format="dimension" />
|
|
||||||
<attr name="iconLineGap" format="dimension" />
|
|
||||||
<attr name="playIconWidth" format="dimension" />
|
|
||||||
<attr name="playIconHeight" format="dimension" />
|
|
||||||
<attr name="playIcon" format="reference" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<attr name="lineHeightHint" format="dimension" />
|
|
||||||
|
|
||||||
<declare-styleable name="BaselineGridTextView">
|
|
||||||
<attr name="lineHeightMultiplierHint" format="float" />
|
|
||||||
<attr name="lineHeightHint" />
|
|
||||||
<attr name="maxLinesByHeight" format="boolean" />
|
|
||||||
<attr name="android:textAppearance" />
|
|
||||||
<attr name="android:fontFamily" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="CircleRectView">
|
|
||||||
<attr name="circleRadius" format="dimension" />
|
|
||||||
</declare-styleable>
|
|
||||||
</resources>
|
</resources>
|
23
app/src/main/res/values/baseline_textview_attrs.xml
Normal file
23
app/src/main/res/values/baseline_textview_attrs.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="BaselineGridTextView">
|
||||||
|
<attr name="lineHeightMultiplierHint" format="float" />
|
||||||
|
<attr name="lineHeightHint" />
|
||||||
|
<attr name="maxLinesByHeight" format="boolean" />
|
||||||
|
<attr name="android:textAppearance" />
|
||||||
|
<attr name="android:fontFamily" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
21
app/src/main/res/values/color_icon_view_attrs.xml
Normal file
21
app/src/main/res/values/color_icon_view_attrs.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="ColorIconsImageView">
|
||||||
|
<attr name="iconBackgroundColor" format="color" />
|
||||||
|
<attr name="colorIconColor" format="color" />
|
||||||
|
<attr name="icon" format="reference" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
23
app/src/main/res/values/contributor_attrs.xml
Normal file
23
app/src/main/res/values/contributor_attrs.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="ContributorsView">
|
||||||
|
<attr name="profile_url" format="string" />
|
||||||
|
<attr name="profile_name" format="string" />
|
||||||
|
<attr name="profile_summary" format="string" />
|
||||||
|
<attr name="profile_link" format="string" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
37
app/src/main/res/values/lrc_view_attrs.xml
Normal file
37
app/src/main/res/values/lrc_view_attrs.xml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="LrcView">
|
||||||
|
<attr name="lrcTextSize" format="dimension" />
|
||||||
|
<attr name="lrcLineSpaceSize" format="dimension" />
|
||||||
|
<attr name="lrcNormalTextColor" format="reference|color" />
|
||||||
|
<attr name="lrcCurrentTextColor" format="reference|color" />
|
||||||
|
<attr name="lrcTouchDelay" format="integer" />
|
||||||
|
<attr name="noLrcTextSize" format="dimension" />
|
||||||
|
<attr name="noLrcTextColor" format="reference|color" />
|
||||||
|
<attr name="indicatorLineHeight" format="dimension" />
|
||||||
|
<attr name="indicatorTextSize" format="dimension" />
|
||||||
|
<attr name="indicatorTextColor" format="reference|color" />
|
||||||
|
<attr name="currentIndicateLrcColor" format="reference|color" />
|
||||||
|
<attr name="indicatorTouchDelay" format="integer" />
|
||||||
|
<attr name="indicatorLineColor" format="reference|color" />
|
||||||
|
<attr name="indicatorStartEndMargin" format="dimension" />
|
||||||
|
<attr name="iconLineGap" format="dimension" />
|
||||||
|
<attr name="playIconWidth" format="dimension" />
|
||||||
|
<attr name="playIconHeight" format="dimension" />
|
||||||
|
<attr name="playIcon" format="reference" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
Loading…
Reference in a new issue