Added transition on user edit and UI changes

This commit is contained in:
h4h13 2019-09-29 14:55:47 +05:30
parent f5953b4930
commit 64c4979752
5 changed files with 69 additions and 71 deletions

View file

@ -54,9 +54,7 @@ class UserInfoActivity : AbsBaseActivity() {
setupToolbar() setupToolbar()
MaterialUtil.setTint(nameContainer, false) MaterialUtil.setTint(nameContainer, false)
MaterialUtil.setTint(bioContainer, false)
name.setText(PreferenceUtil.getInstance(this).userName) name.setText(PreferenceUtil.getInstance(this).userName)
bio.setText(PreferenceUtil.getInstance(this).userBio)
if (PreferenceUtil.getInstance(this).profileImage.isNotEmpty()) { if (PreferenceUtil.getInstance(this).profileImage.isNotEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance(this).profileImage) loadImageFromStorage(PreferenceUtil.getInstance(this).profileImage)

View file

@ -110,7 +110,8 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
toolbar = view.findViewById(R.id.toolbar) toolbar = view.findViewById(R.id.toolbar)
bannerImage?.setOnClickListener { bannerImage?.setOnClickListener {
NavigationUtil.goToUserInfo(requireActivity()) val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
NavigationUtil.goToUserInfo(requireActivity(), options)
} }
if (!PreferenceUtil.getInstance(requireContext()).isHomeBanner) if (!PreferenceUtil.getInstance(requireContext()).isHomeBanner)
setStatusbarColorAuto(view) setStatusbarColorAuto(view)
@ -137,7 +138,8 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
checkPadding() checkPadding()
userImage.setOnClickListener { userImage.setOnClickListener {
NavigationUtil.goToUserInfo(requireActivity()) val options = ActivityOptions.makeSceneTransitionAnimation(mainActivity, userImage, getString(R.string.transition_user_image))
NavigationUtil.goToUserInfo(requireActivity(), options)
} }
titleWelcome.setTextColor(ThemeStore.textColorPrimary(requireContext())) titleWelcome.setTextColor(ThemeStore.textColorPrimary(requireContext()))
titleWelcome.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName) titleWelcome.text = String.format("%s", PreferenceUtil.getInstance(requireContext()).userName)

View file

@ -139,8 +139,10 @@ public class NavigationUtil {
ActivityCompat.startActivity(activity, new Intent(activity, AboutActivity.class), null); ActivityCompat.startActivity(activity, new Intent(activity, AboutActivity.class), null);
} }
public static void goToUserInfo(@NonNull Activity activity) { public static void goToUserInfo(@NonNull Activity activity,
ActivityCompat.startActivity(activity, new Intent(activity, UserInfoActivity.class), null); @NonNull ActivityOptions activityOptions) {
ActivityCompat.startActivity(activity, new Intent(activity, UserInfoActivity.class),
activityOptions.toBundle());
} }
public static void goToOpenSource(@NonNull Activity activity) { public static void goToOpenSource(@NonNull Activity activity) {

View file

@ -10,39 +10,40 @@
android:id="@+id/appBarLayout" android:id="@+id/appBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="0dp" app:liftOnScroll="true">
app:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/profile" /> app:title="@string/profile" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<LinearLayout <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/imageContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dp" android:layout_marginStart="16dp"
android:layout_marginEnd="12dp" android:layout_marginTop="16dp"
android:layout_marginBottom="12dp" android:layout_marginEnd="16dp"
app:cardCornerRadius="12dp" app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true"> app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout <FrameLayout
android:id="@+id/imageContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -59,52 +60,66 @@
android:layout_height="156dp" android:layout_height="156dp"
android:background="@color/twenty_percent_black_overlay" /> android:background="@color/twenty_percent_black_overlay" />
<code.name.monkey.retromusic.views.IconImageView <androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="end"
android:background="?roundSelector" android:background="?roundSelector"
android:padding="16dp" android:padding="16dp"
app:srcCompat="@drawable/ic_add_photo_white_24dp" /> app:srcCompat="@drawable/ic_add_photo_white_24dp" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="8dp">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
app:civ_border="false"
app:civ_shadow="false"
app:srcCompat="@drawable/ic_person_flat" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:gravity="center"
android:padding="12dp"
android:src="@drawable/ic_add_photo_white_24dp"
app:tint="?iconColor" />
</FrameLayout>
</FrameLayout> </FrameLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
<FrameLayout
android:id="@+id/userImageContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginStart="16dp"
android:elevation="8dp"
android:transitionName="@string/transition_user_image"
app:layout_constraintBottom_toBottomOf="@id/imageContainer"
app:layout_constraintStart_toStartOf="@+id/imageContainer"
app:layout_constraintTop_toBottomOf="@id/imageContainer">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/userImage"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
app:civ_border="true"
app:civ_border_color="?android:colorBackground"
app:civ_border_width="2dp"
app:civ_shadow="false"
app:srcCompat="@drawable/ic_person_flat" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:gravity="center"
android:padding="12dp"
android:src="@drawable/ic_add_photo_white_24dp"
app:tint="?iconColor" />
</FrameLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/nameContainer" android:id="@+id/nameContainer"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
app:hintAnimationEnabled="true"> app:hintAnimationEnabled="true"
app:hintEnabled="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/userImageContainer">
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
@ -115,32 +130,12 @@
android:hint="@string/my_name" android:hint="@string/my_name"
android:importantForAutofill="yes" android:importantForAutofill="yes"
android:inputType="textPersonName|textCapWords|text" android:inputType="textPersonName|textCapWords|text"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" android:textAppearance="@style/TextViewSubtitle1"
tools:text="@string/song" /> tools:text="@tools:sample/full_names" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/bioContainer" </androidx.core.widget.NestedScrollView>
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
app:hintAnimationEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/bio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bio"
android:inputType="textPersonName|textCapWords|text"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/next" android:id="@+id/next"

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="transition_album_art" translatable="false">album_art_transition</string> <string name="transition_album_art" translatable="false">album_art_transition</string>
<string name="transition_user_image" translatable="false">user_image_transition</string>
<string name="transition_album_name" translatable="false">album_art_transition</string> <string name="transition_album_name" translatable="false">album_art_transition</string>
<string name="transition_album_text" translatable="false">album_art_transition</string> <string name="transition_album_text" translatable="false">album_art_transition</string>
<string name="transition_artist_image" translatable="false">artist_image_transition</string> <string name="transition_artist_image" translatable="false">artist_image_transition</string>