This commit is contained in:
h4h13 2019-03-25 18:13:43 +05:30
parent a3a4618769
commit 7a42723b9e
103 changed files with 1879 additions and 1195 deletions

View file

@ -32,7 +32,7 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 305
versionCode 308
versionName '3.1.300'
multiDexEnabled true
@ -86,8 +86,8 @@ android {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility '1.8'
targetCompatibility '1.8'
}
configurations.all {
@ -120,17 +120,17 @@ static def getDate() {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.fragment:fragment:$supportLibVersion"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "androidx.recyclerview:recyclerview:$supportLibVersion"
implementation "androidx.gridlayout:gridlayout:$supportLibVersion"
implementation "androidx.cardview:cardview:$supportLibVersion"
implementation "androidx.palette:palette:$supportLibVersion"
implementation "androidx.annotation:annotation:$supportLibVersion"
implementation "androidx.preference:preference:$supportLibVersion"
implementation "androidx.legacy:legacy-support-v13:$supportLibVersion"
implementation "androidx.legacy:legacy-preference-v14:$supportLibVersion"
implementation "com.google.android.material:material:$supportLibVersion"
implementation 'androidx.fragment:fragment:1.1.0-alpha05'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation "androidx.recyclerview:recyclerview:1.1.0-alpha03"
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.palette:palette:1.0.0"
implementation 'androidx.annotation:annotation:1.1.0-alpha02'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation "androidx.legacy:legacy-support-v13:1.0.0"
implementation "androidx.legacy:legacy-preference-v14:1.0.0"
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
@ -141,6 +141,7 @@ dependencies {
implementation 'com.afollestad.material-dialogs:color:2.0.0'
implementation 'com.afollestad:material-cab:0.1.12'
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.7'
@ -151,18 +152,17 @@ dependencies {
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
/*UI Library*/
implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
implementation 'com.r0adkll:slidableactivity:2.0.6'
/*Backend all*/
implementation 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.0-kmod3'
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.4.0.201406110918-r'
implementation 'com.github.jetradarmobile:android-snowfall:1.2.0'
implementation 'com.github.takahirom.downloadable.calligraphy:downloadable-calligraphy:0.1.3'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation project(':appthemehelper')
}
repositories {

View file

@ -165,8 +165,8 @@
android:value="code.name.monkey.retromusic.cast.CastOptionsProvider" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}"
android:name=".misc.GenericFileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data

View file

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ul { list-style-position: outside; padding-left: 0; padding-right: 0; margin-left: 1em; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.1.300</h4> <ul> <li>Added new slide theme</li> <li>Fix Home screen sections loading slow</li> </ul> <h4>v3.1.240</h4> <ul> <li>Fix Search not showing from home screen</li> <li>Fix Volume controls color issue</li> <li>Fix Seek bar alignment</li> <li>Added tiny theme</li> <li>Improved full theme appearances</li> <li>Now playing theme preview updated</li> Added new slide theme</li> <li>Fix Home screen sections loading slow</li> </li> </ul> <h4>v3.1.200</h4> <ul> <li>Added composer sort and editing</li> <li>Fix Crash in Album tag editor while selecting options</li> <li>Added Filter song length</li> <li>Added Favourites playlist icon will be accent color</li> <li>Added Colorful settings icons</li> <li>Added Corners for dialog</li> </ul> <h4>v3.0.570</h4> <ul> <li>Fix Album/Artist square image</li> <li>Fix Delete dialog text format</li> <li>Fix Profile picture not showing after coming back from folders</li> <li>Fix Play button color i Simple and Plain themes</li> <li>Fix Sleep timer dialog crashing</li> <li>Fix Share song dialog title and text</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ul { list-style-position: outside; padding-left: 0; padding-right: 0; margin-left: 1em; } li { padding-top: 8px; } </style> </head> <body> <h4>v3.1.300</h4> <ul> <li>Added new slide theme</li> </ul> <li>Removed library options which are duplicated (it's available from profile menu)</li> <li>Replaced collapsing Fab with Android Floating Extended Fab</li> <li>Replaced home with for you</li> <li>Fixed profile image not loading in about</li> <li>Improved selecting user profile image</li> <li>Added bio to enter custom message</li> <li>Fix Home screen sections loading slow</li> </ul> <h4>v3.1.240</h4> <ul> <li>Fix Search not showing from home screen</li> <li>Fix Volume controls color issue</li> <li>Fix Seek bar alignment</li> <li>Added tiny theme</li> <li>Improved full theme appearances</li> <li>Now playing theme preview updated</li> <li>Fix Home screen sections loading slow</li> Added new slide theme</li> <li>Fix Home screen sections loading slow</li> <li>Fix Home screen sections loading slow</li> </li> </ul> <h4>v3.1.200</h4> <ul> <li>Added composer sort and editing</li> <li>Fix Crash in Album tag editor while selecting options</li> <li>Added Filter song length</li> <li>Added Favourites playlist icon will be accent color</li> <li>Added Colorful settings icons</li> <li>Added Corners for dialog</li> </ul> <h4>v3.0.570</h4> <ul> <li>Fix Album/Artist square image</li> <li>Fix Delete dialog text format</li> <li>Fix Profile picture not showing after coming back from folders</li> <li>Fix Play button color i Simple and Plain themes</li> <li>Fix Sleep timer dialog crashing</li> <li>Fix Share song dialog title and text</li> </ul> <p>If you see entire app white or dark or black select same theme in settings to fix </p> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>

View file

@ -50,7 +50,7 @@ class AddToPlaylistDialog : RoundedBottomSheetDialogFragment() {
bannerTitle.setTextColor(ThemeStore.textColorPrimary(context!!))
val playlists = PlaylistLoader.getAllPlaylists(activity!!).blockingFirst()
val playlistAdapter = AddToPlaylist(activity!!, playlists, R.layout.item_playlist, songs!!, dialog)
val playlistAdapter = AddToPlaylist(activity!!, playlists, R.layout.item_playlist, songs!!, dialog!!)
recyclerView.apply {
layoutManager = LinearLayoutManager(context)
itemAnimator = DefaultItemAnimator()

View file

@ -15,7 +15,6 @@
package code.name.monkey.retromusic.dialogs
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.os.Bundle
import android.view.LayoutInflater
@ -62,7 +61,7 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
override fun onDestroyView() {
super.onDestroyView()
disposable.clear()
disposable.dispose()
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@ -72,9 +71,11 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
text!!.setTextColor(ThemeStore.textColorSecondary(context!!))
titleWelcome!!.setTextColor(ThemeStore.textColorPrimary(context!!))
titleWelcome!!.text = String.format("%s %s!", timeOfTheDay, PreferenceUtil.getInstance().userName)
text.setTextColor(ThemeStore.textColorSecondary(context!!))
text.text = PreferenceUtil.getInstance().userBio
titleWelcome.setTextColor(ThemeStore.textColorPrimary(context!!))
titleWelcome.text = String.format("%s %s!", timeOfTheDay, PreferenceUtil.getInstance().userName)
loadImageFromStorage()
actionSettings.setOnClickListener(this)
@ -99,9 +100,7 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
override fun onClick(view: View) {
val mainActivity = activity as MainActivity? ?: return
when (view.id) {
R.id.actionFolders -> {
mainActivity.setCurrentFragment(FoldersFragment.newInstance(context), true)
}
R.id.actionFolders -> mainActivity.setCurrentFragment(FoldersFragment.newInstance(context), true)
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
R.id.actionAbout -> NavigationUtil.goToAbout(mainActivity)
R.id.actionSleepTimer -> if (fragmentManager != null) {

View file

@ -45,7 +45,7 @@ class SleepTimerDialog : RoundedBottomSheetDialogFragment() {
private var seekArcProgress: Int = 0
private lateinit var timerUpdater: TimerUpdater
override fun onDismiss(dialog: DialogInterface?) {
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
timerUpdater.cancel()
}

View file

@ -0,0 +1,143 @@
/*
* 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.exfab;
/**
* Created by hemanths on 3/20/19
*/
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.transition.AutoTransition;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.view.View;
import com.google.android.material.button.MaterialButton;
import java.util.concurrent.atomic.AtomicBoolean;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import code.name.monkey.retromusic.R;
public class FabIconAnimator {
private static final String ROTATION_Y_PROPERTY = "rotationY";
private static final float TWITCH_END = 20F;
private static final float TWITCH_START = 0F;
private static final int DURATION = 200;
private final MaterialButton button;
private final ConstraintLayout container;
@DrawableRes
private int currentIcon;
@StringRes
private int currentText;
private boolean isAnimating;
private final Transition.TransitionListener listener = new Transition.TransitionListener() {
public void onTransitionStart(Transition transition) {
isAnimating = true;
}
public void onTransitionEnd(Transition transition) {
isAnimating = false;
}
public void onTransitionCancel(Transition transition) {
isAnimating = false;
}
public void onTransitionPause(Transition transition) {
}
public void onTransitionResume(Transition transition) {
}
};
public FabIconAnimator(ConstraintLayout container) {
this.container = container;
this.button = container.findViewById(R.id.fab);
}
public void update(@DrawableRes int icon, @StringRes int text) {
boolean isSame = currentIcon == icon && currentText == text;
currentIcon = icon;
currentText = text;
animateChange(icon, text, isSame);
}
public void setOnClickListener(@Nullable View.OnClickListener clickListener) {
if (clickListener == null) {
button.setOnClickListener(null);
return;
}
AtomicBoolean flag = new AtomicBoolean(true);
button.setOnClickListener(view -> {
if (!flag.getAndSet(false)) return;
clickListener.onClick(view);
button.postDelayed(() -> flag.set(true), 2000);
});
}
private boolean isExtended() { // R.dimen.triple_and_half_margin is 56 dp.
return button.getLayoutParams().height != button.getResources().getDimensionPixelSize(R.dimen.triple_and_half_margin);
}
public void setExtended(boolean extended) {
setExtended(extended, false);
}
private void animateChange(@DrawableRes int icon, @StringRes int text, boolean isSame) {
boolean extended = isExtended();
button.setText(text);
button.setIconResource(icon);
setExtended(extended, !isSame);
if (!extended) twitch();
}
private void setExtended(boolean extended, boolean force) {
if (isAnimating || (extended && isExtended() && !force)) return;
ConstraintSet set = new ConstraintSet();
set.clone(container.getContext(), extended ? R.layout.fab_extended : R.layout.fab_collapsed);
TransitionManager.beginDelayedTransition(container, new AutoTransition()
.addListener(listener).setDuration(150));
if (extended) button.setText(currentText);
else button.setText("");
set.applyTo(container);
}
private void twitch() {
AnimatorSet set = new AnimatorSet();
ObjectAnimator twitchA = animateProperty(ROTATION_Y_PROPERTY, TWITCH_START, TWITCH_END);
ObjectAnimator twitchB = animateProperty(ROTATION_Y_PROPERTY, TWITCH_END, TWITCH_START);
set.play(twitchB).after(twitchA);
set.start();
}
@NonNull
private ObjectAnimator animateProperty(String property, float start, float end) {
return ObjectAnimator.ofFloat(container, property, start, end).setDuration(DURATION);
}
}

View file

@ -0,0 +1,75 @@
/*
* 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.exfab;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Interpolator;
import com.google.android.material.snackbar.Snackbar;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
public class TransientBarBehavior extends CoordinatorLayout.Behavior<View> {
private static final Interpolator fastOutSlowInInterpolator = new FastOutSlowInInterpolator();
public TransientBarBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean layoutDependsOn(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) {
return dependency instanceof Snackbar.SnackbarLayout;
}
@Override
public boolean onDependentViewChanged(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) {
if (child.getVisibility() == View.VISIBLE) {
float translationY = this.getViewTranslationYForSnackbar(parent, child);
child.setTranslationY(translationY);
}
return true;
}
@Override
public void onDependentViewRemoved(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) {
if (dependency instanceof Snackbar.SnackbarLayout && child.getTranslationY() != 0.0F) {
ViewCompat.animate(child).translationY(0.0F).scaleX(1.0F).scaleY(1.0F).alpha(1.0F)
.setInterpolator(fastOutSlowInInterpolator);
}
}
private float getViewTranslationYForSnackbar(CoordinatorLayout parent, View child) {
float minOffset = 0.0F;
List dependencies = parent.getDependencies(child);
int i = 0;
for (int z = dependencies.size(); i < z; ++i) {
View view = (View) dependencies.get(i);
if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(child, view)) {
minOffset = Math.min(minOffset, view.getTranslationY() - (float) view.getHeight());
}
}
return minOffset;
}
}

View file

@ -16,6 +16,7 @@ package code.name.monkey.retromusic.glide.artistimage
import android.content.Context
import android.text.TextUtils
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.rest.LastFMRestClient
import code.name.monkey.retromusic.rest.model.LastFmArtist
import code.name.monkey.retromusic.util.LastFMUtil

View file

@ -0,0 +1,20 @@
/*
* 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.misc;
import androidx.core.content.FileProvider;
public class GenericFileProvider extends FileProvider {
}

View file

@ -14,4 +14,6 @@
package code.name.monkey.retromusic.model
class Contributor(val name: String, val summary: String, val link: String, val profileImage: String)
import com.google.gson.annotations.SerializedName
class Contributor(val name: String, val summary: String, val link: String, @SerializedName("profile_image") val profileImage: String)

View file

@ -17,10 +17,8 @@ package code.name.monkey.retromusic.model.lyrics;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import code.name.monkey.retromusic.model.Song;
public class Lyrics {
private static final ArrayList<Class<? extends Lyrics>> FORMATS = new ArrayList<>();
@ -28,16 +26,12 @@ public class Lyrics {
Lyrics.FORMATS.add(SynchronizedLyricsLRC.class);
}
@NonNull
public Song song;
@NonNull
public String data;
protected boolean parsed = false;
protected boolean valid = false;
@NonNull
public static Lyrics parse(@NonNull Song song, @NonNull String data) {
public static Lyrics parse(Song song, String data) {
for (Class<? extends Lyrics> format : Lyrics.FORMATS) {
try {
Lyrics lyrics = format.newInstance().setData(song, data);
@ -49,7 +43,7 @@ public class Lyrics {
return new Lyrics().setData(song, data).parse(false);
}
public static boolean isSynchronized(@NonNull String data) {
public static boolean isSynchronized(String data) {
for (Class<? extends Lyrics> format : Lyrics.FORMATS) {
try {
Lyrics lyrics = format.newInstance().setData(null, data);
@ -61,13 +55,12 @@ public class Lyrics {
return false;
}
public Lyrics setData(@NonNull Song song, @NonNull String data) {
public Lyrics setData(Song song, String data) {
this.song = song;
this.data = data;
return this;
}
@NonNull
public Lyrics parse(boolean check) {
this.valid = true;
this.parsed = true;
@ -83,7 +76,6 @@ public class Lyrics {
return this.valid;
}
@NonNull
public String getText() {
return this.data.trim().replaceAll("(\r?\n){3,}", "\r\n\r\n");
}

View file

@ -15,12 +15,16 @@
package code.name.monkey.retromusic.rest;
import android.content.Context;
import java.io.File;
import java.util.concurrent.TimeUnit;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.rest.service.LastFMService;
import java.io.File;
import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.ConnectionPool;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
@ -70,6 +74,11 @@ public class LastFMRestClient {
public static OkHttpClient.Builder createDefaultOkHttpClientBuilder(Context context) {
return new OkHttpClient.Builder()
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
.retryOnConnectionFailure(true)
.connectTimeout(1, TimeUnit.MINUTES) // connect timeout
.writeTimeout(1, TimeUnit.MINUTES) // write timeout
.readTimeout(1, TimeUnit.MINUTES) // read timeout
.cache(createDefaultCache(context))
.addInterceptor(createCacheControlInterceptor());
}

View file

@ -1,6 +1,7 @@
package code.name.monkey.retromusic.ui.activities
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.transition.Slide
@ -15,6 +16,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
@ -91,10 +93,10 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsContrac
contentContainer.setOnScrollChangeListener { _: NestedScrollView?, _: Int, scrollY: Int, _: Int, oldScrollY: Int ->
run {
if (scrollY > oldScrollY) {
actionShuffleAll!!.setShowTitle(false)
actionShuffleAll.shrink(true)
}
if (scrollY < oldScrollY) {
actionShuffleAll!!.setShowTitle(true)
actionShuffleAll.extend(true)
}
}
}
@ -255,7 +257,12 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsContrac
val themeColor = if (PreferenceUtil.getInstance().adaptiveColor) color else ThemeStore.accentColor(this)
songTitle.setTextColor(themeColor)
moreTitle.setTextColor(themeColor)
actionShuffleAll.setColor(themeColor)
actionShuffleAll.backgroundTintList = ColorStateList.valueOf(themeColor)
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(themeColor))).apply {
actionShuffleAll.setTextColor(this)
actionShuffleAll.iconTint = this
}
}

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.ui.activities
import android.app.Activity
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Build
import android.os.Bundle
@ -18,6 +19,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
@ -89,10 +91,10 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
contentContainer.setOnScrollChangeListener { _: NestedScrollView?, _: Int, scrollY: Int, _: Int, oldScrollY: Int ->
run {
if (scrollY > oldScrollY) {
actionShuffleAll!!.setShowTitle(false)
actionShuffleAll.shrink(true)
}
if (scrollY < oldScrollY) {
actionShuffleAll!!.setShowTitle(true)
actionShuffleAll.extend(true)
}
}
}
@ -294,7 +296,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailContrac
songTitle.setTextColor(textColor)
biographyTitle.setTextColor(textColor)
actionShuffleAll.setColor(textColor)
actionShuffleAll.backgroundTintList = ColorStateList.valueOf(textColor)
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(textColor))).apply {
actionShuffleAll.setTextColor(this)
actionShuffleAll.iconTint = this
}
findViewById<View>(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this))
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.ui.activities
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.view.Menu
@ -10,6 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
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.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -59,7 +61,7 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
setUpToolBar()
setupRecyclerView()
actionShuffle.setOnClickListener { MusicPlayerRemote.openAndShuffleQueue(songAdapter!!.dataSet, true) }
actionShuffleAll.setOnClickListener { MusicPlayerRemote.openAndShuffleQueue(songAdapter!!.dataSet, true) }
}
private fun setUpToolBar() {
@ -74,7 +76,11 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
setSupportActionBar(this)
ToolbarContentTintHelper.colorBackButton(this, ThemeStore.textColorSecondary(this@GenreDetailsActivity))
}
actionShuffle.setColor(ThemeStore.accentColor(this@GenreDetailsActivity))
actionShuffleAll.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {
actionShuffleAll.setTextColor(this)
actionShuffleAll.iconTint = this
}
title = null
}
@ -128,9 +134,9 @@ class GenreDetailsActivity : AbsSlidingMusicPanelActivity(), GenreDetailsContrac
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
actionShuffle.setShowTitle(false)
actionShuffleAll.shrink(true)
} else if (dy < 0) {
actionShuffle.setShowTitle(true)
actionShuffleAll.extend(true)
}
}
})

View file

@ -1,9 +1,12 @@
package code.name.monkey.retromusic.ui.activities
import android.content.res.ColorStateList
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
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.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -69,9 +72,9 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
clearQueue.setShowTitle(false)
clearQueue.shrink(true)
} else if (dy < 0) {
clearQueue.setShowTitle(true)
clearQueue.extend(true)
}
}
})
@ -146,7 +149,12 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
setSupportActionBar(toolbar)
title = null
toolbar.setNavigationOnClickListener { onBackPressed() }
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.textColorSecondary(this))
clearQueue.setColor(ThemeStore.accentColor(this))
clearQueue.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {
clearQueue.setTextColor(this)
clearQueue.iconTint = this
}
}
}

View file

@ -1,5 +1,6 @@
package code.name.monkey.retromusic.ui.activities
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.view.Menu
@ -9,6 +10,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
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.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
@ -31,7 +33,7 @@ import com.afollestad.materialcab.MaterialCab
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.abs_playlists.*
import kotlinx.android.synthetic.main.activity_playlist_detail.*
import java.util.*
@ -102,13 +104,13 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
actionShuffle.setShowTitle(false)
actionShuffleAll.shrink(true)
} else if (dy < 0) {
actionShuffle.setShowTitle(true)
actionShuffleAll.extend(true)
}
}
})
actionShuffle.setOnClickListener {
actionShuffleAll.setOnClickListener {
if (adapter.dataSet.isEmpty()) {
return@setOnClickListener
}
@ -124,7 +126,12 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
private fun setUpToolBar() {
bannerTitle.text = playlist!!.name
bannerTitle.setTextColor(ThemeStore.textColorPrimary(this))
actionShuffle.setColor(ThemeStore.accentColor(this))
actionShuffleAll.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {
actionShuffleAll.setTextColor(this)
actionShuffleAll.iconTint = this
}
val primaryColor = ThemeStore.primaryColor(this)
toolbar!!.apply {

View file

@ -1,25 +1,29 @@
package code.name.monkey.retromusic.ui.activities
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.content.*
import android.graphics.Bitmap
import android.net.Uri
import android.os.Bundle
import android.provider.DocumentsContract
import android.provider.MediaStore
import android.provider.MediaStore.Images.Media
import android.provider.MediaStore.Images.Media.getBitmap
import android.text.TextUtils
import android.view.MenuItem
import android.widget.Toast
import androidx.core.content.FileProvider
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.Constants.USER_BANNER
import code.name.monkey.retromusic.Constants.USER_PROFILE
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.ImageUtil
import code.name.monkey.retromusic.util.ImageUtil.getResizedBitmap
import code.name.monkey.retromusic.util.PreferenceUtil
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItems
@ -46,8 +50,10 @@ class UserInfoActivity : AbsBaseActivity() {
setupToolbar()
bannerTitle.setTextColor(ThemeStore.textColorPrimary(this))
nameContainer.boxStrokeColor = ThemeStore.accentColor(this)
name!!.setText(PreferenceUtil.getInstance().userName)
MaterialUtil.setTint(nameContainer, false)
MaterialUtil.setTint(bioContainer, false)
name.setText(PreferenceUtil.getInstance().userName)
bio.setText(PreferenceUtil.getInstance().userBio)
if (!PreferenceUtil.getInstance().profileImage.isEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance().profileImage)
@ -57,7 +63,7 @@ class UserInfoActivity : AbsBaseActivity() {
}
userImage.setOnClickListener {
MaterialDialog(this).show {
title(text = "Set a profile photo")
title(text = getString(R.string.set_photo))
listItems(items = listOf(getString(R.string.new_profile_photo), getString(R.string.remove_profile_photo))) { _, position, _ ->
when (position) {
0 -> pickNewPhoto()
@ -70,12 +76,19 @@ class UserInfoActivity : AbsBaseActivity() {
showBannerOptions()
}
next.setOnClickListener {
val nameString = name!!.text!!.toString().trim { it <= ' ' }
val nameString = name.text.toString().trim { it <= ' ' }
if (TextUtils.isEmpty(nameString)) {
Toast.makeText(this, "Umm name is empty", Toast.LENGTH_SHORT).show()
return@setOnClickListener
}
val bioString = bio.text.toString().trim() { it <= ' ' }
if (TextUtils.isEmpty(bioString)) {
Toast.makeText(this, "Umm bio is empty", Toast.LENGTH_SHORT).show()
return@setOnClickListener
}
PreferenceUtil.getInstance().userName = nameString
PreferenceUtil.getInstance().userBio = bioString
setResult(Activity.RESULT_OK)
finish()
}
@ -102,7 +115,6 @@ class UserInfoActivity : AbsBaseActivity() {
}
private fun showBannerOptions() {
MaterialDialog(this).show {
title(R.string.select_banner_photo)
listItems(items = listOf(getString(R.string.new_banner_photo), getString(R.string.remove_banner_photo)))
@ -150,21 +162,60 @@ class UserInfoActivity : AbsBaseActivity() {
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null &&
data.data != null) {
if (resultCode == Activity.RESULT_OK) {
when (requestCode) {
PICK_IMAGE_REQUEST -> {
val uri = data!!.data
try {
val bitmap = getResizedBitmap(getBitmap(contentResolver, uri), PROFILE_ICON_SIZE)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
} catch (e: IOException) {
e.printStackTrace()
}
}
CROP_IMAGE_REQUEST -> {
val extras: Bundle = data?.extras!!
val selectedBitmap: Bitmap = extras.getParcelable("data");
val profileImagePath = saveToInternalStorage(selectedBitmap, USER_PROFILE)
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
PICK_BANNER_REQUEST -> {
val uri = data?.data
try {
val bitmap = getBitmap(contentResolver, uri)
val profileImagePath = saveToInternalStorage(bitmap, USER_BANNER)
PreferenceUtil.getInstance().setBannerImagePath(profileImagePath)
loadBannerFromStorage(profileImagePath)
} catch (e: IOException) {
e.printStackTrace()
}
}
CROP_BANNER_REQUEST -> {
val extras: Bundle = data?.extras!!
val selectedBitmap: Bitmap = extras.getParcelable("data");
val profileImagePath = saveToInternalStorage(selectedBitmap, USER_BANNER)
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
}
}
}
/*if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null && data.data != null) {
val picturePath = data.data
performCrop(picturePath)
} else if (requestCode == CROP_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null && data.data != null) {
val uri = data.data
try {
val bitmap = ImageUtil.getResizedBitmap(Media.getBitmap(contentResolver, uri), PROFILE_ICON_SIZE)
val profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE)
PreferenceUtil.getInstance().saveProfileImage(profileImagePath)
loadImageFromStorage(profileImagePath)
} catch (e: IOException) {
e.printStackTrace()
}
}
if (requestCode == PICK_BANNER_REQUEST && resultCode == Activity.RESULT_OK && data != null &&
} else if (requestCode == PICK_BANNER_REQUEST && resultCode == Activity.RESULT_OK && data != null &&
data.data != null) {
val uri = data.data
try {
@ -176,6 +227,80 @@ class UserInfoActivity : AbsBaseActivity() {
e.printStackTrace()
}
}*/
}
private fun getImagePathFromUri(aUri: Uri?): String? {
var imagePath: String? = null
if (aUri == null) {
return imagePath
}
if (DocumentsContract.isDocumentUri(App.context, aUri)) {
val documentId = DocumentsContract.getDocumentId(aUri)
if ("com.android.providers.media.documents" == aUri.authority) {
val id = documentId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
val selection = MediaStore.Images.Media._ID + "=" + id
imagePath = getImagePath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection)
} else if ("com.android.providers.downloads.documents" == aUri.authority) {
val contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"),
java.lang.Long.valueOf(documentId))
imagePath = getImagePath(contentUri, null)
}
} else if ("content".equals(aUri.scheme!!, ignoreCase = true)) {
imagePath = getImagePath(aUri, null)
} else if ("file".equals(aUri.scheme!!, ignoreCase = true)) {
imagePath = aUri.path
}
return imagePath
}
private fun getImagePath(aUri: Uri, aSelection: String?): String? {
var path: String? = null
val cursor = App.context.contentResolver.query(aUri, null, aSelection, null, null)
if (cursor != null) {
if (cursor.moveToFirst()) {
path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA))
}
cursor.close()
}
return path
}
private fun performBannerCrop(picturePath: Uri?) {
val photoUri = FileProvider.getUriForFile(this, "$packageName.provider", File(getImagePathFromUri(picturePath)))
try {
val cropIntent = Intent("com.android.camera.action.CROP")
cropIntent.setDataAndType(photoUri, "image/*")
cropIntent.putExtra("crop", "true")
cropIntent.putExtra("aspectX", 1)
cropIntent.putExtra("aspectY", 1)
cropIntent.putExtra("return-data", true)
cropIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
startActivityForResult(cropIntent, CROP_BANNER_REQUEST)
} catch (anfe: ActivityNotFoundException) {
val errorMessage = "your device doesn't support the crop action!"
Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show()
}
}
private fun performCrop(imageUri: Uri) {
val photoUri = FileProvider.getUriForFile(this, "$packageName.provider", File(getImagePathFromUri(imageUri)))
try {
val cropIntent = Intent("com.android.camera.action.CROP")
cropIntent.setDataAndType(photoUri, "image/*")
cropIntent.putExtra("crop", "true")
cropIntent.putExtra("aspectX", 1)
cropIntent.putExtra("aspectY", 1)
cropIntent.putExtra("outputX", 280)
cropIntent.putExtra("outputY", 280)
cropIntent.putExtra("return-data", true)
cropIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
startActivityForResult(cropIntent, CROP_IMAGE_REQUEST)
} catch (anfe: ActivityNotFoundException) {
val errorMessage = "your device doesn't support the crop action!"
Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show()
}
}
@ -225,7 +350,17 @@ class UserInfoActivity : AbsBaseActivity() {
companion object {
private const val PICK_IMAGE_REQUEST = 9002
private const val PICK_BANNER_REQUEST = 9003
private const val CROP_IMAGE_REQUEST = 9003
private const val PICK_BANNER_REQUEST = 9004
private const val CROP_BANNER_REQUEST = 9005
private const val PROFILE_ICON_SIZE = 400
}
}
fun Activity.pickImage(requestCode: Int) {
Intent(Intent.ACTION_GET_CONTENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "image/*"
startActivityForResult(this, requestCode)
}
}

View file

@ -28,7 +28,6 @@ import code.name.monkey.retromusic.ui.fragments.player.material.MaterialFragment
import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.slide.SlidePlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.tiny.TinyPlayerFragment
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
@ -195,7 +194,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
MATERIAL -> MaterialFragment()
COLOR -> ColorFragment()
TINY -> TinyPlayerFragment()
SLIDE -> SlidePlayerFragment()
//SLIDE -> SlidePlayerFragment()
else -> PlayerFragment()
} // must implement AbsPlayerFragment
supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment).commit()
@ -262,7 +261,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
(currentNowPlayingScreen == NORMAL || currentNowPlayingScreen == FLAT)) {
super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight)
} else if (currentNowPlayingScreen == FULL || (currentNowPlayingScreen == SLIDE) || currentNowPlayingScreen == CARD ||
} else if (currentNowPlayingScreen == FULL || currentNowPlayingScreen == CARD ||
currentNowPlayingScreen == FIT || /*currentNowPlayingScreen == NowPlayingScreen.CLASSIC ||*/
currentNowPlayingScreen == BLUR || currentNowPlayingScreen == BLUR_CARD) {
super.setLightStatusbar(false)
@ -308,320 +307,3 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding
}
}
/*import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.PersistableBundle
import android.view.View
import android.view.ViewGroup
import android.view.ViewTreeObserver
import androidx.annotation.FloatRange
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.ui.fragments.MiniPlayerFragment
import code.name.monkey.retromusic.ui.fragments.NowPlayingScreen
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.adaptive.AdaptiveFragment
import code.name.monkey.retromusic.ui.fragments.player.blur.BlurPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.card.CardFragment
import code.name.monkey.retromusic.ui.fragments.player.cardblur.CardBlurFragment
import code.name.monkey.retromusic.ui.fragments.player.color.ColorFragment
import code.name.monkey.retromusic.ui.fragments.player.fit.FitFragment
import code.name.monkey.retromusic.ui.fragments.player.flat.FlatPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.full.FullPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.material.MaterialFragment
import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.classic.ClassicPlayerFragment
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.views.BottomNavigationBarTinted
import com.sothree.slidinguppanel.SlidingUpPanelLayout
import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState
import kotlinx.android.synthetic.main.sliding_music_panel_layout.*
abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), SlidingUpPanelLayout.PanelSlideListener, AbsPlayerFragment.Callbacks {
private var miniPlayerFragment: MiniPlayerFragment? = null
private var playerFragment: AbsPlayerFragment? = null
private var currentNowPlayingScreen: NowPlayingScreen? = null
private var navigationbarColor: Int = 0
private var taskColor: Int = 0
private var lightStatusbar: Boolean = false
private var lightNavigationBar: Boolean = false
private var navigationBarColorAnimator: ValueAnimator? = null
private val argbEvaluator = ArgbEvaluator()
val panelState: SlidingUpPanelLayout.PanelState?
get() = slidingLayout.panelState
private val isOneOfTheseThemes: Boolean
get() = (currentNowPlayingScreen == NowPlayingScreen.ADAPTIVE)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(createContentView())
chooseFragmentForTheme()
setupSlidingUpPanel()
}
fun setBottomBarVisibility(gone: Int) {
bottomNavigationView.visibility = gone
hideBottomBar(false)
}
protected abstract fun createContentView(): View
override fun onServiceConnected() {
super.onServiceConnected()
if (!MusicPlayerRemote.playingQueue.isEmpty()) {
slidingLayout.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
slidingLayout.viewTreeObserver.removeOnGlobalLayoutListener(this)
hideBottomBar(false)
}
})
} // don't call hideBottomBar(true) here as it causes a bug with the SlidingUpPanelLayout
}
override fun onQueueChanged() {
super.onQueueChanged()
hideBottomBar(MusicPlayerRemote.playingQueue.isEmpty())
}
fun hideBottomBar(hide: Boolean) {
val heightOfBar = resources.getDimensionPixelSize(R.dimen.mini_player_height)
val heightOfBarWithTabs = resources.getDimensionPixelSize(R.dimen.mini_player_height_expanded)
if (hide) {
slidingLayout.panelHeight = 0
collapsePanel()
} else {
if (!MusicPlayerRemote.playingQueue.isEmpty()) {
slidingLayout.panelHeight = if (bottomNavigationView.visibility == View.VISIBLE) heightOfBarWithTabs else heightOfBar
}
}
}
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
@SuppressLint("InflateParams")
val slidingMusicPanelLayout = layoutInflater.inflate(R.layout.sliding_music_panel_layout, null)
val contentContainer = slidingMusicPanelLayout.findViewById<ViewGroup>(R.id.mainContentFrame)
layoutInflater.inflate(resId, contentContainer)
return slidingMusicPanelLayout
}
override fun onBackPressed() {
if (!handleBackPress())
super.onBackPressed()
}
open fun handleBackPress(): Boolean {
if (slidingLayout.panelHeight != 0 && playerFragment!!.onBackPressed())
return true
if (panelState == SlidingUpPanelLayout.PanelState.EXPANDED) {
collapsePanel()
return true
}
return false
}
fun toggleBottomNavigationView(toggle: Boolean) {
bottomNavigationView.visibility = if (toggle) View.GONE else View.VISIBLE
}
fun getBottomNavigationView(): BottomNavigationBarTinted {
return bottomNavigationView
}
private fun setupSlidingUpPanel() {
slidingLayout.viewTreeObserver
.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
slidingLayout.viewTreeObserver.removeOnGlobalLayoutListener(this)
if (panelState == PanelState.EXPANDED) {
onPanelSlide(slidingLayout, 1f)
onPanelExpanded()
} else if (panelState == PanelState.COLLAPSED) {
onPanelCollapsed()
} else {
playerFragment!!.onHide()
}
}
})
slidingLayout.addPanelSlideListener(this)
}
override fun onPanelSlide(panel: View?, slideOffset: Float) {
setMiniPlayerAlphaProgress(slideOffset)
}
override fun onPanelStateChanged(panel: View, previousState: PanelState, newState: PanelState) {
when (newState) {
SlidingUpPanelLayout.PanelState.COLLAPSED -> onPanelCollapsed()
SlidingUpPanelLayout.PanelState.EXPANDED -> onPanelExpanded()
SlidingUpPanelLayout.PanelState.ANCHORED -> collapsePanel() // this fixes a bug where the panel would get stuck for some reason
else -> {
}
}
}
open fun onPanelCollapsed() {
// restore values
super.setLightStatusbar(lightStatusbar)
super.setTaskDescriptionColor(taskColor)
super.setNavigationbarColor(navigationbarColor)
super.setLightNavigationBar(lightNavigationBar)
playerFragment!!.setMenuVisibility(false)
playerFragment!!.userVisibleHint = false
playerFragment!!.onHide()
}
open fun onPanelExpanded() {
val playerFragmentColor = playerFragment!!.paletteColor
super.setTaskDescriptionColor(playerFragmentColor)
playerFragment!!.setMenuVisibility(true)
playerFragment!!.userVisibleHint = true
playerFragment!!.onShow()
onPaletteColorChanged()
}
private fun setMiniPlayerAlphaProgress(@FloatRange(from = 0.0, to = 1.0) progress: Float) {
if (miniPlayerFragment!!.view == null) return
val alpha = 1 - progress
miniPlayerFragment!!.view!!.alpha = alpha
// necessary to make the views below clickable
miniPlayerFragment!!.view!!.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
bottomNavigationView.translationY = progress * 500
bottomNavigationView.alpha = alpha
}
private fun chooseFragmentForTheme() {
currentNowPlayingScreen = PreferenceUtil.getInstance().nowPlayingScreen
val fragment: Fragment = when (currentNowPlayingScreen) {
NowPlayingScreen.BLUR -> BlurPlayerFragment()
NowPlayingScreen.ADAPTIVE -> AdaptiveFragment()
NowPlayingScreen.NORMAL -> PlayerFragment()
NowPlayingScreen.CARD -> CardFragment()
NowPlayingScreen.BLUR_CARD -> CardBlurFragment()
NowPlayingScreen.FIT -> FitFragment()
NowPlayingScreen.FLAT -> FlatPlayerFragment()
NowPlayingScreen.FULL -> FullPlayerFragment()
NowPlayingScreen.PLAIN -> PlainPlayerFragment()
NowPlayingScreen.SIMPLE -> SimplePlayerFragment()
NowPlayingScreen.MATERIAL -> MaterialFragment()
NowPlayingScreen.COLOR -> ColorFragment()
NowPlayingScreen.CLASSIC -> ClassicPlayerFragment()
else -> PlayerFragment()
} // must implement AbsPlayerFragment
supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment).commit()
supportFragmentManager.executePendingTransactions()
playerFragment = supportFragmentManager.findFragmentById(R.id.playerFragmentContainer) as AbsPlayerFragment
miniPlayerFragment = supportFragmentManager.findFragmentById(R.id.miniPlayerFragment) as MiniPlayerFragment
miniPlayerFragment!!.view!!.setOnClickListener { expandPanel() }
}
override fun onResume() {
super.onResume()
if (currentNowPlayingScreen != PreferenceUtil.getInstance().nowPlayingScreen) {
postRecreate()
}
}
private fun collapsePanel() {
slidingLayout.panelState = PanelState.COLLAPSED
}
fun expandPanel() {
slidingLayout.panelState = PanelState.EXPANDED
}
override fun onPaletteColorChanged() {
if (panelState == PanelState.EXPANDED) {
val paletteColor = playerFragment!!.paletteColor
super.setTaskDescriptionColor(paletteColor)
val isColorLight = ColorUtil.isColorLight(paletteColor)
if (PreferenceUtil.getInstance().adaptiveColor &&
(currentNowPlayingScreen == NowPlayingScreen.NORMAL || currentNowPlayingScreen == NowPlayingScreen.FLAT)) {
super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight)
} else if (currentNowPlayingScreen == NowPlayingScreen.FULL || currentNowPlayingScreen == NowPlayingScreen.CARD ||
currentNowPlayingScreen == NowPlayingScreen.FIT || currentNowPlayingScreen == NowPlayingScreen.CLASSIC||
currentNowPlayingScreen == NowPlayingScreen.BLUR || currentNowPlayingScreen == NowPlayingScreen.BLUR_CARD) {
super.setLightStatusbar(false)
super.setLightNavigationBar(true)
} else if (currentNowPlayingScreen == NowPlayingScreen.COLOR) {
super.setNavigationbarColor(paletteColor)
super.setLightNavigationBar(isColorLight)
super.setLightStatusbar(isColorLight)
} else {
super.setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)))
super.setLightNavigationBar(true)
}
}
}
override fun setLightStatusbar(enabled: Boolean) {
lightStatusbar = enabled
if (panelState == PanelState.COLLAPSED) {
super.setLightStatusbar(enabled)
}
}
override fun setLightNavigationBar(enabled: Boolean) {
lightNavigationBar = enabled
if (panelState == PanelState.COLLAPSED) {
super.setLightNavigationBar(enabled)
}
}
override fun setNavigationbarColor(color: Int) {
navigationbarColor = color
if (panelState == PanelState.COLLAPSED) {
if (navigationBarColorAnimator != null) navigationBarColorAnimator!!.cancel()
super.setNavigationbarColor(color)
}
}
override fun setTaskDescriptionColor(color: Int) {
taskColor = color
if (panelState == PanelState.COLLAPSED) {
super.setTaskDescriptionColor(color)
}
}
override fun onDestroy() {
super.onDestroy()
if (navigationBarColorAnimator != null) navigationBarColorAnimator!!.cancel() // just in case
}
companion object {
val TAG: String = AbsSlidingMusicPanelActivity::class.java.simpleName
}
fun setAntiDragView( antiDragView:View ) {
slidingLayout.setAntiDragView(antiDragView);
}
}*/

View file

@ -3,6 +3,7 @@ package code.name.monkey.retromusic.ui.activities.tageditor
import android.app.Activity
import android.app.SearchManager
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
@ -12,12 +13,15 @@ import android.view.MenuItem
import android.view.View
import android.view.animation.OvershootInterpolator
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.util.RetroUtil
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItems
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import kotlinx.android.synthetic.main.activity_album_tag_editor.*
import org.jaudiotagger.audio.AudioFile
import org.jaudiotagger.audio.AudioFileIO
@ -32,6 +36,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
private var paletteColorPrimary: Int = 0
private var isInNoImageMode: Boolean = false
private var songPaths: List<String>? = null
lateinit var saveFab: ExtendedFloatingActionButton
protected val show: MaterialDialog
get() = MaterialDialog(this@AbsTagEditorActivity).show {
@ -169,7 +174,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
super.onCreate(savedInstanceState)
setContentView(contentViewLayout)
saveFab = findViewById(R.id.saveTags)
getIntentExtras()
songPaths = getSongPaths()
@ -206,9 +211,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
private fun startImagePicker() {
val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.type = "image/*"
startActivityForResult(
Intent.createChooser(intent, getString(R.string.pick_from_local_storage)),
REQUEST_CODE_SELECT_IMAGE)
startActivityForResult(Intent.createChooser(intent, getString(R.string.pick_from_local_storage)), REQUEST_CODE_SELECT_IMAGE)
}
protected abstract fun loadCurrentImage()
@ -220,8 +223,11 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
protected abstract fun deleteImage()
private fun setUpFab() {
saveFab.setColor(ThemeStore.accentColor(this))
saveFab.setShowTitle(true)
saveFab.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this))
ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.accentColor(this)))).apply {
saveFab.setTextColor(this)
saveFab.iconTint = this
}
saveFab.apply {
scaleX = 0f
scaleY = 0f

View file

@ -14,6 +14,7 @@ import android.widget.Toast
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
@ -89,6 +90,12 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
private fun setUpViews() {
fillViewsWithFileTags()
MaterialUtil.setTint(yearContainer, false)
MaterialUtil.setTint(genreContainer, false)
MaterialUtil.setTint(albumTitleContainer, false)
MaterialUtil.setTint(albumArtistContainer, false)
albumText.addTextChangedListener(this)
albumArtistText.addTextChangedListener(this)
genreTitle.addTextChangedListener(this)

View file

@ -6,6 +6,7 @@ import android.text.Editable
import android.text.TextWatcher
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.loaders.SongLoader
@ -43,6 +44,16 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
private fun setUpViews() {
fillViewsWithFileTags()
MaterialUtil.setTint(songTextContainer)
MaterialUtil.setTint(composerContainer, false)
MaterialUtil.setTint(albumTextContainer, false)
MaterialUtil.setTint(artistContainer, false)
MaterialUtil.setTint(albumArtistContainer, false)
MaterialUtil.setTint(yearContainer, false)
MaterialUtil.setTint(genreContainer, false)
MaterialUtil.setTint(trackNumberContainer, false)
MaterialUtil.setTint(lyricsContainer, false)
albumText.addTextChangedListener(this)
songText.addTextChangedListener(this)
albumText.addTextChangedListener(this)

View file

@ -4,12 +4,13 @@ import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.glide.GlideApp
import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.util.RetroUtil.openUrl
import code.name.monkey.retromusic.views.NetworkImageView
import code.name.monkey.retromusic.views.CircularImageView
class ContributorAdapter(private var contributors: List<Contributor>) : RecyclerView.Adapter<ContributorAdapter.ViewHolder>() {
@ -20,29 +21,28 @@ class ContributorAdapter(private var contributors: List<Contributor>) : Recycler
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val contributor = contributors[position]
holder.bindData(contributor)
holder.itemView.setOnClickListener {
openUrl(it!!.context as Activity, contributors[position].link)
}
}
override fun getItemCount(): Int {
return contributors.size
}
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val title: TextView = itemView.findViewById(R.id.title)
val text: TextView = itemView.findViewById(R.id.text)
val image: CircularImageView = itemView.findViewById(R.id.image)
internal fun bindData(contributor: Contributor) {
if (title != null) {
title!!.text = contributor.name
}
if (text != null) {
text!!.text = contributor.summary
}
if (image is NetworkImageView) {
(image as NetworkImageView).setImageUrl(contributor.profileImage)
}
}
override fun onClick(v: View?) {
super.onClick(v)
openUrl(v!!.context as Activity, contributors[adapterPosition].link)
title.text = contributor.name
text.text = contributor.summary
GlideApp.with(image.context)
.load(contributor.profileImage)
.error(R.drawable.ic_person_flat)
.placeholder(R.drawable.ic_person_flat)
.into(image)
}
}
}

View file

@ -31,7 +31,7 @@ import code.name.monkey.retromusic.views.MetalRecyclerViewPager
import com.google.android.material.floatingactionbutton.FloatingActionButton
class HomeAdapter(private val activity: AppCompatActivity, private val homes: List<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
class HomeAdapter(private val activity: AppCompatActivity, private var homes: List<Home>, private val displayMetrics: DisplayMetrics) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun getItemViewType(position: Int): Int {
@ -81,6 +81,11 @@ class HomeAdapter(private val activity: AppCompatActivity, private val homes: Li
return homes.size
}
fun swapData(finalList: List<Home>) {
homes = finalList
notifyDataSetChanged()
}
companion object {
@IntDef(SUGGESTIONS, RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, GENRES, PLAYLISTS)

View file

@ -22,6 +22,6 @@ enum class NowPlayingScreen constructor(@param:StringRes @field:StringRes
PLAIN(R.string.plain, R.drawable.np_plain, 3),
TINY(R.string.tiny, R.drawable.np_tiny, 7),
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
SLIDE(R.string.slide, R.drawable.np_slide, 13)
//SLIDE(R.string.slide, R.drawable.np_slide, 13)
}

View file

@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.ViewUtil
import com.google.android.material.appbar.AppBarLayout
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
@ -64,10 +65,10 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
private fun checkForPadding() {
val height = if (MusicPlayerRemote.playingQueue.isEmpty())
resources.getDimensionPixelSize(R.dimen.mini_player_height)
DensityUtil.dip2px(context!!, 52f)
else
0
recyclerView.setPadding(0, 0, 0, height)
recyclerView.setPadding(0, 0, 0, (height * 2.3).toInt())
}
private fun initLayoutManager() {

View file

@ -16,14 +16,13 @@ open class AbsMusicServiceFragment : Fragment(), MusicServiceEventListener {
var playerActivity: AbsMusicServiceActivity? = null
private set
override fun onAttach(context: Context?) {
override fun onAttach(context: Context) {
super.onAttach(context)
try {
playerActivity = context as AbsMusicServiceActivity?
} catch (e: ClassCastException) {
throw RuntimeException(context!!.javaClass.simpleName + " must be an instance of " + AbsMusicServiceActivity::class.java.simpleName)
throw RuntimeException(context.javaClass.simpleName + " must be an instance of " + AbsMusicServiceActivity::class.java.simpleName)
}
}
override fun onDetach() {

View file

@ -8,39 +8,38 @@ import android.media.MediaMetadataRetriever
import android.os.AsyncTask
import android.os.Bundle
import android.provider.MediaStore
import android.text.TextUtils
import android.view.MenuItem
import android.view.View
import android.widget.Toast
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.dialogs.*
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.PaletteColorHolder
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.ui.activities.tageditor.AbsTagEditorActivity
import code.name.monkey.retromusic.ui.activities.tageditor.SongTagEditorActivity
import code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.*
import code.name.monkey.retromusic.views.FitSystemWindowsLayout
import java.io.FileNotFoundException
abstract class AbsPlayerFragment : AbsMusicServiceFragment(), Toolbar.OnMenuItemClickListener, PaletteColorHolder, PlayerAlbumCoverFragment.Callbacks {
var callbacks: Callbacks? = null
private set
private var updateIsFavoriteTask: AsyncTask<*, *, *>? = null
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
private var playerAlbumCoverFragment: PlayerAlbumCoverFragment? = null
override fun onAttach(context: Context?) {
override fun onAttach(context: Context) {
super.onAttach(context)
try {
callbacks = context as Callbacks?
} catch (e: ClassCastException) {
throw RuntimeException(context!!.javaClass.simpleName + " must implement " + Callbacks::class.java.simpleName)
throw RuntimeException(context.javaClass.simpleName + " must implement " + Callbacks::class.java.simpleName)
}
}
@ -158,16 +157,21 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(), Toolbar.OnMenuItem
override fun onServiceConnected() {
updateIsFavorite()
updateLyrics()
}
override fun onPlayingMetaChanged() {
updateIsFavorite()
updateLyrics()
}
override fun onDestroyView() {
if (updateIsFavoriteTask != null && !updateIsFavoriteTask!!.isCancelled) {
updateIsFavoriteTask!!.cancel(true)
}
if (updateLyricsAsyncTask != null && !updateLyricsAsyncTask!!.isCancelled) {
updateLyricsAsyncTask!!.cancel(true)
}
super.onDestroyView()
}
@ -202,16 +206,58 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(), Toolbar.OnMenuItem
}.execute(MusicPlayerRemote.currentSong)
}
@SuppressLint("StaticFieldLeak")
private fun updateLyrics() {
if (updateLyricsAsyncTask != null) updateLyricsAsyncTask!!.cancel(false)
updateLyricsAsyncTask = object : AsyncTask<Song, Void, Lyrics>() {
override fun onPreExecute() {
super.onPreExecute()
setLyrics(null)
}
override fun doInBackground(vararg params: Song): Lyrics? {
try {
var data: String? = LyricUtil.getStringFromFile(params[0].title, params[0].artistName)
return if (TextUtils.isEmpty(data)) {
data = MusicUtil.getLyrics(params[0])
return if (TextUtils.isEmpty(data)) {
null
} else {
Lyrics.parse(params[0], data)
}
} else Lyrics.parse(params[0], data!!)
} catch (err: FileNotFoundException) {
return null
}
}
override fun onPostExecute(l: Lyrics?) {
setLyrics(l)
}
override fun onCancelled(s: Lyrics?) {
onPostExecute(null)
}
}.execute(MusicPlayerRemote.currentSong)
}
open fun setLyrics(l: Lyrics?) {
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(ThemeStore.primaryColor(activity!!))
if (PreferenceUtil.getInstance().fullScreenMode && view.findViewById<View>(R.id.status_bar) != null) {
view.findViewById<View>(R.id.status_bar).visibility = View.GONE
}
playerAlbumCoverFragment = childFragmentManager.findFragmentById(R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment?
playerAlbumCoverFragment?.setCallbacks(this)
}
fun setSafeArea(safeArea: View) {
val layout = safeArea.findViewById<FitSystemWindowsLayout>(code.name.monkey.retromusic.R.id.safeArea)
val layout = safeArea.findViewById<FitSystemWindowsLayout>(R.id.safeArea)
if (layout != null) {
layout.isFit = !PreferenceUtil.getInstance().fullScreenMode
}
@ -224,6 +270,7 @@ abstract class AbsPlayerFragment : AbsMusicServiceFragment(), Toolbar.OnMenuItem
companion object {
val TAG: String = AbsPlayerFragment::class.java.simpleName
const val VISIBILITY_ANIM_DURATION: Long = 300
}
protected fun getUpNextAndQueueTime(): String {

View file

@ -72,10 +72,9 @@ class GenreFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLa
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
menu!!.removeItem(R.id.action_sort_order)
menu.removeItem(R.id.action_sort_order)
menu.removeItem(R.id.action_grid_size)
menu.removeItem(R.id.action_new_playlist)
}

View file

@ -1,7 +1,6 @@
package code.name.monkey.retromusic.ui.fragments.mainactivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -35,17 +34,12 @@ import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog;
import code.name.monkey.retromusic.dialogs.SleepTimerDialog;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.SortOrder;
import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.ui.activities.SettingsActivity;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.util.Compressor;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
@ -242,7 +236,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
setUpSortOrderMenu(fragment, menu.findItem(R.id.action_sort_order).getSubMenu());
} else {
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title);
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title).setIcon(R.drawable.ic_playlist_add_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
menu.removeItem(R.id.action_grid_size);
}
Activity activity = getActivity();
@ -387,22 +381,6 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
case R.id.action_new_playlist:
CreatePlaylistDialog.Companion.create().show(getChildFragmentManager(), "CREATE_PLAYLIST");
return true;
case R.id.action_shuffle_all:
MusicPlayerRemote.INSTANCE.openAndShuffleQueue(SongLoader.INSTANCE.getAllSongs(getContext())
.blockingFirst(), true);
return true;
case R.id.action_equalizer:
NavigationUtil.openEqualizer(getActivity());
return true;
case R.id.action_sleep_timer:
if (getFragmentManager() != null) {
new SleepTimerDialog().show(getFragmentManager(), TAG);
}
return true;
case R.id.action_settings:
startActivity(new Intent(getContext(), SettingsActivity.class));
break;
}
return super.onOptionsItemSelected(item);
}

View file

@ -77,11 +77,12 @@ class PlaylistsFragment : AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, L
adapter!!.swapDataSet(list)
}
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
menu!!.removeItem(R.id.action_shuffle_all)
menu.removeItem(R.id.action_sort_order)
menu.removeItem(R.id.action_grid_size)
menu.apply {
removeItem(R.id.action_sort_order)
removeItem(R.id.action_grid_size)
}
}
companion object {

View file

@ -31,6 +31,7 @@ import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import com.bumptech.glide.load.engine.DiskCacheStrategy
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
@ -38,6 +39,7 @@ import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.fragment_banner_home.*
import java.io.File
import java.util.*
import kotlin.collections.ArrayList
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
override fun showEmpty() {
@ -166,8 +168,20 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
contentContainerView.setBackgroundColor(ThemeStore.primaryColor(context!!))
setupToolbar()
homeAdapter = HomeAdapter(mainActivity, ArrayList(), displayMetrics)
homePresenter.subscribe()
checkPadding()
}
private fun checkPadding() {
val marginSpan = when {
MusicPlayerRemote.playingQueue.isEmpty() -> RetroUtil.convertDpToPixel(52f, context).toInt()
else -> RetroUtil.convertDpToPixel(0f, context).toInt()
}
(recyclerView.layoutParams as ViewGroup.MarginLayoutParams).bottomMargin = (marginSpan * 2.3f).toInt()
}
private fun setupToolbar() {
@ -210,10 +224,22 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
}
override fun onServiceConnected() {
super.onServiceConnected()
checkPadding()
}
override fun onQueueChanged() {
super.onQueueChanged()
checkPadding()
}
private lateinit var homeAdapter: HomeAdapter
override fun showData(list: ArrayList<Home>) {
val finalList = list.sortedWith(compareBy { it.priority })
homeAdapter.swapData(finalList)
recyclerView.apply {
val homeAdapter = HomeAdapter(mainActivity, finalList, displayMetrics)
layoutManager = LinearLayoutManager(mainActivity)
adapter = homeAdapter
}

View file

@ -4,9 +4,13 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.viewpager.widget.ViewPager
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.transform.CarousalPagerTransformer
import code.name.monkey.retromusic.transform.ParallaxPagerTransformer
import code.name.monkey.retromusic.ui.adapter.album.AlbumCoverPagerAdapter
@ -17,6 +21,10 @@ import kotlinx.android.synthetic.main.fragment_player_album_cover.*
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
private var callbacks: Callbacks? = null
private var currentPosition: Int = 0
private val colorReceiver = object : AlbumCoverPagerAdapter.AlbumCoverFragment.ColorReceiver {
@ -28,7 +36,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
}
fun removeSlideEffect() {
val transformer = ParallaxPagerTransformer(R.id.player_image)
val transformer = ParallaxPagerTransformer(code.name.monkey.retromusic.R.id.player_image)
transformer.setSpeed(0.3f)
viewPager.setPageTransformer(true, transformer)
@ -36,11 +44,13 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_player_album_cover, container, false)
return inflater.inflate(code.name.monkey.retromusic.R.layout.fragment_player_album_cover, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewPager.addOnPageChangeListener(this)
//noinspection ConstantConditions
if (PreferenceUtil.getInstance().carouselEffect() &&
@ -55,10 +65,13 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
viewPager.offscreenPageLimit = 2
viewPager.setPageTransformer(true, PreferenceUtil.getInstance().albumCoverTransform)
}
}
override fun onDestroyView() {
super.onDestroyView()
viewPager.removeOnPageChangeListener(this)
}
@ -125,7 +138,11 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
}
companion object {
val TAG: String = PlayerAlbumCoverFragment::class.java.simpleName
}
}

View file

@ -113,7 +113,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Call
private lateinit var wrappedAdapter: RecyclerView.Adapter<*>
private lateinit var recyclerViewDragDropManager: RecyclerViewDragDropManager
private var lyrics: Lyrics? = null
private var lyricsClassic: Lyrics? = null
private lateinit var impl: Impl
@ -335,7 +335,7 @@ class PortraitImpl(private val fragment: ClassicPlayerFragment) : BaseImpl(fragm
return true
}
code.name.monkey.retromusic.R.id.action_share -> {
SongShareDialog.create(song).show(fragment.fragmentManager, "SONG_SHARE_DIALOG")
SongShareDialog.create(song).show(fragment.fragmentManager!!, "SONG_SHARE_DIALOG")
return true
}
}

View file

@ -58,7 +58,7 @@ class ColorFragment : AbsPlayerFragment() {
private var valueAnimator: ValueAnimator? = null
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
private var lyrics: Lyrics? = null
private var lyricsColor: Lyrics? = null
override fun onShow() {
playbackControlsFragment!!.show()
@ -250,7 +250,7 @@ class ColorFragment : AbsPlayerFragment() {
updateLyricsAsyncTask = object : AsyncTask<Void?, Void?, Lyrics?>() {
override fun onPreExecute() {
super.onPreExecute()
lyrics = null
lyricsColor = null
playerToolbar.menu.removeItem(R.id.action_show_lyrics)
}
@ -262,11 +262,11 @@ class ColorFragment : AbsPlayerFragment() {
}
override fun onPostExecute(l: Lyrics?) {
lyrics = l
if (lyrics == null) {
lyricsColor = l
if (lyricsColor == null) {
lyricsView.setText(R.string.no_lyrics_found)
} else {
lyricsView.text = lyrics!!.text
lyricsView.text = lyricsColor!!.text
}
}

View file

@ -5,6 +5,8 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R
@ -14,8 +16,11 @@ import code.name.monkey.retromusic.glide.GlideApp
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.helper.MusicProgressViewUpdateHelper
import code.name.monkey.retromusic.loaders.ArtistLoader
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment
import code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment
import code.name.monkey.retromusic.util.NavigationUtil
@ -24,7 +29,85 @@ import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.fragment_full.*
class FullPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
class FullPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks, MusicProgressViewUpdateHelper.Callback {
private lateinit var lyricsLayout: FrameLayout
private lateinit var lyricsLine1: TextView
private lateinit var lyricsLine2: TextView
private var lyrics: Lyrics? = null
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
override fun onUpdateProgressViews(progress: Int, total: Int) {
if (!isLyricsLayoutBound()) return
if (!isLyricsLayoutVisible()) {
hideLyricsLayout()
return
}
if (lyrics !is AbsSynchronizedLyrics) return
val synchronizedLyrics = lyrics as AbsSynchronizedLyrics
lyricsLayout.visibility = View.VISIBLE
lyricsLayout.alpha = 1f
val oldLine = lyricsLine2.text.toString()
val line = synchronizedLyrics.getLine(progress)
if (oldLine != line || oldLine.isEmpty()) {
lyricsLine1.text = oldLine
lyricsLine2.text = line
lyricsLine1.visibility = View.VISIBLE
lyricsLine2.visibility = View.VISIBLE
lyricsLine2.measure(View.MeasureSpec.makeMeasureSpec(lyricsLine2.measuredWidth, View.MeasureSpec.EXACTLY), View.MeasureSpec.UNSPECIFIED)
val h: Float = lyricsLine2.measuredHeight.toFloat()
lyricsLine1.alpha = 1f
lyricsLine1.translationY = 0f
lyricsLine1.animate().alpha(0f).translationY(-h).duration = VISIBILITY_ANIM_DURATION
lyricsLine2.alpha = 0f
lyricsLine2.translationY = h
lyricsLine2.animate().alpha(1f).translationY(0f).duration = VISIBILITY_ANIM_DURATION
}
}
private fun isLyricsLayoutVisible(): Boolean {
return lyrics != null && lyrics!!.isSynchronized && lyrics!!.isValid
}
private fun isLyricsLayoutBound(): Boolean {
return lyricsLayout != null && lyricsLine1 != null && lyricsLine2 != null
}
private fun hideLyricsLayout() {
lyricsLayout.animate().alpha(0f).setDuration( VISIBILITY_ANIM_DURATION).withEndAction(Runnable {
if (!isLyricsLayoutBound()) return@Runnable
lyricsLayout.visibility = View.GONE
lyricsLine1.text = null
lyricsLine2.text = null
})
}
override fun setLyrics(l: Lyrics?) {
lyrics = l
if (!isLyricsLayoutBound()) return
if (!isLyricsLayoutVisible()) {
hideLyricsLayout()
return
}
lyricsLine1.text = null
lyricsLine2.text = null
lyricsLayout.visibility = View.VISIBLE
lyricsLayout.animate().alpha(1f).duration = VISIBILITY_ANIM_DURATION
}
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -48,11 +131,17 @@ class FullPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbac
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
lyricsLayout = view.findViewById(R.id.player_lyrics)
lyricsLine1 = view.findViewById(R.id.player_lyrics_line1)
lyricsLine2 = view.findViewById(R.id.player_lyrics_line2)
setUpSubFragments()
setUpPlayerToolbar()
setupArtist()
nextSong.isSelected = true
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this, 500, 1000)
progressViewUpdateHelper.start()
}
private fun setupArtist() {
@ -118,6 +207,7 @@ class FullPlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbac
override fun onDestroyView() {
super.onDestroyView()
progressViewUpdateHelper.stop()
compositeDisposable.dispose()
}

View file

@ -69,21 +69,12 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
lastColor = color
callbacks!!.onPaletteColorChanged()
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, code.name.monkey.retromusic.R.attr.iconColor), activity)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
if (PreferenceUtil.getInstance().adaptiveColor) {
colorize(color)
}
val display = activity?.windowManager?.defaultDisplay
val outMetrics = DisplayMetrics()
display?.getMetrics(outMetrics)
val density = resources.displayMetrics.density
val dpWidth = outMetrics.widthPixels / density
playerAlbumCoverContainer?.layoutParams?.height = RetroUtil.convertDpToPixel((dpWidth - getCutOff()), context!!).toInt()
}
private fun getCutOff(): Int {
@ -105,7 +96,7 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(code.name.monkey.retromusic.R.layout.fragment_player, container, false)
return inflater.inflate(R.layout.fragment_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -113,12 +104,22 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
setUpSubFragments()
setUpPlayerToolbar()
snowfall.visibility = if (PreferenceUtil.getInstance().isSnowFall) View.VISIBLE else View.GONE
val display = activity?.windowManager?.defaultDisplay
val outMetrics = DisplayMetrics()
display?.getMetrics(outMetrics)
val density = resources.displayMetrics.density
val dpWidth = outMetrics.widthPixels / density
playerAlbumCoverContainer?.layoutParams?.height = RetroUtil.convertDpToPixel((dpWidth - getCutOff()), context!!).toInt()
}
private fun setUpSubFragments() {
playbackControlsFragment = childFragmentManager.findFragmentById(code.name.monkey.retromusic.R.id.playbackControlsFragment) as PlayerPlaybackControlsFragment
val playerAlbumCoverFragment = childFragmentManager.findFragmentById(code.name.monkey.retromusic.R.id.playerAlbumCoverFragment) as PlayerAlbumCoverFragment
playerAlbumCoverFragment.setCallbacks(this)
playbackControlsFragment = childFragmentManager.findFragmentById(R.id.playbackControlsFragment) as PlayerPlaybackControlsFragment
}
private fun setUpPlayerToolbar() {
@ -126,7 +127,7 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
playerToolbar.setNavigationOnClickListener { activity!!.onBackPressed() }
playerToolbar.setOnMenuItemClickListener(this)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, code.name.monkey.retromusic.R.attr.iconColor), activity)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, ATHUtil.resolveColor(context, R.attr.iconColor), activity)
}
override fun onServiceConnected() {
@ -144,7 +145,6 @@ class PlayerFragment : AbsPlayerFragment(), PlayerAlbumCoverFragment.Callbacks {
companion object {
fun newInstance(): PlayerFragment {
return PlayerFragment()
}

View file

@ -71,10 +71,11 @@ abstract class AbsSettingsFragment : PreferenceFragmentCompat() {
if (dialogFragment != null) {
// The dialog was created (it was one of our custom Preferences), show the dialog for it
dialogFragment.setTargetFragment(this, 0);
dialogFragment.show(this.fragmentManager, "android.support.v7.preference.PreferenceFragment.DIALOG");
dialogFragment.show(this.fragmentManager!!, "android.support.v7.preference.PreferenceFragment.DIALOG");
} else {
// Dialog creation could not be handled here. Try with the super method.
super.onDisplayPreferenceDialog(preference);
}
}
}

View file

@ -1,12 +1,9 @@
package code.name.monkey.retromusic.ui.fragments.settings
import android.content.Intent
import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.media.audiofx.AudioEffect
import android.os.Bundle
import androidx.preference.Preference
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
@ -17,7 +14,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
class AudioSettings : AbsSettingsFragment() {
override fun invalidateSettings() {
val findPreference = findPreference("equalizer")
val findPreference: Preference = findPreference("equalizer")!!
if (!hasEqualizer() && PreferenceUtil.getInstance().selectedEqualizer != "retro") {
findPreference.isEnabled = false
findPreference.summary = resources.getString(R.string.no_equalizer)

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.ui.fragments.settings
import android.os.Bundle
import android.view.View
import androidx.preference.Preference
import code.name.monkey.retromusic.R
/**
@ -10,7 +11,7 @@ import code.name.monkey.retromusic.R
class ImageSettingFragment : AbsSettingsFragment() {
override fun invalidateSettings() {
val autoDownloadImagesPolicy = findPreference("auto_download_images_policy")
val autoDownloadImagesPolicy: Preference = findPreference("auto_download_images_policy")!!
setSummary(autoDownloadImagesPolicy)
autoDownloadImagesPolicy.setOnPreferenceChangeListener { _, o ->
setSummary(autoDownloadImagesPolicy, o)
@ -25,7 +26,7 @@ class ImageSettingFragment : AbsSettingsFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val preference = findPreference("auto_download_images_policy")
val preference: Preference = findPreference("auto_download_images_policy")!!
setSummary(preference)
}
}

View file

@ -3,10 +3,8 @@ package code.name.monkey.retromusic.ui.fragments.settings
import android.os.Build
import android.os.Bundle
import androidx.preference.TwoStatePreference
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.PreferenceUtil
/**
@ -15,7 +13,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
class NotificationSettingsFragment : AbsSettingsFragment() {
override fun invalidateSettings() {
val classicNotification = findPreference("classic_notification") as TwoStatePreference
val classicNotification: TwoStatePreference = findPreference("classic_notification")!!
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
classicNotification.isVisible = false
} else {

View file

@ -3,10 +3,10 @@ package code.name.monkey.retromusic.ui.fragments.settings
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import androidx.preference.Preference
import androidx.preference.TwoStatePreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.PreferenceUtil.*
/**
@ -19,7 +19,7 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
updateNowPlayingScreenSummary()
updateAlbumCoverStyleSummary()
val carouselEffect = findPreference("carousel_effect") as TwoStatePreference
val carouselEffect: TwoStatePreference = findPreference("carousel_effect")!!
carouselEffect.setOnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean && !App.isProVersion) {
showProToastAndNavigate(activity!!.getString(R.string.pref_title_toggle_carousel_effect))
@ -34,17 +34,19 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
}
private fun updateAlbumCoverStyleSummary() {
findPreference(ALBUM_COVER_STYLE).setSummary(getInstance().albumCoverStyle.titleRes)
val preference: Preference = findPreference(ALBUM_COVER_STYLE)!!
preference.setSummary(getInstance().albumCoverStyle.titleRes)
}
private fun updateNowPlayingScreenSummary() {
findPreference(NOW_PLAYING_SCREEN_ID).setSummary(getInstance().nowPlayingScreen.titleRes)
val preference: Preference = findPreference(NOW_PLAYING_SCREEN_ID)!!
preference.setSummary(getInstance().nowPlayingScreen.titleRes)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
getInstance().registerOnSharedPreferenceChangedListener(this)
val preference = findPreference("album_cover_transform")
val preference: Preference = findPreference("album_cover_transform")!!
setSummary(preference)
}

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.ui.fragments.settings
import android.os.Bundle
import android.view.View
import androidx.preference.Preference
import code.name.monkey.retromusic.R
@ -22,7 +23,7 @@ class OtherSettingsFragment : AbsSettingsFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val preference = findPreference("last_added_interval")
val preference: Preference = findPreference("last_added_interval")!!
setSummary(preference)
}
}

View file

@ -3,6 +3,7 @@ package code.name.monkey.retromusic.ui.fragments.settings
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import androidx.preference.Preference
import androidx.preference.TwoStatePreference
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R
@ -12,7 +13,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil
class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
override fun invalidateSettings() {
val cornerWindow = findPreference("corner_window") as TwoStatePreference
val cornerWindow: TwoStatePreference = findPreference("corner_window")!!
cornerWindow.setOnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean && !App.isProVersion) {
showProToastAndNavigate(activity!!.getString(R.string.pref_title_round_corners))
@ -23,7 +24,7 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
}
val toggleFullScreen = findPreference("toggle_full_screen") as TwoStatePreference
val toggleFullScreen: TwoStatePreference = findPreference("toggle_full_screen")!!
toggleFullScreen.setOnPreferenceChangeListener { _, _ ->
activity!!.recreate()
true
@ -40,14 +41,14 @@ class PersonaizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSh
super.onViewCreated(view, savedInstanceState)
PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this)
var preference = findPreference("album_grid_style")
setSummary(preference)
var preference: Preference? = findPreference("album_grid_style")
setSummary(preference!!)
preference = findPreference("artist_grid_style")
setSummary(preference)
setSummary(preference!!)
preference = findPreference("home_artist_grid_style")
setSummary(preference)
setSummary(preference!!)
preference = findPreference("tab_text_mode")
setSummary(preference)
setSummary(preference!!)
}
override fun onDestroyView() {

View file

@ -5,6 +5,7 @@ import android.graphics.Color.BLUE
import android.os.Build
import android.os.Bundle
import androidx.core.content.ContextCompat
import androidx.preference.Preference
import androidx.preference.TwoStatePreference
import code.name.monkey.appthemehelper.*
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
@ -25,7 +26,7 @@ import com.afollestad.materialdialogs.color.colorChooser
class ThemeSettingsFragment : AbsSettingsFragment() {
override fun invalidateSettings() {
val primaryColorPref = findPreference("primary_color") as ATEColorPreference
val primaryColorPref: ATEColorPreference = findPreference("primary_color")!!
primaryColorPref.isVisible = PreferenceUtil.getInstance().generalTheme == code.name.monkey.retromusic.R.style.Theme_RetroMusic_Color
val primaryColor = ThemeStore.primaryColor(activity!!)
primaryColorPref.setColor(primaryColor, ColorUtil.darkenColor(primaryColor))
@ -49,7 +50,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
true
}
val generalTheme = findPreference("general_theme")
val generalTheme: Preference = findPreference("general_theme")!!
setSummary(generalTheme)
generalTheme.setOnPreferenceChangeListener { _, newValue ->
val theme = newValue as String
@ -85,7 +86,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
true
}
val accentColorPref = findPreference("accent_color") as ATEColorPreference
val accentColorPref: ATEColorPreference = findPreference("accent_color")!!
val accentColor = ThemeStore.accentColor(activity!!)
accentColorPref.setColor(accentColor, ColorUtil.darkenColor(accentColor))
@ -103,7 +104,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() {
return@setOnPreferenceClickListener true
}
val colorAppShortcuts = findPreference("should_color_app_shortcuts") as TwoStatePreference
val colorAppShortcuts: TwoStatePreference = findPreference("should_color_app_shortcuts")!!
if (!VersionUtils.hasNougatMR()) {
colorAppShortcuts.isVisible = false
} else {

View file

@ -0,0 +1,202 @@
/*
* 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.util;
import android.app.Activity;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.util.Log;
import androidx.annotation.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import code.name.monkey.retromusic.App;
/**
* Author: Mario Velasco Casquero
* Date: 08/09/2015
* Email: m3ario@gmail.com
*/
public class ImagePicker {
private static final int DEFAULT_MIN_WIDTH_QUALITY = 400; // min pixels
private static final String TAG = "ImagePicker";
private static final String TEMP_IMAGE_NAME = "tempImage";
public static int minWidthQuality = DEFAULT_MIN_WIDTH_QUALITY;
private static List<Intent> addIntentsToList(Context context, List<Intent> list, Intent intent) {
List<ResolveInfo> resInfo = context.getPackageManager().queryIntentActivities(intent, 0);
for (ResolveInfo resolveInfo : resInfo) {
String packageName = resolveInfo.activityInfo.packageName;
Intent targetedIntent = new Intent(intent);
targetedIntent.setPackage(packageName);
list.add(targetedIntent);
Log.d(TAG, "Intent: " + intent.getAction() + " package: " + packageName);
}
return list;
}
public static Bitmap getImageFromResult(Context context, int resultCode,
Intent imageReturnedIntent) {
Log.d(TAG, "getImageFromResult, resultCode: " + resultCode);
Bitmap bm = null;
File imageFile = getTempFile(context);
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage;
boolean isCamera = (imageReturnedIntent == null ||
imageReturnedIntent.getData() == null ||
imageReturnedIntent.getData().toString().contains(imageFile.toString()));
if (isCamera) { /** CAMERA **/
selectedImage = Uri.fromFile(imageFile);
} else { /** ALBUM **/
selectedImage = imageReturnedIntent.getData();
}
Log.d(TAG, "selectedImage: " + selectedImage);
bm = getImageResized(context, selectedImage);
int rotation = getRotation(context, selectedImage, isCamera);
bm = rotate(bm, rotation);
}
return bm;
}
private static File getTempFile(Context context) {
File imageFile = new File(context.getExternalCacheDir(), TEMP_IMAGE_NAME);
imageFile.getParentFile().mkdirs();
return imageFile;
}
private static Bitmap decodeBitmap(Context context, Uri theUri, int sampleSize) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = sampleSize;
AssetFileDescriptor fileDescriptor = null;
try {
fileDescriptor = context.getContentResolver().openAssetFileDescriptor(theUri, "r");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Bitmap actuallyUsableBitmap = BitmapFactory.decodeFileDescriptor(
fileDescriptor.getFileDescriptor(), null, options);
Log.d(TAG, options.inSampleSize + " sample method bitmap ... " +
actuallyUsableBitmap.getWidth() + " " + actuallyUsableBitmap.getHeight());
return actuallyUsableBitmap;
}
/**
* Resize to avoid using too much memory loading big images (e.g.: 2560*1920)
**/
private static Bitmap getImageResized(Context context, Uri selectedImage) {
Bitmap bm = null;
int[] sampleSizes = new int[]{5, 3, 2, 1};
int i = 0;
do {
bm = decodeBitmap(context, selectedImage, sampleSizes[i]);
Log.d(TAG, "resizer: new bitmap width = " + bm.getWidth());
i++;
} while (bm.getWidth() < minWidthQuality && i < sampleSizes.length);
return bm;
}
private static int getRotation(Context context, Uri imageUri, boolean isCamera) {
int rotation;
if (isCamera) {
rotation = getRotationFromCamera(context, imageUri);
} else {
rotation = getRotationFromGallery(context, imageUri);
}
Log.d(TAG, "Image rotation: " + rotation);
return rotation;
}
private static int getRotationFromCamera(Context context, Uri imageFile) {
int rotate = 0;
try {
context.getContentResolver().notifyChange(imageFile, null);
ExifInterface exif = new ExifInterface(imageFile.getPath());
int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_270:
rotate = 270;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotate = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_90:
rotate = 90;
break;
}
} catch (Exception e) {
e.printStackTrace();
}
return rotate;
}
public static int getRotationFromGallery(Context context, Uri imageUri) {
int result = 0;
String[] columns = {MediaStore.Images.Media.ORIENTATION};
Cursor cursor = null;
try {
cursor = context.getContentResolver().query(imageUri, columns, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int orientationColumnIndex = cursor.getColumnIndex(columns[0]);
result = cursor.getInt(orientationColumnIndex);
}
} catch (Exception e) {
//Do nothing
} finally {
if (cursor != null) {
cursor.close();
}
}//End of try-catch block
return result;
}
private static Bitmap rotate(Bitmap bm, int rotation) {
if (rotation != 0) {
Matrix matrix = new Matrix();
matrix.postRotate(rotation);
Bitmap bmOut = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
return bmOut;
}
return bm;
}
}

View file

@ -21,15 +21,16 @@ import android.content.SharedPreferences.Editor;
import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import java.io.File;
import java.util.Objects;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.viewpager.widget.ViewPager;
import code.name.monkey.retromusic.App;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.SortOrder;
@ -38,8 +39,8 @@ import code.name.monkey.retromusic.transform.DepthTransformation;
import code.name.monkey.retromusic.transform.HingeTransformation;
import code.name.monkey.retromusic.transform.HorizontalFlipTransformation;
import code.name.monkey.retromusic.transform.NormalPageTransformer;
import code.name.monkey.retromusic.transform.VerticalStackTransformer;
import code.name.monkey.retromusic.transform.VerticalFlipTransformation;
import code.name.monkey.retromusic.transform.VerticalStackTransformer;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.fragments.AlbumCoverStyle;
import code.name.monkey.retromusic.ui.fragments.NowPlayingScreen;
@ -61,6 +62,7 @@ public final class PreferenceUtil {
public static final String GENERAL_THEME = "general_theme";
public static final String CIRCULAR_ALBUM_ART = "circular_album_art";
public static final String USER_NAME = "user_name";
public static final String USER_BIO = "user_bio";
public static final String TOGGLE_FULL_SCREEN = "toggle_full_screen";
public static final String TOGGLE_VOLUME = "toggle_volume";
public static final String TOGGLE_TAB_TITLES = "toggle_tab_titles";
@ -154,6 +156,14 @@ public final class PreferenceUtil {
}
}
public String getUserBio() {
return mPreferences.getString(USER_BIO, "");
}
public void setUserBio(String bio) {
mPreferences.edit().putString(USER_BIO, bio).apply();
}
public int getFilterLength() {
return mPreferences.getInt(FILTER_SONG, 20);
}

View file

@ -1,95 +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.views;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.material.card.MaterialCardView;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.transition.AutoTransition;
import androidx.transition.TransitionManager;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.retromusic.R;
public class CollapsingFAB extends FrameLayout {
@ColorInt
int color = Color.WHITE;
String title;
Drawable icon;
boolean showTitle;
ImageView shuffleIcon;
TextView textView;
MaterialCardView cardView;
public CollapsingFAB(@NonNull Context context) {
this(context, null);
}
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray attributes = getContext().obtainStyledAttributes(attrs, R.styleable.CollapsingFAB, 0, 0);
icon = attributes.getDrawable(R.styleable.CollapsingFAB_setIcon);
color = attributes.getColor(R.styleable.CollapsingFAB_shuffleBackgroundColor, 0);
showTitle = attributes.getBoolean(R.styleable.CollapsingFAB_showTitle, false);
title = attributes.getString(R.styleable.CollapsingFAB_setText);
View view = inflate(context, R.layout.collapsing_floating_action_button, this);
shuffleIcon = view.findViewById(R.id.icon);
shuffleIcon.setImageDrawable(icon);
textView = view.findViewById(R.id.shuffle_text);
textView.setText(title);
textView.setVisibility(showTitle ? VISIBLE : GONE);
cardView = view.findViewById(R.id.container);
attributes.recycle();
}
public void setShowTitle(boolean showTitle) {
this.showTitle = showTitle;
TransitionManager.beginDelayedTransition(this, new AutoTransition());
textView.setVisibility(showTitle ? VISIBLE : GONE);
invalidate();
requestLayout();
}
public void setColor(int color) {
this.color = color;
int textColor = MaterialValueHelper.INSTANCE.getPrimaryTextColor(getContext(), ColorUtil.INSTANCE.isColorLight(color));
shuffleIcon.setColorFilter(textColor);
textView.setTextColor(textColor);
cardView.setCardBackgroundColor(ColorStateList.valueOf(color));
postInvalidate();
}
}

View file

@ -0,0 +1,49 @@
/*
* 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.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.util.AttributeSet;
import android.webkit.WebView;
public class LollipopFixedWebView extends WebView {
public LollipopFixedWebView(Context context) {
super(getFixedContext(context));
}
public LollipopFixedWebView(Context context, AttributeSet attrs) {
super(getFixedContext(context), attrs);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(getFixedContext(context), attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(getFixedContext(context), attrs, defStyleAttr, defStyleRes);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing);
}
public static Context getFixedContext(Context context) {
return context.createConfigurationContext(new Configuration());
}
}

View file

@ -18,6 +18,9 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.GlideApp;
@ -26,26 +29,26 @@ import code.name.monkey.retromusic.glide.GlideApp;
*/
public class NetworkImageView extends CircularImageView {
public NetworkImageView(Context context) {
public NetworkImageView(@NonNull Context context) {
super(context);
init(context, null);
}
public NetworkImageView(Context context, AttributeSet attrs) {
public NetworkImageView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public NetworkImageView(Context context, AttributeSet attrs, int defStyleAttr) {
public NetworkImageView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
public void setImageUrl(String imageUrl) {
public void setImageUrl(@NonNull String imageUrl) {
setImageUrl(getContext(), imageUrl);
}
public void setImageUrl(Context context, String imageUrl) {
public void setImageUrl(@NonNull Context context, @NonNull String imageUrl) {
GlideApp.with(context)
.load(imageUrl)
.error(R.drawable.ic_person_flat)

View file

@ -0,0 +1,70 @@
/*
* 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.views;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.retromusic.R;
/**
* Created by hemanths on 3/23/19
*/
public class OptionMenuItemView extends FrameLayout {
public OptionMenuItemView(@NonNull Context context) {
this(context, null);
}
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1);
}
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, -1);
}
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
inflate(context, R.layout.item_option_menu, this);
setBackgroundTintList(ColorStateList.valueOf(ThemeStore.Companion.accentColor(context)));
TextView textView = findViewById(R.id.title);
textView.setTextColor(MaterialValueHelper.INSTANCE.getPrimaryTextColor(context, ColorUtil.INSTANCE.isColorLight(ThemeStore.Companion.primaryColor(context))));
IconImageView iconImageView = findViewById(R.id.icon);
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.OptionMenuItemView, 0, 0);
String title = attributes.getString(R.styleable.OptionMenuItemView_optionTitle);
textView.setText(title);
Drawable icon = attributes.getDrawable(R.styleable.OptionMenuItemView_optionIcon);
iconImageView.setImageDrawable(icon);
attributes.recycle();
}
}

View file

@ -0,0 +1,17 @@
<?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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/md_red_A400" />
<corners android:radius="56dp" />
</shape>

View file

@ -4,9 +4,7 @@
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1 0.9 2 2 2h8c1.1 0 2-0.9 2-2V7z" />
android:pathData="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" />
</vector>

View 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M4,2H20A2,2 0 0,1 22,4V20A2,2 0 0,1 20,22H4C2.92,22 2,21.1 2,20V4A2,2 0 0,1 4,2M4,4V11H11V4H4M4,20H11V13H4V20M20,20V13H13V20H20M20,4H13V11H20V4Z" />
</vector>

View file

@ -98,16 +98,15 @@
</androidx.core.widget.NestedScrollView>
</LinearLayout>
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -23,7 +23,6 @@
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
tools:ignore="UnusedAttribute">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/bannerTitle"
style="@style/BigTitleTextAppearance"
@ -36,13 +35,10 @@
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
<code.name.monkey.retromusic.views.HeightFitSquareLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.5">
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/editorImage"
@ -60,7 +56,7 @@
android:layout_gravity="center"
android:visibility="gone" />
</FrameLayout>
</code.name.monkey.retromusic.views.HeightFitSquareLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/content"
@ -76,21 +72,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:padding="16dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/albumTitleContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -100,9 +89,7 @@
android:background="@null"
android:hint="@string/album"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -110,14 +97,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -127,9 +107,7 @@
android:background="@null"
android:hint="@string/album_artist"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -137,14 +115,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -154,9 +125,7 @@
android:background="@null"
android:hint="@string/genre"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -164,14 +133,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -181,9 +143,7 @@
android:background="@null"
android:hint="@string/year"
android:inputType="text|number"
android:maxLines="1"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
@ -191,13 +151,14 @@
</LinearLayout>
</LinearLayout>
<code.name.monkey.retromusic.views.CollapsingFAB
android:id="@+id/saveFab"
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/saveTags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:setIcon="@drawable/ic_save_white_24dp"
app:setText="Save"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_grey_200" />
android:layout_margin="16dp"
android:gravity="center"
android:text="@string/save"
app:icon="@drawable/ic_save_white_24dp"
app:iconGravity="textStart" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -96,15 +96,12 @@
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong" />
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -123,16 +123,14 @@
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="false"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
<View

View file

@ -95,14 +95,13 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="false"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -130,15 +130,13 @@
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong" />
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="false"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -97,14 +97,12 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="false"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -26,10 +26,10 @@
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_marginEnd="128dp"
android:layout_marginStart="128dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="128dp"
android:layout_marginEnd="128dp"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
@ -100,21 +100,18 @@
</FrameLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/nameContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="@color/md_grey_700"
app:boxStrokeWidth="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/name"
android:layout_width="match_parent"
@ -122,7 +119,27 @@
android:background="@null"
android:hint="@string/my_name"
android:inputType="textPersonName|textCapWords|text"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/bioContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/bio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/bio"
android:inputType="textPersonName|textCapWords|text"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

View file

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="12dp"
android:orientation="vertical">
<LinearLayout
@ -136,9 +137,4 @@
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="12dp"
android:background="?attr/dividerColor" />
</LinearLayout>

View file

@ -114,16 +114,12 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -42,6 +42,10 @@
android:layout_gravity="center"
android:visibility="gone" />
<View
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<LinearLayout
@ -93,21 +97,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
android:padding="16dp">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/albumTitleContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -117,8 +114,7 @@
android:background="@null"
android:hint="@string/album"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -126,14 +122,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -143,8 +132,7 @@
android:background="@null"
android:hint="@string/album_artist"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -152,14 +140,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -169,8 +150,7 @@
android:background="@null"
android:hint="@string/genre"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -178,14 +158,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -195,21 +168,20 @@
android:background="@null"
android:hint="@string/year"
android:inputType="text|number"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
android:id="@+id/saveFab"
android:layout_width="wrap_content"
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/saveTags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
app:setIcon="@drawable/ic_save_white_24dp"
app:setText="Save"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_grey_200" />
android:layout_gravity="bottom"
android:layout_margin="16dp"
android:gravity="center"
android:text="@string/save"
app:icon="@drawable/ic_save_white_24dp"
app:iconGravity="textStart" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -98,14 +98,13 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="10dp"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_black_1000" />
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -68,14 +68,14 @@
android:textColor="?android:textColorSecondary"
android:visibility="gone" />
<code.name.monkey.retromusic.views.CollapsingFAB
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/clearQueue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:setIcon="@drawable/ic_clear_all_black_24dp"
app:showTitle="true"
app:setText="@string/clear_playing_queue"
app:shuffleBackgroundColor="@color/md_deep_purple_A700" />
android:layout_margin="16dp"
android:text="@string/clear_playing_queue"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -91,14 +91,13 @@
tools:visibility="visible" />
</LinearLayout>
<code.name.monkey.retromusic.views.CollapsingFAB
android:id="@+id/actionShuffle"
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/actionShuffleAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
app:setIcon="@drawable/ic_shuffle_white_24dp"
app:setText="@string/action_shuffle_all"
app:showTitle="true" />
android:layout_margin="16dp"
android:text="@string/action_shuffle_all"
app:icon="@drawable/ic_clear_all_black_24dp" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -72,25 +72,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/songText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/song"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="14dp" />
tools:text="@string/song" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -98,39 +89,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<code.name.monkey.appthemehelper.common.views.ATEEditText
android:id="@+id/albumText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/album"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/artistContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -141,23 +117,16 @@
android:gravity="center_vertical"
android:hint="@string/artist"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/albumArtistContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
@ -169,23 +138,16 @@
android:gravity="center_vertical"
android:hint="@string/album_artist"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/composerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
@ -196,8 +158,7 @@
android:gravity="center_vertical"
android:hint="@string/composer"
android:inputType="text|textCapWords"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
@ -208,18 +169,12 @@
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/genreContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_weight="1"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
@ -228,29 +183,21 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:hint="@string/genre"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/yearContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
@ -259,28 +206,20 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:gravity="center_vertical"
android:hint="@string/year"
android:inputType="text|number"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/trackNumberContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
@ -292,24 +231,16 @@
android:gravity="center_vertical"
android:hint="@string/track_hint"
android:inputType="text|number"
android:maxLines="1"
android:padding="16dp" />
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/lyricsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_weight="1"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="?android:attr/textColorPrimary"
app:boxStrokeWidth="1dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
@ -320,8 +251,7 @@
android:layout_gravity="center"
android:gravity="center_vertical"
android:hint="@string/lyrics"
android:inputType="textMultiLine"
android:padding="16dp" />
android:inputType="textMultiLine" />
</com.google.android.material.textfield.TextInputLayout>
@ -330,15 +260,16 @@
</androidx.core.widget.NestedScrollView>
<code.name.monkey.retromusic.views.CollapsingFAB
android:id="@+id/saveFab"
android:layout_width="wrap_content"
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/saveTags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
app:setIcon="@drawable/ic_save_white_24dp"
app:setText="Save"
app:showTitle="true"
app:shuffleBackgroundColor="@color/md_grey_200" />
android:layout_gravity="bottom"
android:layout_margin="16dp"
android:gravity="center"
android:text="@string/save"
app:icon="@drawable/ic_save_white_24dp"
app:iconGravity="textStart" />
<ProgressBar
android:id="@+id/progressBar"

View file

@ -39,7 +39,8 @@
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
android:layout_margin="12dp"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true">
<FrameLayout
@ -102,17 +103,12 @@
android:id="@+id/nameContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
app:boxBackgroundMode="outline"
app:boxCollapsedPaddingTop="16dp"
app:boxCornerRadiusBottomEnd="8dp"
app:boxCornerRadiusBottomStart="8dp"
app:boxCornerRadiusTopEnd="8dp"
app:boxCornerRadiusTopStart="8dp"
app:boxStrokeColor="@color/md_grey_700"
app:boxStrokeWidth="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/name"
android:layout_width="match_parent"
@ -120,7 +116,27 @@
android:background="@null"
android:hint="@string/my_name"
android:inputType="textPersonName|textCapWords|text"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/bioContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
app:boxBackgroundMode="filled"
app:hintEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/bio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/bio"
android:inputType="textPersonName|textCapWords|text"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

View file

@ -28,7 +28,7 @@
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<WebView
<code.name.monkey.retromusic.views.LollipopFixedWebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -1,10 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView
style="@style/SubTitleTextAppearance"
android:text="@string/credit_title" />
@ -26,3 +34,4 @@
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -1,22 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView 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="wrap_content"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView
style="@style/SubTitleTextAppearance"
android:text="@string/others" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp">
<LinearLayout
android:id="@+id/changelog"
android:layout_width="match_parent"
@ -104,4 +105,4 @@
android:text="0.0.0" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView 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="wrap_content"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView
style="@style/SubTitleTextAppearance"
android:text="@string/support_development" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/appGithub"
android:layout_width="match_parent"
@ -273,6 +274,6 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView 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="wrap_content"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
<code.name.monkey.appthemehelper.common.views.ATEAccentTextView
style="@style/SubTitleTextAppearance"
android:text="@string/social" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/pinterestLink"
android:layout_width="match_parent"
@ -45,16 +46,16 @@
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pinterest_page"
style="@style/TextAppearance.MaterialComponents.Subtitle1" />
android:text="@string/pinterest_page" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.85"
style="@style/TextAppearance.MaterialComponents.Body2"
android:text="@string/pinterest_page_summary" />
</LinearLayout>
</LinearLayout>
@ -88,16 +89,16 @@
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/instagram_page"
style="@style/TextAppearance.MaterialComponents.Subtitle1" />
android:text="@string/instagram_page" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.85"
style="@style/TextAppearance.MaterialComponents.Body2"
android:text="@string/instagram_page_summary" />
</LinearLayout>
</LinearLayout>
@ -130,16 +131,16 @@
android:paddingBottom="8dp">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/twitter_page"
style="@style/TextAppearance.MaterialComponents.Subtitle1" />
android:text="@string/twitter_page" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.85"
style="@style/TextAppearance.MaterialComponents.Body2"
android:text="@string/twitter_page_summary" />
</LinearLayout>
</LinearLayout>
@ -172,15 +173,15 @@
android:paddingBottom="8dp">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/discord_page"
style="@style/TextAppearance.MaterialComponents.Subtitle1"/>
android:text="@string/discord_page" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.MaterialComponents.Body2"
android:alpha="0.85"
android:text="@string/discord_summary" />
</LinearLayout>
@ -214,15 +215,15 @@
android:paddingBottom="8dp">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/telegram_group"
style="@style/TextAppearance.MaterialComponents.Subtitle1" />
android:text="@string/telegram_group" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.MaterialComponents.Body2"
android:alpha="0.85"
android:text="@string/telegram_group_summary" />
</LinearLayout>
@ -258,19 +259,18 @@
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/google_plus"
style="@style/TextAppearance.MaterialComponents.Subtitle1" />
android:text="@string/google_plus" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/TextAppearance.MaterialComponents.Body2"
android:alpha="0.85"
android:text="@string/google_plus_community" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -4,8 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:cardCornerRadius="26dp"
app:cardUseCompatPadding="true"
tools:backgroundTint="@color/md_red_400">
@ -26,6 +26,7 @@
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/shuffle_text"
style="@style/TextAppearance.MaterialComponents.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"

View file

@ -0,0 +1,33 @@
<?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.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/extend_fab_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_fab"
android:elevation="8dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/fab"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="56dp"
android:layout_height="56dp"
app:cornerRadius="56dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,33 @@
<?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.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/extend_fab_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_fab"
android:elevation="8dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/fab"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cornerRadius="56dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -108,6 +108,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.core.widget.NestedScrollView>

View file

@ -114,5 +114,42 @@
app:srcCompat="@drawable/default_artist_art" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.Toolbar>
<FrameLayout
android:id="@+id/player_lyrics"
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>
</LinearLayout>
</FrameLayout>

View file

@ -34,19 +34,18 @@
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:layout_gravity="center_vertical"
android:layout_weight="1"
app:layout_collapseMode="pin"
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/bannerTitle"
style="@style/BigTitleTextAppearanceToolbar"
android:text="@string/app_name"
tools:ignore="MissingPrefix" />
tools:ignore="UnusedAttribute" />
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"
@ -56,7 +55,13 @@
android:layout_marginEnd="8dp"
android:layout_weight="0"
app:civ_border="false" />
</androidx.appcompat.widget.Toolbar>
</LinearLayout>
<TextView
android:id="@+id/bannerTitle"
style="@style/BigTitleTextAppearanceToolbar"
android:text="@string/app_name"
tools:ignore="MissingPrefix" />
<ViewStub
android:id="@+id/cab_stub"

View file

@ -5,22 +5,20 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
tools:ignore="MissingPrefix">
<LinearLayout
android:id="@+id/userInfoContainer"
android:layout_width="match_parent"
android:padding="16dp"
android:gravity="center_vertical"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:paddingBottom="16dp">
android:orientation="horizontal">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_weight="0"
app:civ_border="false" />
@ -36,7 +34,9 @@
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/titleWelcome"
style="@style/SubTitleTextAppearance"
android:layout_width="wrap_content"
android:textSize="18sp"
android:layout_height="wrap_content"
android:padding="0dp" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
@ -109,47 +109,73 @@
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionFolders"
style="@style/OptionButtonsStyle"
android:text="@string/folders"
app:icon="@drawable/ic_folder_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_folder_white_24dp"
app:optionTitle="@string/folders" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionEqualizer"
style="@style/OptionButtonsStyle"
android:text="@string/equalizer"
app:icon="@drawable/ic_equalizer_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_equalizer_white_24dp"
app:optionTitle="@string/equalizer" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionSleepTimer"
style="@style/OptionButtonsStyle"
android:text="@string/action_sleep_timer"
app:icon="@drawable/ic_timer_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_timer_white_24dp"
app:optionTitle="@string/action_sleep_timer" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionShare"
style="@style/OptionButtonsStyle"
android:text="@string/action_share"
app:icon="@drawable/ic_share_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_share_white_24dp"
app:optionTitle="@string/action_share" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionBugReport"
style="@style/OptionButtonsStyle"
android:text="@string/report_bug"
app:icon="@drawable/ic_bug_report_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_bug_report_white_24dp"
app:optionTitle="@string/report_bug" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionAbout"
style="@style/OptionButtonsStyle"
android:text="@string/action_about"
app:icon="@drawable/ic_help_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_help_white_24dp"
app:optionTitle="@string/action_about" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
<code.name.monkey.retromusic.views.OptionMenuItemView
android:id="@+id/actionRate"
style="@style/OptionButtonsStyle"
android:text="@string/rate_app"
app:icon="@drawable/ic_star_white_24dp" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
android:clickable="true"
android:focusable="true"
app:optionIcon="@drawable/ic_star_white_24dp"
app:optionTitle="@string/rate_app" />
</LinearLayout>

View file

@ -12,8 +12,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/progress_slider_height"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">

View file

@ -9,8 +9,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/progress_slider_height"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">

View file

@ -86,7 +86,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_weight="0">
<androidx.appcompat.widget.Toolbar

View file

@ -7,5 +7,4 @@
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View file

@ -9,10 +9,10 @@
tools:ignore="MissingPrefix">
<RelativeLayout
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:layout_width="match_parent"
android:layout_height="28dp">
android:layout_height="28dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<TextView
android:id="@+id/songCurrentProgress"
@ -61,8 +61,7 @@
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center"
android:orientation="vertical"
android:padding="8dp">
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title"
@ -88,7 +87,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"

View file

@ -12,12 +12,13 @@
android:paddingEnd="12dp"
tools:ignore="PrivateResource">
<code.name.monkey.retromusic.views.NetworkImageView
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/image"
android:layout_width="40dp"
android:layout_height="40dp"
app:civ_border="false"
app:civ_shadow="false" />
app:civ_shadow="false"
app:srcCompat="@drawable/ic_person_flat" />
<LinearLayout
android:layout_width="match_parent"
@ -30,12 +31,13 @@
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/title"
style="@style/TextAppearance.MaterialComponents.Subtitle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:layout_height="wrap_content" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:id="@+id/text"
style="@style/TextAppearance.MaterialComponents.Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.85" />

View file

@ -0,0 +1,42 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="0dp"
android:paddingEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="14dp"
app:srcCompat="@drawable/ic_folder_white_24dp" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/folders"
android:textSize="16sp" />
</LinearLayout>

View file

@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:paddingBottom="12dp">
<LinearLayout
android:layout_width="wrap_content"
@ -38,10 +39,4 @@
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:itemMargin="28dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="8dp"
android:background="?attr/dividerColor" />
</LinearLayout>

View file

@ -40,9 +40,4 @@
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="8dp"
android:background="?attr/dividerColor" />
</LinearLayout>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/mainContent"
@ -11,10 +11,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:layout_constraintBottom_toBottomOf="parent"
sothree:layout_constraintEnd_toEndOf="parent"
sothree:layout_constraintStart_toStartOf="parent"
sothree:layout_constraintTop_toTopOf="parent"
sothree:umanoOverlay="false"
sothree:umanoPanelHeight="0dp"
sothree:umanoScrollableView="@+id/recycler_view"
@ -49,7 +45,7 @@
<code.name.monkey.retromusic.views.BottomNavigationBarTinted
android:id="@+id/bottomNavigationView"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:elevation="0dp"
@ -59,8 +55,6 @@
app:itemTextAppearanceInactive="@style/BottomSheetTextAppearance"
app:itemTextColor="@drawable/bottom_navigation_item_colors"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="@+id/slidingLayout"
app:layout_constraintEnd_toEndOf="@+id/slidingLayout"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_navigation_main" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -3,15 +3,11 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".DrawerActivity">
<item
android:id="@+id/action_shuffle_all"
android:icon="@drawable/ic_shuffle_white_24dp"
android:title="@string/action_shuffle_all"
app:showAsAction="never" />
<item
android:id="@+id/action_grid_size"
android:title="@string/action_grid_size">
android:icon="@drawable/ic_grid_size_white_24dp"
android:title="@string/action_grid_size"
app:showAsAction="ifRoom">
<menu>
<group
android:id="@+id/group_grid_size"
@ -47,25 +43,9 @@
<item
android:id="@+id/action_sort_order"
android:title="@string/action_sort_order">
android:icon="@drawable/ic_sort_white_24dp"
android:title="@string/action_sort_order"
app:showAsAction="ifRoom">
<menu></menu>
</item>
<item
android:id="@+id/action_sleep_timer"
android:orderInCategory="98"
android:title="@string/action_sleep_timer"
app:showAsAction="never" />
<item
android:id="@+id/action_equalizer"
android:orderInCategory="99"
android:title="@string/equalizer"
app:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>

View file

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CollapsingFAB">
<attr name="shuffleBackgroundColor" format="color" />
<attr name="showTitle" format="boolean" />
<attr name="setIcon" format="reference" />
<attr name="setText" format="string" />
</declare-styleable>
<attr name="roundSelector" format="reference" />
<attr name="rectSelector" format="reference" />
<attr name="rectSelectorStrong" format="reference" />
@ -58,4 +53,9 @@
<attr name="iconBackgroundColor" format="color" />
<attr name="icon" format="reference" />
</declare-styleable>
<declare-styleable name="OptionMenuItemView">
<attr name="optionTitle" format="reference" />
<attr name="optionIcon" format="reference" />
</declare-styleable>
</resources>

View file

@ -59,5 +59,6 @@ http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
<dimen name="horizontal_margin">0dp</dimen>
<dimen name="bottom_sheet_width">0dp</dimen>
<dimen name="mini_player_height_expanded">104dp</dimen>
<dimen name="progress_slider_height">28dp</dimen>
<dimen name="progress_slider_height">30dp</dimen>
<dimen name="triple_and_half_margin">56dp</dimen>
</resources>

View file

@ -603,5 +603,8 @@
<string name="next_song">Next Song</string>
<string name="last_song">Last song</string>
<string name="slide">Slide</string>
<string name="save">Save</string>
<string name="pick_image_intent_text">Pick image</string>
<string name="set_photo">Set a profile photo</string>
</resources>

View file

@ -28,9 +28,9 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.preference:preference:1.1.0-alpha04'
implementation 'androidx.cardview:cardview:1.0.0'
// Used for the list preference classes
implementation "com.afollestad.material-dialogs:core:$materialDialog"

View file

@ -0,0 +1,39 @@
/*
* 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.appthemehelper.common.views
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import code.name.monkey.appthemehelper.ThemeStore
class ATEAccentTextView : AppCompatTextView {
constructor(context: Context) : super(context) {
init(context, null)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
init(context, attrs)
}
private fun init(context: Context, attrs: AttributeSet?) {
setTextColor(ThemeStore.accentColor(context))
}
}

View file

@ -0,0 +1,32 @@
/*
* 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.appthemehelper.common.views
import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
class ATEExtendedFloatingActionButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = -1) : ExtendedFloatingActionButton(context, attrs, defStyleAttr) {
init {
backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(context))
setTextColor(ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(ThemeStore.accentColor(context)))))
}
}

Some files were not shown because too many files have changed in this diff Show more