Merge branch 'dev' into TeGaX-ru-fix-patch

This commit is contained in:
Hemanth S 2020-11-28 14:31:55 +05:30 committed by GitHub
commit e2b4ffab30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
228 changed files with 10570 additions and 8363 deletions

View file

@ -25,7 +25,7 @@ android {
} }
signingConfigs { signingConfigs {
release { release {
Properties properties = getProperties('/Users/apple/Documents/Github/retro.properties ') Properties properties = getProperties('E:/Documents/GitHub/retro.properties')
storeFile file(getProperty(properties, 'storeFile')) storeFile file(getProperty(properties, 'storeFile'))
keyAlias getProperty(properties, 'keyAlias') keyAlias getProperty(properties, 'keyAlias')
storePassword getProperty(properties, 'storePassword') storePassword getProperty(properties, 'storePassword')

View file

@ -53,6 +53,7 @@ object Constants {
) )
const val NUMBER_OF_TOP_TRACKS = 99 const val NUMBER_OF_TOP_TRACKS = 99
} }
const val EXTRA_PLAYLIST_TYPE = "type"
const val EXTRA_GENRE = "extra_genre" const val EXTRA_GENRE = "extra_genre"
const val EXTRA_PLAYLIST = "extra_playlist" const val EXTRA_PLAYLIST = "extra_playlist"
const val EXTRA_PLAYLIST_ID = "extra_playlist_id" const val EXTRA_PLAYLIST_ID = "extra_playlist_id"

View file

@ -77,7 +77,6 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar() setDrawUnderStatusBar()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setStatusbarColorAuto() setStatusbarColorAuto()
setNavigationbarColorAuto() setNavigationbarColorAuto()
setLightNavigationBar(true) setLightNavigationBar(true)
@ -91,6 +90,12 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
if (!hasPermissions()) { if (!hasPermissions()) {
findNavController(R.id.fragment_container).navigate(R.id.permissionFragment) findNavController(R.id.fragment_container).navigate(R.id.permissionFragment)
} }
showPromotionalDialog()
}
private fun showPromotionalDialog() {
} }
private fun setupNavigationController() { private fun setupNavigationController() {
@ -104,9 +109,6 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
} }
navController.graph = navGraph navController.graph = navGraph
NavigationUI.setupWithNavController(getBottomNavigationView(), navController) NavigationUI.setupWithNavController(getBottomNavigationView(), navController)
navController.addOnDestinationChangedListener { _, _, _ ->
// appBarLayout.setExpanded(true, true)
}
} }
override fun onSupportNavigateUp(): Boolean = override fun onSupportNavigateUp(): Boolean =

View file

@ -86,6 +86,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
setMiniPlayerAlphaProgress(slideOffset) setMiniPlayerAlphaProgress(slideOffset)
dimBackground.show() dimBackground.show()
dimBackground.alpha = slideOffset dimBackground.alpha = slideOffset
println(slideOffset)
} }
override fun onStateChanged(bottomSheet: View, newState: Int) { override fun onStateChanged(bottomSheet: View, newState: Int) {
@ -97,6 +98,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
onPanelCollapsed() onPanelCollapsed()
dimBackground.hide() dimBackground.hide()
} }
else -> { else -> {
println("Do something") println("Do something")
} }
@ -114,11 +116,11 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
setupBottomSheet() setupBottomSheet()
updateColor() updateColor()
val themeColor = ATHUtil.resolveColor(this, android.R.attr.windowBackground, Color.GRAY) val themeColor = resolveColor(android.R.attr.windowBackground, Color.GRAY)
dimBackground.setBackgroundColor(ColorUtil.withAlpha(themeColor, 0.5f)) dimBackground.setBackgroundColor(ColorUtil.withAlpha(themeColor, 0.5f))
dimBackground.setOnClickListener { dimBackground.setOnClickListener {
println("dimBackground") println("dimBackground")
collapsePanel()
} }
} }
@ -154,6 +156,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity() {
fun collapsePanel() { fun collapsePanel() {
bottomSheetBehavior.state = STATE_COLLAPSED bottomSheetBehavior.state = STATE_COLLAPSED
setMiniPlayerAlphaProgress(0f)
} }
fun expandPanel() { fun expandPanel() {

View file

@ -17,11 +17,9 @@ package code.name.monkey.retromusic.activities.tageditor
import android.app.Activity import android.app.Activity
import android.app.SearchManager import android.app.SearchManager
import android.content.Intent import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.net.Uri import android.net.Uri
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.MenuItem import android.view.MenuItem
@ -30,25 +28,26 @@ import android.view.animation.OvershootInterpolator
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.MaterialValueHelper
import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.appthemehelper.util.TintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.R.drawable import code.name.monkey.retromusic.R.drawable
import code.name.monkey.retromusic.activities.base.AbsBaseActivity import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.activities.saf.SAFGuideActivity import code.name.monkey.retromusic.activities.saf.SAFGuideActivity
import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.model.ArtworkInfo
import code.name.monkey.retromusic.model.LoadingInfo
import code.name.monkey.retromusic.repository.Repository import code.name.monkey.retromusic.repository.Repository
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.SAFUtil import code.name.monkey.retromusic.util.SAFUtil
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.File
import java.util.*
import kotlinx.android.synthetic.main.activity_album_tag_editor.* import kotlinx.android.synthetic.main.activity_album_tag_editor.*
import org.jaudiotagger.audio.AudioFile import org.jaudiotagger.audio.AudioFile
import org.jaudiotagger.audio.AudioFileIO import org.jaudiotagger.audio.AudioFileIO
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.io.File
import java.util.*
abstract class AbsTagEditorActivity : AbsBaseActivity() { abstract class AbsTagEditorActivity : AbsBaseActivity() {
val repository by inject<Repository>() val repository by inject<Repository>()
@ -63,6 +62,8 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
private val currentSongPath: String? = null private val currentSongPath: String? = null
private var savedTags: Map<FieldKey, String>? = null private var savedTags: Map<FieldKey, String>? = null
private var savedArtworkInfo: ArtworkInfo? = null private var savedArtworkInfo: ArtworkInfo? = null
protected abstract val contentViewLayout: Int
protected abstract fun loadImageFromFile(selectedFile: Uri?)
protected val show: AlertDialog protected val show: AlertDialog
get() = get() =
@ -76,7 +77,6 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
} }
} }
.show() .show()
protected abstract val contentViewLayout: Int
internal val albumArtist: String? internal val albumArtist: String?
get() { get() {
@ -196,6 +196,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
getIntentExtras() getIntentExtras()
songPaths = getSongPaths() songPaths = getSongPaths()
println(songPaths?.size)
if (songPaths!!.isEmpty()) { if (songPaths!!.isEmpty()) {
finish() finish()
} }
@ -212,9 +213,9 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
private fun setUpImageView() { private fun setUpImageView() {
loadCurrentImage() loadCurrentImage()
items = listOf( items = listOf(
getString(code.name.monkey.retromusic.R.string.pick_from_local_storage), getString(R.string.pick_from_local_storage),
getString(code.name.monkey.retromusic.R.string.web_search), getString(R.string.web_search),
getString(code.name.monkey.retromusic.R.string.remove_cover) getString(R.string.remove_cover)
) )
editorImage?.setOnClickListener { show } editorImage?.setOnClickListener { show }
} }
@ -225,7 +226,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
startActivityForResult( startActivityForResult(
Intent.createChooser( Intent.createChooser(
intent, intent,
getString(code.name.monkey.retromusic.R.string.pick_from_local_storage) getString(R.string.pick_from_local_storage)
), REQUEST_CODE_SELECT_IMAGE ), REQUEST_CODE_SELECT_IMAGE
) )
} }
@ -237,20 +238,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
protected abstract fun deleteImage() protected abstract fun deleteImage()
private fun setUpFab() { private fun setUpFab() {
saveFab.backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(this)) saveFab.accentColor()
ColorStateList.valueOf(
MaterialValueHelper.getPrimaryTextColor(
this,
ColorUtil.isColorLight(
ThemeStore.accentColor(
this
)
)
)
).apply {
saveFab.setTextColor(this)
saveFab.iconTint = this
}
saveFab.apply { saveFab.apply {
scaleX = 0f scaleX = 0f
scaleY = 0f scaleY = 0f
@ -344,30 +332,19 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
RetroUtil.hideSoftKeyboard(this) RetroUtil.hideSoftKeyboard(this)
hideFab() hideFab()
println(fieldKeyValueMap)
savedSongPaths = songPaths WriteTagsAsyncTask(this).execute(
savedTags = fieldKeyValueMap LoadingInfo(
savedArtworkInfo = artworkInfo songPaths,
fieldKeyValueMap,
if (!SAFUtil.isSAFRequired(savedSongPaths)) { artworkInfo
writeTags(savedSongPaths) )
} else { )
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (SAFUtil.isSDCardAccessGranted(this)) {
writeTags(savedSongPaths)
} else {
startActivityForResult(
Intent(this, SAFGuideActivity::class.java),
SAFGuideActivity.REQUEST_CODE_SAF_GUIDE
)
}
}
}
} }
private fun writeTags(paths: List<String>?) { private fun writeTags(paths: List<String>?) {
WriteTagsAsyncTask(this).execute( WriteTagsAsyncTask(this).execute(
WriteTagsAsyncTask.LoadingInfo( LoadingInfo(
paths, paths,
savedTags, savedTags,
savedArtworkInfo savedArtworkInfo
@ -375,6 +352,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
) )
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
super.onActivityResult(requestCode, resultCode, intent) super.onActivityResult(requestCode, resultCode, intent)
when (requestCode) { when (requestCode) {
@ -400,7 +378,6 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
} }
} }
protected abstract fun loadImageFromFile(selectedFile: Uri?)
private fun getAudioFile(path: String): AudioFile { private fun getAudioFile(path: String): AudioFile {
return try { return try {
@ -411,7 +388,6 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
} }
} }
class ArtworkInfo constructor(val albumId: Long, val artwork: Bitmap?)
companion object { companion object {

View file

@ -32,6 +32,7 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.model.ArtworkInfo
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.ImageUtil import code.name.monkey.retromusic.util.ImageUtil
import code.name.monkey.retromusic.util.RetroColorUtil.generatePalette import code.name.monkey.retromusic.util.RetroColorUtil.generatePalette
@ -177,8 +178,11 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
writeValuesToFiles( writeValuesToFiles(
fieldKeyValueMap, fieldKeyValueMap,
if (deleteAlbumArt) ArtworkInfo(id, null) when {
else if (albumArtBitmap == null) null else ArtworkInfo(id, albumArtBitmap!!) deleteAlbumArt -> ArtworkInfo(id, null)
albumArtBitmap == null -> null
else -> ArtworkInfo(id, albumArtBitmap!!)
}
) )
} }

View file

@ -23,10 +23,10 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.repository.SongRepository import code.name.monkey.retromusic.repository.SongRepository
import java.util.*
import kotlinx.android.synthetic.main.activity_song_tag_editor.* import kotlinx.android.synthetic.main.activity_song_tag_editor.*
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.util.*
class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher { class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
@ -102,11 +102,7 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
writeValuesToFiles(fieldKeyValueMap, null) writeValuesToFiles(fieldKeyValueMap, null)
} }
override fun getSongPaths(): List<String> { override fun getSongPaths(): List<String> = listOf(songRepository.song(id).data)
val paths = ArrayList<String>(1)
paths.add(songRepository.song(id).data)
return paths
}
override fun loadImageFromFile(selectedFile: Uri?) { override fun loadImageFromFile(selectedFile: Uri?) {
} }

View file

@ -5,188 +5,148 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
import android.net.Uri; import android.util.Log;
import android.os.Build; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R; import com.afollestad.materialdialogs.MaterialDialog;
import code.name.monkey.retromusic.misc.DialogAsyncTask;
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.SAFUtil;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.audio.exceptions.CannotReadException;
import org.jaudiotagger.audio.exceptions.CannotWriteException;
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
import org.jaudiotagger.tag.FieldKey; import org.jaudiotagger.tag.FieldKey;
import org.jaudiotagger.tag.Tag; import org.jaudiotagger.tag.Tag;
import org.jaudiotagger.tag.TagException;
import org.jaudiotagger.tag.images.Artwork; import org.jaudiotagger.tag.images.Artwork;
import org.jaudiotagger.tag.images.ArtworkFactory; import org.jaudiotagger.tag.images.ArtworkFactory;
public class WriteTagsAsyncTask import java.io.File;
extends DialogAsyncTask<WriteTagsAsyncTask.LoadingInfo, Integer, String[]> { import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Map;
private WeakReference<Activity> activity; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.misc.DialogAsyncTask;
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.model.LoadingInfo;
import code.name.monkey.retromusic.util.MusicUtil;
public WriteTagsAsyncTask(@NonNull Activity activity) { public class WriteTagsAsyncTask extends DialogAsyncTask<LoadingInfo, Integer, List<String>> {
super(activity);
this.activity = new WeakReference<>(activity);
}
@NonNull public WriteTagsAsyncTask(Context context) {
@Override super(context);
protected Dialog createDialog(@NonNull Context context) { }
return new MaterialAlertDialogBuilder(context) @Override
.setTitle(R.string.saving_changes) protected List<String> doInBackground(LoadingInfo... params) {
.setCancelable(false)
.setView(R.layout.loading)
.create();
}
@Override
protected String[] doInBackground(LoadingInfo... params) {
try {
LoadingInfo info = params[0];
Artwork artwork = null;
File albumArtFile = null;
if (info.artworkInfo != null && info.artworkInfo.getArtwork() != null) {
try { try {
albumArtFile = MusicUtil.INSTANCE.createAlbumArtFile().getCanonicalFile(); LoadingInfo info = params[0];
info.artworkInfo
.getArtwork()
.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile));
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile);
} catch (IOException e) {
e.printStackTrace();
}
}
int counter = 0; Artwork artwork = null;
boolean wroteArtwork = false; File albumArtFile = null;
boolean deletedArtwork = false; if (info.getArtworkInfo() != null && info.getArtworkInfo().getArtwork() != null) {
for (String filePath : info.filePaths) { try {
publishProgress(++counter, info.filePaths.size()); albumArtFile = MusicUtil.INSTANCE.createAlbumArtFile().getCanonicalFile();
try { info.getArtworkInfo().getArtwork().compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile));
Uri safUri = null; artwork = ArtworkFactory.createArtworkFromFile(albumArtFile);
if (filePath.contains(SAFUtil.SEPARATOR)) { } catch (IOException e) {
String[] fragments = filePath.split(SAFUtil.SEPARATOR); e.printStackTrace();
filePath = fragments[0]; }
safUri = Uri.parse(fragments[1]);
}
AudioFile audioFile = AudioFileIO.read(new File(filePath));
Tag tag = audioFile.getTagOrCreateAndSetDefault();
if (info.fieldKeyValueMap != null) {
for (Map.Entry<FieldKey, String> entry : info.fieldKeyValueMap.entrySet()) {
try {
tag.setField(entry.getKey(), entry.getValue());
} catch (Exception e) {
e.printStackTrace();
}
} }
}
if (info.artworkInfo != null) { int counter = 0;
if (info.artworkInfo.getArtwork() == null) { boolean wroteArtwork = false;
tag.deleteArtworkField(); boolean deletedArtwork = false;
deletedArtwork = true; for (String filePath : info.getFilePaths()) {
} else if (artwork != null) { publishProgress(++counter, info.getFilePaths().size());
tag.deleteArtworkField(); try {
tag.setField(artwork); AudioFile audioFile = AudioFileIO.read(new File(filePath));
wroteArtwork = true; Tag tag = audioFile.getTagOrCreateAndSetDefault();
if (info.getFieldKeyValueMap() != null) {
for (Map.Entry<FieldKey, String> entry : info.getFieldKeyValueMap().entrySet()) {
try {
tag.setField(entry.getKey(), entry.getValue());
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (info.getArtworkInfo() != null) {
if (info.getArtworkInfo().getArtwork() == null) {
tag.deleteArtworkField();
deletedArtwork = true;
} else if (artwork != null) {
tag.deleteArtworkField();
tag.setField(artwork);
wroteArtwork = true;
}
}
audioFile.commit();
} catch (@NonNull CannotReadException | IOException | CannotWriteException | TagException | ReadOnlyFileException | InvalidAudioFrameException e) {
e.printStackTrace();
}
} }
}
Activity activity = this.activity.get(); Context context = getContext();
SAFUtil.write(activity, audioFile, safUri); if (context != null) {
if (wroteArtwork) {
MusicUtil.INSTANCE.
insertAlbumArt(context, info.getArtworkInfo().getAlbumId(), albumArtFile.getPath());
} else if (deletedArtwork) {
MusicUtil.INSTANCE.deleteAlbumArt(context, info.getArtworkInfo().getAlbumId());
}
}
} catch (@NonNull Exception e) { return info.getFilePaths();
e.printStackTrace(); } catch (Exception e) {
e.printStackTrace();
return null;
} }
} }
Context context = getContext(); @Override
if (context != null) { protected void onPostExecute(List<String> toBeScanned) {
if (wroteArtwork) { super.onPostExecute(toBeScanned);
MusicUtil.INSTANCE.insertAlbumArt( scan(toBeScanned);
context, info.artworkInfo.getAlbumId(), albumArtFile.getPath()); }
} else if (deletedArtwork) {
MusicUtil.INSTANCE.deleteAlbumArt(context, info.artworkInfo.getAlbumId()); @Override
protected void onCancelled(List<String> toBeScanned) {
super.onCancelled(toBeScanned);
scan(toBeScanned);
}
private void scan(List<String> toBeScanned) {
Context context = getContext();
if (toBeScanned == null || toBeScanned.isEmpty()) {
Log.i("scan", "scan: Empty");
Toast.makeText(context, "Scan file from folder", Toast.LENGTH_SHORT).show();
return;
} }
} MediaScannerConnection.scanFile(context, toBeScanned.toArray(new String[0]), null, context instanceof Activity ? new UpdateToastMediaScannerCompletionListener((Activity) context, toBeScanned) : null);
Collection<String> paths = info.filePaths;
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
paths = new ArrayList<>(info.filePaths.size());
for (String path : info.filePaths) {
if (path.contains(SAFUtil.SEPARATOR)) {
path = path.split(SAFUtil.SEPARATOR)[0];
}
paths.add(path);
}
}
return paths.toArray(new String[paths.size()]);
} catch (Exception e) {
e.printStackTrace();
return null;
} }
}
@Override @Override
protected void onCancelled(String[] toBeScanned) { protected Dialog createDialog(@NonNull Context context) {
super.onCancelled(toBeScanned); return new MaterialDialog.Builder(context)
scan(toBeScanned); .title(R.string.saving_changes)
} .cancelable(false)
.progress(false, 0)
@Override .build();
protected void onPostExecute(String[] toBeScanned) {
super.onPostExecute(toBeScanned);
scan(toBeScanned);
}
@Override
protected void onProgressUpdate(@NonNull Dialog dialog, Integer... values) {
super.onProgressUpdate(dialog, values);
// ((MaterialDialog) dialog).setMaxProgress(values[1]);
// ((MaterialDialog) dialog).setProgress(values[0]);
}
private void scan(String[] toBeScanned) {
Activity activity = this.activity.get();
if (activity != null) {
MediaScannerConnection.scanFile(
activity,
toBeScanned,
null,
new UpdateToastMediaScannerCompletionListener(activity, toBeScanned));
} }
}
public static class LoadingInfo { @Override
protected void onProgressUpdate(@NonNull Dialog dialog, Integer... values) {
@Nullable final Map<FieldKey, String> fieldKeyValueMap; super.onProgressUpdate(dialog, values);
((MaterialDialog) dialog).setMaxProgress(values[1]);
final Collection<String> filePaths; ((MaterialDialog) dialog).setProgress(values[0]);
@Nullable private AbsTagEditorActivity.ArtworkInfo artworkInfo;
public LoadingInfo(
Collection<String> filePaths,
@Nullable Map<FieldKey, String> fieldKeyValueMap,
@Nullable AbsTagEditorActivity.ArtworkInfo artworkInfo) {
this.filePaths = filePaths;
this.fieldKeyValueMap = fieldKeyValueMap;
this.artworkInfo = artworkInfo;
} }
}
} }

View file

@ -17,13 +17,12 @@ package code.name.monkey.retromusic.adapter
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.os.bundleOf import androidx.core.view.ViewCompat
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.navigation.findNavController
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.retromusic.EXTRA_GENRE
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.interfaces.IGenreClickListener
import code.name.monkey.retromusic.model.Genre import code.name.monkey.retromusic.model.Genre
import java.util.* import java.util.*
@ -34,7 +33,8 @@ import java.util.*
class GenreAdapter( class GenreAdapter(
private val activity: FragmentActivity, private val activity: FragmentActivity,
var dataSet: List<Genre>, var dataSet: List<Genre>,
private val mItemLayoutRes: Int private val mItemLayoutRes: Int,
private val listener: IGenreClickListener
) : RecyclerView.Adapter<GenreAdapter.ViewHolder>() { ) : RecyclerView.Adapter<GenreAdapter.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(activity).inflate(mItemLayoutRes, parent, false)) return ViewHolder(LayoutInflater.from(activity).inflate(mItemLayoutRes, parent, false))
@ -62,10 +62,8 @@ class GenreAdapter(
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
override fun onClick(v: View?) { override fun onClick(v: View?) {
activity.findNavController(R.id.fragment_container).navigate( ViewCompat.setTransitionName(itemView, "genre")
R.id.genreDetailsFragment, listener.onClickGenre(dataSet[layoutPosition], itemView)
bundleOf(EXTRA_GENRE to dataSet[layoutPosition])
)
} }
} }
} }

View file

@ -38,6 +38,7 @@ import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.IAlbumClickListener import code.name.monkey.retromusic.interfaces.IAlbumClickListener
import code.name.monkey.retromusic.interfaces.IArtistClickListener import code.name.monkey.retromusic.interfaces.IArtistClickListener
import code.name.monkey.retromusic.interfaces.IGenreClickListener
import code.name.monkey.retromusic.model.* import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
@ -45,7 +46,8 @@ import com.google.android.material.card.MaterialCardView
class HomeAdapter( class HomeAdapter(
private val activity: AppCompatActivity private val activity: AppCompatActivity
) : RecyclerView.Adapter<RecyclerView.ViewHolder>(), IArtistClickListener, IAlbumClickListener { ) : RecyclerView.Adapter<RecyclerView.ViewHolder>(), IArtistClickListener, IAlbumClickListener,
IGenreClickListener {
private var list = listOf<Home>() private var list = listOf<Home>()
@ -220,7 +222,8 @@ class HomeAdapter(
val genreAdapter = GenreAdapter( val genreAdapter = GenreAdapter(
activity, activity,
home.arrayList as List<Genre>, home.arrayList as List<Genre>,
R.layout.item_grid_genre R.layout.item_grid_genre,
this@HomeAdapter
) )
recyclerView.apply { recyclerView.apply {
layoutManager = GridLayoutManager(activity, 3, GridLayoutManager.HORIZONTAL, false) layoutManager = GridLayoutManager(activity, 3, GridLayoutManager.HORIZONTAL, false)
@ -267,4 +270,16 @@ class HomeAdapter(
) )
) )
} }
override fun onClickGenre(genre: Genre, view: View) {
activity.findNavController(R.id.fragment_container).navigate(
R.id.genreDetailsFragment,
bundleOf(EXTRA_GENRE to genre),
null,
FragmentNavigatorExtras(
view to "genre"
)
)
}
} }

View file

@ -18,6 +18,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.core.view.isGone
import androidx.core.view.isInvisible import androidx.core.view.isInvisible
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
@ -26,6 +27,7 @@ import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.* import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder import code.name.monkey.retromusic.adapter.base.MediaEntryViewHolder
import code.name.monkey.retromusic.db.PlaylistEntity
import code.name.monkey.retromusic.db.PlaylistWithSongs import code.name.monkey.retromusic.db.PlaylistWithSongs
import code.name.monkey.retromusic.glide.AlbumGlideRequest import code.name.monkey.retromusic.glide.AlbumGlideRequest
import code.name.monkey.retromusic.glide.ArtistGlideRequest import code.name.monkey.retromusic.glide.ArtistGlideRequest
@ -52,7 +54,7 @@ class SearchAdapter(
if (dataSet[position] is Album) return ALBUM if (dataSet[position] is Album) return ALBUM
if (dataSet[position] is Artist) return ARTIST if (dataSet[position] is Artist) return ARTIST
if (dataSet[position] is Genre) return GENRE if (dataSet[position] is Genre) return GENRE
if (dataSet[position] is PlaylistWithSongs) return PLAYLIST if (dataSet[position] is PlaylistEntity) return PLAYLIST
return if (dataSet[position] is Song) SONG else HEADER return if (dataSet[position] is Song) SONG else HEADER
} }
@ -107,9 +109,9 @@ class SearchAdapter(
) )
} }
PLAYLIST -> { PLAYLIST -> {
val playlist = dataSet[position] as PlaylistWithSongs val playlist = dataSet[position] as PlaylistEntity
holder.title?.text = playlist.playlistEntity.playlistName holder.title?.text = playlist.playlistName
holder.text?.text = MusicUtil.playlistInfoString(activity, playlist.songs) //holder.text?.text = MusicUtil.playlistInfoString(activity, playlist.songs)
} }
else -> { else -> {
holder.title?.text = dataSet[position].toString() holder.title?.text = dataSet[position].toString()
@ -137,6 +139,7 @@ class SearchAdapter(
itemView.setOnLongClickListener(null) itemView.setOnLongClickListener(null)
imageTextContainer?.isInvisible = true imageTextContainer?.isInvisible = true
if (itemViewType == SONG) { if (itemViewType == SONG) {
imageTextContainer?.isGone = true
menu?.visibility = View.VISIBLE menu?.visibility = View.VISIBLE
menu?.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) { menu?.setOnClickListener(object : SongMenuHelper.OnClickSongMenu(activity) {
override val song: Song override val song: Song

View file

@ -89,15 +89,6 @@ open class AlbumAdapter(
holder.itemView.isActivated = isChecked holder.itemView.isActivated = isChecked
holder.title?.text = getAlbumTitle(album) holder.title?.text = getAlbumTitle(album)
holder.text?.text = getAlbumText(album) holder.text?.text = getAlbumText(album)
holder.playSongs?.setOnClickListener {
album.songs.let { songs ->
MusicPlayerRemote.openQueue(
songs,
0,
true
)
}
}
loadAlbumCover(album, holder) loadAlbumCover(album, holder)
} }

View file

@ -65,7 +65,7 @@ class HorizontalAlbumAdapter(
} }
override fun getItemViewType(position: Int): Int { override fun getItemViewType(position: Int): Int {
return HorizontalAdapterHelper.getItemViewtype(position, itemCount) return HorizontalAdapterHelper.getItemViewType(position, itemCount)
} }
override fun getItemCount(): Int { override fun getItemCount(): Int {

View file

@ -21,6 +21,7 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import com.google.android.material.card.MaterialCardView; import com.google.android.material.card.MaterialCardView;
@ -47,11 +48,10 @@ public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHold
@Nullable public View mask; @Nullable public View mask;
@Nullable public View menu; @Nullable public AppCompatImageView menu;
@Nullable public View paletteColorContainer; @Nullable public View paletteColorContainer;
@Nullable public ImageButton playSongs;
@Nullable public RecyclerView recyclerView; @Nullable public RecyclerView recyclerView;
@ -83,7 +83,6 @@ public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHold
paletteColorContainer = itemView.findViewById(R.id.paletteColorContainer); paletteColorContainer = itemView.findViewById(R.id.paletteColorContainer);
recyclerView = itemView.findViewById(R.id.recycler_view); recyclerView = itemView.findViewById(R.id.recycler_view);
mask = itemView.findViewById(R.id.mask); mask = itemView.findViewById(R.id.mask);
playSongs = itemView.findViewById(R.id.playSongs);
dummyContainer = itemView.findViewById(R.id.dummy_view); dummyContainer = itemView.findViewById(R.id.dummy_view);
if (imageContainerCard != null) { if (imageContainerCard != null) {

View file

@ -15,15 +15,18 @@
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentActivity
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.applyColor
import code.name.monkey.retromusic.extensions.applyOutlineColor
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.ICabHolder import code.name.monkey.retromusic.interfaces.ICabHolder
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
class ShuffleButtonSongAdapter( class ShuffleButtonSongAdapter(
activity: AppCompatActivity, activity: FragmentActivity,
dataSet: MutableList<Song>, dataSet: MutableList<Song>,
itemLayoutRes: Int, itemLayoutRes: Int,
ICabHolder: ICabHolder? ICabHolder: ICabHolder?
@ -35,16 +38,19 @@ class ShuffleButtonSongAdapter(
override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) { override fun onBindViewHolder(holder: SongAdapter.ViewHolder, position: Int) {
if (holder.itemViewType == OFFSET_ITEM) { if (holder.itemViewType == OFFSET_ITEM) {
val color = ThemeStore.accentColor(activity)
val viewHolder = holder as ViewHolder val viewHolder = holder as ViewHolder
viewHolder.playAction?.let { viewHolder.playAction?.let {
it.setOnClickListener { it.setOnClickListener {
MusicPlayerRemote.openQueue(dataSet, 0, true) MusicPlayerRemote.openQueue(dataSet, 0, true)
} }
it.applyOutlineColor(color)
} }
viewHolder.shuffleAction?.let { viewHolder.shuffleAction?.let {
it.setOnClickListener { it.setOnClickListener {
MusicPlayerRemote.openAndShuffleQueue(dataSet, true) MusicPlayerRemote.openAndShuffleQueue(dataSet, true)
} }
it.applyColor(color)
} }
} else { } else {
super.onBindViewHolder(holder, position - 1) super.onBindViewHolder(holder, position - 1)

View file

@ -111,6 +111,7 @@ open class SongAdapter(
holder.title?.setTextColor(color.primaryTextColor) holder.title?.setTextColor(color.primaryTextColor)
holder.text?.setTextColor(color.secondaryTextColor) holder.text?.setTextColor(color.secondaryTextColor)
holder.paletteColorContainer?.setBackgroundColor(color.backgroundColor) holder.paletteColorContainer?.setBackgroundColor(color.backgroundColor)
holder.menu?.imageTintList= ColorStateList.valueOf(color.primaryTextColor)
} }
holder.mask?.backgroundTintList = ColorStateList.valueOf(color.primaryTextColor) holder.mask?.backgroundTintList = ColorStateList.valueOf(color.primaryTextColor)
} }

View file

@ -20,6 +20,7 @@ import android.os.Bundle
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.model.Playlist import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
import code.name.monkey.retromusic.model.smartplaylist.ShuffleAllPlaylist import code.name.monkey.retromusic.model.smartplaylist.ShuffleAllPlaylist
@ -31,16 +32,7 @@ class AppShortcutLauncherActivity : Activity() {
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
when (extraNotNull(KEY_SHORTCUT_TYPE, SHORTCUT_TYPE_NONE).value) {
var shortcutType = SHORTCUT_TYPE_NONE
// Set shortcutType from the intent extras
val extras = intent.extras
if (extras != null) {
shortcutType = extras.getInt(KEY_SHORTCUT_TYPE, SHORTCUT_TYPE_NONE)
}
when (shortcutType) {
SHORTCUT_TYPE_SHUFFLE_ALL -> { SHORTCUT_TYPE_SHUFFLE_ALL -> {
startServiceWithPlaylist( startServiceWithPlaylist(
SHUFFLE_MODE_SHUFFLE, ShuffleAllPlaylist() SHUFFLE_MODE_SHUFFLE, ShuffleAllPlaylist()
@ -78,9 +70,9 @@ class AppShortcutLauncherActivity : Activity() {
companion object { companion object {
const val KEY_SHORTCUT_TYPE = "code.name.monkey.retromusic.appshortcuts.ShortcutType" const val KEY_SHORTCUT_TYPE = "code.name.monkey.retromusic.appshortcuts.ShortcutType"
const val SHORTCUT_TYPE_SHUFFLE_ALL = 0 const val SHORTCUT_TYPE_SHUFFLE_ALL = 0L
const val SHORTCUT_TYPE_TOP_TRACKS = 1 const val SHORTCUT_TYPE_TOP_TRACKS = 1L
const val SHORTCUT_TYPE_LAST_ADDED = 2 const val SHORTCUT_TYPE_LAST_ADDED = 2L
const val SHORTCUT_TYPE_NONE = 4 const val SHORTCUT_TYPE_NONE = 4L
} }
} }

View file

@ -32,7 +32,7 @@ class DynamicShortcutManager(private val context: Context) {
this.context.getSystemService(ShortcutManager::class.java) this.context.getSystemService(ShortcutManager::class.java)
private val defaultShortcuts: List<ShortcutInfo> private val defaultShortcuts: List<ShortcutInfo>
get() = Arrays.asList( get() = listOf(
ShuffleAllShortcutType(context).shortcutInfo, ShuffleAllShortcutType(context).shortcutInfo,
TopTracksShortcutType(context).shortcutInfo, TopTracksShortcutType(context).shortcutInfo,
LastAddedShortcutType(context).shortcutInfo LastAddedShortcutType(context).shortcutInfo
@ -58,8 +58,12 @@ class DynamicShortcutManager(private val context: Context) {
icon: Icon, icon: Icon,
intent: Intent intent: Intent
): ShortcutInfo { ): ShortcutInfo {
return ShortcutInfo.Builder(context, id).setShortLabel(shortLabel) return ShortcutInfo.Builder(context, id)
.setLongLabel(longLabel).setIcon(icon).setIntent(intent).build() .setShortLabel(shortLabel)
.setLongLabel(longLabel)
.setIcon(icon)
.setIntent(intent)
.build()
} }
fun reportShortcutUsed(context: Context, shortcutId: String) { fun reportShortcutUsed(context: Context, shortcutId: String) {

View file

@ -33,11 +33,11 @@ abstract class BaseShortcutType(internal var context: Context) {
* @param shortcutType Describes the type of shortcut to create (ShuffleAll, TopTracks, custom playlist, etc.) * @param shortcutType Describes the type of shortcut to create (ShuffleAll, TopTracks, custom playlist, etc.)
* @return * @return
*/ */
internal fun getPlaySongsIntent(shortcutType: Int): Intent { internal fun getPlaySongsIntent(shortcutType: Long): Intent {
val intent = Intent(context, AppShortcutLauncherActivity::class.java) val intent = Intent(context, AppShortcutLauncherActivity::class.java)
intent.action = Intent.ACTION_VIEW intent.action = Intent.ACTION_VIEW
val b = Bundle() val b = Bundle()
b.putInt(AppShortcutLauncherActivity.KEY_SHORTCUT_TYPE, shortcutType) b.putLong(AppShortcutLauncherActivity.KEY_SHORTCUT_TYPE, shortcutType)
intent.putExtras(b) intent.putExtras(b)
return intent return intent
} }

View file

@ -26,20 +26,16 @@ import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
class ShuffleAllShortcutType(context: Context) : BaseShortcutType(context) { class ShuffleAllShortcutType(context: Context) : BaseShortcutType(context) {
override val shortcutInfo: ShortcutInfo override val shortcutInfo: ShortcutInfo
get() = ShortcutInfo.Builder( get() = ShortcutInfo.Builder(context, id)
context, id .setShortLabel(context.getString(R.string.app_shortcut_shuffle_all_short))
).setShortLabel(context.getString(R.string.app_shortcut_shuffle_all_short)).setLongLabel( .setLongLabel(context.getString(R.string.app_shortcut_shuffle_all_long))
context.getString(R.string.app_shortcut_shuffle_all_long) .setIcon(AppShortcutIconGenerator.generateThemedIcon(context, R.drawable.ic_app_shortcut_shuffle_all))
).setIcon( .setIntent(getPlaySongsIntent(AppShortcutLauncherActivity.SHORTCUT_TYPE_SHUFFLE_ALL))
AppShortcutIconGenerator.generateThemedIcon(
context, R.drawable.ic_app_shortcut_shuffle_all
)
).setIntent(getPlaySongsIntent(AppShortcutLauncherActivity.SHORTCUT_TYPE_SHUFFLE_ALL))
.build() .build()
companion object { companion object {
val id: String val id: String
get() = BaseShortcutType.ID_PREFIX + "shuffle_all" get() = ID_PREFIX + "shuffle_all"
} }
} }

View file

@ -19,7 +19,7 @@ import androidx.room.RoomDatabase
@Database( @Database(
entities = [PlaylistEntity::class, SongEntity::class, HistoryEntity::class, PlayCountEntity::class, BlackListStoreEntity::class, LyricsEntity::class], entities = [PlaylistEntity::class, SongEntity::class, HistoryEntity::class, PlayCountEntity::class, BlackListStoreEntity::class, LyricsEntity::class],
version = 22, version = 23,
exportSchema = false exportSchema = false
) )
abstract class RetroDatabase : RoomDatabase() { abstract class RetroDatabase : RoomDatabase() {

View file

@ -154,6 +154,10 @@ fun MaterialButton.applyColor(color: Int) {
iconTint = textColorColorStateList iconTint = textColorColorStateList
} }
fun MaterialButton.accentColor(){
this.applyColor(ThemeStore.accentColor(context))
}
fun MaterialButton.applyOutlineColor(color: Int) { fun MaterialButton.applyOutlineColor(color: Int) {
val textColorColorStateList = ColorStateList.valueOf(color) val textColorColorStateList = ColorStateList.valueOf(color)
setTextColor(textColorColorStateList) setTextColor(textColorColorStateList)

View file

@ -15,9 +15,12 @@
package code.name.monkey.retromusic.extensions package code.name.monkey.retromusic.extensions
import android.animation.ObjectAnimator import android.animation.ObjectAnimator
import android.content.Context
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.ViewTreeObserver
import android.view.inputmethod.InputMethodManager
import android.widget.EditText import android.widget.EditText
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.core.animation.doOnEnd import androidx.core.animation.doOnEnd
@ -75,3 +78,39 @@ fun BottomSheetBehavior<*>.peekHeightAnimate(value: Int) {
start() start()
} }
} }
fun View.focusAndShowKeyboard() {
/**
* This is to be called when the window already has focus.
*/
fun View.showTheKeyboardNow() {
if (isFocused) {
post {
// We still post the call, just in case we are being notified of the windows focus
// but InputMethodManager didn't get properly setup yet.
val imm =
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
}
}
requestFocus()
if (hasWindowFocus()) {
// No need to wait for the window to get focus.
showTheKeyboardNow()
} else {
// We need to wait until the window gets focus.
viewTreeObserver.addOnWindowFocusChangeListener(
object : ViewTreeObserver.OnWindowFocusChangeListener {
override fun onWindowFocusChanged(hasFocus: Boolean) {
// This notification will arrive just before the InputMethodManager gets set up.
if (hasFocus) {
this@focusAndShowKeyboard.showTheKeyboardNow()
// Its very important to remove this listener once we are done.
viewTreeObserver.removeOnWindowFocusChangeListener(this)
}
}
})
}
}

View file

@ -1,37 +0,0 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* 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.fragments
import androidx.lifecycle.ViewModel
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.*
open class CoroutineViewModel(
private val mainDispatcher: CoroutineDispatcher
) : ViewModel() {
private val job = Job()
protected val scope = CoroutineScope(job + mainDispatcher)
protected fun launch(
context: CoroutineContext = mainDispatcher,
start: CoroutineStart = CoroutineStart.DEFAULT,
block: suspend CoroutineScope.() -> Unit
) = scope.launch(context, start, block)
override fun onCleared() {
super.onCleared()
job.cancel()
}
}

View file

@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
import code.name.monkey.retromusic.* import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.adapter.album.AlbumAdapter import code.name.monkey.retromusic.adapter.album.AlbumAdapter
import code.name.monkey.retromusic.adapter.artist.ArtistAdapter import code.name.monkey.retromusic.adapter.artist.ArtistAdapter
import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
import code.name.monkey.retromusic.adapter.song.SongAdapter import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.db.toSong import code.name.monkey.retromusic.db.toSong
import code.name.monkey.retromusic.extensions.dipToPix import code.name.monkey.retromusic.extensions.dipToPix
@ -34,7 +35,6 @@ import code.name.monkey.retromusic.interfaces.IAlbumClickListener
import code.name.monkey.retromusic.interfaces.IArtistClickListener import code.name.monkey.retromusic.interfaces.IArtistClickListener
import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.state.NowPlayingPanelState
import code.name.monkey.retromusic.util.RetroUtil import code.name.monkey.retromusic.util.RetroUtil
import kotlinx.android.synthetic.main.fragment_playlist_detail.* import kotlinx.android.synthetic.main.fragment_playlist_detail.*
@ -48,18 +48,10 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
mainActivity.setSupportActionBar(toolbar) mainActivity.setSupportActionBar(toolbar)
progressIndicator.hide() progressIndicator.hide()
when (args.type) { when (args.type) {
TOP_ARTISTS -> { TOP_ARTISTS -> loadArtists(R.string.top_artists, TOP_ARTISTS)
loadArtists(R.string.top_artists, TOP_ARTISTS) RECENT_ARTISTS -> loadArtists(R.string.recent_artists, RECENT_ARTISTS)
} TOP_ALBUMS -> loadAlbums(R.string.top_albums, TOP_ALBUMS)
RECENT_ARTISTS -> { RECENT_ALBUMS -> loadAlbums(R.string.recent_albums, RECENT_ALBUMS)
loadArtists(R.string.recent_artists, RECENT_ARTISTS)
}
TOP_ALBUMS -> {
loadAlbums(R.string.top_albums, TOP_ALBUMS)
}
RECENT_ALBUMS -> {
loadAlbums(R.string.recent_albums, RECENT_ALBUMS)
}
FAVOURITES -> loadFavorite() FAVOURITES -> loadFavorite()
HISTORY_PLAYLIST -> loadHistory() HISTORY_PLAYLIST -> loadHistory()
LAST_ADDED_PLAYLIST -> lastAddedSongs() LAST_ADDED_PLAYLIST -> lastAddedSongs()
@ -77,7 +69,7 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
private fun lastAddedSongs() { private fun lastAddedSongs() {
toolbar.setTitle(R.string.last_added) toolbar.setTitle(R.string.last_added)
val songAdapter = SongAdapter( val songAdapter = ShuffleButtonSongAdapter(
requireActivity(), requireActivity(),
mutableListOf(), mutableListOf(),
R.layout.item_list, null R.layout.item_list, null
@ -93,7 +85,7 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
private fun topPlayed() { private fun topPlayed() {
toolbar.setTitle(R.string.my_top_tracks) toolbar.setTitle(R.string.my_top_tracks)
val songAdapter = SongAdapter( val songAdapter = ShuffleButtonSongAdapter(
requireActivity(), requireActivity(),
mutableListOf(), mutableListOf(),
R.layout.item_list, null R.layout.item_list, null
@ -110,7 +102,7 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
private fun loadHistory() { private fun loadHistory() {
toolbar.setTitle(R.string.history) toolbar.setTitle(R.string.history)
val songAdapter = SongAdapter( val songAdapter = ShuffleButtonSongAdapter(
requireActivity(), requireActivity(),
mutableListOf(), mutableListOf(),
R.layout.item_list, null R.layout.item_list, null

View file

@ -15,36 +15,19 @@
package code.name.monkey.retromusic.fragments package code.name.monkey.retromusic.fragments
import android.widget.Toast import android.widget.Toast
import androidx.lifecycle.LiveData import androidx.lifecycle.*
import androidx.lifecycle.MutableLiveData import code.name.monkey.retromusic.*
import androidx.lifecycle.ViewModel import code.name.monkey.retromusic.db.*
import androidx.lifecycle.liveData
import androidx.lifecycle.viewModelScope
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.RECENT_ALBUMS
import code.name.monkey.retromusic.RECENT_ARTISTS
import code.name.monkey.retromusic.TOP_ALBUMS
import code.name.monkey.retromusic.TOP_ARTISTS
import code.name.monkey.retromusic.db.PlaylistEntity
import code.name.monkey.retromusic.db.PlaylistWithSongs
import code.name.monkey.retromusic.db.SongEntity
import code.name.monkey.retromusic.db.toSong
import code.name.monkey.retromusic.db.toSongEntity
import code.name.monkey.retromusic.fragments.ReloadType.* import code.name.monkey.retromusic.fragments.ReloadType.*
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.model.Album import code.name.monkey.retromusic.model.*
import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.model.Contributor
import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Home
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
import code.name.monkey.retromusic.state.NowPlayingPanelState
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class LibraryViewModel( class LibraryViewModel(
private val repository: RealRepository private val repository: RealRepository
@ -152,9 +135,11 @@ class LibraryViewModel(
} }
} }
fun search(query: String?) = viewModelScope.launch(IO) { fun search(query: String?) {
val result = repository.search(query) viewModelScope.launch(IO) {
searchResults.postValue(result) val result = repository.search(query)
withContext(Main) { searchResults.postValue(result) }
}
} }
fun forceReload(reloadType: ReloadType) = viewModelScope.launch { fun forceReload(reloadType: ReloadType) = viewModelScope.launch {
@ -322,7 +307,8 @@ class LibraryViewModel(
viewModelScope.launch(IO) { viewModelScope.launch(IO) {
val playlists = checkPlaylistExists(playlistName) val playlists = checkPlaylistExists(playlistName)
if (playlists.isEmpty()) { if (playlists.isEmpty()) {
val playlistId: Long = createPlaylist(PlaylistEntity(playlistName = playlistName)) val playlistId: Long =
createPlaylist(PlaylistEntity(playlistName = playlistName))
insertSongs(songs.map { it.toSongEntity(playlistId) }) insertSongs(songs.map { it.toSongEntity(playlistId) })
forceReload(Playlists) forceReload(Playlists)
} else { } else {

View file

@ -17,11 +17,7 @@ package code.name.monkey.retromusic.fragments.albums
import android.app.ActivityOptions import android.app.ActivityOptions
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.*
import android.view.MenuInflater
import android.view.MenuItem
import android.view.SubMenu
import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat import androidx.core.text.HtmlCompat
@ -287,8 +283,8 @@ class AlbumDetailsFragment : AbsMainActivityFragment(R.layout.fragment_album_det
} }
private fun setColors(color: Int) { private fun setColors(color: Int) {
shuffleAction.applyColor(color) shuffleAction?.applyColor(color)
playAction.applyOutlineColor(color) playAction?.applyOutlineColor(color)
} }
override fun onAlbumClick(albumId: Long, view: View) { override fun onAlbumClick(albumId: Long, view: View) {

View file

@ -14,6 +14,7 @@
*/ */
package code.name.monkey.retromusic.fragments.artists package code.name.monkey.retromusic.fragments.artists
import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.text.Spanned import android.text.Spanned
@ -137,7 +138,7 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
} }
} }
fun showArtist(artist: Artist) { private fun showArtist(artist: Artist) {
this.artist = artist this.artist = artist
loadArtistImage(artist) loadArtistImage(artist)
if (RetroUtil.isAllowedToDownloadMetadata(requireContext())) { if (RetroUtil.isAllowedToDownloadMetadata(requireContext())) {
@ -164,7 +165,7 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
songTitle.text = songText songTitle.text = songText
albumTitle.text = albumText albumTitle.text = albumText
songAdapter.swapDataSet(artist.songs.sortedBy { it.trackNumber }) songAdapter.swapDataSet(artist.songs.sortedBy { it.trackNumber })
artist.albums?.let { albumAdapter.swapDataSet(it) } albumAdapter.swapDataSet(artist.albums)
} }
private fun loadBiography( private fun loadBiography(
@ -174,7 +175,7 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
biography = null biography = null
this.lang = lang this.lang = lang
detailsViewModel.getArtistInfo(name, lang, null) detailsViewModel.getArtistInfo(name, lang, null)
.observe(viewLifecycleOwner, Observer { result -> .observe(viewLifecycleOwner, { result ->
when (result) { when (result) {
is Result.Loading -> println("Loading") is Result.Loading -> println("Loading")
is Result.Error -> println("Error") is Result.Error -> println("Error")
@ -222,8 +223,8 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
} }
private fun setColors(color: Int) { private fun setColors(color: Int) {
shuffleAction.applyColor(color) shuffleAction?.applyColor(color)
playAction.applyOutlineColor(color) playAction?.applyOutlineColor(color)
} }
override fun onAlbumClick(albumId: Long, view: View) { override fun onAlbumClick(albumId: Long, view: View) {
@ -282,6 +283,21 @@ class ArtistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_artist_d
return true return true
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
REQUEST_CODE_SELECT_IMAGE -> if (resultCode == Activity.RESULT_OK) {
data?.data?.let {
CustomArtistImageUtil.getInstance(requireContext())
.setCustomArtistImage(artist, it)
}
}
else -> if (resultCode == Activity.RESULT_OK) {
println("OK")
}
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater) super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.menu_artist_detail, menu) inflater.inflate(R.menu.menu_artist_detail, menu)

View file

@ -50,13 +50,13 @@ import code.name.monkey.retromusic.model.lyrics.Lyrics
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
import code.name.monkey.retromusic.util.* import code.name.monkey.retromusic.util.*
import java.io.FileNotFoundException
import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.* import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.*
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.koin.android.ext.android.get import org.koin.android.ext.android.get
import java.io.FileNotFoundException
abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragment(layout), abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMainActivityFragment(layout),
Toolbar.OnMenuItemClickListener, IPaletteColorHolder, PlayerAlbumCoverFragment.Callbacks { Toolbar.OnMenuItemClickListener, IPaletteColorHolder, PlayerAlbumCoverFragment.Callbacks {

View file

@ -112,7 +112,7 @@ abstract class AbsRecyclerViewCustomGridSizeFragment<A : RecyclerView.Adapter<*>
} else { } else {
0 0
} }
recyclerView.setPadding(padding, padding, padding, padding) //recyclerView.setPadding(padding, padding, padding, padding)
} }
protected abstract fun setGridSize(gridSize: Int) protected abstract fun setGridSize(gridSize: Int)

View file

@ -15,10 +15,14 @@
package code.name.monkey.retromusic.fragments.base package code.name.monkey.retromusic.fragments.base
import android.os.Bundle import android.os.Bundle
import android.view.* import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.annotation.NonNull import androidx.annotation.NonNull
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.core.text.HtmlCompat import androidx.core.text.HtmlCompat
import androidx.core.view.updatePadding
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
@ -28,12 +32,9 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.state.NowPlayingPanelState
import code.name.monkey.retromusic.util.DensityUtil import code.name.monkey.retromusic.util.DensityUtil
import code.name.monkey.retromusic.util.ThemedFastScroller.create import code.name.monkey.retromusic.util.ThemedFastScroller.create
import code.name.monkey.retromusic.views.ScrollingViewOnApplyWindowInsetsListener
import com.google.android.material.appbar.AppBarLayout import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.transition.Hold
import kotlinx.android.synthetic.main.fragment_main_recycler.* import kotlinx.android.synthetic.main.fragment_main_recycler.*
import me.zhanghai.android.fastscroll.FastScroller import me.zhanghai.android.fastscroll.FastScroller
import me.zhanghai.android.fastscroll.FastScrollerBuilder import me.zhanghai.android.fastscroll.FastScrollerBuilder
@ -50,15 +51,6 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
protected var adapter: A? = null protected var adapter: A? = null
protected var layoutManager: LM? = null protected var layoutManager: LM? = null
private fun setUpTransitions() {
exitTransition = Hold()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setUpTransitions()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
mainActivity.setBottomBarVisibility(View.VISIBLE) mainActivity.setBottomBarVisibility(View.VISIBLE)
@ -92,12 +84,7 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
layoutManager = this@AbsRecyclerViewFragment.layoutManager layoutManager = this@AbsRecyclerViewFragment.layoutManager
adapter = this@AbsRecyclerViewFragment.adapter adapter = this@AbsRecyclerViewFragment.adapter
val fastScroller = create(this) val fastScroller = create(this)
setOnApplyWindowInsetsListener(
ScrollingViewOnApplyWindowInsetsListener(
recyclerView,
fastScroller
)
)
} }
checkForPadding() checkForPadding()
} }
@ -131,13 +118,13 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
private fun checkForPadding() { private fun checkForPadding() {
val itemCount: Int = adapter?.itemCount ?: 0 val itemCount: Int = adapter?.itemCount ?: 0
val params = container.layoutParams as ViewGroup.MarginLayoutParams
if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) { if (itemCount > 0 && MusicPlayerRemote.playingQueue.isNotEmpty()) {
val height = DensityUtil.dip2px(requireContext(), 104f) val height = DensityUtil.dip2px(requireContext(), 112f)
params.bottomMargin = height recyclerView.updatePadding(0, 0, 0, height)
} else { } else {
val height = DensityUtil.dip2px(requireContext(), 52f) val height = DensityUtil.dip2px(requireContext(), 56f)
params.bottomMargin = height recyclerView.updatePadding(0, 0, 0, height)
} }
} }
@ -151,12 +138,12 @@ abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : Recycle
protected abstract fun createAdapter(): A protected abstract fun createAdapter(): A
override fun onOffsetChanged(p0: AppBarLayout?, i: Int) { override fun onOffsetChanged(p0: AppBarLayout?, i: Int) {
container.setPadding( /*recyclerView.setPadding(
container.paddingLeft, recyclerView.paddingLeft,
container.paddingTop, recyclerView.paddingTop,
container.paddingRight, recyclerView.paddingRight,
i i
) )*/
} }
override fun onQueueChanged() { override fun onQueueChanged() {

View file

@ -54,6 +54,7 @@ import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
@ -520,7 +521,7 @@ public class FoldersFragment extends AbsMainActivityFragment
getActivity().getApplicationContext(), getActivity().getApplicationContext(),
toBeScanned, toBeScanned,
null, null,
new UpdateToastMediaScannerCompletionListener(getActivity(), toBeScanned)); new UpdateToastMediaScannerCompletionListener(getActivity(), Arrays.asList(toBeScanned)));
} }
} }

View file

@ -19,10 +19,12 @@ import android.view.Menu
import android.view.MenuInflater import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import androidx.core.view.ViewCompat
import androidx.navigation.fragment.navArgs import androidx.navigation.fragment.navArgs
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.song.SongAdapter import code.name.monkey.retromusic.adapter.song.SongAdapter
import code.name.monkey.retromusic.extensions.dipToPix import code.name.monkey.retromusic.extensions.dipToPix
@ -30,11 +32,11 @@ import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.helper.menu.GenreMenuHelper import code.name.monkey.retromusic.helper.menu.GenreMenuHelper
import code.name.monkey.retromusic.model.Genre import code.name.monkey.retromusic.model.Genre
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.state.NowPlayingPanelState import com.google.android.material.transition.MaterialContainerTransform
import java.util.*
import kotlinx.android.synthetic.main.fragment_playlist_detail.* import kotlinx.android.synthetic.main.fragment_playlist_detail.*
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf import org.koin.core.parameter.parametersOf
import java.util.*
class GenreDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_detail) { class GenreDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_detail) {
private val arguments by navArgs<GenreDetailsFragmentArgs>() private val arguments by navArgs<GenreDetailsFragmentArgs>()
@ -43,22 +45,31 @@ class GenreDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_
} }
private lateinit var genre: Genre private lateinit var genre: Genre
private lateinit var songAdapter: SongAdapter private lateinit var songAdapter: SongAdapter
private fun setUpTransitions() {
val transform = MaterialContainerTransform()
transform.setAllContainerColors(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
sharedElementEnterTransition = transform
}
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onCreate(savedInstanceState)
setUpTransitions()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setHasOptionsMenu(true) setHasOptionsMenu(true)
mainActivity.setBottomBarVisibility(View.GONE) mainActivity.setBottomBarVisibility(View.GONE)
mainActivity.addMusicServiceEventListener(detailsViewModel) mainActivity.addMusicServiceEventListener(detailsViewModel)
mainActivity.setSupportActionBar(toolbar) mainActivity.setSupportActionBar(toolbar)
progressIndicator.hide() ViewCompat.setTransitionName(container, "genre")
genre = arguments.extraGenre
toolbar?.title = arguments.extraGenre.name
setupRecyclerView() setupRecyclerView()
detailsViewModel.getSongs().observe(viewLifecycleOwner, androidx.lifecycle.Observer { detailsViewModel.getSongs().observe(viewLifecycleOwner, {
songs(it) songs(it)
}) })
detailsViewModel.getGenre().observe(viewLifecycleOwner, androidx.lifecycle.Observer {
genre = it
toolbar?.title = it.name
})
} }
private fun setupRecyclerView() { private fun setupRecyclerView() {
@ -77,7 +88,9 @@ class GenreDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playlist_
} }
fun songs(songs: List<Song>) { fun songs(songs: List<Song>) {
songAdapter.swapDataSet(songs) progressIndicator.hide()
if (songs.isNotEmpty()) songAdapter.swapDataSet(songs)
else songAdapter.swapDataSet(emptyList())
} }
private fun getEmojiByUnicode(unicode: Int): String { private fun getEmojiByUnicode(unicode: Int): String {

View file

@ -16,13 +16,20 @@ package code.name.monkey.retromusic.fragments.genres
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.core.os.bundleOf
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.retromusic.EXTRA_GENRE
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.GenreAdapter import code.name.monkey.retromusic.adapter.GenreAdapter
import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment import code.name.monkey.retromusic.fragments.base.AbsRecyclerViewFragment
import code.name.monkey.retromusic.interfaces.IGenreClickListener
import code.name.monkey.retromusic.model.Genre
class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager>() { class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
IGenreClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
libraryViewModel.getGenre().observe(viewLifecycleOwner, Observer { libraryViewModel.getGenre().observe(viewLifecycleOwner, Observer {
@ -39,7 +46,7 @@ class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager
override fun createAdapter(): GenreAdapter { override fun createAdapter(): GenreAdapter {
val dataSet = if (adapter == null) ArrayList() else adapter!!.dataSet val dataSet = if (adapter == null) ArrayList() else adapter!!.dataSet
return GenreAdapter(requireActivity(), dataSet, R.layout.item_list_no_image) return GenreAdapter(requireActivity(), dataSet, R.layout.item_list_no_image, this)
} }
override val emptyMessage: Int override val emptyMessage: Int
@ -54,4 +61,15 @@ class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager
return GenresFragment() return GenresFragment()
} }
} }
override fun onClickGenre(genre: Genre, view: View) {
findNavController().navigate(
R.id.genreDetailsFragment,
bundleOf(EXTRA_GENRE to genre),
null,
FragmentNavigatorExtras(
view to "genre"
)
)
}
} }

View file

@ -29,17 +29,13 @@ import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.common.ATHToolbarActivity import code.name.monkey.appthemehelper.common.ATHToolbarActivity
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.HISTORY_PLAYLIST import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.LAST_ADDED_PLAYLIST
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.TOP_PLAYED_PLAYLIST
import code.name.monkey.retromusic.adapter.HomeAdapter import code.name.monkey.retromusic.adapter.HomeAdapter
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog
import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog import code.name.monkey.retromusic.dialogs.ImportPlaylistDialog
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.glide.ProfileBannerGlideRequest import code.name.monkey.retromusic.glide.ProfileBannerGlideRequest
import code.name.monkey.retromusic.glide.UserProfileGlideRequest import code.name.monkey.retromusic.glide.UserProfileGlideRequest
import code.name.monkey.retromusic.state.NowPlayingPanelState
import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
@ -68,14 +64,14 @@ class HomeFragment :
lastAdded.setOnClickListener { lastAdded.setOnClickListener {
findNavController().navigate( findNavController().navigate(
R.id.detailListFragment, R.id.detailListFragment,
bundleOf("type" to LAST_ADDED_PLAYLIST) bundleOf(EXTRA_PLAYLIST_TYPE to LAST_ADDED_PLAYLIST)
) )
} }
topPlayed.setOnClickListener { topPlayed.setOnClickListener {
findNavController().navigate( findNavController().navigate(
R.id.detailListFragment, R.id.detailListFragment,
bundleOf("type" to TOP_PLAYED_PLAYLIST) bundleOf(EXTRA_PLAYLIST_TYPE to TOP_PLAYED_PLAYLIST)
) )
} }
@ -86,7 +82,7 @@ class HomeFragment :
history.setOnClickListener { history.setOnClickListener {
findNavController().navigate( findNavController().navigate(
R.id.detailListFragment, R.id.detailListFragment,
bundleOf("type" to HISTORY_PLAYLIST) bundleOf(EXTRA_PLAYLIST_TYPE to HISTORY_PLAYLIST)
) )
} }

View file

@ -22,7 +22,6 @@ import android.widget.FrameLayout
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.navigation.fragment.FragmentNavigatorExtras
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.EXTRA_ARTIST_ID import code.name.monkey.retromusic.EXTRA_ARTIST_ID
@ -163,13 +162,10 @@ class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
private fun setupArtist() { private fun setupArtist() {
artistImage.setOnClickListener { artistImage.setOnClickListener {
mainActivity.collapsePanel() mainActivity.collapsePanel()
findNavController() findNavController().navigate(
.navigate( R.id.artistDetailsFragment,
R.id.artistDetailsFragment, bundleOf(EXTRA_ARTIST_ID to MusicPlayerRemote.currentSong.artistId),
bundleOf(EXTRA_ARTIST_ID to MusicPlayerRemote.currentSong.artistId), )
null,
FragmentNavigatorExtras(it to "artist")
)
} }
} }

View file

@ -168,8 +168,8 @@ class GradientPlayerFragment : AbsPlayerFragment(R.layout.fragment_gradient_play
} }
override fun onPause() { override fun onPause() {
recyclerViewDragDropManager?.cancelDrag()
super.onPause() super.onPause()
recyclerViewDragDropManager?.cancelDrag()
progressViewUpdateHelper.stop() progressViewUpdateHelper.stop()
} }

View file

@ -12,14 +12,13 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.song.PlaylistSongAdapter import code.name.monkey.retromusic.adapter.song.ShuffleButtonSongAdapter
import code.name.monkey.retromusic.db.PlaylistWithSongs import code.name.monkey.retromusic.db.PlaylistWithSongs
import code.name.monkey.retromusic.db.toSongs import code.name.monkey.retromusic.db.toSongs
import code.name.monkey.retromusic.extensions.dipToPix import code.name.monkey.retromusic.extensions.dipToPix
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.state.NowPlayingPanelState
import com.google.android.material.transition.MaterialContainerTransform import com.google.android.material.transition.MaterialContainerTransform
import kotlinx.android.synthetic.main.fragment_playlist_detail.* import kotlinx.android.synthetic.main.fragment_playlist_detail.*
import org.koin.androidx.viewmodel.ext.android.viewModel import org.koin.androidx.viewmodel.ext.android.viewModel
@ -32,7 +31,7 @@ class PlaylistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playli
} }
private lateinit var playlist: PlaylistWithSongs private lateinit var playlist: PlaylistWithSongs
private lateinit var playlistSongAdapter: PlaylistSongAdapter private lateinit var playlistSongAdapter: ShuffleButtonSongAdapter
private fun setUpTransitions() { private fun setUpTransitions() {
val transform = MaterialContainerTransform() val transform = MaterialContainerTransform()
@ -61,8 +60,7 @@ class PlaylistDetailsFragment : AbsMainActivityFragment(R.layout.fragment_playli
} }
private fun setUpRecyclerView() { private fun setUpRecyclerView() {
playlistSongAdapter = PlaylistSongAdapter( playlistSongAdapter = ShuffleButtonSongAdapter(
playlist.playlistEntity,
requireActivity(), requireActivity(),
ArrayList(), ArrayList(),
R.layout.item_list, R.layout.item_list,

View file

@ -15,6 +15,7 @@
package code.name.monkey.retromusic.fragments.search package code.name.monkey.retromusic.fragments.search
import android.content.ActivityNotFoundException import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.speech.RecognizerIntent import android.speech.RecognizerIntent
@ -22,7 +23,6 @@ import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.View import android.view.View
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import androidx.core.content.ContextCompat.getSystemService
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -32,6 +32,7 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.SearchAdapter import code.name.monkey.retromusic.adapter.SearchAdapter
import code.name.monkey.retromusic.extensions.accentColor import code.name.monkey.retromusic.extensions.accentColor
import code.name.monkey.retromusic.extensions.dipToPix import code.name.monkey.retromusic.extensions.dipToPix
import code.name.monkey.retromusic.extensions.focusAndShowKeyboard
import code.name.monkey.retromusic.extensions.showToast import code.name.monkey.retromusic.extensions.showToast
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputEditText
@ -54,17 +55,16 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
mainActivity.setSupportActionBar(toolbar) mainActivity.setSupportActionBar(toolbar)
libraryViewModel.clearSearchResult() libraryViewModel.clearSearchResult()
setupRecyclerView() setupRecyclerView()
searchView.addTextChangedListener(this) searchView.apply {
addTextChangedListener(this@SearchFragment)
focusAndShowKeyboard()
}
voiceSearch.setOnClickListener { startMicSearch() } voiceSearch.setOnClickListener { startMicSearch() }
clearText.setOnClickListener { searchView.clearText() } clearText.setOnClickListener { searchView.clearText() }
keyboardPopup.apply { keyboardPopup.apply {
accentColor() accentColor()
setOnClickListener { setOnClickListener {
val inputManager = getSystemService( searchView.focusAndShowKeyboard()
requireContext(),
InputMethodManager::class.java
)
inputManager?.showSoftInput(searchView, InputMethodManager.SHOW_IMPLICIT)
} }
} }
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -145,6 +145,19 @@ class SearchFragment : AbsMainActivityFragment(R.layout.fragment_search), TextWa
showToast(getString(R.string.speech_not_supported)) showToast(getString(R.string.speech_not_supported))
} }
} }
override fun onDestroyView() {
hideKeyboard(view)
super.onDestroyView()
}
private fun hideKeyboard(view: View?) {
if (view != null) {
val imm: InputMethodManager =
requireContext().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
}
}
} }
fun TextInputEditText.clearText() { fun TextInputEditText.clearText() {

View file

@ -25,7 +25,7 @@ import com.bumptech.glide.request.animation.GlideAnimation
abstract class SingleColorTarget(view: ImageView) : BitmapPaletteTarget(view) { abstract class SingleColorTarget(view: ImageView) : BitmapPaletteTarget(view) {
protected val defaultFooterColor: Int private val defaultFooterColor: Int
get() = ATHUtil.resolveColor(view.context, R.attr.colorControlNormal) get() = ATHUtil.resolveColor(view.context, R.attr.colorControlNormal)
abstract fun onColorReady(color: Int) abstract fun onColorReady(color: Int)

View file

@ -20,7 +20,7 @@ import code.name.monkey.retromusic.R
object HorizontalAdapterHelper { object HorizontalAdapterHelper {
const val LAYOUT_RES = R.layout.item_album_card const val LAYOUT_RES = R.layout.item_image
private const val TYPE_FIRST = 1 private const val TYPE_FIRST = 1
private const val TYPE_MIDDLE = 2 private const val TYPE_MIDDLE = 2
@ -40,7 +40,7 @@ object HorizontalAdapterHelper {
} }
} }
fun getItemViewtype(position: Int, itemCount: Int): Int { fun getItemViewType(position: Int, itemCount: Int): Int {
return when (position) { return when (position) {
0 -> TYPE_FIRST 0 -> TYPE_FIRST
itemCount - 1 -> TYPE_LAST itemCount - 1 -> TYPE_LAST

View file

@ -0,0 +1,8 @@
package code.name.monkey.retromusic.interfaces
import android.view.View
import code.name.monkey.retromusic.model.Genre
interface IGenreClickListener {
fun onClickGenre(genre: Genre, view: View)
}

View file

@ -0,0 +1,13 @@
package code.name.monkey.retromusic.interfaces
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.model.Genre
interface IHomeClickListener {
fun onAlbumClick(album: Album)
fun onArtistClick(artist: Artist)
fun onGenreClick(genre: Genre)
}

View file

@ -19,49 +19,54 @@ import android.app.Activity;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
import android.net.Uri; import android.net.Uri;
import android.widget.Toast; import android.widget.Toast;
import code.name.monkey.retromusic.R;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List;
/** @author Karim Abou Zeid (kabouzeid) */ import code.name.monkey.retromusic.R;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public class UpdateToastMediaScannerCompletionListener public class UpdateToastMediaScannerCompletionListener
implements MediaScannerConnection.OnScanCompletedListener { implements MediaScannerConnection.OnScanCompletedListener {
private final WeakReference<Activity> activityWeakReference; private final WeakReference<Activity> activityWeakReference;
private final String couldNotScanFiles; private final String couldNotScanFiles;
private final String scannedFiles; private final String scannedFiles;
private final String[] toBeScanned; private final List<String> toBeScanned;
private int failed = 0; private int failed = 0;
private int scanned = 0; private int scanned = 0;
private Toast toast; private Toast toast;
@SuppressLint("ShowToast") @SuppressLint("ShowToast")
public UpdateToastMediaScannerCompletionListener(Activity activity, String[] toBeScanned) { public UpdateToastMediaScannerCompletionListener(Activity activity, List<String> toBeScanned) {
this.toBeScanned = toBeScanned; this.toBeScanned = toBeScanned;
scannedFiles = activity.getString(R.string.scanned_files); scannedFiles = activity.getString(R.string.scanned_files);
couldNotScanFiles = activity.getString(R.string.could_not_scan_files); couldNotScanFiles = activity.getString(R.string.could_not_scan_files);
toast = Toast.makeText(activity.getApplicationContext(), "", Toast.LENGTH_SHORT); toast = Toast.makeText(activity.getApplicationContext(), "", Toast.LENGTH_SHORT);
activityWeakReference = new WeakReference<>(activity); activityWeakReference = new WeakReference<>(activity);
} }
@Override @Override
public void onScanCompleted(final String path, final Uri uri) { public void onScanCompleted(final String path, final Uri uri) {
Activity activity = activityWeakReference.get(); Activity activity = activityWeakReference.get();
if (activity != null) { if (activity != null) {
activity.runOnUiThread( activity.runOnUiThread(
() -> { () -> {
if (uri == null) { if (uri == null) {
failed++; failed++;
} else { } else {
scanned++; scanned++;
} }
String text = String text =
" " " "
+ String.format(scannedFiles, scanned, toBeScanned.length) + String.format(scannedFiles, scanned, toBeScanned.size())
+ (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : ""); + (failed > 0 ? " " + String.format(couldNotScanFiles, failed) : "");
toast.setText(text); toast.setText(text);
toast.show(); toast.show();
}); });
}
} }
}
} }

View file

@ -0,0 +1,5 @@
package code.name.monkey.retromusic.model
import android.graphics.Bitmap
class ArtworkInfo constructor(val albumId: Long, val artwork: Bitmap?)

View file

@ -0,0 +1,9 @@
package code.name.monkey.retromusic.model
import org.jaudiotagger.tag.FieldKey
class LoadingInfo(
val filePaths: List<String>?,
val fieldKeyValueMap: Map<FieldKey, String>?,
val artworkInfo: ArtworkInfo?
)

View file

@ -6,7 +6,7 @@ import kotlin.math.abs
object PlaylistIdGenerator { object PlaylistIdGenerator {
operator fun invoke(name: String, @DrawableRes iconRes: Int): Long { operator fun invoke(name: String, @DrawableRes iconRes: Int): Long {
return -abs(31L * name.hashCode() + iconRes * name.hashCode() * 31L * 31L) return abs(31L * name.hashCode() + iconRes * name.hashCode() * 31L * 31L)
} }
} }

View file

@ -33,9 +33,7 @@ import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorButtons import code.name.monkey.retromusic.extensions.*
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.extensions.materialDialog
import code.name.monkey.retromusic.fragments.AlbumCoverStyle import code.name.monkey.retromusic.fragments.AlbumCoverStyle
import code.name.monkey.retromusic.fragments.AlbumCoverStyle.* import code.name.monkey.retromusic.fragments.AlbumCoverStyle.*
import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.NavigationUtil
@ -126,9 +124,10 @@ class AlbumCoverStylePreferenceDialog : DialogFragment(),
Glide.with(context).load(albumCoverStyle.drawableResId).into(image) Glide.with(context).load(albumCoverStyle.drawableResId).into(image)
title.setText(albumCoverStyle.titleRes) title.setText(albumCoverStyle.titleRes)
if (isAlbumCoverStyle(albumCoverStyle)) { if (isAlbumCoverStyle(albumCoverStyle)) {
proText.show()
proText.setText(R.string.pro) proText.setText(R.string.pro)
} else { } else {
proText.setText(R.string.free) proText.hide()
} }
return layout return layout
} }

View file

@ -72,7 +72,7 @@ class LibraryPreferenceDialog : DialogFragment() {
categoryAdapter.categoryInfos = PreferenceUtil.defaultCategories categoryAdapter.categoryInfos = PreferenceUtil.defaultCategories
} }
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok) { _, _ -> updateCategories(categoryAdapter.categoryInfos) } .setPositiveButton( R.string.done) { _, _ -> updateCategories(categoryAdapter.categoryInfos) }
.setView(view) .setView(view)
.create() .create()
.colorButtons() .colorButtons()

View file

@ -32,9 +32,7 @@ import androidx.viewpager.widget.ViewPager
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import code.name.monkey.retromusic.App import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.colorButtons import code.name.monkey.retromusic.extensions.*
import code.name.monkey.retromusic.extensions.colorControlNormal
import code.name.monkey.retromusic.extensions.materialDialog
import code.name.monkey.retromusic.fragments.NowPlayingScreen import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.NowPlayingScreen.* import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.NavigationUtil
@ -93,7 +91,7 @@ class NowPlayingScreenPreferenceDialog : DialogFragment(), ViewPager.OnPageChang
val nowPlayingScreen = values()[viewPagerPosition] val nowPlayingScreen = values()[viewPagerPosition]
if (isNowPlayingThemes(nowPlayingScreen)) { if (isNowPlayingThemes(nowPlayingScreen)) {
val result = val result =
getString(nowPlayingScreen.titleRes) + " theme is Pro version feature." "${getString(nowPlayingScreen.titleRes)} theme is Pro version feature."
Toast.makeText(context, result, Toast.LENGTH_SHORT).show() Toast.makeText(context, result, Toast.LENGTH_SHORT).show()
NavigationUtil.goToProVersion(requireContext()) NavigationUtil.goToProVersion(requireContext())
} else { } else {
@ -131,9 +129,10 @@ private class NowPlayingScreenAdapter(private val context: Context) : PagerAdapt
Glide.with(context).load(nowPlayingScreen.drawableResId).into(image) Glide.with(context).load(nowPlayingScreen.drawableResId).into(image)
title.setText(nowPlayingScreen.titleRes) title.setText(nowPlayingScreen.titleRes)
if (isNowPlayingThemes(nowPlayingScreen)) { if (isNowPlayingThemes(nowPlayingScreen)) {
proText.show()
proText.setText(R.string.pro) proText.setText(R.string.pro)
} else { }else{
proText.setText(R.string.free) proText.hide()
} }
return layout return layout
} }
@ -160,14 +159,5 @@ private class NowPlayingScreenAdapter(private val context: Context) : PagerAdapt
} }
private fun isNowPlayingThemes(screen: NowPlayingScreen): Boolean { private fun isNowPlayingThemes(screen: NowPlayingScreen): Boolean {
return (screen == Full || return (screen == Full || screen == Card || screen == Plain || screen == Blur || screen == Color || screen == Simple || screen == BlurCard || screen == Circle || screen == Adaptive) && !App.isProVersion()
screen == Card ||
screen == Plain ||
screen == Blur ||
screen == Color ||
screen == Simple ||
screen == BlurCard ||
screen == Circle ||
screen == Adaptive)
&& !App.isProVersion()
} }

View file

@ -26,7 +26,7 @@ class RealSearchRepository(
private val roomRepository: RoomRepository, private val roomRepository: RoomRepository,
private val genreRepository: GenreRepository, private val genreRepository: GenreRepository,
) { ) {
suspend fun searchAll(context: Context, query: String?): MutableList<Any> { fun searchAll(context: Context, query: String?): MutableList<Any> {
val results = mutableListOf<Any>() val results = mutableListOf<Any>()
query?.let { searchString -> query?.let { searchString ->
val songs = songRepository.songs(searchString) val songs = songRepository.songs(searchString)
@ -53,14 +53,14 @@ class RealSearchRepository(
results.add(context.resources.getString(R.string.genres)) results.add(context.resources.getString(R.string.genres))
results.addAll(genres) results.addAll(genres)
} }
val playlist = roomRepository.playlistWithSongs().filter { playlist -> /* val playlist = roomRepository.playlists().filter { playlist ->
playlist.playlistEntity.playlistName.toLowerCase(Locale.getDefault()) playlist.playlistName.toLowerCase(Locale.getDefault())
.contains(searchString.toLowerCase(Locale.getDefault())) .contains(searchString.toLowerCase(Locale.getDefault()))
} }
if (playlist.isNotEmpty()) { if (playlist.isNotEmpty()) {
results.add(context.getString(R.string.playlists)) results.add(context.getString(R.string.playlists))
results.addAll(playlist) results.addAll(playlist)
} }*/
} }
return results return results
} }

View file

@ -72,8 +72,10 @@ import code.name.monkey.retromusic.appwidgets.AppWidgetText;
import code.name.monkey.retromusic.glide.BlurTransformation; import code.name.monkey.retromusic.glide.BlurTransformation;
import code.name.monkey.retromusic.glide.SongGlideRequest; import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.helper.ShuffleHelper; import code.name.monkey.retromusic.helper.ShuffleHelper;
import code.name.monkey.retromusic.model.AbsCustomPlaylist;
import code.name.monkey.retromusic.model.Playlist; import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.Song; import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
import code.name.monkey.retromusic.providers.HistoryStore; import code.name.monkey.retromusic.providers.HistoryStore;
import code.name.monkey.retromusic.providers.MusicPlaybackQueueStore; import code.name.monkey.retromusic.providers.MusicPlaybackQueueStore;
import code.name.monkey.retromusic.providers.SongPlayCountStore; import code.name.monkey.retromusic.providers.SongPlayCountStore;
@ -1271,10 +1273,10 @@ public class MusicService extends Service
} }
private void playFromPlaylist(Intent intent) { private void playFromPlaylist(Intent intent) {
Playlist playlist = intent.getParcelableExtra(INTENT_EXTRA_PLAYLIST); AbsSmartPlaylist playlist = intent.getParcelableExtra(INTENT_EXTRA_PLAYLIST);
int shuffleMode = intent.getIntExtra(INTENT_EXTRA_SHUFFLE_MODE, getShuffleMode()); int shuffleMode = intent.getIntExtra(INTENT_EXTRA_SHUFFLE_MODE, getShuffleMode());
if (playlist != null) { if (playlist != null) {
List<Song> playlistSongs = playlist.getSongs(); List<Song> playlistSongs = playlist.songs();
if (!playlistSongs.isEmpty()) { if (!playlistSongs.isEmpty()) {
if (shuffleMode == SHUFFLE_MODE_SHUFFLE) { if (shuffleMode == SHUFFLE_MODE_SHUFFLE) {
int startPosition = new Random().nextInt(playlistSongs.size()); int startPosition = new Random().nextInt(playlistSongs.size());

View file

@ -27,6 +27,8 @@ import androidx.core.text.HtmlCompat
import androidx.media.app.NotificationCompat.MediaStyle import androidx.media.app.NotificationCompat.MediaStyle
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.MainActivity import code.name.monkey.retromusic.activities.MainActivity
import code.name.monkey.retromusic.db.PlaylistEntity
import code.name.monkey.retromusic.db.toSongEntity
import code.name.monkey.retromusic.glide.SongGlideRequest import code.name.monkey.retromusic.glide.SongGlideRequest
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
@ -38,140 +40,149 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.request.animation.GlideAnimation import com.bumptech.glide.request.animation.GlideAnimation
import com.bumptech.glide.request.target.SimpleTarget import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.koin.core.KoinComponent
class PlayingNotificationImpl : PlayingNotification() { class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
private var target: Target<BitmapPaletteWrapper>? = null private var target: Target<BitmapPaletteWrapper>? = null
@Synchronized @Synchronized
override fun update() { override fun update() {
stopped = false stopped = false
GlobalScope.launch {
val song = service.currentSong
val playlist: PlaylistEntity? = MusicUtil.repository.favoritePlaylist()
val isPlaying = service.isPlaying
val isFavorite = if (playlist != null) {
val songEntity = song.toSongEntity(playlist.playListId)
MusicUtil.repository.isFavoriteSong(songEntity).isNotEmpty()
} else false
val song = service.currentSong val playButtonResId =
val isPlaying = service.isPlaying if (isPlaying) R.drawable.ic_pause_white_48dp else R.drawable.ic_play_arrow_white_48dp
val isFavorite = MusicUtil.isFavorite(service, song) val favoriteResId =
val playButtonResId = if (isFavorite) R.drawable.ic_favorite else R.drawable.ic_favorite_border
if (isPlaying) R.drawable.ic_pause_white_48dp else R.drawable.ic_play_arrow_white_48dp
val favoriteResId =
if (isFavorite) R.drawable.ic_favorite else R.drawable.ic_favorite_border
val action = Intent(service, MainActivity::class.java) val action = Intent(service, MainActivity::class.java)
action.putExtra(MainActivity.EXPAND_PANEL, PreferenceUtil.isExpandPanel) action.putExtra(MainActivity.EXPAND_PANEL, PreferenceUtil.isExpandPanel)
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
val clickIntent = val clickIntent =
PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT) PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT)
val serviceName = ComponentName(service, MusicService::class.java) val serviceName = ComponentName(service, MusicService::class.java)
val intent = Intent(ACTION_QUIT) val intent = Intent(ACTION_QUIT)
intent.component = serviceName intent.component = serviceName
val deleteIntent = PendingIntent.getService(service, 0, intent, 0) val deleteIntent = PendingIntent.getService(service, 0, intent, 0)
val bigNotificationImageSize = service.resources val bigNotificationImageSize = service.resources
.getDimensionPixelSize(R.dimen.notification_big_image_size) .getDimensionPixelSize(R.dimen.notification_big_image_size)
service.runOnUiThread { service.runOnUiThread {
if (target != null) { if (target != null) {
Glide.clear(target) Glide.clear(target)
} }
target = SongGlideRequest.Builder.from(Glide.with(service), song) target = SongGlideRequest.Builder.from(Glide.with(service), song)
.checkIgnoreMediaStore(service) .checkIgnoreMediaStore(service)
.generatePalette(service).build() .generatePalette(service).build()
.centerCrop() .centerCrop()
.into(object : SimpleTarget<BitmapPaletteWrapper>( .into(object : SimpleTarget<BitmapPaletteWrapper>(
bigNotificationImageSize, bigNotificationImageSize,
bigNotificationImageSize bigNotificationImageSize
) {
override fun onResourceReady(
resource: BitmapPaletteWrapper,
glideAnimation: GlideAnimation<in BitmapPaletteWrapper>
) { ) {
update( override fun onResourceReady(
resource.bitmap, resource: BitmapPaletteWrapper,
RetroColorUtil.getColor(resource.palette, Color.TRANSPARENT) glideAnimation: GlideAnimation<in BitmapPaletteWrapper>
) ) {
} update(
resource.bitmap,
override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) { RetroColorUtil.getColor(resource.palette, Color.TRANSPARENT)
super.onLoadFailed(e, errorDrawable)
update(null, Color.TRANSPARENT)
}
fun update(bitmap: Bitmap?, color: Int) {
var bitmapFinal = bitmap
if (bitmapFinal == null) {
bitmapFinal = BitmapFactory.decodeResource(
service.resources,
R.drawable.default_audio_art
) )
} }
val toggleFavorite = NotificationCompat.Action( override fun onLoadFailed(e: Exception?, errorDrawable: Drawable?) {
favoriteResId, super.onLoadFailed(e, errorDrawable)
service.getString(R.string.action_toggle_favorite), update(null, Color.TRANSPARENT)
retrievePlaybackAction(TOGGLE_FAVORITE) }
)
val playPauseAction = NotificationCompat.Action(
playButtonResId,
service.getString(R.string.action_play_pause),
retrievePlaybackAction(ACTION_TOGGLE_PAUSE)
)
val previousAction = NotificationCompat.Action(
R.drawable.ic_skip_previous_round_white_32dp,
service.getString(R.string.action_previous),
retrievePlaybackAction(ACTION_REWIND)
)
val nextAction = NotificationCompat.Action(
R.drawable.ic_skip_next_round_white_32dp,
service.getString(R.string.action_next),
retrievePlaybackAction(ACTION_SKIP)
)
val builder = NotificationCompat.Builder( fun update(bitmap: Bitmap?, color: Int) {
service, var bitmapFinal = bitmap
NOTIFICATION_CHANNEL_ID if (bitmapFinal == null) {
) bitmapFinal = BitmapFactory.decodeResource(
.setSmallIcon(R.drawable.ic_notification) service.resources,
.setLargeIcon(bitmapFinal) R.drawable.default_audio_art
.setContentIntent(clickIntent)
.setDeleteIntent(deleteIntent)
.setContentTitle(
HtmlCompat.fromHtml(
"<b>" + song.title + "</b>",
HtmlCompat.FROM_HTML_MODE_LEGACY
) )
)
.setContentText(song.artistName)
.setSubText(
HtmlCompat.fromHtml(
"<b>" + song.albumName + "</b>",
HtmlCompat.FROM_HTML_MODE_LEGACY
)
)
.setOngoing(isPlaying)
.setShowWhen(false)
.addAction(toggleFavorite)
.addAction(previousAction)
.addAction(playPauseAction)
.addAction(nextAction)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setStyle(
MediaStyle()
.setMediaSession(service.mediaSession.sessionToken)
.setShowActionsInCompactView(1, 2, 3)
)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
if (Build.VERSION.SDK_INT <=
Build.VERSION_CODES.O && PreferenceUtil.isColoredNotification
) {
builder.color = color
} }
}
if (stopped) { val toggleFavorite = NotificationCompat.Action(
return // notification has been stopped before loading was finished favoriteResId,
service.getString(R.string.action_toggle_favorite),
retrievePlaybackAction(TOGGLE_FAVORITE)
)
val playPauseAction = NotificationCompat.Action(
playButtonResId,
service.getString(R.string.action_play_pause),
retrievePlaybackAction(ACTION_TOGGLE_PAUSE)
)
val previousAction = NotificationCompat.Action(
R.drawable.ic_skip_previous_round_white_32dp,
service.getString(R.string.action_previous),
retrievePlaybackAction(ACTION_REWIND)
)
val nextAction = NotificationCompat.Action(
R.drawable.ic_skip_next_round_white_32dp,
service.getString(R.string.action_next),
retrievePlaybackAction(ACTION_SKIP)
)
val builder = NotificationCompat.Builder(
service,
NOTIFICATION_CHANNEL_ID
)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(bitmapFinal)
.setContentIntent(clickIntent)
.setDeleteIntent(deleteIntent)
.setContentTitle(
HtmlCompat.fromHtml(
"<b>" + song.title + "</b>",
HtmlCompat.FROM_HTML_MODE_LEGACY
)
)
.setContentText(song.artistName)
.setSubText(
HtmlCompat.fromHtml(
"<b>" + song.albumName + "</b>",
HtmlCompat.FROM_HTML_MODE_LEGACY
)
)
.setOngoing(isPlaying)
.setShowWhen(false)
.addAction(toggleFavorite)
.addAction(previousAction)
.addAction(playPauseAction)
.addAction(nextAction)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setStyle(
MediaStyle()
.setMediaSession(service.mediaSession.sessionToken)
.setShowActionsInCompactView(1, 2, 3)
)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
if (Build.VERSION.SDK_INT <=
Build.VERSION_CODES.O && PreferenceUtil.isColoredNotification
) {
builder.color = color
}
}
if (stopped) {
return // notification has been stopped before loading was finished
}
updateNotifyModeAndPostNotification(builder.build())
} }
updateNotifyModeAndPostNotification(builder.build()) })
} }
})
} }
} }

View file

@ -15,7 +15,9 @@ import android.widget.Toast
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.db.PlaylistEntity
import code.name.monkey.retromusic.db.SongEntity import code.name.monkey.retromusic.db.SongEntity
import code.name.monkey.retromusic.db.toSongEntity
import code.name.monkey.retromusic.extensions.getLong import code.name.monkey.retromusic.extensions.getLong
import code.name.monkey.retromusic.helper.MusicPlayerRemote.removeFromQueue import code.name.monkey.retromusic.helper.MusicPlayerRemote.removeFromQueue
import code.name.monkey.retromusic.model.Artist import code.name.monkey.retromusic.model.Artist
@ -24,8 +26,11 @@ import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics
import code.name.monkey.retromusic.repository.RealPlaylistRepository import code.name.monkey.retromusic.repository.RealPlaylistRepository
import code.name.monkey.retromusic.repository.RealSongRepository import code.name.monkey.retromusic.repository.RealSongRepository
import code.name.monkey.retromusic.repository.Repository
import code.name.monkey.retromusic.repository.SongRepository import code.name.monkey.retromusic.repository.SongRepository
import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.service.MusicService
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.jaudiotagger.audio.AudioFileIO import org.jaudiotagger.audio.AudioFileIO
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import org.koin.core.KoinComponent import org.koin.core.KoinComponent
@ -89,7 +94,7 @@ object MusicUtil : KoinComponent {
fun deleteAlbumArt(context: Context, albumId: Long) { fun deleteAlbumArt(context: Context, albumId: Long) {
val contentResolver = context.contentResolver val contentResolver = context.contentResolver
val localUri = Uri.parse("content://media/external/audio/albumart") val localUri = Uri.parse("content://media/external/audio/albumart")
contentResolver.delete(ContentUris.withAppendedId(localUri, albumId.toLong()), null, null) contentResolver.delete(ContentUris.withAppendedId(localUri, albumId), null, null)
contentResolver.notifyChange(localUri, null) contentResolver.notifyChange(localUri, null)
} }
@ -160,7 +165,7 @@ object MusicUtil : KoinComponent {
try { try {
val newLyrics = val newLyrics =
FileUtil.read(f) FileUtil.read(f)
if (newLyrics != null && !newLyrics.trim { it <= ' ' }.isEmpty()) { if (newLyrics != null && newLyrics.trim { it <= ' ' }.isNotEmpty()) {
if (AbsSynchronizedLyrics.isSynchronized(newLyrics)) { if (AbsSynchronizedLyrics.isSynchronized(newLyrics)) {
return newLyrics return newLyrics
} }
@ -278,9 +283,8 @@ object MusicUtil : KoinComponent {
path: String? path: String?
) { ) {
val contentResolver = context.contentResolver val contentResolver = context.contentResolver
val artworkUri = val artworkUri = Uri.parse("content://media/external/audio/albumart")
Uri.parse("content://media/external/audio/albumart") contentResolver.delete(ContentUris.withAppendedId(artworkUri, albumId), null, null)
contentResolver.delete(ContentUris.withAppendedId(artworkUri, albumId.toLong()), null, null)
val values = ContentValues() val values = ContentValues()
values.put("album_id", albumId) values.put("album_id", albumId)
values.put("_data", path) values.put("_data", path)
@ -321,16 +325,21 @@ object MusicUtil : KoinComponent {
return playlist.name == context.getString(R.string.favorites) return playlist.name == context.getString(R.string.favorites)
} }
val repository = get<Repository>()
fun toggleFavorite(context: Context, song: Song) { fun toggleFavorite(context: Context, song: Song) {
if (isFavorite(context, song)) { GlobalScope.launch {
PlaylistsUtil.removeFromPlaylist(context, song, getFavoritesPlaylist(context).id) val playlist: PlaylistEntity? = repository.favoritePlaylist()
} else { if (playlist != null) {
PlaylistsUtil.addToPlaylist( val songEntity = song.toSongEntity(playlist.playListId)
context, song, getOrCreateFavoritesPlaylist(context).id, val isFavorite = repository.isFavoriteSong(songEntity).isNotEmpty()
false if (isFavorite) {
) repository.removeSongFromPlaylist(songEntity)
} else {
repository.insertSongs(listOf(song.toSongEntity(playlist.playListId)))
}
}
context.sendBroadcast(Intent(MusicService.FAVORITE_STATE_CHANGED))
} }
context.sendBroadcast(Intent(MusicService.FAVORITE_STATE_CHANGED))
} }
private fun getFavoritesPlaylist(context: Context): Playlist { private fun getFavoritesPlaylist(context: Context): Playlist {
@ -434,9 +443,7 @@ object MusicUtil : KoinComponent {
} }
fun deleteTracks(context: Context, songs: List<Song>) { fun deleteTracks(context: Context, songs: List<Song>) {
val projection = arrayOf( val projection = arrayOf(BaseColumns._ID, MediaStore.MediaColumns.DATA)
BaseColumns._ID, MediaStore.MediaColumns.DATA
)
val selection = StringBuilder() val selection = StringBuilder()
selection.append(BaseColumns._ID + " IN (") selection.append(BaseColumns._ID + " IN (")
for (i in songs.indices) { for (i in songs.indices) {

View file

@ -1,6 +1,5 @@
package code.name.monkey.retromusic.util package code.name.monkey.retromusic.util
import android.content.Context
import android.content.SharedPreferences.OnSharedPreferenceChangeListener import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.net.ConnectivityManager import android.net.ConnectivityManager
import android.net.NetworkInfo import android.net.NetworkInfo
@ -8,75 +7,7 @@ import androidx.core.content.ContextCompat
import androidx.core.content.edit import androidx.core.content.edit
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import code.name.monkey.retromusic.ADAPTIVE_COLOR_APP import code.name.monkey.retromusic.*
import code.name.monkey.retromusic.ALBUM_ARTISTS_ONLY
import code.name.monkey.retromusic.ALBUM_ART_ON_LOCK_SCREEN
import code.name.monkey.retromusic.ALBUM_COVER_STYLE
import code.name.monkey.retromusic.ALBUM_COVER_TRANSFORM
import code.name.monkey.retromusic.ALBUM_DETAIL_SONG_SORT_ORDER
import code.name.monkey.retromusic.ALBUM_GRID_SIZE
import code.name.monkey.retromusic.ALBUM_GRID_SIZE_LAND
import code.name.monkey.retromusic.ALBUM_GRID_STYLE
import code.name.monkey.retromusic.ALBUM_SONG_SORT_ORDER
import code.name.monkey.retromusic.ALBUM_SORT_ORDER
import code.name.monkey.retromusic.ARTIST_ALBUM_SORT_ORDER
import code.name.monkey.retromusic.ARTIST_GRID_SIZE
import code.name.monkey.retromusic.ARTIST_GRID_SIZE_LAND
import code.name.monkey.retromusic.ARTIST_GRID_STYLE
import code.name.monkey.retromusic.ARTIST_SONG_SORT_ORDER
import code.name.monkey.retromusic.ARTIST_SORT_ORDER
import code.name.monkey.retromusic.AUDIO_DUCKING
import code.name.monkey.retromusic.AUTO_DOWNLOAD_IMAGES_POLICY
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.BLACK_THEME
import code.name.monkey.retromusic.BLUETOOTH_PLAYBACK
import code.name.monkey.retromusic.BLURRED_ALBUM_ART
import code.name.monkey.retromusic.CAROUSEL_EFFECT
import code.name.monkey.retromusic.CHOOSE_EQUALIZER
import code.name.monkey.retromusic.CLASSIC_NOTIFICATION
import code.name.monkey.retromusic.COLORED_APP_SHORTCUTS
import code.name.monkey.retromusic.COLORED_NOTIFICATION
import code.name.monkey.retromusic.DESATURATED_COLOR
import code.name.monkey.retromusic.EXPAND_NOW_PLAYING_PANEL
import code.name.monkey.retromusic.EXTRA_SONG_INFO
import code.name.monkey.retromusic.FILTER_SONG
import code.name.monkey.retromusic.GAP_LESS_PLAYBACK
import code.name.monkey.retromusic.GENERAL_THEME
import code.name.monkey.retromusic.GENRE_SORT_ORDER
import code.name.monkey.retromusic.HOME_ALBUM_GRID_STYLE
import code.name.monkey.retromusic.HOME_ARTIST_GRID_STYLE
import code.name.monkey.retromusic.IGNORE_MEDIA_STORE_ARTWORK
import code.name.monkey.retromusic.INITIALIZED_BLACKLIST
import code.name.monkey.retromusic.KEEP_SCREEN_ON
import code.name.monkey.retromusic.LANGUAGE_NAME
import code.name.monkey.retromusic.LAST_ADDED_CUTOFF
import code.name.monkey.retromusic.LAST_CHANGELOG_VERSION
import code.name.monkey.retromusic.LAST_PAGE
import code.name.monkey.retromusic.LAST_SLEEP_TIMER_VALUE
import code.name.monkey.retromusic.LIBRARY_CATEGORIES
import code.name.monkey.retromusic.LOCK_SCREEN
import code.name.monkey.retromusic.LYRICS_OPTIONS
import code.name.monkey.retromusic.NEXT_SLEEP_TIMER_ELAPSED_REALTIME
import code.name.monkey.retromusic.NOW_PLAYING_SCREEN_ID
import code.name.monkey.retromusic.PAUSE_ON_ZERO_VOLUME
import code.name.monkey.retromusic.PLAYLIST_SORT_ORDER
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.RECENTLY_PLAYED_CUTOFF
import code.name.monkey.retromusic.SAF_SDCARD_URI
import code.name.monkey.retromusic.SLEEP_TIMER_FINISH_SONG
import code.name.monkey.retromusic.SONG_GRID_SIZE
import code.name.monkey.retromusic.SONG_GRID_SIZE_LAND
import code.name.monkey.retromusic.SONG_GRID_STYLE
import code.name.monkey.retromusic.SONG_SORT_ORDER
import code.name.monkey.retromusic.START_DIRECTORY
import code.name.monkey.retromusic.TAB_TEXT_MODE
import code.name.monkey.retromusic.TOGGLE_ADD_CONTROLS
import code.name.monkey.retromusic.TOGGLE_FULL_SCREEN
import code.name.monkey.retromusic.TOGGLE_HEADSET
import code.name.monkey.retromusic.TOGGLE_HOME_BANNER
import code.name.monkey.retromusic.TOGGLE_SHUFFLE
import code.name.monkey.retromusic.TOGGLE_VOLUME
import code.name.monkey.retromusic.USER_NAME
import code.name.monkey.retromusic.extensions.getIntRes import code.name.monkey.retromusic.extensions.getIntRes
import code.name.monkey.retromusic.extensions.getStringOrDefault import code.name.monkey.retromusic.extensions.getStringOrDefault
import code.name.monkey.retromusic.fragments.AlbumCoverStyle import code.name.monkey.retromusic.fragments.AlbumCoverStyle
@ -84,13 +15,7 @@ import code.name.monkey.retromusic.fragments.NowPlayingScreen
import code.name.monkey.retromusic.fragments.folder.FoldersFragment import code.name.monkey.retromusic.fragments.folder.FoldersFragment
import code.name.monkey.retromusic.helper.SortOrder.* import code.name.monkey.retromusic.helper.SortOrder.*
import code.name.monkey.retromusic.model.CategoryInfo import code.name.monkey.retromusic.model.CategoryInfo
import code.name.monkey.retromusic.transform.CascadingPageTransformer import code.name.monkey.retromusic.transform.*
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.VerticalFlipTransformation
import code.name.monkey.retromusic.transform.VerticalStackTransformer
import code.name.monkey.retromusic.util.theme.ThemeMode import code.name.monkey.retromusic.util.theme.ThemeMode
import com.google.android.material.bottomnavigation.LabelVisibilityMode import com.google.android.material.bottomnavigation.LabelVisibilityMode
import com.google.gson.Gson import com.google.gson.Gson
@ -183,13 +108,6 @@ object PreferenceUtil {
putString(SAF_SDCARD_URI, value) putString(SAF_SDCARD_URI, value)
} }
val selectedEqualizer
get() = sharedPreferences.getStringOrDefault(
CHOOSE_EQUALIZER,
"system"
)
val autoDownloadImagesPolicy val autoDownloadImagesPolicy
get() = sharedPreferences.getStringOrDefault( get() = sharedPreferences.getStringOrDefault(
AUTO_DOWNLOAD_IMAGES_POLICY, AUTO_DOWNLOAD_IMAGES_POLICY,
@ -458,11 +376,6 @@ object PreferenceUtil {
putInt(LAST_SLEEP_TIMER_VALUE, value) putInt(LAST_SLEEP_TIMER_VALUE, value)
} }
var lastPage
get() = sharedPreferences.getInt(LAST_PAGE, R.id.action_song)
set(value) = sharedPreferences.edit {
putInt(LAST_PAGE, value)
}
var nextSleepTimerElapsedRealTime var nextSleepTimerElapsedRealTime
get() = sharedPreferences.getInt( get() = sharedPreferences.getInt(
@ -486,8 +399,8 @@ object PreferenceUtil {
val position = sharedPreferences.getStringOrDefault( val position = sharedPreferences.getStringOrDefault(
HOME_ARTIST_GRID_STYLE, "0" HOME_ARTIST_GRID_STYLE, "0"
).toInt() ).toInt()
val typedArray = val typedArray = App.getContext()
App.getContext().resources.obtainTypedArray(R.array.pref_home_grid_style_layout) .resources.obtainTypedArray(R.array.pref_home_grid_style_layout)
val layoutRes = typedArray.getResourceId(position, 0) val layoutRes = typedArray.getResourceId(position, 0)
typedArray.recycle() typedArray.recycle()
return if (layoutRes == 0) { return if (layoutRes == 0) {
@ -497,10 +410,12 @@ object PreferenceUtil {
val homeAlbumGridStyle: Int val homeAlbumGridStyle: Int
get() { get() {
val position = sharedPreferences.getStringOrDefault(HOME_ALBUM_GRID_STYLE, "4").toInt() val position = sharedPreferences.getStringOrDefault(
val typedArray = HOME_ALBUM_GRID_STYLE, "4"
App.getContext().resources.obtainTypedArray(R.array.pref_home_grid_style_layout) ).toInt()
val layoutRes = typedArray.getResourceId(position, 0) val typedArray = App.getContext()
.resources.obtainTypedArray(R.array.pref_home_grid_style_layout)
val layoutRes = typedArray.getResourceId(position, 4)
typedArray.recycle() typedArray.recycle()
return if (layoutRes == 0) { return if (layoutRes == 0) {
R.layout.item_artist R.layout.item_artist
@ -510,7 +425,7 @@ object PreferenceUtil {
val tabTitleMode: Int val tabTitleMode: Int
get() { get() {
return when (sharedPreferences.getStringOrDefault( return when (sharedPreferences.getStringOrDefault(
TAB_TEXT_MODE, "0" TAB_TEXT_MODE, "1"
).toInt()) { ).toInt()) {
1 -> LabelVisibilityMode.LABEL_VISIBILITY_LABELED 1 -> LabelVisibilityMode.LABEL_VISIBILITY_LABELED
0 -> LabelVisibilityMode.LABEL_VISIBILITY_AUTO 0 -> LabelVisibilityMode.LABEL_VISIBILITY_AUTO
@ -639,32 +554,9 @@ object PreferenceUtil {
} }
fun getRecentlyPlayedCutoffTimeMillis(): Long { fun getRecentlyPlayedCutoffTimeMillis(): Long {
return getCutoffTimeMillis(RECENTLY_PLAYED_CUTOFF)
}
fun getRecentlyPlayedCutoffText(context: Context): String? {
return getCutoffText(RECENTLY_PLAYED_CUTOFF, context)
}
private fun getCutoffText(
cutoff: String,
context: Context
): String? {
return when (sharedPreferences.getString(cutoff, "")) {
"today" -> context.getString(R.string.today)
"this_week" -> context.getString(R.string.this_week)
"past_seven_days" -> context.getString(R.string.past_seven_days)
"past_three_months" -> context.getString(R.string.past_three_months)
"this_year" -> context.getString(R.string.this_year)
"this_month" -> context.getString(R.string.this_month)
else -> context.getString(R.string.this_month)
}
}
private fun getCutoffTimeMillis(cutoff: String): Long {
val calendarUtil = CalendarUtil() val calendarUtil = CalendarUtil()
val interval: Long val interval: Long
interval = when (sharedPreferences.getString(cutoff, "")) { interval = when (sharedPreferences.getString(RECENTLY_PLAYED_CUTOFF, "")) {
"today" -> calendarUtil.elapsedToday "today" -> calendarUtil.elapsedToday
"this_week" -> calendarUtil.elapsedWeek "this_week" -> calendarUtil.elapsedWeek
"past_seven_days" -> calendarUtil.getElapsedDays(7) "past_seven_days" -> calendarUtil.getElapsedDays(7)
@ -690,5 +582,4 @@ object PreferenceUtil {
} }
return (System.currentTimeMillis() - interval) / 1000 return (System.currentTimeMillis() - interval) / 1000
} }
} }

View file

@ -73,7 +73,7 @@ class RingtoneManager(val context: Context) {
return false return false
} }
fun getDialog(context: Context): AlertDialog { fun getDialog(context: Context) {
return MaterialAlertDialogBuilder(context, R.style.MaterialAlertDialogTheme) return MaterialAlertDialogBuilder(context, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.dialog_title_set_ringtone) .setTitle(R.string.dialog_title_set_ringtone)
.setMessage(R.string.dialog_message_set_ringtone) .setMessage(R.string.dialog_message_set_ringtone)
@ -83,7 +83,7 @@ class RingtoneManager(val context: Context) {
context.startActivity(intent) context.startActivity(intent)
} }
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.create() .create().show()
} }
} }
} }

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="150" />

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="150" />

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="50%p"
android:toXDelta="0" />
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0"
android:toXDelta="-50%p" />
<alpha
android:duration="@android:integer/config_mediumAnimTime"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

View file

@ -1,72 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.12342857"
android:scaleY="0.12342857"
android:translateX="36.966858"
android:translateY="32.4">
<path
android:pathData="M10.256,0L265.4,0C268.967,0 270.26,0.371 271.563,1.069C272.867,1.766 273.89,2.789 274.587,4.093C275.285,5.396 275.656,6.689 275.656,10.256L275.656,177.191C275.656,180.757 275.285,182.05 274.587,183.353C273.89,184.657 272.867,185.68 271.563,186.378C270.26,187.075 268.967,187.446 265.4,187.446L10.256,187.446C6.689,187.446 5.396,187.075 4.093,186.378C2.789,185.68 1.766,184.657 1.069,183.353C0.371,182.05 0,180.757 -0,177.191L0,10.256C-0,6.689 0.371,5.396 1.069,4.093C1.766,2.789 2.789,1.766 4.093,1.069C5.396,0.371 6.689,0 10.256,0Z"
android:strokeWidth="1"
android:fillType="evenOdd"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:gradientRadius="236.10738"
android:centerX="0"
android:centerY="0"
android:type="radial">
<item
android:offset="0"
android:color="#FF3D5AFE" />
<item
android:offset="1"
android:color="#FF651FFF" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M262.814,336.03L0.163,75.53L0.006,183.375C0.002,185.781 0.962,188.088 2.67,189.781L161.703,347.393C163.201,348.877 165.225,349.711 167.334,349.711L257.18,349.711C261.598,349.711 265.18,346.129 265.18,341.711C265.18,339.577 264.328,337.533 262.814,336.03Z"
android:strokeWidth="1"
android:fillType="evenOdd"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:gradientRadius="250.9684"
android:centerX="-32.788143"
android:centerY="67.34283"
android:type="radial">
<item
android:offset="0"
android:color="#FF3D5AFE" />
<item
android:offset="1"
android:color="#FF651FFF" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M8.035,349.71L59.204,349.71C63.623,349.71 67.204,346.128 67.204,341.71C67.204,339.608 66.377,337.59 64.901,336.093L13.732,284.191C10.63,281.045 5.565,281.009 2.418,284.111C0.894,285.614 0.035,287.666 0.035,289.808L0.035,341.71C0.035,346.128 3.617,349.71 8.035,349.71Z"
android:strokeWidth="1"
android:fillType="evenOdd"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:gradientRadius="95.39285"
android:centerX="-268.79202"
android:centerY="57.347355"
android:type="radial">
<item
android:offset="0"
android:color="#FF3D5AFE" />
<item
android:offset="1"
android:color="#FF651FFF" />
</gradient>
</aapt:attr>
</path>
</group>
</vector>

View file

@ -1,15 +0,0 @@
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<item
android:id="@+id/state_on"
android:drawable="@drawable/ic_album"
android:state_checked="true" />
<item
android:id="@+id/state_off"
android:drawable="@drawable/ic_album" />
<transition
android:drawable="@drawable/avd_album"
android:fromId="@id/state_off"
android:toId="@id/state_on" />
</animated-selector>

View file

@ -1,15 +0,0 @@
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<item
android:id="@+id/state_on"
android:drawable="@drawable/ic_home"
android:state_checked="true" />
<item
android:id="@+id/state_off"
android:drawable="@drawable/ic_home" />
<transition
android:drawable="@drawable/avd_home"
android:fromId="@id/state_off"
android:toId="@id/state_on" />
</animated-selector>

View file

@ -1,15 +0,0 @@
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<item
android:id="@+id/state_on"
android:drawable="@drawable/ic_audiotrack"
android:state_checked="true" />
<item
android:id="@+id/state_off"
android:drawable="@drawable/ic_audiotrack" />
<transition
android:drawable="@drawable/avd_music_note"
android:fromId="@id/state_off"
android:toId="@id/state_on" />
</animated-selector>

View file

@ -1,38 +0,0 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="path"
android:pathData="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 16.5 C 9.51 16.5 7.5 14.49 7.5 12 C 7.5 9.51 9.51 7.5 12 7.5 C 14.49 7.5 16.5 9.51 16.5 12 C 16.5 14.49 14.49 16.5 12 16.5 Z M 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 Z"
android:fillColor="#000"
android:strokeWidth="1" />
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<set>
<objectAnimator
android:propertyName="pathData"
android:duration="200"
android:valueFrom="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 16.5 C 9.51 16.5 7.5 14.49 7.5 12 C 7.5 9.51 9.51 7.5 12 7.5 C 14.49 7.5 16.5 9.51 16.5 12 C 16.5 14.49 14.49 16.5 12 16.5 Z M 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 Z M 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 L 12 12"
android:valueTo="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 20 C 7.59 20 4 16.41 4 12 C 4 7.59 7.59 4 12 4 C 16.41 4 20 7.59 20 12 C 20 16.41 16.41 20 12 20 Z M 12 7.5 C 9.51 7.5 7.5 9.51 7.5 12 C 7.5 14.49 9.51 16.5 12 16.5 C 14.49 16.5 16.5 14.49 16.5 12 C 16.5 9.51 14.49 7.5 12 7.5 Z M 12 13 C 11.45 13 11 12.55 11 12 C 11 11.45 11.45 11 12 11 C 12.55 11 13 11.45 13 12 C 13 12.55 12.55 13 12 13 L 12 13"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="pathData"
android:startOffset="200"
android:duration="200"
android:valueFrom="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 20 C 7.59 20 4 16.41 4 12 C 4 7.59 7.59 4 12 4 C 16.41 4 20 7.59 20 12 C 20 16.41 16.41 20 12 20 Z M 12 7.5 C 9.51 7.5 7.5 9.51 7.5 12 C 7.5 14.49 9.51 16.5 12 16.5 C 14.49 16.5 16.5 14.49 16.5 12 C 16.5 9.51 14.49 7.5 12 7.5 Z M 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 L 12 13"
android:valueTo="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 16.5 C 9.51 16.5 7.5 14.49 7.5 12 C 7.5 9.51 9.51 7.5 12 7.5 C 14.49 7.5 16.5 9.51 16.5 12 C 16.5 14.49 14.49 16.5 12 16.5 Z M 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 Z M 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 L 12 12"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</aapt:attr>
</target>
</animated-vector>

View file

@ -1,95 +0,0 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="home"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group android:name="home_icon">
<path
android:name="home_data"
android:pathData="M 10 19 L 10 14 L 14 14 L 14 19 C 14 19.55 14.45 20 15 20 L 18 20 C 18.55 20 19 19.55 19 19 L 19 12 L 20.7 12 C 21.16 12 21.38 11.43 21.03 11.13 L 12.67 3.6 C 12.29 3.26 11.71 3.26 11.33 3.6 L 2.97 11.13 C 2.63 11.43 2.84 12 3.3 12 L 5 12 L 5 19 C 5 19.55 5.45 20 6 20 L 9 20 C 9.55 20 10 19.55 10 19 Z"
android:fillColor="#000"
android:strokeWidth="1" />
</group>
<group
android:name="sun"
android:translateX="-5"
android:translateY="4"
android:scaleX="0.2"
android:scaleY="0.2">
<path
android:name="sun_data"
android:pathData="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z"
android:fillColor="#000"
android:strokeWidth="1" />
</group>
<group
android:name="cloud"
android:translateX="2"
android:scaleX="0.2"
android:scaleY="0.2">
<path
android:name="path"
android:pathData="M 19.37 10.04 C 18.68 6.59 15.65 4 12.01 4 C 9.12 4 6.61 5.64 5.36 8.04 C 2.35 8.36 0.01 10.91 0.01 14 C 0.01 17.31 2.7 20 6.01 20 L 19.01 20 C 21.77 20 24.01 17.76 24.01 15 C 24.01 12.36 21.96 10.22 19.37 10.04 Z"
android:fillColor="#000"
android:strokeWidth="1" />
</group>
<group
android:name="cloud_1"
android:translateX="1"
android:translateY="4"
android:scaleX="0.1"
android:scaleY="0.1">
<path
android:name="cloud_2"
android:pathData="M 19.37 10.04 C 18.68 6.59 15.65 4 12.01 4 C 9.12 4 6.61 5.64 5.36 8.04 C 2.35 8.36 0.01 10.91 0.01 14 C 0.01 17.31 2.7 20 6.01 20 L 19.01 20 C 21.77 20 24.01 17.76 24.01 15 C 24.01 12.36 21.96 10.22 19.37 10.04 Z"
android:fillColor="#000000" />
</group>
</vector>
</aapt:attr>
<target android:name="sun">
<aapt:attr name="android:animation">
<set>
<objectAnimator
android:propertyName="translateX"
android:duration="400"
android:valueFrom="-5"
android:valueTo="16"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="translateY"
android:duration="400"
android:valueFrom="10"
android:valueTo="1"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</aapt:attr>
</target>
<target android:name="cloud">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="translateX"
android:duration="400"
android:valueFrom="1"
android:valueTo="24"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="cloud_1">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="translateX"
android:duration="400"
android:valueFrom="0"
android:valueTo="12"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
</animated-vector>

View file

@ -1,114 +0,0 @@
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group android:name="group_1">
<path
android:name="note_1"
android:pathData="M 12 5 L 12 13.55 C 11.06 13.01 9.9 12.8 8.67 13.23 C 7.33 13.71 6.3 14.9 6.06 16.3 C 5.6 19.04 7.92 21.38 10.65 20.95 C 12.61 20.64 14 18.84 14 16.85 L 14 7 L 16 7 C 17.1 7 18 6.1 18 5 C 18 3.9 17.1 3 16 3 L 14 3 C 12.9 3 12 3.9 12 5 Z"
android:fillColor="#000"
android:strokeWidth="1" />
</group>
<group
android:name="group_2"
android:translateX="-2"
android:translateY="13"
android:scaleX="0.4"
android:scaleY="0.4">
<path
android:name="note_2"
android:pathData="M 12 5 L 12 13.55 C 11.06 13.01 9.9 12.8 8.67 13.23 C 7.33 13.71 6.3 14.9 6.06 16.3 C 5.6 19.04 7.92 21.38 10.65 20.95 C 12.61 20.64 14 18.84 14 16.85 L 14 7 L 16 7 C 17.1 7 18 6.1 18 5 C 18 3.9 17.1 3 16 3 L 14 3 C 12.9 3 12 3.9 12 5 Z"
android:fillColor="#000000" />
</group>
<group
android:name="group_3"
android:translateX="16"
android:translateY="-1"
android:scaleX="0.4"
android:scaleY="0.4">
<path
android:name="path"
android:pathData="M 12 5 L 12 13.55 C 11.06 13.01 9.9 12.8 8.67 13.23 C 7.33 13.71 6.3 14.9 6.06 16.3 C 5.6 19.04 7.92 21.38 10.65 20.95 C 12.61 20.64 14 18.84 14 16.85 L 14 7 L 16 7 C 17.1 7 18 6.1 18 5 C 18 3.9 17.1 3 16 3 L 14 3 C 12.9 3 12 3.9 12 5 Z"
android:fillColor="#000000" />
</group>
</vector>
</aapt:attr>
<target android:name="group_1">
<aapt:attr name="android:animation">
<set>
<objectAnimator
android:propertyName="translateY"
android:duration="100"
android:valueFrom="-3"
android:valueTo="3"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="translateY"
android:startOffset="125"
android:duration="76"
android:valueFrom="-1"
android:valueTo="-2"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="translateY"
android:startOffset="225"
android:duration="175"
android:valueFrom="-1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</aapt:attr>
</target>
<target android:name="group_2">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="translateY"
android:duration="400"
android:valueFrom="13"
android:valueTo="-11"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="group_3">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="translateY"
android:duration="400"
android:valueFrom="-1"
android:valueTo="15"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="note_2">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillAlpha"
android:duration="400"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="path">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillAlpha"
android:duration="400"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
</animated-vector>

View file

@ -1,35 +0,0 @@
<?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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape
android:dither="true"
android:shape="ring"
android:thickness="3dp"
android:type="sweep"
android:useLevel="false">
<solid android:color="?android:attr/textColorSecondary" />
</shape>
</item>
<item android:id="@android:id/progress">
<shape
android:shape="ring"
android:thickness="3dp"
android:type="sweep"
android:useLevel="true">
<solid android:color="?attr/colorAccent" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<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="M3 8c0 0.55 0.45 1 1 1s1-0.45 1-1V6h2c0.55 0 1-0.45 1-1s-0.45-1-1-1H5V2c0-0.55-0.45-1-1-1s-1 0.45-1 1v2H1c-0.55 0-1 0.45-1 1s0.45 1 1 1h2v2z" />
<path
android:fillColor="@color/md_white_1000"
android:pathData="M 13 11 C 14.6568542495 11 16 12.3431457505 16 14 C 16 15.6568542495 14.6568542495 17 13 17 C 11.3431457505 17 10 15.6568542495 10 14 C 10 12.3431457505 11.3431457505 11 13 11 Z" />
<path
android:fillColor="@color/md_white_1000"
android:pathData="M21 6h-3.17l-1.24-1.35c-0.37-0.41-0.91-0.65-1.47-0.65h-6.4c0.17 0.3 0.28 0.63 0.28 1 0 1.1-0.9 2-2 2H6v1c0 1.1-0.9 2-2 2-0.37 0-0.7-0.11-1-0.28V20c0 1.1 0.9 2 2 2h16c1.1 0 2-0.9 2-2V8c0-1.1-0.9-2-2-2zm-8 13c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z" />
</vector>

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="176dp"
android:height="176dp"
android:viewportWidth="176"
android:viewportHeight="176">
<group
android:pivotX="88"
android:pivotY="88"
android:scaleX="0.916"
android:scaleY="0.916"
android:translateX="-8"
android:translateY="-8">
<path
android:name="ic_app_shortcut_search_ic"
android:fillColor="@color/md_white_1000"
android:pathData="M104.333 97.3333H100.647L99.34 96.0733C103.913 90.7533 106.667 83.8467 106.667 76.3333C106.667 59.58 93.0867 46 76.3333 46C59.58 46 46 59.58 46 76.3333C46 93.0867 59.58 106.667 76.3333 106.667C83.8467 106.667 90.7533 103.913 96.0733 99.34L97.3333 100.647V104.333L120.667 127.62L127.62 120.667L104.333 97.3333V97.3333ZM76.3333 97.3333C64.7133 97.3333 55.3333 87.9533 55.3333 76.3333C55.3333 64.7133 64.7133 55.3333 76.3333 55.3333C87.9533 55.3333 97.3333 64.7133 97.3333 76.3333C97.3333 87.9533 87.9533 97.3333 76.3333 97.3333Z" />
</group>
</vector>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<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="M11,14C12,14 13.05,14.16 14.2,14.44C13.39,15.31 13,16.33 13,17.5C13,18.39 13.25,19.23 13.78,20H3V18C3,16.81 3.91,15.85 5.74,15.12C7.57,14.38 9.33,14 11,14M11,12C9.92,12 9,11.61 8.18,10.83C7.38,10.05 7,9.11 7,8C7,6.92 7.38,6 8.18,5.18C9,4.38 9.92,4 11,4C12.11,4 13.05,4.38 13.83,5.18C14.61,6 15,6.92 15,8C15,9.11 14.61,10.05 13.83,10.83C13.05,11.61 12.11,12 11,12M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z" />
</vector>

View file

@ -1,9 +0,0 @@
<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="#FFFFFFFF"
android:pathData="M17,3A2,2 0 0,1 19,5V21L12,18L5,21V5C5,3.89 5.9,3 7,3H17M11,11A2,2 0 0,0 9,13A2,2 0 0,0 11,15A2,2 0 0,0 13,13V8H16V6H12V11.27C11.71,11.1 11.36,11 11,11Z" />
</vector>

View file

@ -1,10 +0,0 @@
<!-- drawable/currency_inr.xml -->
<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="M8,3H18L17,5H13.74C14.22,5.58 14.58,6.26 14.79,7H18L17,9H15C14.75,11.57 12.74,13.63 10.2,13.96V14H9.5L15.5,21H13L7,14V12H9.5V12C11.26,12 12.72,10.7 12.96,9H7L8,7H12.66C12.1,5.82 10.9,5 9.5,5H7L8,3Z" />
</vector>

View file

@ -1,10 +0,0 @@
<vector android:height="24dp"
android:tint="#FFFFFF"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="#FF000000"
android:pathData="M17.66,7.93L12,2.27 6.34,7.93c-3.12,3.12 -3.12,8.19 0,11.31C7.9,20.8 9.95,21.58 12,21.58c2.05,0 4.1,-0.78 5.66,-2.34 3.12,-3.12 3.12,-8.19 0,-11.31zM12,19.59c-1.6,0 -3.11,-0.62 -4.24,-1.76C6.62,16.69 6,15.19 6,13.59s0.62,-3.11 1.76,-4.24L12,5.1v14.49z" />
</vector>

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2020 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 18h16c0.55 0 1-0.45 1-1s-0.45-1-1-1H4c-0.55 0-1 0.45-1 1s0.45 1 1 1zm0-5h16c0.55 0 1-0.45 1-1s-0.45-1-1-1H4c-0.55 0-1 0.45-1 1s0.45 1 1 1zM3 7c0 0.55 0.45 1 1 1h16c0.55 0 1-0.45 1-1s-0.45-1-1-1H4c-0.55 0-1 0.45-1 1z" />
</vector>

View file

@ -1,10 +0,0 @@
<!-- drawable/rounded_corner.xml -->
<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="M19,19H21V21H19V19M19,17H21V15H19V17M3,13H5V11H3V13M3,17H5V15H3V17M3,9H5V7H3V9M3,5H5V3H3V5M7,5H9V3H7V5M15,21H17V19H15V21M11,21H13V19H11V21M15,21H17V19H15V21M7,21H9V19H7V21M3,21H5V19H3V21M21,8A5,5 0 0,0 16,3H11V5H16A3,3 0 0,1 19,8V13H21V8Z" />
</vector>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<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="M19.8 10.7L4.2 5l-0.7 1.9L17.6 12H5c-1.1 0-2 0.9-2 2v4c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-5.5c0-0.8-0.5-1.6-1.2-1.8zM19 18H5v-4h14v4zM6 15h2v2H6zm4 0h8v2h-8z" />
</vector>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<corners android:radius="35dp" />
<stroke
android:width="2dp"
android:color="@color/md_white_1000" />
</shape>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp" />
<solid android:color="@android:color/black" />
</shape>

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2020 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="?attr/colorControlNormal" />
<corners android:radius="8dp" />
<size
android:width="72dp"
android:height="4dp" />
</shape>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="#11000000"
android:endColor="@color/twenty_percent_black_overlay"
android:startColor="#00000000" />
</shape>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="135"
android:endColor="#00000000"
android:startColor="#11000000"
android:type="linear" />
</shape>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/white" />
</shape>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="4dp"
android:right="4dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="3dp"
android:topRightRadius="3dp" />
<size android:height="3dp" />
</shape>
</item>
</layer-list>

View file

@ -1,7 +1,6 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/gradient_background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"> android:background="?attr/colorSurface">
@ -64,7 +63,6 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout <LinearLayout
android:id="@+id/editables"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"

View file

@ -67,7 +67,6 @@
app:layout_constraintTop_toBottomOf="@id/toolbarContainer"> app:layout_constraintTop_toBottomOf="@id/toolbarContainer">
<LinearLayout <LinearLayout
android:id="@+id/background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">

View file

@ -21,7 +21,6 @@
tools:layout="@layout/fragment_album_full_cover" /> tools:layout="@layout/fragment_album_full_cover" />
<FrameLayout <FrameLayout
android:id="@+id/toolbar_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">

View file

@ -114,7 +114,6 @@
app:tint="@color/md_green_500" /> app:tint="@color/md_green_500" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/volumeText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/volume" android:text="@string/volume"

View file

@ -2,7 +2,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/anti_clickable"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?android:attr/windowBackground"> android:background="?android:attr/windowBackground">

View file

@ -55,7 +55,6 @@
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/toolbar_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"> android:layout_weight="0">

View file

@ -16,7 +16,6 @@
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<View <View
android:id="@+id/gradient_background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />

View file

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="156dp"
android:layout_margin="8dp"
app:cardCornerRadius="16dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="@tools:sample/avatars" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/playSongs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="12dp"
android:background="@drawable/color_circle_gradient"
android:backgroundTint="@color/eighty_percent_black_overlay"
android:padding="8dp"
app:srcCompat="@drawable/ic_play_arrow_white_32dp" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingTop="6dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="@tools:sample/lorem/random" />
</LinearLayout>

View file

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/rectSelector"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="match_parent"
android:layout_height="256dp"
android:layout_margin="8dp"
app:cardCornerRadius="16dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="@tools:sample/avatars" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/playSongs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="12dp"
android:background="@drawable/color_circle_gradient"
android:backgroundTint="@color/eighty_percent_black_overlay"
android:padding="8dp"
app:srcCompat="@drawable/ic_play_arrow_white_32dp" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingTop="6dp"
android:paddingEnd="8dp"
android:paddingBottom="4dp"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textAppearance="@style/TextViewSubtitle1"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />
</LinearLayout>

View file

@ -65,7 +65,6 @@
app:srcCompat="@drawable/ic_library_add" /> app:srcCompat="@drawable/ic_library_add" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/materialTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
@ -152,7 +151,6 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/shortcuts"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:constraint_referenced_ids="history,lastAdded,topPlayed,actionShuffle" /> app:constraint_referenced_ids="history,lastAdded,topPlayed,actionShuffle" />

View file

@ -36,7 +36,6 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout <LinearLayout
android:id="@+id/editables"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">

View file

@ -2,7 +2,6 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorSurface"> android:background="?attr/colorSurface">

View file

@ -63,7 +63,6 @@
app:srcCompat="@drawable/ic_close" /> app:srcCompat="@drawable/ic_close" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/car"
android:layout_width="52dp" android:layout_width="52dp"
android:layout_height="52dp" android:layout_height="52dp"
android:layout_margin="16dp" android:layout_margin="16dp"

View file

@ -53,7 +53,6 @@
<LinearLayout <LinearLayout
android:id="@+id/cardContent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical" android:orientation="vertical"
@ -128,29 +127,6 @@
android:textColor="@color/md_white_1000" /> android:textColor="@color/md_white_1000" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
app:srcCompat="@drawable/ic_check_circle"
app:tint="@color/md_white_1000" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="@string/window_corner_edges"
android:textAppearance="@style/TextViewSubtitle1"
android:textColor="@color/md_white_1000" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -28,7 +28,6 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout <LinearLayout
android:id="@+id/editables"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"

View file

@ -57,7 +57,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/separator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_columnSpan="2" android:layout_columnSpan="2"

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