refactor code

This commit is contained in:
h4h13 2018-12-13 02:32:14 +05:30
parent f4c56c8484
commit d6a99f99e4
29 changed files with 299 additions and 178 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
static def gitBranch() {
def branch = 'GitHub'
@ -31,8 +32,8 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 262
versionName '3.0.030'
versionCode 263
versionName '3.0.130'
multiDexEnabled true
@ -144,12 +145,10 @@ dependencies {
implementation "com.afollestad.material-dialogs:core:$materialDialog"
implementation "com.afollestad.material-dialogs:commons:$materialDialog"
implementation 'com.afollestad:material-cab:0.1.12'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'
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 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
transitive = true
}
@ -170,6 +169,8 @@ dependencies {
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
implementation 'com.github.jetradarmobile:android-snowfall:1.2.0'
implementation 'com.github.javiersantos:PiracyChecker:1.2.4'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
}
repositories {
mavenCentral()

View file

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ul { list-style-position: outside; padding-left: 0; padding-right: 0; margin-left: 1em; } li { padding-top: 8px; } </style> </head> <body> <h3>Version 3.0.00</h3> <ul style="line-height:150%"> <li>Converted app to kotlin</li> <li>Now you can add plain text home screen widget</li> <li>Good old side navigation bar for options</li> <li>Bug report for better tracking with milestones</li> <li>Snow fall effect can be enable from other settings</li> <li>Click new music mix to play songs</li> <li>Gradient image option for gird list</li> <li>Clear button for playing queue</li> <li>Folder list back button</li> <li>New theme Fit</li> <li>On library click on toolbar for accessing main menu </li> <li>On home click on toolbar for accessing search </li> <li>BottomSheetDialogue is now adaptable to screens, background colour and text size consistency. </li> <li>Removed coloured navigation bar option to making app adapt the primary colour</li> <li>Swipe up gesture for now playing removed, replaced with "tap to open", To achieve transparent navigation bar for desired themes. </li> <li>Improved tablet UI and home screen by adding suggestions toggle banner issues.</li> <li>Improving lyrics page</li> </ul> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ul { list-style-position: outside; padding-left: 0; padding-right: 0; margin-left: 1em; } li { padding-top: 8px; } </style> </head> <body> <h3>Version 3.0.00</h3> <ul style="line-height:150%"> <li>Converted app to kotlin</li> <li>Now you can add plain text home screen widget</li> <li>Good old side navigation bar for options</li> <li>Bug report for better tracking with milestones</li> <li>Snow fall effect can be enable from other settings(Works only one normal theme)</li> <li>Click new music mix to play songs</li> <li>Gradient image option for gird list</li> <li>Clear button for playing queue</li> <li>Folder list back button</li> <li>New theme Fit</li> <li>On library click on toolbar for accessing main menu </li> <li>On home click on toolbar for accessing search </li> <li>BottomSheetDialogue is now adaptable to screens, background colour and text size consistency. </li> <li>Removed coloured navigation bar option to making app adapt the primary colour</li> <li>Swipe up gesture for now playing removed, replaced with "tap to open", To achieve transparent navigation bar for desired themes. </li> <li>Improved tablet UI and home screen by adding suggestions toggle banner issues.</li> <li>Improving lyrics page</li> </ul> <p style="line-height:150%"><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a> </p> <p style="line-height:150%">*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>

View file

@ -1,15 +1,20 @@
package code.name.monkey.retromusic.dialogs
import android.content.Intent
import android.graphics.Bitmap
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.app.ShareCompat
import androidx.core.content.ContextCompat
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.retromusic.App
import code.name.monkey.retromusic.Constants.USER_PROFILE
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.ui.activities.MainActivity
import code.name.monkey.retromusic.ui.activities.bugreport.BugReportActivity
import code.name.monkey.retromusic.ui.fragments.mainactivity.folders.FoldersFragment
import code.name.monkey.retromusic.util.Compressor
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
@ -21,7 +26,7 @@ import kotlinx.android.synthetic.main.fragment_main_options.*
import java.io.File
import java.util.*
class MainOptionsBottomSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnClickListener {
class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnClickListener {
private val disposable = CompositeDisposable()
@ -52,6 +57,7 @@ class MainOptionsBottomSheetDialogFragment : RoundedBottomSheetDialogFragment(),
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
actionBuyPro.visibility = if (!App.isProVersion) View.VISIBLE else View.GONE
text!!.setTextColor(ThemeStore.textColorSecondary(context!!))
titleWelcome!!.setTextColor(ThemeStore.textColorPrimary(context!!))
titleWelcome!!.text = String.format("%s %s!", timeOfTheDay, PreferenceUtil.getInstance().userName)
@ -61,24 +67,51 @@ class MainOptionsBottomSheetDialogFragment : RoundedBottomSheetDialogFragment(),
actionAbout.setOnClickListener(this)
actionSleepTimer.setOnClickListener(this)
userInfoContainer.setOnClickListener(this)
actionEqualizer.setOnClickListener(this)
actionFolders.setOnClickListener(this)
actionRate.setOnClickListener(this)
actionShare.setOnClickListener(this)
actionBuyPro.setOnClickListener(this)
actionBugReport.setOnClickListener(this)
}
override fun onClick(view: View) {
val mainActivity = activity as MainActivity? ?: return
when (view.id) {
R.id.actionFolders -> {
mainActivity.setCurrentFragment(FoldersFragment.newInstance(context), true)
}
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
R.id.actionAbout -> NavigationUtil.goToAbout(mainActivity)
R.id.actionSleepTimer -> if (fragmentManager != null) {
SleepTimerDialog().show(fragmentManager!!, TAG)
}
R.id.userInfoContainer -> NavigationUtil.goToUserInfo(activity!!)
R.id.userInfoContainer -> NavigationUtil.goToUserInfo(mainActivity)
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)
R.id.actionShare -> shareApp()
R.id.actionBugReport -> prepareBugReport()
R.id.actionEqualizer -> NavigationUtil.openEqualizer(mainActivity)
R.id.actionBuyPro -> NavigationUtil.goToProVersion(mainActivity)
}
dismiss()
}
private fun prepareBugReport() {
startActivity(Intent(activity, BugReportActivity::class.java))
}
private fun shareApp() {
val shareIntent = ShareCompat.IntentBuilder.from(activity)
.setType("songText/plain")
.setText(String.format(getString(R.string.app_share), activity!!.packageName))
.intent
if (shareIntent.resolveActivity(activity!!.packageManager) != null) {
startActivity(
Intent.createChooser(shareIntent, resources.getText(R.string.action_share)))
}
}
private fun loadImageFromStorage() {
disposable.add(Compressor(context!!)
@ -102,16 +135,16 @@ class MainOptionsBottomSheetDialogFragment : RoundedBottomSheetDialogFragment(),
private const val TAG: String = "MainOptionsBottomSheetD"
fun newInstance(selected_id: Int): MainOptionsBottomSheetDialogFragment {
fun newInstance(selected_id: Int): OptionsSheetDialogFragment {
val bundle = Bundle()
bundle.putInt("selected_id", selected_id)
val fragment = MainOptionsBottomSheetDialogFragment()
val fragment = OptionsSheetDialogFragment()
fragment.arguments = bundle
return fragment
}
fun newInstance(): MainOptionsBottomSheetDialogFragment {
return MainOptionsBottomSheetDialogFragment()
fun newInstance(): OptionsSheetDialogFragment {
return OptionsSheetDialogFragment()
}
}
}

View file

@ -2,9 +2,9 @@ package code.name.monkey.retromusic.loaders
import android.content.Context
import java.util.ArrayList
import code.name.monkey.retromusic.misc.DisposingObserver
import code.name.monkey.retromusic.model.Playlist
import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
@ -13,9 +13,9 @@ import io.reactivex.Observable
object HomeLoader {
fun getRecentAndTopThings(
context: Context): Observable<ArrayList<AbsSmartPlaylist>> {
fun getRecentAndTopThings(context: Context): Observable<ArrayList<AbsSmartPlaylist>> {
val objects = ArrayList<AbsSmartPlaylist>()
return Observable.create { e ->
HistoryPlaylist(context).getSongs(context).subscribe { songs ->
@ -56,6 +56,4 @@ object HomeLoader {
}
return Observable.just(playlists)
}
}

View file

@ -24,7 +24,7 @@ object LastAddedSongsLoader {
return SongLoader.getSongs(makeLastAddedCursor(context))
}
fun makeLastAddedCursor(@NonNull context: Context): Cursor? {
private fun makeLastAddedCursor(@NonNull context: Context): Cursor? {
val cutoff = PreferenceUtil.getInstance().lastAddedCutoff
return SongLoader.makeSongCursor(

View file

@ -0,0 +1,24 @@
package code.name.monkey.retromusic.misc
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
object DisposableManager {
private var compositeDisposable: CompositeDisposable? = null
fun add(disposable: Disposable) {
getCompositeDisposable().add(disposable)
}
fun dispose() {
getCompositeDisposable().dispose()
}
private fun getCompositeDisposable(): CompositeDisposable {
if (compositeDisposable == null || compositeDisposable!!.isDisposed) {
compositeDisposable = CompositeDisposable()
}
return compositeDisposable!!
}
}

View file

@ -0,0 +1,18 @@
package code.name.monkey.retromusic.misc
import androidx.annotation.CallSuper
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
class DisposingObserver<T> : Observer<T> {
@CallSuper
override fun onSubscribe(d: Disposable) {
DisposableManager.add(d)
}
override fun onNext(next: T) {}
override fun onError(e: Throwable) {}
override fun onComplete() {}
}

View file

@ -3,6 +3,12 @@ package code.name.monkey.retromusic.mvp.presenter
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.contract.HomeContract
import code.name.monkey.retromusic.util.PreferenceUtil
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
add(disposable)
}
class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), HomeContract.HomePresenter {
@ -19,22 +25,24 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
}
override fun unsubscribe() {
disposable.clear()
if (!disposable.isDisposed) {
disposable.dispose()
}
}
fun loadPlaylists() {
disposable.add(repository.allPlaylists
disposable += repository.allPlaylists
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.subscribe({ playlist ->
if (!playlist.isEmpty()) {
view.playlists(playlist)
}
}, { view.showEmptyView() }, { view.completed() }))
}, { view.showEmptyView() }, { view.completed() })
}
override fun loadRecentAlbums() {
disposable.add(repository.recentAlbums
disposable += repository.recentAlbums
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe { view.loading() }
@ -42,11 +50,11 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
if (!artists.isEmpty()) {
view.recentAlbum(artists)
}
}, { view.showEmptyView() }, { view.completed() }))
}, { view.showEmptyView() }, { view.completed() })
}
override fun loadTopAlbums() {
disposable.add(repository.topAlbums
disposable += repository.topAlbums
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe { view.loading() }
@ -54,11 +62,11 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
if (!artists.isEmpty()) {
view.topAlbums(artists)
}
}, { view.showEmptyView() }, { view.completed() }))
}, { view.showEmptyView() }, { view.completed() })
}
override fun loadRecentArtists() {
disposable.add(repository.recentArtists
disposable += repository.recentArtists
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe { view.loading() }
@ -66,11 +74,11 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
if (!artists.isEmpty()) {
view.recentArtist(artists)
}
}, { view.showEmptyView() }, { view.completed() }))
}, { view.showEmptyView() }, { view.completed() })
}
override fun loadTopArtists() {
disposable.add(repository.topArtists
disposable += repository.topArtists
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe { view.loading() }
@ -78,20 +86,21 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
if (!artists.isEmpty()) {
view.topArtists(artists)
}
}, { view.showEmptyView() }, { view.completed() }))
}, { view.showEmptyView() }, { view.completed() })
}
override fun loadSuggestions() {
disposable.add(repository.suggestionSongs
disposable += repository.suggestionSongs
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe { view.loading() }
.subscribe({ songs -> view.suggestions(songs) }, { view.showEmptyView() }, { view.completed() }))
.subscribe({ songs -> view.suggestions(songs) },
{ view.showEmptyView() }, { view.completed() })
}
override fun loadGenres() {
disposable.add(repository.allGenres
disposable += repository.allGenres
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe { view.loading() }
@ -99,7 +108,6 @@ class HomePresenter(private val view: HomeContract.HomeView) : Presenter(), Home
if (!genres.isEmpty()) {
view.geners(genres)
}
},
{ view.showEmptyView() }, { view.completed() }))
}, { view.showEmptyView() }, { view.completed() })
}
}

View file

@ -13,7 +13,6 @@ import okhttp3.Call;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
@ -64,11 +63,7 @@ public class KogouClient {
}
private static OkHttpClient.Builder createDefaultOkHttpClientBuilder() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
return new OkHttpClient.Builder()
.addInterceptor(interceptor)
.cache(createDefaultCache(App.Companion.getInstance()))
.addInterceptor(createCacheControlInterceptor());
}

View file

@ -136,7 +136,7 @@ abstract class AbsSlidingMusicPanelActivity protected constructor() : AbsMusicSe
bottomNavigationView.visibility = if (toggle) View.GONE else View.VISIBLE
}
fun getBottomNavigationView(): BottomNavigationBarTinted? {
fun getBottomNavigationView(): BottomNavigationBarTinted {
return bottomNavigationView
}

View file

@ -8,10 +8,9 @@ import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.VersionUtils
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.dialogs.MainOptionsBottomSheetDialogFragment
import code.name.monkey.retromusic.dialogs.OptionsSheetDialogFragment
import code.name.monkey.retromusic.ui.activities.MainActivity
abstract class AbsMainActivityFragment : AbsMusicServiceFragment() {
val mainActivity: MainActivity
@ -51,6 +50,6 @@ abstract class AbsMainActivityFragment : AbsMusicServiceFragment() {
}
protected fun showMainMenu() {
MainOptionsBottomSheetDialogFragment.newInstance().show(childFragmentManager, "Main Menu")
OptionsSheetDialogFragment.newInstance().show(childFragmentManager, "Main Menu")
}
}

View file

@ -2,6 +2,7 @@ package code.name.monkey.retromusic.ui.fragments.mainactivity;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -10,15 +11,20 @@ import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.afollestad.materialcab.MaterialCab;
import com.google.android.material.appbar.AppBarLayout;
import java.io.File;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@ -38,9 +44,17 @@ import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.ui.activities.SettingsActivity;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.ui.fragments.mainactivity.home.BannerHomeFragment;
import code.name.monkey.retromusic.util.Compressor;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder, MainActivityFragmentCallbacks {
@ -54,6 +68,8 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
private MaterialCab cab;
private FragmentManager fragmentManager;
private ImageView userImage;
private CompositeDisposable disposable = new CompositeDisposable();
public static Fragment newInstance(int tab) {
Bundle args = new Bundle();
@ -76,9 +92,25 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
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;
}
private void loadImageFromStorage() {
disposable.add(new Compressor(Objects.requireNonNull(getContext()))
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(new File(PreferenceUtil.getInstance().getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bitmap -> userImage.setImageBitmap(bitmap),
throwable -> userImage.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_person_flat))));
}
public void setTitle(@StringRes int name) {
bannerTitle.setText(getString(name));
}
@ -134,7 +166,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
TintHelper.setTintAuto(contentContainer, primaryColor, true);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setNavigationIcon(R.drawable.ic_search_white_24dp);
appBarLayout.setBackgroundColor(primaryColor);
appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
@ -169,7 +201,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
@NonNull
@Override
public MaterialCab openCab(int menuRes, MaterialCab.Callback callback) {
public MaterialCab openCab(int menuRes, @NonNull MaterialCab.Callback callback) {
if (cab != null && cab.isActive()) {
cab.finish();
}
@ -348,9 +380,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
MusicPlayerRemote.INSTANCE.openAndShuffleQueue(SongLoader.INSTANCE.getAllSongs(getContext())
.blockingFirst(), true);
return true;
case R.id.action_search:
NavigationUtil.goToSearch(getMainActivity());
break;
case R.id.action_equalizer:
NavigationUtil.openEqualizer(getActivity());
return true;

View file

@ -230,14 +230,17 @@ public class FoldersFragment extends AbsMainActivityFragment implements
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext());
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
//noinspection ConstantConditions
getActivity().setTitle(null);
getMainActivity().setSupportActionBar(toolbar);
TintHelper.setTintAuto(container, primaryColor, true);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationOnClickListener(v -> {
getActivity().onBackPressed();
});
breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), ColorUtil.darkenColor(primaryColor)));
breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), ColorUtil.darkenColor(primaryColor)));

View file

@ -40,7 +40,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.abs_playlists.*
import kotlinx.android.synthetic.main.fragment_banner_home.*
import kotlinx.android.synthetic.main.home_section_content.*
import java.io.File
@ -58,11 +57,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
private lateinit var userImage: ImageView
private lateinit var toolbar: Toolbar
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
mainActivity.setBottomBarVisibility(View.GONE)
}
override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(if (PreferenceUtil.getInstance().isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home, viewGroup, false)
}
@ -95,16 +89,14 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
private fun loadTimeImage(day: String) {
if (bannerImage != null) {
if (PreferenceUtil.getInstance().bannerImage.isEmpty()) {
Glide.with(activity).load(day)
/*Glide.with(activity).load(day)
.asBitmap()
.placeholder(R.drawable.material_design_default)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(bannerImage!!)
.into(bannerImage!!)*/
} else {
disposable.add(Compressor(context!!)
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
@ -140,8 +132,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.setBottomBarVisibility(View.GONE)
toolbar = view.findViewById(R.id.toolbar)
if (!PreferenceUtil.getInstance().isHomeBanner)
@ -183,13 +173,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
loadImageFromStorage(userImage)
getTimeOfTheDay()
searchView.setOnClickListener {
NavigationUtil.goToSearch(activity!!)
}
}
private fun setupToolbar() {
toolbar.navigationIcon = TintHelper.createTintedDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_menu_white_24dp), ThemeStore.textColorPrimary(context!!))
toolbar.navigationIcon = TintHelper.createTintedDrawable(ContextCompat.getDrawable(context!!, R.drawable.ic_search_white_24dp), ThemeStore.textColorPrimary(context!!))
mainActivity.title = null
mainActivity.setSupportActionBar(toolbar)
toolbar.setBackgroundColor(Color.TRANSPARENT)

View file

@ -1,7 +1,7 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<corners android:radius="5dp" />
<corners android:radius="8dp" />
<solid android:color="@color/md_grey_200" />
</shape>
</item>
@ -9,7 +9,7 @@
<item android:id="@android:id/secondaryProgress">
<clip>
<shape android:shape="rectangle">
<corners android:radius="5dp" />
<corners android:radius="8dp" />
<solid android:color="@color/md_grey_200" />
</shape>
</clip>
@ -17,9 +17,9 @@
<item android:id="@android:id/progress">
<clip>
<shape>
<shape android:shape="rectangle">
<solid android:color="@color/md_green_A700" />
<corners android:radius="5dp" />
<corners android:radius="8dp" />
</shape>
</clip>
</item>

View file

@ -5,28 +5,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.IconImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="14dp"
app:srcCompat="@drawable/ic_search_white_24dp" />
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="12dp"
android:text="@string/search_hint" />
</com.google.android.material.card.MaterialCardView>
<androidx.appcompat.widget.AppCompatTextView
style="@style/SubTitleTextAppearance"
android:text="@string/for_you" />

View file

@ -5,28 +5,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.IconImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="14dp"
app:srcCompat="@drawable/ic_search_white_24dp" />
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="12dp"
android:text="@string/search_hint" />
</com.google.android.material.card.MaterialCardView>
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
style="@style/SubTitleTextAppearance"
android:text="@string/for_you" />

View file

@ -17,7 +17,7 @@
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="scroll|enterAlways"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Caption"
app:titleMargin="0dp"
app:titleMarginStart="0dp"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -10,16 +9,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigationView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:paddingStart="0dp"
android:paddingEnd="8dp"
app:headerLayout="@layout/navigation_drawer_header"
app:itemBackground="@drawable/navigation_item"
app:itemTextAppearance="@style/NavigationViewTitleTextAppearance"
app:menu="@menu/menu_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
</FrameLayout>

View file

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"

View file

@ -42,13 +42,12 @@
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/album_cover_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<fragment
android:id="@+id/player_album_cover_fragment"
android:id="@+id/playerAlbumCoverFragment"
android:name="code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@ -61,14 +60,13 @@
tools:background="@color/md_white_1000">
<fragment
android:id="@+id/playback_controls_fragment"
android:id="@+id/playbackControlsFragment"
android:name="code.name.monkey.retromusic.ui.fragments.player.blur.BlurPlaybackControlsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<FrameLayout
android:id="@+id/toolbar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0">

View file

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

View file

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadingEdge="vertical">
android:fadingEdge="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:id="@+id/offlineLyrics"
@ -12,5 +14,5 @@
android:lineSpacingExtra="3dp"
android:padding="16dp"
android:text="@string/no_lyrics_found"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6" />
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1" />
</ScrollView>

View file

@ -7,8 +7,6 @@
android:orientation="vertical"
tools:ignore="MissingPrefix">
<LinearLayout
android:id="@+id/userInfoContainer"
android:layout_width="match_parent"
@ -61,6 +59,35 @@
android:textAllCaps="false"
app:srcCompat="@drawable/ic_settings_white_24dp" />
</LinearLayout>
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionFolders"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/folders"
android:textAllCaps="false"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_folder_white_24dp"
app:iconPadding="12dp"
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionEqualizer"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/equalizer"
android:textAllCaps="false"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_equalizer_white_24dp"
app:iconPadding="12dp"
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionSleepTimer"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
@ -75,6 +102,34 @@
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionShare"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/action_share"
android:textAllCaps="false"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_share_white_24dp"
app:iconPadding="12dp"
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionBugReport"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/report_bug"
android:textAllCaps="false"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_bug_report_white_24dp"
app:iconPadding="12dp"
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionAbout"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
@ -103,5 +158,18 @@
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
<code.name.monkey.retromusic.views.MaterialButtonTextColor
android:id="@+id/actionBuyPro"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/buy_pro"
android:textAllCaps="false"
android:textColor="?android:attr/textColorPrimary"
app:icon="@drawable/ic_card_giftcard_white_24dp"
app:iconPadding="12dp"
app:iconTint="?iconColor"
app:rippleColor="?iconColor" />
</LinearLayout>

View file

@ -89,6 +89,7 @@
android:layout_width="match_parent"
android:layout_height="3dp"
android:progress="20"
android:progressDrawable="@drawable/color_progress_seek"
app:mpb_progressStyle="horizontal"
app:mpb_useIntrinsicPadding="false" />
</code.name.monkey.retromusic.views.FitSystemWindowsLayout>

View file

@ -1,19 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<code.name.monkey.retromusic.views.LyricView
android:id="@+id/lyricsView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:fadeInFadeOut="true"
app:highlightColor="@color/md_white_1000"
app:hint="No Lyrics"
app:hintColor="@color/md_grey_400"
app:lineSpace="15dp"
app:textAlign="left"
app:textSize="18sp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
app:textSize="18sp" />
</LinearLayout>

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_home"
android:enabled="true"
android:icon="@drawable/ic_home_white_24dp"
android:title="@string/home" />
<item
android:id="@+id/action_song"
android:enabled="true"

View file

@ -2,11 +2,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".DrawerActivity">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search_white_24dp"
android:title="@string/action_search"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_shuffle_all"
android:icon="@drawable/ic_shuffle_white_24dp"