From 4197fde1402c1a7efae081b52f58fe3f2adbe1a3 Mon Sep 17 00:00:00 2001 From: h4h13 Date: Sun, 17 Feb 2019 22:31:35 +0530 Subject: [PATCH] Fix lot of things haha --- app/build.gradle | 11 +-- app/src/main/AndroidManifest.xml | 2 +- app/src/main/assets/retro-changelog.html | 2 +- .../dialogs/BlacklistFolderChooserDialog.java | 12 ++-- .../retromusic/dialogs/DeleteSongsDialog.kt | 2 +- .../dialogs/ScanMediaFolderChooserDialog.java | 2 +- .../retromusic/dialogs/SleepTimerDialog.kt | 10 ++- .../retromusic/dialogs/SongShareDialog.kt | 11 +-- .../retromusic/helper/LastChanceHandler.kt | 3 +- .../retromusic/mvp/contract/HomeContract.kt | 4 +- .../retromusic/mvp/presenter/HomePresenter.kt | 6 +- .../preferences/AlbumCoverStylePreference.kt | 5 +- .../retromusic/providers/NotPlayedStore.kt | 68 ++++++++++++++++++ .../ui/activities/ErrorHandlerActivity.kt | 1 - .../ui/activities/PurchaseActivity.kt | 2 +- .../ui/activities/WhatsNewActivity.java | 2 +- .../bugreport/ErrorHandlerActivity.kt | 1 + .../retromusic/ui/fragments/VolumeFragment.kt | 12 ++-- .../mainactivity/LibraryFragment.java | 4 +- .../mainactivity/home/BannerHomeFragment.kt | 29 +++++--- .../AdaptivePlaybackControlsFragment.kt | 13 +++- .../player/fit/FitPlaybackControlsFragment.kt | 12 ++-- .../flat/FlatPlaybackControlsFragment.kt | 12 ++-- .../material/MaterialControlsFragment.kt | 18 ++--- .../plain/PlainPlaybackControlsFragment.kt | 14 ++-- .../simple/SimplePlaybackControlsFragment.kt | 12 ++-- .../name/monkey/retromusic/util/ViewUtil.kt | 1 - app/src/main/res/drawable/flat_shadow.png | Bin 0 -> 423 bytes .../main/res/drawable/flat_shadow_thumb.xml | 8 +++ app/src/main/res/drawable/switch_square.xml | 8 +++ .../res/drawable/switch_thumb_material.xml | 4 +- app/src/main/res/layout/dialog_file_share.xml | 39 +++++----- .../main/res/layout/dialog_sleep_timer.xml | 2 +- ...ment_adaptive_player_playback_controls.xml | 20 +++--- ...ent_card_blur_player_playback_controls.xml | 3 +- ...fragment_flat_player_playback_controls.xml | 4 +- .../fragment_material_playback_controls.xml | 1 + app/src/main/res/layout/fragment_volume.xml | 4 +- app/src/main/res/values/styles.xml | 6 +- .../common/prefs/ATECheckBoxPreference.kt | 0 .../common/prefs/ATEColorPreference.kt | 0 .../common/prefs/ATEDialogPreference.kt | 1 + .../common/prefs/ATEEditTextPreference.kt | 0 .../common/prefs/ATEListPreference.kt | 0 .../common/prefs/ATEMultiSelectPreference.kt | 0 .../common/prefs/ATEPreference.kt | 0 .../common/prefs/ATEPreferenceCategory.kt | 0 .../common/prefs/ATESwitchPreference.kt | 0 .../supportv7/ATEPreferenceFragmentCompat.kt | 0 ...EEditTextPreferenceDialogFragmentCompat.kt | 0 .../ATEListPreferenceDialogFragmentCompat.kt | 0 .../dialogs/ATEPreferenceDialogFragment.kt | 0 .../util/MaterialDialogsUtil.kt | 0 build.gradle | 4 +- 54 files changed, 250 insertions(+), 125 deletions(-) create mode 100644 app/src/main/java/code/name/monkey/retromusic/providers/NotPlayedStore.kt delete mode 100644 app/src/main/java/code/name/monkey/retromusic/ui/activities/ErrorHandlerActivity.kt create mode 100644 app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/ErrorHandlerActivity.kt create mode 100644 app/src/main/res/drawable/flat_shadow.png create mode 100644 app/src/main/res/drawable/flat_shadow_thumb.xml create mode 100644 app/src/main/res/drawable/switch_square.xml mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATECheckBoxPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEColorPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEDialogPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEEditTextPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEListPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEMultiSelectPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEPreferenceCategory.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreferenceFragmentCompat.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEEditTextPreferenceDialogFragmentCompat.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.kt mode change 100755 => 100644 appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialDialogsUtil.kt diff --git a/app/build.gradle b/app/build.gradle index 00485c9c..f6878f76 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,8 +32,8 @@ android { vectorDrawables.useSupportLibrary = true applicationId "code.name.monkey.retromusic" - versionCode 283 - versionName '3.0.550' + versionCode 286 + versionName '3.0.570' multiDexEnabled true @@ -131,7 +131,7 @@ dependencies { implementation "com.google.android.material:material:$supportLibVersion" implementation "com.squareup.retrofit2:retrofit:2.5.0" - implementation "com.squareup.retrofit2:converter-gson:2.4.0" + implementation "com.squareup.retrofit2:converter-gson:2.5.0" implementation "com.squareup.retrofit2:adapter-rxjava2:2.5.0" implementation "com.afollestad.material-dialogs:core:$materialDialog" @@ -141,8 +141,8 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.8.0' implementation 'com.github.bumptech.glide:okhttp3-integration:4.8.0' - implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' - implementation 'io.reactivex.rxjava2:rxjava:2.1.17' + implementation 'io.reactivex.rxjava2:rxandroid:2.1.0' + implementation 'io.reactivex.rxjava2:rxjava:2.2.6' implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') { transitive = true @@ -167,6 +167,7 @@ dependencies { kapt 'com.github.bumptech.glide:compiler:4.8.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + } repositories { mavenCentral() diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c0b46fdf..0ec25824 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -115,7 +115,7 @@

v3.0.550

Highlights

  • Kotlin conversion from Good old Java
  • Outline style system icons
  • New Material Design principles and Guide lines
  • Holiday Theme

Changelog

  • Added favorite songs in home section
  • Combined home sections to single Recycler View to make load faster
  • Fixed app clear data when crash happens
  • Updated translations
  • By default theme will be dark
  • Now you can add search app shortcut in home screen
  • Last selected Lyrics options saved
  • Fonts are removed to make it fast loading
  • Now you can add plain text home screen widget
  • Good old side navigation bar for options
  • Bug report for better tracking with milestones
  • Snow fall effect can be enable from other settings(Works only one normal theme)
  • Click new music mix to play songs
  • Gradient image option for gird list
  • Clear button for playing queue
  • Folder list back button
  • New theme Fit
  • On library click on toolbar for accessing main menu
  • On home click on toolbar for accessing search
  • BottomSheetDialogue is now adaptable to screens, background colour and text size consistency.
  • Removed coloured navigation bar option to making app adapt the primary colour
  • Swipe up gesture for now playing removed, replaced with "tap to open", To achieve transparent navigation bar for desired themes.
  • Improved tablet UI and home screen by adding suggestions toggle banner issues.
  • Improving lyrics page
  • Updated image loading libraries(might loose your current artist images)

If you see entire app white or dark or black select same theme in settings to fix

FAQ's

*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.

\ No newline at end of file +

v3.0.570

  • Fix Album/Artist square image
  • Fix Delete dialog text format
  • Fix Profile picture not showing after coming back from folders
  • Fix Play button color i Simple and Plain themes
  • Fix Sleep timer dialog crashing
  • Fix Share song dialog title and text

If you see entire app white or dark or black select same theme in settings to fix

FAQ's

*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again.

\ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.java b/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.java index 0bd45f81..f3283f65 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.java +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/BlacklistFolderChooserDialog.java @@ -24,7 +24,7 @@ import code.name.monkey.retromusic.R; /** * @author Aidan Follestad (afollestad), modified by Karim Abou Zeid */ -public class BlacklistFolderChooserDialog extends DialogFragment implements MaterialDialog.ListCallback { +public class BlacklistFolderChooserDialog extends DialogFragment /*implements MaterialDialog.ListCallback */{ private String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath(); private File parentFolder; @@ -68,7 +68,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate return null; } - @NonNull + /*@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) @@ -102,9 +102,9 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate .positiveText(R.string.add_action) .negativeText(android.R.string.cancel); return builder.build(); - } + }*/ - @Override + /*@Override public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence s) { if (canGoUp && i == 0) { parentFolder = parentFolder.getParentFile(); @@ -120,7 +120,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate } } reload(); - } + }*/ private void checkIfCanGoUp() { canGoUp = parentFolder.getParent() != null; @@ -130,7 +130,7 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate parentContents = listFiles(); MaterialDialog dialog = (MaterialDialog) getDialog(); dialog.setTitle(parentFolder.getAbsolutePath()); - dialog.setItems((CharSequence[]) getContentsArray()); + //dialog.setItems((CharSequence[]) getContentsArray()); } @Override diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt index 2c892747..e9098643 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/DeleteSongsDialog.kt @@ -30,7 +30,7 @@ class DeleteSongsDialog : RoundedBottomSheetDialogFragment() { } else { getString(R.string.delete_song_x, songs[0].title) } - dialogTitle.text = content + dialogTitle.text = Html.fromHtml(content) } actionDelete.apply { setOnClickListener { diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/ScanMediaFolderChooserDialog.java b/app/src/main/java/code/name/monkey/retromusic/dialogs/ScanMediaFolderChooserDialog.java index 5419ce90..1b1440fe 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/ScanMediaFolderChooserDialog.java +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/ScanMediaFolderChooserDialog.java @@ -1 +1 @@ -package code.name.monkey.retromusic.dialogs; import android.Manifest; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.pm.PackageManager; import android.media.MediaScannerConnection; import android.os.Build; import android.os.Bundle; import android.os.Environment; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.ActivityCompat; import androidx.fragment.app.DialogFragment; import android.view.View; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener; import code.name.monkey.retromusic.ui.fragments.mainactivity.folders.FoldersFragment; import code.name.monkey.retromusic.util.PreferenceUtil; /** * @author Aidan Follestad (afollestad), modified by Karim Abou Zeid */ public class ScanMediaFolderChooserDialog extends DialogFragment implements MaterialDialog.ListCallback { String initialPath = PreferenceUtil.getInstance().getStartDirectory().getAbsolutePath(); private File parentFolder; private File[] parentContents; private boolean canGoUp = false; public static ScanMediaFolderChooserDialog create() { return new ScanMediaFolderChooserDialog(); } private static void scanPaths(@NonNull WeakReference activityWeakReference, @NonNull Context applicationContext, @Nullable String[] toBeScanned) { Activity activity = activityWeakReference.get(); if (toBeScanned == null || toBeScanned.length < 1) { Toast.makeText(applicationContext, R.string.nothing_to_scan, Toast.LENGTH_SHORT).show(); } else { MediaScannerConnection.scanFile(applicationContext, toBeScanned, null, activity != null ? new UpdateToastMediaScannerCompletionListener(activity, toBeScanned) : null); } } private String[] getContentsArray() { if (parentContents == null) { if (canGoUp) { return new String[]{".."}; } return new String[]{}; } String[] results = new String[parentContents.length + (canGoUp ? 1 : 0)]; if (canGoUp) { results[0] = ".."; } for (int i = 0; i < parentContents.length; i++) { results[canGoUp ? i + 1 : i] = parentContents[i].getName(); } return results; } private File[] listFiles() { File[] contents = parentFolder.listFiles(); List results = new ArrayList<>(); if (contents != null) { for (File fi : contents) { if (fi.isDirectory()) { results.add(fi); } } Collections.sort(results, new FolderSorter()); return results.toArray(new File[results.size()]); } return null; } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission( getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { return new MaterialDialog.Builder(getActivity()) .title(R.string.md_error_label) .content(R.string.md_storage_perm_error) .positiveText(android.R.string.ok) .build(); } if (savedInstanceState == null) { savedInstanceState = new Bundle(); } if (!savedInstanceState.containsKey("current_path")) { savedInstanceState.putString("current_path", initialPath); } parentFolder = new File(savedInstanceState.getString("current_path", File.pathSeparator)); checkIfCanGoUp(); parentContents = listFiles(); MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()) .title(parentFolder.getAbsolutePath()) .items((CharSequence[]) getContentsArray()) .itemsCallback(this) .autoDismiss(false) .onPositive((dialog, which) -> { final Context applicationContext = getActivity().getApplicationContext(); final WeakReference activityWeakReference = new WeakReference<>(getActivity()); dismiss(); new FoldersFragment.ListPathsAsyncTask(getActivity(), paths -> scanPaths(activityWeakReference, applicationContext, paths)).execute(new FoldersFragment.ListPathsAsyncTask.LoadingInfo(parentFolder, FoldersFragment.AUDIO_FILE_FILTER)); }) .onNegative((materialDialog, dialogAction) -> dismiss()) .positiveText(R.string.action_scan_directory) .negativeText(android.R.string.cancel); return builder.build(); } @Override public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence s) { if (canGoUp && i == 0) { parentFolder = parentFolder.getParentFile(); if (parentFolder.getAbsolutePath().equals("/storage/emulated")) { parentFolder = parentFolder.getParentFile(); } checkIfCanGoUp(); } else { parentFolder = parentContents[canGoUp ? i - 1 : i]; canGoUp = true; if (parentFolder.getAbsolutePath().equals("/storage/emulated")) { parentFolder = Environment.getExternalStorageDirectory(); } } reload(); } private void checkIfCanGoUp() { canGoUp = parentFolder.getParent() != null; } private void reload() { parentContents = listFiles(); MaterialDialog dialog = (MaterialDialog) getDialog(); dialog.setTitle(parentFolder.getAbsolutePath()); dialog.setItems((CharSequence[]) getContentsArray()); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("current_path", parentFolder.getAbsolutePath()); } private static class FolderSorter implements Comparator { @Override public int compare(File lhs, File rhs) { return lhs.getName().compareTo(rhs.getName()); } } } \ No newline at end of file +package code.name.monkey.retromusic.dialogs; import android.Manifest; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.pm.PackageManager; import android.media.MediaScannerConnection; import android.os.Build; import android.os.Bundle; import android.os.Environment; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.ActivityCompat; import androidx.fragment.app.DialogFragment; import android.view.View; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener; import code.name.monkey.retromusic.ui.fragments.mainactivity.folders.FoldersFragment; import code.name.monkey.retromusic.util.PreferenceUtil; /** * @author Aidan Follestad (afollestad), modified by Karim Abou Zeid */ public class ScanMediaFolderChooserDialog extends DialogFragment /*implements MaterialDialog.ListCallback*/ { String initialPath = PreferenceUtil.getInstance().getStartDirectory().getAbsolutePath(); private File parentFolder; private File[] parentContents; private boolean canGoUp = false; public static ScanMediaFolderChooserDialog create() { return new ScanMediaFolderChooserDialog(); } private static void scanPaths(@NonNull WeakReference activityWeakReference, @NonNull Context applicationContext, @Nullable String[] toBeScanned) { Activity activity = activityWeakReference.get(); if (toBeScanned == null || toBeScanned.length < 1) { Toast.makeText(applicationContext, R.string.nothing_to_scan, Toast.LENGTH_SHORT).show(); } else { MediaScannerConnection.scanFile(applicationContext, toBeScanned, null, activity != null ? new UpdateToastMediaScannerCompletionListener(activity, toBeScanned) : null); } } private String[] getContentsArray() { if (parentContents == null) { if (canGoUp) { return new String[]{".."}; } return new String[]{}; } String[] results = new String[parentContents.length + (canGoUp ? 1 : 0)]; if (canGoUp) { results[0] = ".."; } for (int i = 0; i < parentContents.length; i++) { results[canGoUp ? i + 1 : i] = parentContents[i].getName(); } return results; } private File[] listFiles() { File[] contents = parentFolder.listFiles(); List results = new ArrayList<>(); if (contents != null) { for (File fi : contents) { if (fi.isDirectory()) { results.add(fi); } } Collections.sort(results, new FolderSorter()); return results.toArray(new File[results.size()]); } return null; } /*@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission( getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { return new MaterialDialog.Builder(getActivity()) .title(R.string.md_error_label) .content(R.string.md_storage_perm_error) .positiveText(android.R.string.ok) .build(); } if (savedInstanceState == null) { savedInstanceState = new Bundle(); } if (!savedInstanceState.containsKey("current_path")) { savedInstanceState.putString("current_path", initialPath); } parentFolder = new File(savedInstanceState.getString("current_path", File.pathSeparator)); checkIfCanGoUp(); parentContents = listFiles(); MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()) .title(parentFolder.getAbsolutePath()) .items((CharSequence[]) getContentsArray()) .itemsCallback(this) .autoDismiss(false) .onPositive((dialog, which) -> { final Context applicationContext = getActivity().getApplicationContext(); final WeakReference activityWeakReference = new WeakReference<>(getActivity()); dismiss(); new FoldersFragment.ListPathsAsyncTask(getActivity(), paths -> scanPaths(activityWeakReference, applicationContext, paths)).execute(new FoldersFragment.ListPathsAsyncTask.LoadingInfo(parentFolder, FoldersFragment.AUDIO_FILE_FILTER)); }) .onNegative((materialDialog, dialogAction) -> dismiss()) .positiveText(R.string.action_scan_directory) .negativeText(android.R.string.cancel); return builder.build(); } @Override public void onSelection(MaterialDialog materialDialog, View view, int i, CharSequence s) { if (canGoUp && i == 0) { parentFolder = parentFolder.getParentFile(); if (parentFolder.getAbsolutePath().equals("/storage/emulated")) { parentFolder = parentFolder.getParentFile(); } checkIfCanGoUp(); } else { parentFolder = parentContents[canGoUp ? i - 1 : i]; canGoUp = true; if (parentFolder.getAbsolutePath().equals("/storage/emulated")) { parentFolder = Environment.getExternalStorageDirectory(); } } reload(); }*/ private void checkIfCanGoUp() { canGoUp = parentFolder.getParent() != null; } private void reload() { parentContents = listFiles(); MaterialDialog dialog = (MaterialDialog) getDialog(); dialog.setTitle(parentFolder.getAbsolutePath()); //dialog.setItems((CharSequence[]) getContentsArray()); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("current_path", parentFolder.getAbsolutePath()); } private static class FolderSorter implements Comparator { @Override public int compare(File lhs, File rhs) { return lhs.getName().compareTo(rhs.getName()); } } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt index 266d6f0d..d10b9b03 100755 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SleepTimerDialog.kt @@ -5,9 +5,6 @@ import android.app.PendingIntent import android.content.Context import android.content.DialogInterface import android.content.Intent -import android.graphics.PorterDuff -import android.graphics.drawable.ClipDrawable -import android.graphics.drawable.LayerDrawable import android.os.Bundle import android.os.CountDownTimer import android.os.SystemClock @@ -24,6 +21,7 @@ import code.name.monkey.retromusic.R import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil +import code.name.monkey.retromusic.util.ViewUtil import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment import kotlinx.android.synthetic.main.dialog_sleep_timer.* import java.util.* @@ -50,9 +48,7 @@ class SleepTimerDialog : RoundedBottomSheetDialogFragment() { } private fun setProgressBarColor(dark: Int) { - val ld = seekBar.progressDrawable as LayerDrawable - val clipDrawable = ld.findDrawableByLayerId(android.R.id.progress) as ClipDrawable - clipDrawable.setColorFilter(dark, PorterDuff.Mode.SRC_IN) + ViewUtil.setProgressDrawable(progressSlider = seekBar, newColor = dark) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -68,7 +64,9 @@ class SleepTimerDialog : RoundedBottomSheetDialogFragment() { seekArcProgress = PreferenceUtil.getInstance().lastSleepTimerValue updateTimeDisplayTime() seekBar.progress = seekArcProgress + setProgressBarColor(ThemeStore.accentColor(context!!)) + seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) { if (i < 1) { diff --git a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt index a4679a59..24c42157 100644 --- a/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/dialogs/SongShareDialog.kt @@ -13,12 +13,12 @@ import code.name.monkey.retromusic.R import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment -import kotlinx.android.synthetic.main.dialog_delete.* +import kotlinx.android.synthetic.main.dialog_file_share.* class SongShareDialog : RoundedBottomSheetDialogFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.dialog_delete, container, false) + return inflater.inflate(R.layout.dialog_file_share, container, false) } @SuppressLint("StringFormatInvalid") @@ -27,7 +27,7 @@ class SongShareDialog : RoundedBottomSheetDialogFragment() { val song = arguments!!.getParcelable("song")!! dialogTitle.setTextColor(ThemeStore.textColorPrimary(context!!)) - actionDelete.apply { + audioText.apply { text = getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName) setTextColor(ThemeStore.textColorSecondary(context!!)) setOnClickListener { @@ -41,15 +41,16 @@ class SongShareDialog : RoundedBottomSheetDialogFragment() { MaterialUtil.setTint(this) } - actionCancel.apply { + audioFile.apply { setTextColor(ThemeStore.textColorSecondary(context!!)) setOnClickListener { - MusicUtil.createShareSongFileIntent(song, context) + activity!!.startActivity(Intent.createChooser(MusicUtil.createShareSongFileIntent(song, activity), null)) dismiss() } icon = ContextCompat.getDrawable(context, R.drawable.ic_share_white_24dp) MaterialUtil.setTint(this, false) } + } companion object { diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt b/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt index bd0ecd9e..4347d52c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt +++ b/app/src/main/java/code/name/monkey/retromusic/helper/LastChanceHandler.kt @@ -3,7 +3,7 @@ package code.name.monkey.retromusic.helper import android.content.Intent import androidx.core.app.ActivityCompat import code.name.monkey.retromusic.App -import code.name.monkey.retromusic.ui.activities.ErrorHandlerActivity +import code.name.monkey.retromusic.ui.activities.bugreport.ErrorHandlerActivity class TopExceptionHandler() : Thread.UncaughtExceptionHandler { private val defaultUEH: Thread.UncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler() @@ -11,6 +11,7 @@ class TopExceptionHandler() : Thread.UncaughtExceptionHandler { override fun uncaughtException(t: Thread, e: Throwable) { var arr = e.stackTrace var report = e.toString() + "\n\n" + report += "--------- Stack trace ---------\n\n" for (i in arr.indices) { report += " " + arr[i].toString() + "\n" diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/contract/HomeContract.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/contract/HomeContract.kt index 9fbccfee..734cc7ac 100644 --- a/app/src/main/java/code/name/monkey/retromusic/mvp/contract/HomeContract.kt +++ b/app/src/main/java/code/name/monkey/retromusic/mvp/contract/HomeContract.kt @@ -6,7 +6,9 @@ import code.name.monkey.retromusic.mvp.BaseView interface HomeContract { - interface HomeView : BaseView> + interface HomeView : BaseView> { + fun showEmpty() + } interface HomePresenter : BasePresenter { diff --git a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt index 65141292..a1db74be 100644 --- a/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/mvp/presenter/HomePresenter.kt @@ -41,11 +41,13 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home if (favoritePlaylist.isNotEmpty()) homes.add(Home(R.string.favorites, 0, favoritePlaylist, PLAYLISTS)) if (genres.isNotEmpty() && PreferenceUtil.getInstance().isGenreShown) homes.add(Home(R.string.genres, 0, genres, GENRES)) homes - }).subscribe { homes -> + }).subscribe({ homes -> if (homes.isNotEmpty()) { view.showData(homes as ArrayList) } - } + }, { + view.showEmpty() + }, { }) } override fun subscribe() { diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreference.kt index a6e1cc86..7d2a2e59 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreference.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreference.kt @@ -2,11 +2,10 @@ package code.name.monkey.retromusic.preferences import android.content.Context import android.util.AttributeSet - -import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference +import androidx.preference.DialogPreference -class AlbumCoverStylePreference : ATEDialogPreference { +class AlbumCoverStylePreference : DialogPreference { constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet) : super(context, attrs) diff --git a/app/src/main/java/code/name/monkey/retromusic/providers/NotPlayedStore.kt b/app/src/main/java/code/name/monkey/retromusic/providers/NotPlayedStore.kt new file mode 100644 index 00000000..fd60eaed --- /dev/null +++ b/app/src/main/java/code/name/monkey/retromusic/providers/NotPlayedStore.kt @@ -0,0 +1,68 @@ +package code.name.monkey.retromusic.providers + +import android.content.ContentValues +import android.content.Context +import android.database.sqlite.SQLiteDatabase +import android.database.sqlite.SQLiteOpenHelper +import code.name.monkey.retromusic.loaders.SongLoader +import code.name.monkey.retromusic.model.Song +import io.reactivex.schedulers.Schedulers + +class NotPlayedStore(val context: Context) : SQLiteOpenHelper(context, DATABASE_NAME, null, VERSION) { + + private val dataBaseCreate = "CREATE TABLE IF NOT EXISTS $NAME ( $ID LONG PRIMARY KEY )" + + override fun onCreate(db: SQLiteDatabase) { + db.execSQL(dataBaseCreate) + } + + override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) { + db.execSQL("DROP TABLE IF EXISTS $NAME") + } + + fun removeSong(id: Long) { + val db = writableDatabase + db.apply { + beginTransaction() + delete(NAME, "$ID = $id", null) + setTransactionSuccessful() + endTransaction() + close() + } + } + + fun addAllSongs(songs: ArrayList) { + SongLoader.getAllSongs(context) + .map { + val database = writableDatabase; + database.apply { + val contentValues = ContentValues() + for (song in songs) { + contentValues.put(ID, song.id) + insert(NAME, null, contentValues) + } + setTransactionSuccessful() + endTransaction() + } + return@map true + } + .subscribeOn(Schedulers.io()) + .subscribe() + } + + companion object { + const val NAME = "not_played_songs" + const val ID = "song_id" + const val DATABASE_NAME = "not_played.db" + private const val VERSION = 1 + private var sInstance: NotPlayedStore? = null + + @Synchronized + fun getInstance(context: Context): NotPlayedStore { + if (sInstance == null) { + sInstance = NotPlayedStore(context.applicationContext) + } + return sInstance!! + } + } +} diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/ErrorHandlerActivity.kt b/app/src/main/java/code/name/monkey/retromusic/ui/activities/ErrorHandlerActivity.kt deleted file mode 100644 index 42019bc4..00000000 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/ErrorHandlerActivity.kt +++ /dev/null @@ -1 +0,0 @@ -package code.name.monkey.retromusic.ui.activities import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import kotlinx.android.synthetic.main.activity_error_handler.* class ErrorHandlerActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(code.name.monkey.retromusic.R.layout.activity_error_handler) clearAppData.setOnClickListener { try { val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.data = Uri.parse("package:$packageName") startActivity(intent) } catch (e: ActivityNotFoundException) { val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS) startActivity(intent) } } sendCrashLog.setOnClickListener { val sendIntent = Intent(Intent.ACTION_SEND) val subject = "Error report" val body = intent.getStringExtra("error") sendIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("monkeycodeapp@gmail.com")) sendIntent.putExtra(Intent.EXTRA_TEXT, body) sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject) sendIntent.type = "message/rfc822" startActivity(Intent.createChooser(sendIntent, "Send crash log")) deleteFile("stack.trace") } showCrashError.text = String.format("%s", intent.getStringExtra("error")) } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/PurchaseActivity.kt b/app/src/main/java/code/name/monkey/retromusic/ui/activities/PurchaseActivity.kt index 19344893..e567838e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/PurchaseActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/PurchaseActivity.kt @@ -40,7 +40,7 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler { appBarLayout.setBackgroundColor(primaryColor) toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp) - toolbar.setNavigationOnClickListener { v -> onBackPressed() } + toolbar.setNavigationOnClickListener { onBackPressed() } bannerTitle.setTextColor(ThemeStore.textColorPrimary(this)) setSupportActionBar(toolbar) title = null diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/WhatsNewActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/WhatsNewActivity.java index 56abf433..f19de472 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/WhatsNewActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/WhatsNewActivity.java @@ -65,7 +65,7 @@ public class WhatsNewActivity extends AbsBaseActivity { setTitle(null); toolbar.setNavigationOnClickListener(v -> onBackPressed()); title.setTextColor(ThemeStore.Companion.textColorPrimary(this)); - ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.Companion.accentColor(this)); + try { // Load from phonograph-changelog.html in the assets folder diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/ErrorHandlerActivity.kt b/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/ErrorHandlerActivity.kt new file mode 100644 index 00000000..a568d91b --- /dev/null +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/bugreport/ErrorHandlerActivity.kt @@ -0,0 +1 @@ +package code.name.monkey.retromusic.ui.activities.bugreport import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import code.name.monkey.retromusic.R import code.name.monkey.retromusic.ui.activities.bugreport.model.DeviceInfo import kotlinx.android.synthetic.main.activity_error_handler.* class ErrorHandlerActivity : AppCompatActivity() { private var deviceInfo: DeviceInfo? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_error_handler) deviceInfo = DeviceInfo(this) clearAppData.setOnClickListener { try { val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.data = Uri.parse("package:$packageName") startActivity(intent) } catch (e: ActivityNotFoundException) { val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS) startActivity(intent) } } sendCrashLog.setOnClickListener { val sendIntent = Intent(Intent.ACTION_SEND) val subject = "Error report" val body = intent.getStringExtra("error") + "\n" + deviceInfo!!.toString() sendIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("monkeycodeapp@gmail.com")) sendIntent.putExtra(Intent.EXTRA_TEXT, body) sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject) sendIntent.type = "message/rfc822" startActivity(Intent.createChooser(sendIntent, "Send crash log")) deleteFile("stack.trace") } showCrashError.text = String.format("%s", intent.getStringExtra("error")) showCrashError.append(deviceInfo!!.toString()) } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/VolumeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/VolumeFragment.kt index d181546e..68a12d1c 100755 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/VolumeFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/VolumeFragment.kt @@ -1,7 +1,6 @@ package code.name.monkey.retromusic.ui.fragments import android.content.Context -import android.content.res.ColorStateList import android.graphics.Color import android.graphics.PorterDuff import android.media.AudioManager @@ -11,8 +10,8 @@ import android.view.View import android.view.ViewGroup import android.widget.SeekBar import androidx.fragment.app.Fragment -import androidx.transition.TransitionManager import code.name.monkey.appthemehelper.ThemeStore +import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.util.PreferenceUtil @@ -34,7 +33,7 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - setTintable(ThemeStore.textColorSecondary(context!!)) + TintHelper.setTintAuto(volumeSeekBar, ThemeStore.textColorPrimary(context!!), false) volumeDown.setOnClickListener(this) volumeUp.setOnClickListener(this) } @@ -101,9 +100,10 @@ class VolumeFragment : Fragment(), SeekBar.OnSeekBarChangeListener, OnAudioVolum private fun setProgressBarColor(newColor: Int) { - volumeSeekBar.thumbTintList = ColorStateList.valueOf(newColor) - volumeSeekBar.progressTintList = ColorStateList.valueOf(newColor) - volumeSeekBar.progressBackgroundTintList = ColorStateList.valueOf(newColor) + //volumeSeekBar.thumbTintList = ColorStateList.valueOf(newColor) + //volumeSeekBar.progressTintList = ColorStateList.valueOf(newColor) + //volumeSeekBar.progressBackgroundTintList = ColorStateList.valueOf(newColor) + TintHelper.setTintAuto(volumeSeekBar, newColor, false) volumeDown.setColorFilter(newColor, PorterDuff.Mode.SRC_IN) volumeUp.setColorFilter(newColor, PorterDuff.Mode.SRC_IN) } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/LibraryFragment.java b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/LibraryFragment.java index 6f802781..bd5a9f0d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/LibraryFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/LibraryFragment.java @@ -69,7 +69,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde private MaterialCab cab; private FragmentManager fragmentManager; private ImageView userImage; - private CompositeDisposable disposable = new CompositeDisposable(); + private CompositeDisposable disposable ; @Override public void onDestroyView() { @@ -94,12 +94,14 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_library, container, false); + disposable = new CompositeDisposable(); contentContainer = view.findViewById(R.id.fragmentContainer); bannerTitle = view.findViewById(R.id.bannerTitle); appBarLayout = view.findViewById(R.id.appBarLayout); toolbar = view.findViewById(R.id.toolbar); userImage = view.findViewById(R.id.userImage); userImage.setOnClickListener(v -> showMainMenu()); + loadImageFromStorage(); return view; } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/home/BannerHomeFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/home/BannerHomeFragment.kt index cb2ed355..c1f2a77c 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/home/BannerHomeFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/mainactivity/home/BannerHomeFragment.kt @@ -40,8 +40,11 @@ import java.io.File import java.util.* class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView { + override fun showEmpty() { - val disposable: CompositeDisposable = CompositeDisposable() + } + + private lateinit var disposable: CompositeDisposable private lateinit var homePresenter: HomePresenter private lateinit var contentContainerView: View private lateinit var lastAdded: View @@ -111,7 +114,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ - imageView.setImageBitmap(it) + if (it != null) { + imageView.setImageBitmap(it) + } else { + imageView.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat)) + } }) { imageView.setImageDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_person_flat)) }) @@ -132,22 +139,22 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba lastAdded = view.findViewById(R.id.lastAdded) lastAdded.setOnClickListener { - NavigationUtil.goToPlaylistNew(activity!!, LastAddedPlaylist(activity!!)) + NavigationUtil.goToPlaylistNew(mainActivity, LastAddedPlaylist(mainActivity)) } topPlayed = view.findViewById(R.id.topPlayed) topPlayed.setOnClickListener { - NavigationUtil.goToPlaylistNew(activity!!, MyTopTracksPlaylist(activity!!)) + NavigationUtil.goToPlaylistNew(mainActivity, MyTopTracksPlaylist(mainActivity)) } actionShuffle = view.findViewById(R.id.actionShuffle) actionShuffle.setOnClickListener { - MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(activity!!).blockingFirst(), true) + MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(mainActivity).blockingFirst(), true) } history = view.findViewById(R.id.history) history.setOnClickListener { - NavigationUtil.goToPlaylistNew(activity!!, HistoryPlaylist(activity!!)) + NavigationUtil.goToPlaylistNew(mainActivity, HistoryPlaylist(mainActivity)) } userImage = view.findViewById(R.id.userImage) @@ -163,9 +170,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba setupToolbar() homePresenter.subscribe() - loadImageFromStorage(userImage) - getTimeOfTheDay() - } private fun setupToolbar() { @@ -179,6 +183,13 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba return false } + override fun onResume() { + super.onResume() + disposable = CompositeDisposable() + loadImageFromStorage(userImage) + getTimeOfTheDay() + } + override fun onDestroyView() { super.onDestroyView() disposable.dispose() diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt index b8220f06..c2fefd1a 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/adaptive/AdaptivePlaybackControlsFragment.kt @@ -8,6 +8,7 @@ import android.view.View import android.view.ViewGroup import android.view.animation.LinearInterpolator import android.widget.SeekBar +import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper @@ -20,6 +21,7 @@ import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener import code.name.monkey.retromusic.service.MusicService import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.util.MusicUtil +import code.name.monkey.retromusic.util.PreferenceUtil import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.* class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() { @@ -94,9 +96,14 @@ class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() { updatePrevNextColor() updatePlayPauseColor() - TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)), false) - TintHelper.setTintAuto(playPauseButton, color, true) - TintHelper.setTintAuto(progressSlider, color, false) + val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { + color + } else { + ThemeStore.accentColor(context!!) + } + TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(colorFinal)), false) + TintHelper.setTintAuto(playPauseButton, colorFinal, true) + TintHelper.setTintAuto(progressSlider, colorFinal, false) } private fun updatePlayPauseColor() { diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/fit/FitPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/fit/FitPlaybackControlsFragment.kt index 3a3857f7..4c2505d6 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/fit/FitPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/fit/FitPlaybackControlsFragment.kt @@ -2,8 +2,6 @@ package code.name.monkey.retromusic.ui.fragments.player.fit import android.animation.ObjectAnimator import android.graphics.PorterDuff -import android.graphics.drawable.ClipDrawable -import android.graphics.drawable.LayerDrawable import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -29,7 +27,6 @@ import code.name.monkey.retromusic.util.PreferenceUtil import kotlinx.android.synthetic.main.fragment_player_playback_controls.* import kotlinx.android.synthetic.main.media_button.* import kotlinx.android.synthetic.main.player_time.* -import kotlinx.android.synthetic.main.volume_controls.* class FitPlaybackControlsFragment : AbsPlayerControlsFragment() { @@ -112,12 +109,12 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() { lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false) } - if (PreferenceUtil.getInstance().adaptiveColor) { - setFabColor(color) + val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { + color } else { - setFabColor(ThemeStore.accentColor(context!!)) + ThemeStore.accentColor(context!!) } - + setFabColor(colorFinal) updateRepeatState() updateShuffleState() updatePrevNextColor() @@ -126,7 +123,6 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() { private fun setFabColor(i: Int) { TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(i)), false) TintHelper.setTintAuto(playPauseButton, i, true) - } private fun setUpPlayPauseFab() { diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/flat/FlatPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/flat/FlatPlaybackControlsFragment.kt index e692ed68..5c5f2b8b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/flat/FlatPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/flat/FlatPlaybackControlsFragment.kt @@ -104,11 +104,15 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback { lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false) lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false) } - val accentColor = ThemeStore.accentColor(context!!) - val b = PreferenceUtil.getInstance().adaptiveColor - updateTextColors(if (b) color else accentColor) - setProgressBarColor(if (b) color else accentColor) + val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { + color + } else { + ThemeStore.accentColor(context!!) + } + + updateTextColors(colorFinal) + setProgressBarColor(colorFinal) updateRepeatState() updateShuffleState() diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/material/MaterialControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/material/MaterialControlsFragment.kt index 1735c814..10d5bcde 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/material/MaterialControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/material/MaterialControlsFragment.kt @@ -1,7 +1,6 @@ package code.name.monkey.retromusic.ui.fragments.player.material import android.animation.ObjectAnimator -import android.content.res.ColorStateList import android.graphics.PorterDuff import android.os.Bundle import android.view.LayoutInflater @@ -9,9 +8,11 @@ import android.view.View import android.view.ViewGroup import android.view.animation.LinearInterpolator import android.widget.SeekBar +import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper +import code.name.monkey.appthemehelper.util.TintHelper import code.name.monkey.retromusic.R import code.name.monkey.retromusic.helper.MusicPlayerRemote import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper @@ -22,7 +23,6 @@ import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.PreferenceUtil import kotlinx.android.synthetic.main.fragment_material_playback_controls.* -import kotlinx.android.synthetic.main.fragment_volume.* import kotlinx.android.synthetic.main.player_time.* /** @@ -104,15 +104,17 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() { updateRepeatState() updateShuffleState() - if (PreferenceUtil.getInstance().adaptiveColor) { - lastPlaybackControlsColor = color - text.setTextColor(color) - progressSlider.thumbTintList = ColorStateList.valueOf(color) - progressSlider.progressTintList = ColorStateList.valueOf(color) - progressSlider.progressBackgroundTintList = ColorStateList.valueOf(color) + val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { + color + } else { + ThemeStore.accentColor(context!!) } + lastPlaybackControlsColor = colorFinal + text.setTextColor(colorFinal) + TintHelper.setTintAuto(progressSlider, colorFinal, false) + updatePlayPauseColor() updatePrevNextColor() } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/plain/PlainPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/plain/PlainPlaybackControlsFragment.kt index 9c158546..595de026 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/plain/PlainPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/plain/PlainPlaybackControlsFragment.kt @@ -11,6 +11,7 @@ import android.view.animation.AccelerateInterpolator import android.view.animation.DecelerateInterpolator import android.view.animation.LinearInterpolator import android.widget.SeekBar +import code.name.monkey.appthemehelper.ThemeStore import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ColorUtil import code.name.monkey.appthemehelper.util.MaterialValueHelper @@ -126,11 +127,16 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() { lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false) } - if (PreferenceUtil.getInstance().adaptiveColor) { - TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(color)), false) - TintHelper.setTintAuto(playPauseButton, color, true) - setProgressBarColor(color) + val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { + color + } else { + ThemeStore.accentColor(context!!) } + + TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false) + TintHelper.setTintAuto(playPauseButton, colorFinal, true) + setProgressBarColor(colorFinal) + updateRepeatState() updateShuffleState() updatePrevNextColor() diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/simple/SimplePlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/simple/SimplePlaybackControlsFragment.kt index 8b575695..dcfd891d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/simple/SimplePlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/simple/SimplePlaybackControlsFragment.kt @@ -188,14 +188,16 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() { lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(context!!, false) } - if (PreferenceUtil.getInstance().adaptiveColor) { - TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(color)), false) - TintHelper.setTintAuto(playPauseButton, color, true) - text.setTextColor(color) + val colorFinal = if (PreferenceUtil.getInstance().adaptiveColor) { + color } else { - text.setTextColor(ThemeStore.accentColor(context!!)) + ThemeStore.accentColor(context!!) } + TintHelper.setTintAuto(playPauseButton, MaterialValueHelper.getPrimaryTextColor(context!!, ColorUtil.isColorLight(colorFinal)), false) + TintHelper.setTintAuto(playPauseButton, colorFinal, true) + text.setTextColor(colorFinal) + updateRepeatState() updateShuffleState() updatePrevNextColor() diff --git a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt index b34ecdf6..af48de6a 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt +++ b/app/src/main/java/code/name/monkey/retromusic/util/ViewUtil.kt @@ -37,7 +37,6 @@ object ViewUtil { val clipDrawableBackground = ld.findDrawableByLayerId(android.R.id.background) clipDrawableBackground.setColorFilter(MaterialValueHelper.getPrimaryDisabledTextColor(progressSlider.context, ColorUtil.isColorLight(ThemeStore.primaryColor(progressSlider.context))), PorterDuff.Mode.SRC_IN) - } private fun createColorAnimator(target: Any, propertyName: String, @ColorInt startColor: Int, @ColorInt endColor: Int): Animator { diff --git a/app/src/main/res/drawable/flat_shadow.png b/app/src/main/res/drawable/flat_shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..1f8a177364092eaff30ce1133d56402a954f22c5 GIT binary patch literal 423 zcmV;Y0a*TtP)Px$VM# zcfqL5)^Lg7VWeQ7%LjsWT~?lEauxqs0BRR~Y9bC+Cklhs+V>ylwaY>1qehx^9VY_N zoqRMlTG{BR_}%^QZN!`8x_b=|G}VcB4t~8l8op5v=-s6Br$>fHo&W+5 + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/switch_square.xml b/app/src/main/res/drawable/switch_square.xml new file mode 100644 index 00000000..377369b2 --- /dev/null +++ b/app/src/main/res/drawable/switch_square.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/switch_thumb_material.xml b/app/src/main/res/drawable/switch_thumb_material.xml index 8c359a89..a961deb9 100755 --- a/app/src/main/res/drawable/switch_thumb_material.xml +++ b/app/src/main/res/drawable/switch_thumb_material.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/src/main/res/layout/dialog_file_share.xml b/app/src/main/res/layout/dialog_file_share.xml index 1eaa12ca..8f1a0848 100644 --- a/app/src/main/res/layout/dialog_file_share.xml +++ b/app/src/main/res/layout/dialog_file_share.xml @@ -1,35 +1,42 @@ + android:textStyle="bold" /> - + android:textAllCaps="false" /> - + android:textAllCaps="false" + app:strokeWidth="2dp" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_sleep_timer.xml b/app/src/main/res/layout/dialog_sleep_timer.xml index 8c97801e..28f05aee 100644 --- a/app/src/main/res/layout/dialog_sleep_timer.xml +++ b/app/src/main/res/layout/dialog_sleep_timer.xml @@ -30,7 +30,7 @@ android:textAppearance="?android:textAppearanceLarge" /> - + android:paddingStart="16dp" + android:paddingEnd="16dp"> + android:paddingStart="8dp" + android:paddingEnd="8dp"> diff --git a/app/src/main/res/layout/fragment_flat_player_playback_controls.xml b/app/src/main/res/layout/fragment_flat_player_playback_controls.xml index 7a8afa44..615e1d0c 100644 --- a/app/src/main/res/layout/fragment_flat_player_playback_controls.xml +++ b/app/src/main/res/layout/fragment_flat_player_playback_controls.xml @@ -12,10 +12,8 @@ android:id="@+id/progressSlider" android:layout_width="match_parent" android:layout_height="wrap_content" - android:maxHeight="3dp" - android:progressDrawable="@drawable/color_progress_seek" android:splitTrack="false" - android:thumb="@drawable/switch_thumb_material" + android:thumb="@drawable/flat_shadow_thumb" tools:ignore="RtlHardcoded,UnusedAttribute" /> diff --git a/app/src/main/res/layout/fragment_material_playback_controls.xml b/app/src/main/res/layout/fragment_material_playback_controls.xml index b9806e9d..6dd093d8 100644 --- a/app/src/main/res/layout/fragment_material_playback_controls.xml +++ b/app/src/main/res/layout/fragment_material_playback_controls.xml @@ -14,6 +14,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:maxHeight="3dp" + android:progressDrawable="@drawable/color_progress_seek" android:paddingStart="24dp" android:paddingEnd="24dp" tools:progress="20" /> diff --git a/app/src/main/res/layout/fragment_volume.xml b/app/src/main/res/layout/fragment_volume.xml index 456c394f..7d912910 100755 --- a/app/src/main/res/layout/fragment_volume.xml +++ b/app/src/main/res/layout/fragment_volume.xml @@ -20,7 +20,9 @@ android:id="@+id/volumeSeekBar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" /> + android:layout_weight="1" + android:maxHeight="3dp" + android:progressDrawable="@drawable/color_progress_seek" /> diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATECheckBoxPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATECheckBoxPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEColorPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEColorPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEDialogPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEDialogPreference.kt old mode 100755 new mode 100644 index 180094c3..794afe3a --- a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEDialogPreference.kt +++ b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEDialogPreference.kt @@ -3,6 +3,7 @@ package code.name.monkey.appthemehelper.common.prefs import android.content.Context import android.util.AttributeSet import code.name.monkey.appthemehelper.R +import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.prefs.MaterialDialogPreference diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEEditTextPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEEditTextPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEListPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEListPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEMultiSelectPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEMultiSelectPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEPreferenceCategory.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATEPreferenceCategory.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/ATESwitchPreference.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreferenceFragmentCompat.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/ATEPreferenceFragmentCompat.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEEditTextPreferenceDialogFragmentCompat.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEEditTextPreferenceDialogFragmentCompat.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEListPreferenceDialogFragmentCompat.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/common/prefs/supportv7/dialogs/ATEPreferenceDialogFragment.kt old mode 100755 new mode 100644 diff --git a/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialDialogsUtil.kt b/appthemehelper/src/main/java/code/name/monkey/appthemehelper/util/MaterialDialogsUtil.kt old mode 100755 new mode 100644 diff --git a/build.gradle b/build.gradle index a7f7d2cf..3fcc6baf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.11' + ext.kotlin_version = '1.3.21' ext { supportLibVersion = '1.0.0' firebase = "11.8.0" @@ -13,7 +13,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }