Added scroll animation
This commit is contained in:
parent
79bdd49547
commit
1932ba219e
35 changed files with 247 additions and 97 deletions
|
@ -22,7 +22,7 @@ android {
|
|||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
applicationId "code.name.monkey.retromusic"
|
||||
versionCode 399
|
||||
versionCode 400
|
||||
versionName '3.4.850'
|
||||
|
||||
multiDexEnabled true
|
||||
|
@ -116,6 +116,7 @@ static def getDate() {
|
|||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation project(':appthemehelper')
|
||||
implementation project(':liboverscroll')
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
implementation "androidx.gridlayout:gridlayout:1.0.0"
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.afollestad.materialdialogs.bottomsheets.BottomSheet
|
|||
import com.afollestad.materialdialogs.list.listItems
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import kotlinx.android.synthetic.main.activity_about.container
|
||||
import kotlinx.android.synthetic.main.activity_about.toolbar
|
||||
import kotlinx.android.synthetic.main.card_credit.recyclerView
|
||||
import kotlinx.android.synthetic.main.card_other.changelog
|
||||
|
@ -48,6 +49,7 @@ import kotlinx.android.synthetic.main.card_social.instagramLink
|
|||
import kotlinx.android.synthetic.main.card_social.pinterestLink
|
||||
import kotlinx.android.synthetic.main.card_social.telegramLink
|
||||
import kotlinx.android.synthetic.main.card_social.twitterLink
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
import java.io.IOException
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
|
@ -86,6 +88,7 @@ class AboutActivity : AbsBaseActivity(), View.OnClickListener {
|
|||
version.setSummary(getAppVersion())
|
||||
setUpView()
|
||||
loadContributors()
|
||||
OverScrollDecoratorHelper.setUpOverScroll(container)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.bumptech.glide.Glide
|
|||
import kotlinx.android.synthetic.main.activity_album.albumCoverContainer
|
||||
import kotlinx.android.synthetic.main.activity_album.albumText
|
||||
import kotlinx.android.synthetic.main.activity_album.albumTitle
|
||||
import kotlinx.android.synthetic.main.activity_album.container
|
||||
import kotlinx.android.synthetic.main.activity_album.image
|
||||
import kotlinx.android.synthetic.main.activity_album.toolbar
|
||||
import kotlinx.android.synthetic.main.activity_album_content.moreRecyclerView
|
||||
|
@ -54,6 +55,7 @@ import kotlinx.android.synthetic.main.activity_album_content.playAction
|
|||
import kotlinx.android.synthetic.main.activity_album_content.recyclerView
|
||||
import kotlinx.android.synthetic.main.activity_album_content.shuffleAction
|
||||
import kotlinx.android.synthetic.main.activity_album_content.songTitle
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
import java.util.ArrayList
|
||||
import javax.inject.Inject
|
||||
import android.util.Pair as UtilPair
|
||||
|
@ -158,6 +160,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
|
|||
isNestedScrollingEnabled = false
|
||||
adapter = simpleSongAdapter
|
||||
}
|
||||
|
||||
OverScrollDecoratorHelper.setUpOverScroll(container)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
|
|
@ -42,6 +42,7 @@ import code.name.monkey.retromusic.util.RetroColorUtil
|
|||
import code.name.monkey.retromusic.util.RetroUtil
|
||||
import com.afollestad.materialcab.MaterialCab
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.android.synthetic.main.activity_album.container
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.albumRecyclerView
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.albumTitle
|
||||
import kotlinx.android.synthetic.main.activity_artist_content.biographyText
|
||||
|
@ -56,6 +57,7 @@ import kotlinx.android.synthetic.main.activity_artist_details.image
|
|||
import kotlinx.android.synthetic.main.activity_artist_details.imageContainer
|
||||
import kotlinx.android.synthetic.main.activity_artist_details.text
|
||||
import kotlinx.android.synthetic.main.activity_artist_details.toolbar
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -177,6 +179,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), ArtistDetailsView,
|
|||
layoutManager = LinearLayoutManager(this.context)
|
||||
adapter = songAdapter
|
||||
}
|
||||
OverScrollDecoratorHelper.setUpOverScroll(container)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import kotlinx.android.synthetic.main.activity_playing_queue.clearQueue
|
|||
import kotlinx.android.synthetic.main.activity_playing_queue.playerQueueSubHeader
|
||||
import kotlinx.android.synthetic.main.activity_playing_queue.recyclerView
|
||||
import kotlinx.android.synthetic.main.activity_playing_queue.toolbar
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
|
||||
open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
||||
|
||||
|
@ -108,6 +109,7 @@ open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
}
|
||||
})
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
|
||||
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL)
|
||||
}
|
||||
|
||||
private fun checkForPadding() {
|
||||
|
|
|
@ -34,6 +34,7 @@ import kotlinx.android.synthetic.main.activity_playlist_detail.emptyEmoji
|
|||
import kotlinx.android.synthetic.main.activity_playlist_detail.emptyText
|
||||
import kotlinx.android.synthetic.main.activity_playlist_detail.recyclerView
|
||||
import kotlinx.android.synthetic.main.activity_playlist_detail.toolbar
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, PlaylistSongsView {
|
||||
|
@ -75,6 +76,8 @@ class PlaylistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder, Playli
|
|||
|
||||
private fun setUpRecyclerView() {
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(this, recyclerView)
|
||||
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL)
|
||||
|
||||
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||
if (playlist is AbsCustomPlaylist) {
|
||||
adapter = PlaylistSongAdapter(this, ArrayList(), R.layout.item_list, false, this)
|
||||
|
|
|
@ -38,6 +38,7 @@ import kotlinx.android.synthetic.main.activity_search.recyclerView
|
|||
import kotlinx.android.synthetic.main.activity_search.searchContainer
|
||||
import kotlinx.android.synthetic.main.activity_search.searchView
|
||||
import kotlinx.android.synthetic.main.activity_search.voiceSearch
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -112,6 +113,8 @@ class SearchActivity : AbsMusicServiceActivity(), OnQueryTextListener, TextWatch
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL)
|
||||
}
|
||||
|
||||
private fun setupSearchView() {
|
||||
|
|
|
@ -1,51 +1,37 @@
|
|||
package code.name.monkey.retromusic.activities;
|
||||
|
||||
import static code.name.monkey.appthemehelper.util.ATHUtil.INSTANCE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
|
||||
import static code.name.monkey.appthemehelper.util.ATHUtil.INSTANCE;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper;
|
||||
|
||||
public class WhatsNewActivity extends AbsBaseActivity {
|
||||
WebView webView;
|
||||
Toolbar toolbar;
|
||||
|
||||
AppBarLayout appBarLayout;
|
||||
|
||||
Toolbar toolbar;
|
||||
|
||||
private static void setChangelogRead(@NonNull Context context) {
|
||||
try {
|
||||
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
int currentVersion = pInfo.versionCode;
|
||||
PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static String colorToCSS(int color) {
|
||||
return String.format("rgb(%d, %d, %d)", Color.red(color), Color.green(color), Color.blue(color)); // on API 29, WebView doesn't load with hex colors
|
||||
}
|
||||
WebView webView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
@ -65,24 +51,30 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar);
|
||||
NestedScrollView nestedScrollView = findViewById(R.id.container);
|
||||
OverScrollDecoratorHelper.setUpOverScroll(nestedScrollView);
|
||||
|
||||
try {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
InputStream json = getAssets().open("retro-changelog.html");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(json, StandardCharsets.UTF_8));
|
||||
String str;
|
||||
while ((str = in.readLine()) != null)
|
||||
while ((str = in.readLine()) != null) {
|
||||
buf.append(str);
|
||||
}
|
||||
in.close();
|
||||
|
||||
// Inject color values for WebView body background and links
|
||||
final boolean isDark = INSTANCE.isWindowBackgroundDark(this);
|
||||
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff")));
|
||||
final String backgroundColor = colorToCSS(INSTANCE.resolveColor(this, R.attr.colorSurface,
|
||||
Color.parseColor(isDark ? "#424242" : "#ffffff")));
|
||||
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
|
||||
final String changeLog = buf.toString()
|
||||
.replace("{style-placeholder}", String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
|
||||
.replace("{style-placeholder}",
|
||||
String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
|
||||
.replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this)))
|
||||
.replace("{link-color-active}", colorToCSS(ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));
|
||||
.replace("{link-color-active}",
|
||||
colorToCSS(ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));
|
||||
|
||||
webView.loadData(changeLog, "text/html", "UTF-8");
|
||||
} catch (Throwable e) {
|
||||
|
@ -90,4 +82,19 @@ public class WhatsNewActivity extends AbsBaseActivity {
|
|||
}
|
||||
setChangelogRead(this);
|
||||
}
|
||||
|
||||
private static String colorToCSS(int color) {
|
||||
return String.format("rgb(%d, %d, %d)", Color.red(color), Color.green(color),
|
||||
Color.blue(color)); // on API 29, WebView doesn't load with hex colors
|
||||
}
|
||||
|
||||
private static void setChangelogRead(@NonNull Context context) {
|
||||
try {
|
||||
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
int currentVersion = pInfo.versionCode;
|
||||
PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,9 +13,15 @@ import code.name.monkey.retromusic.util.DensityUtil
|
|||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.*
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.container
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.empty
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.emptyEmoji
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.emptyText
|
||||
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.recyclerView
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
|
||||
abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> : AbsLibraryPagerFragment(), AppBarLayout.OnOffsetChangedListener {
|
||||
abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
|
||||
AbsLibraryPagerFragment(), AppBarLayout.OnOffsetChangedListener {
|
||||
|
||||
protected var adapter: A? = null
|
||||
protected var layoutManager: LM? = null
|
||||
|
@ -40,6 +46,8 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
}
|
||||
recyclerView.layoutManager = layoutManager
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
OverScrollDecoratorHelper.setUpOverScroll(recyclerView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL)
|
||||
}
|
||||
|
||||
private fun initAdapter() {
|
||||
|
@ -92,7 +100,8 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
|
|||
container.paddingLeft,
|
||||
container.paddingTop,
|
||||
container.paddingRight,
|
||||
libraryFragment.totalAppBarScrollingRange + i)
|
||||
libraryFragment.totalAppBarScrollingRange + i
|
||||
)
|
||||
}
|
||||
|
||||
override fun onQueueChanged() {
|
||||
|
|
|
@ -4,12 +4,16 @@ import android.app.ActivityOptions
|
|||
import android.content.res.ColorStateList
|
||||
import android.os.Bundle
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.*
|
||||
import android.view.LayoutInflater
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import code.name.monkey.appthemehelper.common.ATHToolbarActivity
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.App
|
||||
import code.name.monkey.retromusic.Constants
|
||||
|
@ -30,14 +34,24 @@ import code.name.monkey.retromusic.mvp.presenter.HomePresenter
|
|||
import code.name.monkey.retromusic.mvp.presenter.HomeView
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import kotlinx.android.synthetic.main.abs_playlists.*
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.*
|
||||
import kotlinx.android.synthetic.main.home_content.*
|
||||
import kotlinx.android.synthetic.main.abs_playlists.actionShuffle
|
||||
import kotlinx.android.synthetic.main.abs_playlists.history
|
||||
import kotlinx.android.synthetic.main.abs_playlists.lastAdded
|
||||
import kotlinx.android.synthetic.main.abs_playlists.topPlayed
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.bannerImage
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.titleWelcome
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.toolbarContainer
|
||||
import kotlinx.android.synthetic.main.fragment_banner_home.userImage
|
||||
import kotlinx.android.synthetic.main.fragment_home.container
|
||||
import kotlinx.android.synthetic.main.home_content.emptyContainer
|
||||
import kotlinx.android.synthetic.main.home_content.recyclerView
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.ArrayList
|
||||
import java.util.Calendar
|
||||
import java.util.Random
|
||||
import javax.inject.Inject
|
||||
|
||||
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks, HomeView {
|
||||
|
@ -53,7 +67,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, viewGroup: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home, viewGroup, false)
|
||||
return inflater.inflate(
|
||||
if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home,
|
||||
viewGroup,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
private fun loadImageFromStorage() {
|
||||
|
@ -81,7 +99,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
toolbar = view.findViewById(R.id.toolbar)
|
||||
|
||||
bannerImage?.setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
userImage,
|
||||
getString(R.string.transition_user_image)
|
||||
)
|
||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||
}
|
||||
|
||||
|
@ -104,7 +126,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
setupToolbar()
|
||||
|
||||
userImage?.setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
userImage,
|
||||
getString(R.string.transition_user_image)
|
||||
)
|
||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||
}
|
||||
titleWelcome?.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName)
|
||||
|
@ -118,14 +144,8 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
}
|
||||
homePresenter.attachView(this)
|
||||
homePresenter.loadSections()
|
||||
}
|
||||
|
||||
private fun toolbarColor(): Int {
|
||||
return if (PreferenceUtil.getInstance(requireContext()).isHomeBanner) {
|
||||
ColorUtil.withAlpha(RetroColorUtil.toolbarColor(mainActivity), 0.85f)
|
||||
} else {
|
||||
RetroColorUtil.toolbarColor(mainActivity)
|
||||
}
|
||||
OverScrollDecoratorHelper.setUpOverScroll(container)
|
||||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
|
@ -133,7 +153,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
|
||||
setNavigationIcon(R.drawable.ic_menu_white_24dp)
|
||||
setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, toolbarContainer, getString(R.string.transition_toolbar))
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
toolbarContainer,
|
||||
getString(R.string.transition_toolbar)
|
||||
)
|
||||
NavigationUtil.goToSearch(requireActivity(), options)
|
||||
}
|
||||
|
||||
|
@ -164,7 +188,12 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
super.onCreateOptionsMenu(menu, inflater)
|
||||
inflater.inflate(R.menu.menu_search, menu)
|
||||
|
||||
ToolbarContentTintHelper.handleOnCreateOptionsMenu(requireActivity(), toolbar, menu, ATHToolbarActivity.getToolbarBackgroundColor(toolbar))
|
||||
ToolbarContentTintHelper.handleOnCreateOptionsMenu(
|
||||
requireActivity(),
|
||||
toolbar,
|
||||
menu,
|
||||
ATHToolbarActivity.getToolbarBackgroundColor(toolbar)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
|
@ -174,7 +203,11 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == R.id.action_search) {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, toolbarContainer, getString(R.string.transition_toolbar))
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
toolbarContainer,
|
||||
getString(R.string.transition_toolbar)
|
||||
)
|
||||
NavigationUtil.goToSearch(requireActivity(), true, options)
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
|
@ -195,7 +228,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
|
|||
loadTimeImage(day)
|
||||
}
|
||||
|
||||
|
||||
private fun loadTimeImage(day: String) {
|
||||
bannerImage?.let {
|
||||
val request = Glide.with(requireContext())
|
||||
|
|
|
@ -26,8 +26,18 @@ import androidx.preference.PreferenceManager
|
|||
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceFragmentCompat
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.preferences.*
|
||||
import code.name.monkey.retromusic.preferences.AlbumCoverStylePreference
|
||||
import code.name.monkey.retromusic.preferences.AlbumCoverStylePreferenceDialog
|
||||
import code.name.monkey.retromusic.preferences.BlacklistPreference
|
||||
import code.name.monkey.retromusic.preferences.BlacklistPreferenceDialog
|
||||
import code.name.monkey.retromusic.preferences.LibraryPreference
|
||||
import code.name.monkey.retromusic.preferences.LibraryPreferenceDialog
|
||||
import code.name.monkey.retromusic.preferences.MaterialListPreference
|
||||
import code.name.monkey.retromusic.preferences.MaterialListPreferenceDialog
|
||||
import code.name.monkey.retromusic.preferences.NowPlayingScreenPreference
|
||||
import code.name.monkey.retromusic.preferences.NowPlayingScreenPreferenceDialog
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
@ -54,9 +64,11 @@ abstract class AbsSettingsFragment : ATEPreferenceFragmentCompat() {
|
|||
|
||||
protected fun setSummary(preference: Preference?) {
|
||||
preference?.let {
|
||||
setSummary(it, PreferenceManager
|
||||
setSummary(
|
||||
it, PreferenceManager
|
||||
.getDefaultSharedPreferences(it.context)
|
||||
.getString(it.key, ""))
|
||||
.getString(it.key, "")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +80,7 @@ abstract class AbsSettingsFragment : ATEPreferenceFragmentCompat() {
|
|||
listView.setPadding(0, 0, 0, 0)
|
||||
listView.setPaddingRelative(0, 0, 0, 0)
|
||||
invalidateSettings()
|
||||
OverScrollDecoratorHelper.setUpOverScroll(listView, OverScrollDecoratorHelper.ORIENTATION_VERTICAL)
|
||||
}
|
||||
|
||||
override fun onCreatePreferenceDialog(preference: Preference): DialogFragment? {
|
||||
|
|
|
@ -28,12 +28,23 @@ import code.name.monkey.retromusic.activities.SettingsActivity
|
|||
import code.name.monkey.retromusic.extensions.hide
|
||||
import code.name.monkey.retromusic.extensions.show
|
||||
import code.name.monkey.retromusic.util.NavigationUtil
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.*
|
||||
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.aboutSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.audioSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.buyPremium
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.buyProContainer
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.container
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.diamondIcon
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.generalSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.imageSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.notificationSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.nowPlayingSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.otherSettings
|
||||
import kotlinx.android.synthetic.main.fragment_main_settings.personalizeSettings
|
||||
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
|
||||
|
||||
class MainSettingsFragment : Fragment(), View.OnClickListener {
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
override fun onClick(view: View) {
|
||||
when (view.id) {
|
||||
R.id.generalSettings -> inflateFragment(ThemeSettingsFragment(), R.string.general_settings_title)
|
||||
R.id.audioSettings -> inflateFragment(AudioSettings(), R.string.pref_header_audio)
|
||||
R.id.nowPlayingSettings -> inflateFragment(NowPlayingSettingsFragment(), R.string.now_playing)
|
||||
|
@ -45,8 +56,10 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_main_settings, container, false)
|
||||
}
|
||||
|
||||
|
@ -75,7 +88,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
|
|||
buyPremium.setTextColor(it)
|
||||
diamondIcon.imageTintList = ColorStateList.valueOf(it)
|
||||
}
|
||||
|
||||
OverScrollDecoratorHelper.setUpOverScroll(container)
|
||||
}
|
||||
|
||||
private fun inflateFragment(fragment: Fragment, @StringRes title: Int) {
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true"
|
||||
android:id="@+id/container"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
@ -115,5 +116,4 @@
|
|||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
</FrameLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
|
||||
android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
|
||||
app:behavior_overlapTop="72dp"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/background"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
@ -48,7 +48,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:liftOnScroll="true">
|
||||
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill_vertical"
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill_vertical"
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:behavior_overlapTop="52dp"
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_fragment_content"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/colorSurface"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
|
@ -71,6 +71,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill_vertical"
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill_vertical"
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:behavior_overlapTop="52dp"
|
||||
|
|
|
@ -72,11 +72,11 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/toolbar_margin_horizontal"
|
||||
android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
|
||||
android:layout_weight="1"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
@ -50,7 +51,6 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:orientation="vertical">
|
||||
|
||||
<code.name.monkey.retromusic.views.WidthFitSquareCardView
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
android:layout_marginStart="@dimen/button_margin_horizontal"
|
||||
android:layout_marginEnd="@dimen/button_margin_horizontal"
|
||||
android:text="@string/action_play_all"
|
||||
app:backgroundTint="?attr/colorSurface"
|
||||
app:icon="@drawable/ic_play_arrow_white_24dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/shuffleAction"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
|
@ -27,6 +28,7 @@
|
|||
android:layout_marginStart="@dimen/button_margin_horizontal"
|
||||
android:layout_marginEnd="@dimen/button_margin_horizontal"
|
||||
android:text="@string/shuffle"
|
||||
app:backgroundTint="?attr/colorSurface"
|
||||
app:icon="@drawable/ic_shuffle_white_24dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playAction"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp" />
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
|
||||
tools:background="?attr/colorSurface" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/cab_stub"
|
||||
|
@ -42,6 +43,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
android:background="?attr/colorSurface">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:id="@+id/container"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<code.name.monkey.retromusic.views.LollipopFixedWebView
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/container"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package me.everything.android.ui.overscroll.adapters;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
|
||||
public class NestedScrollViewOverScrollDecorAdapter implements IOverScrollDecoratorAdapter {
|
||||
|
||||
protected final NestedScrollView mView;
|
||||
|
||||
public NestedScrollViewOverScrollDecorAdapter(@NonNull NestedScrollView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return this.mView;
|
||||
}
|
||||
|
||||
public boolean isInAbsoluteEnd() {
|
||||
return !this.mView.canScrollVertically(1);
|
||||
}
|
||||
|
||||
public boolean isInAbsoluteStart() {
|
||||
return !this.mView.canScrollVertically(-1);
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
include ':app', ':appthemehelper', ':core'
|
||||
include ':app', ':appthemehelper', ':liboverscroll'
|
Loading…
Reference in a new issue