Removed profiling
This commit is contained in:
parent
46013b17ab
commit
a6e772ef6d
14 changed files with 44 additions and 448 deletions
|
@ -14,54 +14,26 @@
|
|||
|
||||
package code.name.monkey.retromusic.dialogs
|
||||
|
||||
import android.app.Dialog
|
||||
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 androidx.fragment.app.DialogFragment
|
||||
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.activities.MainActivity
|
||||
import code.name.monkey.retromusic.activities.bugreport.BugReportActivity
|
||||
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.views.RoundedBottomSheetDialogFragment
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
||||
import kotlinx.android.synthetic.main.fragment_main_options.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnClickListener {
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
|
||||
private val timeOfTheDay: String
|
||||
get() {
|
||||
var message = getString(R.string.title_good_day)
|
||||
val c = Calendar.getInstance()
|
||||
|
||||
when (c.get(Calendar.HOUR_OF_DAY)) {
|
||||
in 0..5 -> message = getString(R.string.title_good_night)
|
||||
in 6..11 -> message = getString(R.string.title_good_morning)
|
||||
in 12..15 -> message = getString(R.string.title_good_afternoon)
|
||||
in 16..19 -> message = getString(R.string.title_good_evening)
|
||||
in 20..23 -> message = getString(R.string.title_good_night)
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
disposable.dispose()
|
||||
}
|
||||
class OptionsSheetDialogFragment : DialogFragment(), View.OnClickListener {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_main_options, container, false)
|
||||
|
@ -70,18 +42,9 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
text.setTextColor(ThemeStore.textColorSecondary(context!!))
|
||||
text.text = PreferenceUtil.getInstance().userBio
|
||||
titleWelcome.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
titleWelcome.text = String.format("%s %s!", timeOfTheDay, PreferenceUtil.getInstance().userName)
|
||||
|
||||
loadImageFromStorage()
|
||||
|
||||
actionSettings.setOnClickListener(this)
|
||||
|
||||
actionSleepTimer.setOnClickListener(this)
|
||||
actionLibrary.setOnClickListener(this)
|
||||
userInfoContainer.setOnClickListener(this)
|
||||
actionEqualizer.setOnClickListener(this)
|
||||
actionFolders.setOnClickListener(this)
|
||||
actionRate.setOnClickListener(this)
|
||||
|
@ -103,11 +66,9 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
|
|||
R.id.actionFolders -> mainActivity.selectedFragment(R.id.action_folder)
|
||||
R.id.actionLibrary -> mainActivity.selectedFragment(PreferenceUtil.getInstance().lastPage)
|
||||
R.id.actionSettings -> NavigationUtil.goToSettings(mainActivity)
|
||||
|
||||
R.id.actionSleepTimer -> if (fragmentManager != null) {
|
||||
SleepTimerDialog().show(fragmentManager!!, TAG)
|
||||
}
|
||||
R.id.userInfoContainer -> NavigationUtil.goToUserInfo(mainActivity)
|
||||
R.id.actionRate -> NavigationUtil.goToPlayStore(mainActivity)
|
||||
R.id.actionShare -> shareApp()
|
||||
R.id.actionBugReport -> prepareBugReport()
|
||||
|
@ -132,23 +93,11 @@ class OptionsSheetDialogFragment : RoundedBottomSheetDialogFragment(), View.OnCl
|
|||
}
|
||||
}
|
||||
|
||||
private fun loadImageFromStorage() {
|
||||
override fun getDialog(): Dialog? {
|
||||
return MaterialDialog(activity!!, BottomSheet())
|
||||
.show {
|
||||
|
||||
disposable.add(Compressor(context!!)
|
||||
.setMaxHeight(300)
|
||||
.setMaxWidth(300)
|
||||
.setQuality(75)
|
||||
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||
.compressToBitmapAsFlowable(
|
||||
File(PreferenceUtil.getInstance().profileImage, USER_PROFILE))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ userImage!!.setImageBitmap(it) }, {
|
||||
userImage!!.setImageDrawable(ContextCompat
|
||||
.getDrawable(context!!, R.drawable.ic_account_white_24dp))
|
||||
}, {
|
||||
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -9,8 +9,6 @@ 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 androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -53,9 +51,8 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
|
||||
private MaterialCab cab;
|
||||
private FragmentManager fragmentManager;
|
||||
private ImageView userImage;
|
||||
private CompositeDisposable disposable;
|
||||
private TextView bannerTitle;
|
||||
|
||||
|
||||
@NonNull
|
||||
public static Fragment newInstance(int tab) {
|
||||
|
@ -84,16 +81,15 @@ 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);
|
||||
userImage.setOnClickListener(v -> showMainMenu());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setTitle(@StringRes int name) {
|
||||
bannerTitle.setText(getString(name));
|
||||
toolbar.setTitle(getString(name));
|
||||
}
|
||||
|
||||
public void addOnAppBarOffsetChangedListener(@NonNull AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
|
||||
|
@ -143,17 +139,16 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
private void setupToolbar() {
|
||||
int primaryColor = ThemeStore.Companion.primaryColor(getContext());
|
||||
TintHelper.setTintAuto(contentContainer, primaryColor, true);
|
||||
bannerTitle.setTextColor(ThemeStore.Companion.textColorPrimary(getContext()));
|
||||
|
||||
toolbar.setOnClickListener(v -> {
|
||||
showMainMenu();
|
||||
});
|
||||
toolbar.setBackgroundColor(primaryColor);
|
||||
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() {
|
||||
|
|
|
@ -2,7 +2,6 @@ package code.name.monkey.retromusic.fragments.mainactivity.folders;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -14,10 +13,8 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -31,10 +28,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.afollestad.materialcab.MaterialCab;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.afollestad.materialdialogs.bottomsheets.BottomSheet;
|
||||
import com.bumptech.glide.request.Request;
|
||||
import com.bumptech.glide.request.target.SizeReadyCallback;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
||||
|
@ -59,7 +52,6 @@ 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.glide.GlideApp;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.helper.menu.SongMenuHelper;
|
||||
import code.name.monkey.retromusic.helper.menu.SongsMenuHelper;
|
||||
|
@ -76,8 +68,6 @@ import code.name.monkey.retromusic.util.RetroColorUtil;
|
|||
import code.name.monkey.retromusic.util.ViewUtil;
|
||||
import code.name.monkey.retromusic.views.BreadCrumbLayout;
|
||||
|
||||
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
||||
|
||||
public class FoldersFragment extends AbsMainActivityFragment implements
|
||||
MainActivityFragmentCallbacks,
|
||||
CabHolder, BreadCrumbLayout.SelectionCallback, SongFileAdapter.Callbacks,
|
||||
|
@ -95,15 +85,12 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
|
||||
private View coordinatorLayout, container, empty;
|
||||
|
||||
private TextView title;
|
||||
|
||||
private Toolbar toolbar;
|
||||
|
||||
private BreadCrumbLayout breadCrumbs;
|
||||
|
||||
private AppBarLayout appBarLayout;
|
||||
|
||||
private ImageView userImage;
|
||||
|
||||
private FastScrollRecyclerView recyclerView;
|
||||
|
||||
|
@ -162,14 +149,12 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
|
||||
private void initViews(View view) {
|
||||
coordinatorLayout = view.findViewById(R.id.coordinatorLayout);
|
||||
userImage = view.findViewById(R.id.userImage);
|
||||
userImage.setOnClickListener(v -> showMainMenu());
|
||||
|
||||
recyclerView = view.findViewById(R.id.recyclerView);
|
||||
appBarLayout = view.findViewById(R.id.appBarLayout);
|
||||
breadCrumbs = view.findViewById(R.id.breadCrumbs);
|
||||
toolbar = view.findViewById(R.id.toolbar);
|
||||
empty = view.findViewById(android.R.id.empty);
|
||||
title = view.findViewById(R.id.bannerTitle);
|
||||
container = view.findViewById(R.id.container);
|
||||
}
|
||||
|
||||
|
@ -242,19 +227,14 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
}
|
||||
|
||||
private void setUpAppbarColor() {
|
||||
title.setTextColor(ThemeStore.Companion.textColorPrimary(getContext()));
|
||||
|
||||
int primaryColor = ThemeStore.Companion.primaryColor(getContext());
|
||||
|
||||
getActivity().setTitle(null);
|
||||
getMainActivity().setSupportActionBar(toolbar);
|
||||
TintHelper.setTintAuto(container, primaryColor, true);
|
||||
appBarLayout.setBackgroundColor(primaryColor);
|
||||
toolbar.setBackgroundColor(primaryColor);
|
||||
toolbar.setNavigationOnClickListener(v -> {
|
||||
getActivity().onBackPressed();
|
||||
toolbar.setOnClickListener(v -> {
|
||||
showMainMenu();
|
||||
});
|
||||
|
||||
breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
||||
breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(),
|
||||
ColorUtil.INSTANCE.darkenColor(primaryColor)));
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package code.name.monkey.retromusic.fragments.mainactivity.home
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.*
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.Constants.USER_BANNER
|
||||
import code.name.monkey.retromusic.Constants.USER_PROFILE
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.adapter.HomeAdapter
|
||||
import code.name.monkey.retromusic.fragments.base.AbsMainActivityFragment
|
||||
import code.name.monkey.retromusic.glide.GlideApp
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks
|
||||
import code.name.monkey.retromusic.loaders.SongLoader
|
||||
|
@ -27,22 +21,11 @@ import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist
|
|||
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist
|
||||
import code.name.monkey.retromusic.mvp.contract.HomeContract
|
||||
import code.name.monkey.retromusic.mvp.presenter.HomePresenter
|
||||
import code.name.monkey.retromusic.util.Compressor
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.request.Request
|
||||
import com.bumptech.glide.request.target.SizeReadyCallback
|
||||
import com.bumptech.glide.request.target.Target
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeContract.HomeView {
|
||||
override fun showEmpty() {
|
||||
|
@ -56,11 +39,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
private lateinit var topPlayed: View
|
||||
private lateinit var actionShuffle: View
|
||||
private lateinit var history: View
|
||||
private lateinit var userImage: ImageView
|
||||
private lateinit var toolbar: Toolbar
|
||||
|
||||
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)
|
||||
return inflater.inflate(R.layout.fragment_home, viewGroup, false)
|
||||
}
|
||||
|
||||
private val displayMetrics: DisplayMetrics
|
||||
|
@ -71,44 +53,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
return metrics
|
||||
}
|
||||
|
||||
private fun getTimeOfTheDay() {
|
||||
val c = Calendar.getInstance()
|
||||
val timeOfDay = c.get(Calendar.HOUR_OF_DAY)
|
||||
|
||||
var images = arrayOf<String>()
|
||||
when (timeOfDay) {
|
||||
in 0..5 -> images = resources.getStringArray(R.array.night)
|
||||
in 6..11 -> images = resources.getStringArray(R.array.morning)
|
||||
in 12..15 -> images = resources.getStringArray(R.array.after_noon)
|
||||
in 16..19 -> images = resources.getStringArray(R.array.evening)
|
||||
in 20..23 -> images = resources.getStringArray(R.array.night)
|
||||
}
|
||||
|
||||
val day = images[Random().nextInt(images.size)]
|
||||
loadTimeImage(day)
|
||||
}
|
||||
|
||||
|
||||
private fun loadTimeImage(day: String) {
|
||||
if (bannerImage != null) {
|
||||
if (PreferenceUtil.getInstance().bannerImage.isEmpty()) {
|
||||
GlideApp.with(activity!!)
|
||||
.load(day)
|
||||
.placeholder(R.drawable.material_design_default)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(bannerImage!!)
|
||||
} else {
|
||||
disposable.add(Compressor(context!!)
|
||||
.setQuality(100)
|
||||
.setCompressFormat(Bitmap.CompressFormat.WEBP)
|
||||
.compressToBitmapAsFlowable(File(PreferenceUtil.getInstance().bannerImage, USER_BANNER))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { bannerImage!!.setImageBitmap(it) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
homePresenter = HomePresenter(this)
|
||||
|
@ -142,9 +86,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
NavigationUtil.goToPlaylistNew(mainActivity, HistoryPlaylist(mainActivity))
|
||||
}
|
||||
|
||||
userImage = view.findViewById(R.id.userImage)
|
||||
userImage.setOnClickListener { showMainMenu() }
|
||||
|
||||
homePresenter = HomePresenter(this)
|
||||
|
||||
contentContainerView = view.findViewById(R.id.contentContainer)
|
||||
|
@ -168,12 +109,12 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
mainActivity.title = null
|
||||
toolbar.apply {
|
||||
setBackgroundColor(if (PreferenceUtil.getInstance().isHomeBanner) Color.TRANSPARENT else ThemeStore.primaryColor(context))
|
||||
setNavigationOnClickListener {
|
||||
NavigationUtil.goToSearch(activity)
|
||||
}
|
||||
setOnClickListener { showMainMenu() }
|
||||
}
|
||||
mainActivity.setSupportActionBar(toolbar)
|
||||
}
|
||||
|
@ -185,7 +126,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
disposable = CompositeDisposable()
|
||||
getTimeOfTheDay()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
|
|
@ -14,27 +14,16 @@
|
|||
|
||||
package code.name.monkey.retromusic.fragments.settings
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.retromusic.Constants.USER_PROFILE
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.SettingsActivity
|
||||
import code.name.monkey.retromusic.util.Compressor
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
|
||||
class MainSettingsFragment : Fragment(), View.OnClickListener {
|
||||
|
@ -70,30 +59,11 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
|
|||
otherSettings.setOnClickListener(this)
|
||||
aboutSettings.setOnClickListener(this)
|
||||
|
||||
text.setTextColor(ThemeStore.textColorSecondary(context!!))
|
||||
text.text = PreferenceUtil.getInstance().userBio
|
||||
titleWelcome.setTextColor(ThemeStore.textColorPrimary(context!!))
|
||||
titleWelcome.text = String.format("%s %s!", getTimeOfTheDay(), PreferenceUtil.getInstance().userName)
|
||||
userInfoContainer.setOnClickListener { NavigationUtil.goToUserInfo(activity!!) }
|
||||
}
|
||||
|
||||
private fun inflateFragment(fragment: Fragment, @StringRes title: Int) {
|
||||
if (activity != null) {
|
||||
(activity as SettingsActivity).setupFragment(fragment, title)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTimeOfTheDay(): String {
|
||||
var message = getString(R.string.title_good_day)
|
||||
val c = Calendar.getInstance()
|
||||
val timeOfDay = c.get(Calendar.HOUR_OF_DAY)
|
||||
|
||||
when (timeOfDay) {
|
||||
in 0..5 -> message = getString(R.string.title_good_night)
|
||||
in 6..11 -> message = getString(R.string.title_good_morning)
|
||||
in 12..15 -> message = getString(R.string.title_good_afternoon)
|
||||
in 16..19 -> message = getString(R.string.title_good_evening)
|
||||
in 20..23 -> message = getString(R.string.title_good_night)
|
||||
}
|
||||
return message
|
||||
}
|
||||
}
|
|
@ -25,36 +25,12 @@
|
|||
android:background="@android:color/transparent"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:title="@string/app_name"
|
||||
app:layout_collapseMode="pin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bannerTitle"
|
||||
style="@style/BigTitleTextAppearanceToolbar"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/library"
|
||||
android:textColor="@color/md_white_1000"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
|
|
@ -31,32 +31,8 @@
|
|||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bannerTitle"
|
||||
style="@style/BigTitleTextAppearanceToolbar"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/library"
|
||||
android:textColor="@color/md_white_1000"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
app:title="@string/app_name"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
|
|
@ -32,31 +32,8 @@
|
|||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bannerTitle"
|
||||
style="@style/BigTitleTextAppearanceToolbar"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/library"
|
||||
android:textColor="@color/md_white_1000"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
app:title="@string/app_name"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
|
|
|
@ -40,30 +40,8 @@
|
|||
style="@style/Toolbar"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:layout_collapseMode="pin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bannerTitle"
|
||||
style="@style/BigTitleTextAppearanceToolbar"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/folders"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
app:title="@string/folders"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/cab_stub"
|
||||
|
|
|
@ -27,31 +27,9 @@
|
|||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:title="@string/app_name"
|
||||
app:layout_collapseMode="pin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bannerTitle"
|
||||
style="@style/BigTitleTextAppearanceToolbar"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/app_name"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
|
|
@ -38,31 +38,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="14dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bannerTitle"
|
||||
style="@style/BigTitleTextAppearanceToolbar"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/library"
|
||||
android:textColor="@color/md_white_1000"
|
||||
tools:ignore="MissingPrefix" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/cab_stub"
|
||||
|
|
|
@ -7,59 +7,6 @@
|
|||
android:orientation="vertical"
|
||||
tools:ignore="MissingPrefix">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/userInfoContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
|
||||
<code.name.monkey.retromusic.views.CircularImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_weight="0"
|
||||
app:civ_border="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp">
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/titleWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.75"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/lets_play_something" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<code.name.monkey.retromusic.views.IconImageView
|
||||
android:id="@+id/actionSettings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?roundSelector"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="12dp"
|
||||
android:textAllCaps="false"
|
||||
app:srcCompat="@drawable/ic_settings_white_24dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/buyProContainer"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -116,6 +63,16 @@
|
|||
app:optionIcon="@drawable/ic_folder_white_24dp"
|
||||
app:optionTitle="@string/folders" />
|
||||
|
||||
<code.name.monkey.retromusic.views.OptionMenuItemView
|
||||
android:id="@+id/actionSettings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?rectSelector"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:optionIcon="@drawable/ic_settings_white_24dp"
|
||||
app:optionTitle="@string/action_settings" />
|
||||
|
||||
<code.name.monkey.retromusic.views.OptionMenuItemView
|
||||
android:id="@+id/actionEqualizer"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -13,60 +13,6 @@
|
|||
android:orientation="vertical"
|
||||
tools:background="@color/md_black_1000">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/userInfoContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="72dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<code.name.monkey.retromusic.views.UserImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="0"
|
||||
android:background="@android:color/transparent"
|
||||
app:civ_border="false"
|
||||
app:civ_border_width="0dp"
|
||||
app:civ_shadow="false" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
|
||||
android:id="@+id/titleWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/general_settings_title"
|
||||
android:textSize="@dimen/ate_default_textsize_subheading"
|
||||
app:fontFamily="@font/circular_std_medium" />
|
||||
|
||||
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:maxLines="4"
|
||||
android:text="@string/lets_play_something"
|
||||
android:textSize="@dimen/ate_default_textsize_body"
|
||||
tools:text="Summary" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/generalSettings"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
|
||||
|
||||
<style name="ToolbarTextAppearance">
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:fontFamily">@font/circular</item>
|
||||
</style>
|
||||
|
||||
<style name="ToolbarSubTitleTextAppearance">
|
||||
|
|
Loading…
Reference in a new issue