Added scroll animation

This commit is contained in:
h4h13 2020-01-06 01:55:55 +05:30
parent 1932ba219e
commit 5038f9afa1
13 changed files with 684 additions and 567 deletions

View file

@ -304,8 +304,8 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), AlbumDetailsView, C
intent.putExtra(AbsTagEditorActivity.EXTRA_ID, album.id) intent.putExtra(AbsTagEditorActivity.EXTRA_ID, album.id)
val options = ActivityOptions.makeSceneTransitionAnimation( val options = ActivityOptions.makeSceneTransitionAnimation(
this, this,
image, albumCoverContainer,
getString(R.string.transition_album_art) "${getString(R.string.transition_album_art)}_${album.id}"
) )
startActivityForResult(intent, TAG_EDITOR_REQUEST, options.toBundle()) startActivityForResult(intent, TAG_EDITOR_REQUEST, options.toBundle())
return true return true

View file

@ -10,7 +10,9 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment import code.name.monkey.retromusic.fragments.settings.MainSettingsFragment
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.appBarLayout
import kotlinx.android.synthetic.main.activity_settings.detailContentFrame
import kotlinx.android.synthetic.main.activity_settings.toolbar
class SettingsActivity : AbsBaseActivity() { class SettingsActivity : AbsBaseActivity() {

View file

@ -11,6 +11,7 @@ import android.os.Bundle
import android.text.Editable import android.text.Editable
import android.text.TextUtils import android.text.TextUtils
import android.text.TextWatcher import android.text.TextWatcher
import android.transition.Slide
import android.widget.Toast import android.widget.Toast
import code.name.monkey.appthemehelper.util.ATHUtil import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.MaterialUtil import code.name.monkey.appthemehelper.util.MaterialUtil
@ -37,6 +38,7 @@ import kotlinx.android.synthetic.main.activity_album_tag_editor.albumText
import kotlinx.android.synthetic.main.activity_album_tag_editor.albumTitleContainer import kotlinx.android.synthetic.main.activity_album_tag_editor.albumTitleContainer
import kotlinx.android.synthetic.main.activity_album_tag_editor.genreContainer import kotlinx.android.synthetic.main.activity_album_tag_editor.genreContainer
import kotlinx.android.synthetic.main.activity_album_tag_editor.genreTitle import kotlinx.android.synthetic.main.activity_album_tag_editor.genreTitle
import kotlinx.android.synthetic.main.activity_album_tag_editor.imageContainer
import kotlinx.android.synthetic.main.activity_album_tag_editor.toolbar import kotlinx.android.synthetic.main.activity_album_tag_editor.toolbar
import kotlinx.android.synthetic.main.activity_album_tag_editor.yearContainer import kotlinx.android.synthetic.main.activity_album_tag_editor.yearContainer
import kotlinx.android.synthetic.main.activity_album_tag_editor.yearTitle import kotlinx.android.synthetic.main.activity_album_tag_editor.yearTitle
@ -48,6 +50,16 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
override val contentViewLayout: Int override val contentViewLayout: Int
get() = R.layout.activity_album_tag_editor get() = R.layout.activity_album_tag_editor
private fun windowEnterTransition() {
val slide = Slide()
slide.excludeTarget(R.id.appBarLayout, true)
slide.excludeTarget(R.id.status_bar, true)
slide.excludeTarget(android.R.id.statusBarBackground, true)
slide.excludeTarget(android.R.id.navigationBarBackground, true)
window.enterTransition = slide
}
override fun loadImageFromFile(selectedFileUri: Uri?) { override fun loadImageFromFile(selectedFileUri: Uri?) {
Glide.with(this@AlbumTagEditorActivity).load(selectedFileUri).asBitmap() Glide.with(this@AlbumTagEditorActivity).load(selectedFileUri).asBitmap()
@ -93,8 +105,10 @@ class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar() setDrawUnderStatusBar()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
window.sharedElementsUseOverlay = true
lastFMRestClient = LastFMRestClient(this) lastFMRestClient = LastFMRestClient(this)
imageContainer?.transitionName = "${getString(R.string.transition_album_art)}_$id"
windowEnterTransition()
setUpViews() setUpViews()
setupToolbar() setupToolbar()
} }

View file

@ -149,8 +149,10 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
} }
private fun setupToolbar() { private fun setupToolbar() {
toolbar.apply { toolbar.apply {
backgroundTintList = ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface)) backgroundTintList =
ColorStateList.valueOf(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
setNavigationIcon(R.drawable.ic_menu_white_24dp) setNavigationIcon(R.drawable.ic_menu_white_24dp)
setOnClickListener { setOnClickListener {
val options = ActivityOptions.makeSceneTransitionAnimation( val options = ActivityOptions.makeSceneTransitionAnimation(

View file

@ -32,7 +32,6 @@ 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.audioSettings
import kotlinx.android.synthetic.main.fragment_main_settings.buyPremium 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.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.diamondIcon
import kotlinx.android.synthetic.main.fragment_main_settings.generalSettings 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.imageSettings
@ -40,6 +39,7 @@ import kotlinx.android.synthetic.main.fragment_main_settings.notificationSetting
import kotlinx.android.synthetic.main.fragment_main_settings.nowPlayingSettings 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.otherSettings
import kotlinx.android.synthetic.main.fragment_main_settings.personalizeSettings import kotlinx.android.synthetic.main.fragment_main_settings.personalizeSettings
import kotlinx.android.synthetic.main.fragment_main_settings.scrollView
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper import me.everything.android.ui.overscroll.OverScrollDecoratorHelper
class MainSettingsFragment : Fragment(), View.OnClickListener { class MainSettingsFragment : Fragment(), View.OnClickListener {
@ -88,7 +88,7 @@ class MainSettingsFragment : Fragment(), View.OnClickListener {
buyPremium.setTextColor(it) buyPremium.setTextColor(it)
diamondIcon.imageTintList = ColorStateList.valueOf(it) diamondIcon.imageTintList = ColorStateList.valueOf(it)
} }
OverScrollDecoratorHelper.setUpOverScroll(container) OverScrollDecoratorHelper.setUpOverScroll(scrollView)
} }
private fun inflateFragment(fragment: Fragment, @StringRes title: Int) { private fun inflateFragment(fragment: Fragment, @StringRes title: Int) {

View file

@ -22,7 +22,6 @@ import androidx.preference.TwoStatePreference
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.util.PreferenceUtil import code.name.monkey.retromusic.util.PreferenceUtil
class PersonalizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSharedPreferenceChangeListener { class PersonalizeSettingsFragment : AbsSettingsFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
override fun invalidateSettings() { override fun invalidateSettings() {

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View file

@ -26,7 +26,7 @@
<FrameLayout <FrameLayout
android:id="@+id/contentFrame" android:id="@+id/contentFrame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout

View file

@ -27,8 +27,8 @@
</FrameLayout> </FrameLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
@ -53,7 +53,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/bannerImage" android:id="@+id/bannerImage"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -63,7 +62,6 @@
tools:ignore="ContentDescription" tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/backgrounds/scenic[9]" /> tools:srcCompat="@tools:sample/backgrounds/scenic[9]" />
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/toolbarContainer" android:id="@+id/toolbarContainer"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container" android:id="@+id/scrollView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"> android:overScrollMode="never">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -570,7 +570,7 @@
<string name="primary_color">Primary color</string> <string name="primary_color">Primary color</string>
<string name="primary_color_desc">The primary theme color, defaults to blue grey, for now works with dark colors</string> <string name="primary_color_desc">The primary theme color, defaults to blue grey, for now works with dark colors</string>
<string name="pro_summary">Now playing themes, Carousel effect and more..</string> <string name="pro_summary">Black theme, Now playing themes, Carousel effect and more..</string>
<string name="profile">Profile</string> <string name="profile">Profile</string>

View file

@ -47,6 +47,12 @@
android:layout="@layout/list_item_view_switch" android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_home_banner" android:summary="@string/pref_summary_home_banner"
android:title="@string/pref_title_home_banner" /> android:title="@string/pref_title_home_banner" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false"
android:key="hide_home_banner_search"
android:layout="@layout/list_item_view_switch"
android:summary="@string/pref_summary_home_banner"
android:title="@string/pref_title_home_banner" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory> </code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
@ -77,7 +83,6 @@
android:layout="@layout/preference_category_title" android:layout="@layout/preference_category_title"
android:title="@string/window"> android:title="@string/window">
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference <code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="toggle_full_screen" android:key="toggle_full_screen"