diff --git a/app/build.gradle b/app/build.gradle index 720f943a..16a88adb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,7 +23,6 @@ static def gitBranch() { android { compileSdkVersion 28 - buildToolsVersion '29.0.0 rc2' defaultConfig { minSdkVersion 21 targetSdkVersion 28 @@ -120,14 +119,14 @@ static def getDate() { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.multidex:multidex:2.0.1' - implementation 'androidx.fragment:fragment:1.1.0-alpha06' - implementation 'androidx.appcompat:appcompat:1.1.0-alpha04' + implementation 'androidx.fragment:fragment:1.1.0-alpha08' + implementation 'androidx.appcompat:appcompat:1.1.0-alpha05' implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha04' implementation "androidx.gridlayout:gridlayout:1.0.0" implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.palette:palette:1.0.0" implementation 'androidx.annotation:annotation:1.1.0-beta01' - implementation 'androidx.preference:preference:1.1.0-alpha04' + implementation 'androidx.preference:preference:1.1.0-alpha05' implementation "androidx.legacy:legacy-support-v13:1.0.0" implementation "androidx.legacy:legacy-preference-v14:1.0.0" implementation 'com.google.android.material:material:1.1.0-alpha05' @@ -135,10 +134,10 @@ dependencies { implementation 'com.squareup.retrofit2:retrofit:2.5.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" - implementation "com.afollestad.material-dialogs:core:$materialDialog" - implementation 'com.afollestad.material-dialogs:input:2.0.0' - implementation 'com.afollestad.material-dialogs:color:2.0.0' + implementation 'com.afollestad.material-dialogs:core:3.0.0-alpha1' + implementation 'com.afollestad.material-dialogs:input:3.0.0-alpha1' + implementation 'com.afollestad.material-dialogs:color:3.0.0-alpha1' + implementation 'com.afollestad.material-dialogs:bottomsheets:3.0.0-alpha1' implementation 'com.afollestad:material-cab:0.1.12' implementation 'com.github.bumptech.glide:glide:4.8.0' kapt 'com.github.bumptech.glide:compiler:4.8.0' diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt index 669e8fa8..ca4aa7f0 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt +++ b/app/src/main/java/code/name/monkey/retromusic/activities/base/AbsSlidingMusicPanelActivity.kt @@ -20,6 +20,7 @@ import code.name.monkey.retromusic.fragments.player.adaptive.AdaptiveFragment import code.name.monkey.retromusic.fragments.player.blur.BlurPlayerFragment import code.name.monkey.retromusic.fragments.player.card.CardFragment import code.name.monkey.retromusic.fragments.player.cardblur.CardBlurFragment +import code.name.monkey.retromusic.fragments.player.classic.ClassicPlayerFragment import code.name.monkey.retromusic.fragments.player.color.ColorFragment import code.name.monkey.retromusic.fragments.player.fit.FitFragment import code.name.monkey.retromusic.fragments.player.flat.FlatPlayerFragment @@ -28,6 +29,7 @@ import code.name.monkey.retromusic.fragments.player.material.MaterialFragment import code.name.monkey.retromusic.fragments.player.normal.PlayerFragment import code.name.monkey.retromusic.fragments.player.plain.PlainPlayerFragment import code.name.monkey.retromusic.fragments.player.simple.SimplePlayerFragment +import code.name.monkey.retromusic.fragments.player.slide.SlidePlayerFragment import code.name.monkey.retromusic.fragments.player.tiny.TinyPlayerFragment import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.views.BottomNavigationBarTinted @@ -194,7 +196,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(), Sliding MATERIAL -> MaterialFragment() COLOR -> ColorFragment() TINY -> TinyPlayerFragment() - //SLIDE -> SlidePlayerFragment() + CLASSIC -> ClassicPlayerFragment() else -> PlayerFragment() } // must implement AbsPlayerFragment supportFragmentManager.beginTransaction().replace(R.id.playerFragmentContainer, fragment).commit() diff --git a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/WriteTagsAsyncTask.java b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/WriteTagsAsyncTask.java index 9648fdd6..8ead2b76 100644 --- a/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/WriteTagsAsyncTask.java +++ b/app/src/main/java/code/name/monkey/retromusic/activities/tageditor/WriteTagsAsyncTask.java @@ -7,6 +7,7 @@ import android.graphics.Bitmap; import android.media.MediaScannerConnection; import com.afollestad.materialdialogs.MaterialDialog; +import com.afollestad.materialdialogs.bottomsheets.BottomSheet; import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFileIO; @@ -134,7 +135,7 @@ public class WriteTagsAsyncTask extends @Override protected Dialog createDialog(@NonNull Context context) { - return new MaterialDialog(context) + return new MaterialDialog(context, new BottomSheet()) .title(R.string.saving_changes, "") .cancelable(false); } diff --git a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt index 5015db01..c28fcdb9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/adapter/album/AlbumCoverPagerAdapter.kt @@ -10,13 +10,14 @@ import android.widget.ImageView import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import code.name.monkey.retromusic.R +import code.name.monkey.retromusic.activities.LyricsActivity +import code.name.monkey.retromusic.fragments.AlbumCoverStyle +import code.name.monkey.retromusic.fragments.NowPlayingScreen import code.name.monkey.retromusic.glide.GlideApp import code.name.monkey.retromusic.glide.RetroGlideExtension import code.name.monkey.retromusic.glide.RetroMusicColoredTarget import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter import code.name.monkey.retromusic.model.Song -import code.name.monkey.retromusic.activities.LyricsActivity -import code.name.monkey.retromusic.fragments.AlbumCoverStyle import code.name.monkey.retromusic.util.PreferenceUtil import java.util.* @@ -90,8 +91,11 @@ class AlbumCoverPagerAdapter(fm: FragmentManager, private val dataSet: ArrayList } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - val layout = layout - val view = inflater.inflate(layout, container, false) + var finalLayout = layout + if (PreferenceUtil.getInstance().nowPlayingScreen == NowPlayingScreen.CLASSIC) { + finalLayout = R.layout.fragment_album_full_cover + } + val view = inflater.inflate(finalLayout, container, false) albumCover = view.findViewById(R.id.player_image) albumCover.setOnClickListener { startActivity(Intent(context, LyricsActivity::class.java)) } return view diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt index e3a61c7e..228ddb58 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/NowPlayingScreen.kt @@ -22,6 +22,7 @@ enum class NowPlayingScreen constructor(@param:StringRes @field:StringRes PLAIN(R.string.plain, R.drawable.np_plain, 3), TINY(R.string.tiny, R.drawable.np_tiny, 7), SIMPLE(R.string.simple, R.drawable.np_simple, 8), + CLASSIC(R.string.classic, R.drawable.np_normal, 13); //SLIDE(R.string.slide, R.drawable.np_slide, 13) } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/LibraryFragment.java b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/LibraryFragment.java index 22446b9d..25de9f79 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/LibraryFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/LibraryFragment.java @@ -11,7 +11,6 @@ import android.view.SubMenu; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -37,11 +36,11 @@ import code.name.monkey.appthemehelper.util.TintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog; +import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; +import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment; import code.name.monkey.retromusic.helper.SortOrder; import code.name.monkey.retromusic.interfaces.CabHolder; import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks; -import code.name.monkey.retromusic.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; -import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment; import code.name.monkey.retromusic.util.Compressor; import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.RetroColorUtil; @@ -59,7 +58,6 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde private Toolbar toolbar; private AppBarLayout appBarLayout; - private TextView bannerTitle; private View contentContainer; private MaterialCab cab; @@ -94,7 +92,6 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde 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); @@ -118,14 +115,14 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde } public void setTitle(@StringRes int name) { - bannerTitle.setText(getString(name)); + toolbar.setTitle(getString(name)); } - public void addOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) { + public void addOnAppBarOffsetChangedListener(@NonNull AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) { appBarLayout.addOnOffsetChangedListener(onOffsetChangedListener); } - public void removeOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) { + public void removeOnAppBarOffsetChangedListener(@NonNull AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) { appBarLayout.removeOnOffsetChangedListener(onOffsetChangedListener); } @@ -166,18 +163,19 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde @SuppressWarnings("ConstantConditions") private void setupToolbar() { - bannerTitle.setTextColor(ThemeStore.Companion.textColorPrimary(getContext())); - int primaryColor = ThemeStore.Companion.primaryColor(getContext()); TintHelper.setTintAuto(contentContainer, primaryColor, true); toolbar.setBackgroundColor(primaryColor); - toolbar.setNavigationIcon(R.drawable.ic_search_white_24dp); + + toolbar.setNavigationIcon(null); appBarLayout.setBackgroundColor(primaryColor); appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext()))); getMainActivity().setTitle(null); getMainActivity().setSupportActionBar(toolbar); + + } private Fragment getCurrentFragment() { diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java index b2ec3874..6c6d72bb 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/mainactivity/folders/FoldersFragment.java @@ -20,6 +20,7 @@ import android.widget.Toast; import com.afollestad.materialcab.MaterialCab; import com.afollestad.materialdialogs.MaterialDialog; +import com.afollestad.materialdialogs.bottomsheets.BottomSheet; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.snackbar.Snackbar; import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView; @@ -48,8 +49,9 @@ import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.TintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; - import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.adapter.SongFileAdapter; +import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment; import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.menu.SongMenuHelper; import code.name.monkey.retromusic.helper.menu.SongsMenuHelper; @@ -60,8 +62,6 @@ import code.name.monkey.retromusic.misc.DialogAsyncTask; import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener; import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader; import code.name.monkey.retromusic.model.Song; -import code.name.monkey.retromusic.adapter.SongFileAdapter; -import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment; import code.name.monkey.retromusic.util.FileUtil; import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.RetroColorUtil; @@ -245,7 +245,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements }); breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor))); - breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor))); + breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), + ColorUtil.INSTANCE.darkenColor(primaryColor))); appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity().setLightStatusbar(!ATHUtil.INSTANCE.isWindowBackgroundDark(getContext()))); } @@ -347,7 +348,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements BreadCrumbLayout.Crumb crumb = getActiveCrumb(); if (crumb != null) { //noinspection Convert2MethodRef - new ListPathsAsyncTask(getActivity(), paths -> scanPaths(paths)).execute(new ListPathsAsyncTask.LoadingInfo(crumb.getFile(), AUDIO_FILE_FILTER)); + new ListPathsAsyncTask(getActivity(), paths -> scanPaths(paths)).execute(new ListPathsAsyncTask.LoadingInfo(crumb.getFile(), + AUDIO_FILE_FILTER)); } return true; } @@ -454,7 +456,9 @@ public class FoldersFragment extends AbsMainActivityFragment implements case R.id.action_details: case R.id.action_set_as_ringtone: case R.id.action_delete_from_device: - new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> SongMenuHelper.INSTANCE.handleMenuClick(getActivity(), songs.get(0), itemId)).execute(new ListSongsAsyncTask.LoadingInfo(toList(file), AUDIO_FILE_FILTER, getFileComparator())); + new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> SongMenuHelper.INSTANCE.handleMenuClick(getActivity(), + songs.get(0), itemId)).execute(new ListSongsAsyncTask.LoadingInfo(toList(file), AUDIO_FILE_FILTER, + getFileComparator())); return true; case R.id.action_scan: new ListPathsAsyncTask(getActivity(), this::scanPaths).execute(new ListPathsAsyncTask.LoadingInfo(file, AUDIO_FILE_FILTER)); @@ -739,13 +743,13 @@ public class FoldersFragment extends AbsMainActivityFragment implements @Override protected Dialog createDialog(@NonNull Context context) { - View view= LayoutInflater.from(context).inflate(R.layout.progress_bar,null); - ProgressBar progressBar= view.findViewById(R.id.progressBar); - ViewUtil.INSTANCE.setProgressDrawable(progressBar,ThemeStore.Companion.accentColor(context)); + View view = LayoutInflater.from(context).inflate(R.layout.progress_bar, null); + ProgressBar progressBar = view.findViewById(R.id.progressBar); + ViewUtil.INSTANCE.setProgressDrawable(progressBar, ThemeStore.Companion.accentColor(context)); - MaterialDialog materialDialog= new MaterialDialog(context); - materialDialog.setContentView(R.layout.progress_bar); - materialDialog.title(R.string.listing_files,""); + MaterialDialog materialDialog = new MaterialDialog(context, new BottomSheet()); + materialDialog.setContentView(view); + materialDialog.title(R.string.listing_files, ""); return materialDialog; } diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerPlaybackControlsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerPlaybackControlsFragment.kt index bddaa282..e2aff8c9 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerPlaybackControlsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/player/classic/ClassicPlayerPlaybackControlsFragment.kt @@ -30,7 +30,6 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() { playerPlayPauseFab.animate() .scaleX(1f) .scaleY(1f) - .rotation(360f) .setInterpolator(DecelerateInterpolator()) .start() } @@ -50,19 +49,19 @@ class ClassicPlayerPlaybackControlsFragment : AbsPlayerControlsFragment() { fun setDark(dark: Boolean) { if (dark) { - lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true); - lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true); + lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(activity, true) + lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(activity, true) } else { - lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false); - lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false); + lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(activity, false) + lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(activity, false) } //volumeFragment?.setTintableColor(lastPlaybackControlsColor) - updateRepeatState(); - updateShuffleState(); - updatePrevNextColor(); - updateProgressTextColor(); + updateRepeatState() + updateShuffleState() + updatePrevNextColor() + updateProgressTextColor() } private var playerFabPlayPauseDrawable: PlayPauseDrawable? = null diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt index cb6ad7db..3ac5206e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AbsSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.graphics.Color diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt index 63220236..922f0955 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/AudioSettings.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.content.Intent diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ImageSettingFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ImageSettingFragment.kt index 1f09c211..de616d86 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ImageSettingFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ImageSettingFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.os.Bundle diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt index 1627286c..d2ae8cac 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/MainSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.graphics.Bitmap diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt index ba1cb40d..f2c6f065 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NotificationSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.os.Build diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt index 64daa9d4..492f2d97 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/NowPlayingSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.content.SharedPreferences diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/OtherSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/OtherSettingsFragment.kt index f2c67726..4093a592 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/OtherSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/OtherSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.os.Bundle diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt index d2d0424e..e497178d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/PersonaizeSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.content.SharedPreferences diff --git a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt index 17a9f882..a9eb816d 100644 --- a/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt +++ b/app/src/main/java/code/name/monkey/retromusic/fragments/settings/ThemeSettingsFragment.kt @@ -1,3 +1,17 @@ +/* + * Copyright (c) 2019 Hemanth Savarala. + * + * Licensed under the GNU General Public License v3 + * + * This is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by + * the Free Software Foundation either version 3 of the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + */ + package code.name.monkey.retromusic.fragments.settings import android.graphics.Color @@ -16,6 +30,7 @@ import code.name.monkey.retromusic.R import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager import code.name.monkey.retromusic.util.PreferenceUtil import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.color.colorChooser @@ -27,11 +42,11 @@ class ThemeSettingsFragment : AbsSettingsFragment() { override fun invalidateSettings() { val primaryColorPref: ATEColorPreference = findPreference("primary_color")!! - primaryColorPref.isVisible = PreferenceUtil.getInstance().generalTheme == code.name.monkey.retromusic.R.style.Theme_RetroMusic_Color + primaryColorPref.isVisible = PreferenceUtil.getInstance().generalTheme == R.style.Theme_RetroMusic_Color val primaryColor = ThemeStore.primaryColor(activity!!) primaryColorPref.setColor(primaryColor, ColorUtil.darkenColor(primaryColor)) primaryColorPref.setOnPreferenceClickListener { - MaterialDialog(activity!!).show { + MaterialDialog(activity!!, BottomSheet()).show { title(code.name.monkey.retromusic.R.string.primary_color) positiveButton(R.string.set) colorChooser(initialSelection = BLUE, allowCustomArgb = true, colors = PRIMARY_COLORS, subColors = PRIMARY_COLORS_SUB) { _, color -> @@ -69,8 +84,8 @@ class ThemeSettingsFragment : AbsSettingsFragment() { when (theme) { "light" -> ThemeStore.editTheme(context!!).primaryColor(Color.WHITE).commit() "black" -> ThemeStore.editTheme(context!!).primaryColor(Color.BLACK).commit() - "dark" -> ThemeStore.editTheme(context!!).primaryColor(ContextCompat.getColor(context!!, code.name.monkey.retromusic.R.color.md_grey_900)).commit() - "color" -> ThemeStore.editTheme(context!!).primaryColor(ContextCompat.getColor(context!!, code.name.monkey.retromusic.R.color.md_blue_grey_800)).commit() + "dark" -> ThemeStore.editTheme(context!!).primaryColor(ContextCompat.getColor(context!!, R.color.md_grey_900)).commit() + "color" -> ThemeStore.editTheme(context!!).primaryColor(ContextCompat.getColor(context!!, R.color.md_blue_grey_800)).commit() } ThemeStore.editTheme(activity!!) @@ -91,7 +106,7 @@ class ThemeSettingsFragment : AbsSettingsFragment() { accentColorPref.setColor(accentColor, ColorUtil.darkenColor(accentColor)) accentColorPref.setOnPreferenceClickListener { - MaterialDialog(activity!!).show { + MaterialDialog(activity!!, BottomSheet()).show { title(R.string.accent_color) positiveButton(R.string.set) colorChooser(colors = ACCENT_COLORS, allowCustomArgb = true, subColors = ACCENT_COLORS_SUB) { _, color -> diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt index ed789d59..a39cc086 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/AlbumCoverStylePreferenceDialog.kt @@ -33,6 +33,7 @@ import code.name.monkey.retromusic.fragments.AlbumCoverStyle import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.customview.customView import com.bumptech.glide.Glide @@ -68,7 +69,7 @@ class AlbumCoverStylePreferenceDialog : PreferenceDialogFragmentCompat(), ViewPa viewPager.pageMargin = ViewUtil.convertDpToPixel(32f, resources).toInt() viewPager.currentItem = PreferenceUtil.getInstance().albumCoverStyle.ordinal - return MaterialDialog(activity!!).show { + return MaterialDialog(activity!!, BottomSheet()).show { title(R.string.pref_title_album_cover_style) positiveButton(R.string.set) { val nowPlayingScreen = AlbumCoverStyle.values()[viewPagerPosition] diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt index 958cef48..9a715495 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/MaterialListPreference.kt @@ -23,6 +23,7 @@ import androidx.preference.ListPreference import androidx.preference.PreferenceDialogFragmentCompat import code.name.monkey.retromusic.R import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.list.listItemsSingleChoice @@ -63,7 +64,8 @@ class MaterialListPreferenceDialog : PreferenceDialogFragmentCompat() { val entries = arguments?.getStringArrayList(EXTRA_ENTRIES) val entriesValues = arguments?.getStringArrayList(EXTRA_ENTRIES_VALUES) - return MaterialDialog(activity!!).show { + return MaterialDialog(activity!!, BottomSheet()) + .show { title(text = materialListPreference.title.toString()) positiveButton(R.string.set) listItemsSingleChoice(items = entries, initialSelection = position, waitForPositiveButton = true) { _, index, _ -> diff --git a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt index 50f8eb9e..6a05afec 100644 --- a/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt +++ b/app/src/main/java/code/name/monkey/retromusic/preferences/NowPlayingScreenPreferenceDialog.kt @@ -35,6 +35,7 @@ import code.name.monkey.retromusic.util.NavigationUtil import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.ViewUtil import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.customview.customView import com.bumptech.glide.Glide @@ -83,9 +84,10 @@ class NowPlayingScreenPreferenceDialog : PreferenceDialogFragmentCompat(), ViewP viewPager.currentItem = PreferenceUtil.getInstance().nowPlayingScreen.ordinal - return MaterialDialog(activity!!).show { + return MaterialDialog(activity!!, BottomSheet()).show { title(R.string.pref_title_album_cover_style) positiveButton(R.string.set) { + val nowPlayingScreen = NowPlayingScreen.values()[viewPagerPosition] if (isNowPlayingThemes(nowPlayingScreen)) { val result = getString(nowPlayingScreen.titleRes) + " theme is Pro version feature." diff --git a/app/src/main/java/code/name/monkey/retromusic/service/MediaButtonIntentReceiver.kt b/app/src/main/java/code/name/monkey/retromusic/service/MediaButtonIntentReceiver.kt index ef99d3da..b48f34dc 100644 --- a/app/src/main/java/code/name/monkey/retromusic/service/MediaButtonIntentReceiver.kt +++ b/app/src/main/java/code/name/monkey/retromusic/service/MediaButtonIntentReceiver.kt @@ -19,14 +19,13 @@ import android.annotation.SuppressLint import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.os.Build import android.os.Handler import android.os.Message import android.os.PowerManager import android.os.PowerManager.WakeLock import android.util.Log import android.view.KeyEvent - +import androidx.core.content.ContextCompat import code.name.monkey.retromusic.BuildConfig import code.name.monkey.retromusic.Constants.ACTION_PAUSE import code.name.monkey.retromusic.Constants.ACTION_PLAY @@ -35,6 +34,7 @@ import code.name.monkey.retromusic.Constants.ACTION_SKIP import code.name.monkey.retromusic.Constants.ACTION_STOP import code.name.monkey.retromusic.Constants.ACTION_TOGGLE_PAUSE + /** * Used to control headset playback. * Single press: pause/resume @@ -152,10 +152,16 @@ class MediaButtonIntentReceiver : BroadcastReceiver() { private fun startService(context: Context, command: String?) { val intent = Intent(context, MusicService::class.java) intent.action = command - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(intent) - } else { + try { + // IMPORTANT NOTE: (kind of a hack) + // on Android O and above the following crashes when the app is not running + // there is no good way to check whether the app is running so we catch the exception + // we do not always want to use startForegroundService() because then one gets an ANR + // if no notification is displayed via startForeground() + // according to Play analytics this happens a lot, I suppose for example if command = PAUSE context.startService(intent) + } catch (ignored: IllegalStateException) { + ContextCompat.startForegroundService(context, intent) } } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java index 90c89202..1864b593 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java @@ -29,10 +29,6 @@ import android.text.TextUtils; import android.util.Log; import android.widget.Toast; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.content.FileProvider; - import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.tag.FieldKey; @@ -43,6 +39,9 @@ import java.util.List; import java.util.Locale; import java.util.regex.Pattern; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.content.FileProvider; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.loaders.PlaylistLoader; @@ -99,22 +98,15 @@ public class MusicUtil { * Ex: for a given album --> buildInfoString(album.artist, album.songCount) */ public static String buildInfoString(@NonNull final String string1, @NonNull final String string2) { - // Skip empty strings - if (string1.isEmpty()) { - return string2; + if (TextUtils.isEmpty(string1)) { + //noinspection ConstantConditions + return TextUtils.isEmpty(string2) ? "" : string2; } - if (string2.isEmpty()) { - return string1; + if (TextUtils.isEmpty(string2)) { + //noinspection ConstantConditions + return TextUtils.isEmpty(string1) ? "" : string1; } - - final String separator = " • "; - - final StringBuilder builder = new StringBuilder(); - builder.append(string1); - builder.append(separator); - builder.append(string2); - - return builder.toString(); + return string1 + " • " + string2; } @NonNull diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 52fb70d5..7361aa10 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -34,34 +34,23 @@ android:layout_height="wrap_content" app:layout_scrollFlags="scroll|enterAlways"> - - - + - - + + + app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" /> diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 36b7b4ff..7a147ce3 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" tools:context=".DrawerActivity"> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d7def9c..8d76c670 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -614,5 +614,6 @@ On Select preset Upgrade to premium + New playlist diff --git a/app/src/main/res/values/styles_parents.xml b/app/src/main/res/values/styles_parents.xml index 3233306b..d7e6a689 100644 --- a/app/src/main/res/values/styles_parents.xml +++ b/app/src/main/res/values/styles_parents.xml @@ -44,6 +44,7 @@ @transition/grid_exit @transition/grid_exit @font/circular + @color/md_white_1000 @@ -125,6 +126,7 @@ @transition/grid_exit @font/circular + @color/md_grey_900 diff --git a/appthemehelper/build.gradle b/appthemehelper/build.gradle index 76ce7837..fd8c5f1a 100644 --- a/appthemehelper/build.gradle +++ b/appthemehelper/build.gradle @@ -22,20 +22,17 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - productFlavors { - } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'androidx.appcompat:appcompat:1.1.0-alpha04' + implementation 'androidx.appcompat:appcompat:1.1.0-alpha05' implementation 'com.google.android.material:material:1.1.0-alpha05' - implementation 'androidx.preference:preference:1.1.0-alpha04' + implementation 'androidx.preference:preference:1.1.0-alpha05' implementation 'androidx.cardview:cardview:1.0.0' // Used for the list preference classes - implementation "com.afollestad.material-dialogs:core:$materialDialog" - implementation "com.afollestad.material-dialogs:core:$materialDialog" - implementation 'com.afollestad.material-dialogs:input:2.0.0' - implementation 'com.afollestad.material-dialogs:color:2.0.0' + implementation 'com.afollestad.material-dialogs:core:3.0.0-alpha1' + implementation 'com.afollestad.material-dialogs:input:3.0.0-alpha1' + implementation 'com.afollestad.material-dialogs:color:3.0.0-alpha1' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/build.gradle b/build.gradle index 3fbfbf2c..a3bc94ad 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.21' + ext.kotlin_version = '1.3.31' ext { supportLibVersion = '1.1.0-alpha05' firebase = "11.8.0"