Skip to content

Commit

Permalink
add scale image animation
Browse files Browse the repository at this point in the history
  • Loading branch information
MashudiSudonym committed Apr 27, 2021
1 parent 377e307 commit 6324e9b
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ class UpdateUserProfileActivity : AppCompatActivity() {

// Form Validator
formValidation()

// swipe to refresh data
updateUserProfileBinding.updateUserProfileSwipeRefreshView.setOnRefreshListener {
updateUserProfileBinding.updateUserProfileSwipeRefreshView.isRefreshing = false

// get data
initializeFieldValueOfUserProfileData()
}
}

// Validate form on this activity
Expand Down
24 changes: 13 additions & 11 deletions app/src/main/res/layout/activity_update_user_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.motion.widget.MotionLayout
android:id="@+id/form_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:layoutDescription="@xml/activity_update_user_profile_xml_form_layout_scene">

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/img_profile"
Expand All @@ -48,22 +49,23 @@
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_baseline_person_pin"
app:civ_border_color="@color/application_color"
app:civ_border_width="2dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/ic_baseline_person_pin"
app:civ_border_color="@color/colorPrimary"
app:civ_border_width="2dp" />
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/btn_choose_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginTop="250dp"
android:layout_marginEnd="16dp"
android:text="@string/choose_image"
app:layout_constraintEnd_toEndOf="@+id/img_profile"
app:layout_constraintStart_toStartOf="@+id/img_profile"
app:layout_constraintTop_toBottomOf="@+id/img_profile" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/btn_save"
Expand Down Expand Up @@ -169,7 +171,7 @@
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.motion.widget.MotionLayout>
</ScrollView>


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">

<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:duration="1000">
<KeyFrameSet>
</KeyFrameSet>
<OnClick motion:targetId="@id/img_profile"
motion:clickAction="toggle" />
</Transition>

<ConstraintSet android:id="@+id/start">
</ConstraintSet>

<ConstraintSet android:id="@+id/end">
<Constraint
android:layout_marginEnd="16dp"
android:layout_height="340dp"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="340dp"
android:layout_marginStart="16dp"
android:id="@+id/img_profile" />
<Constraint
android:id="@+id/btn_choose_image"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toTopOf="parent"
motion:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="250dp"
android:alpha="0" />
<Constraint
android:id="@+id/btn_save"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
motion:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toBottomOf="@+id/til_edt_email"
android:layout_marginStart="16dp"
motion:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="32dp"
android:alpha="0" />
<Constraint
android:id="@+id/til_edt_email"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toBottomOf="@+id/til_edt_address"
android:layout_marginStart="16dp"
motion:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="16dp"
android:alpha="0" />
<Constraint
android:id="@+id/til_edt_address"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toBottomOf="@+id/til_edt_phone"
android:layout_marginStart="16dp"
motion:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="16dp"
android:alpha="0" />
<Constraint
android:id="@+id/til_edt_name"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toBottomOf="@+id/btn_choose_image"
android:layout_marginStart="16dp"
motion:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="32dp"
android:alpha="0" />
<Constraint
android:id="@+id/til_edt_phone"
motion:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
motion:layout_constraintTop_toBottomOf="@+id/til_edt_name"
android:layout_marginStart="16dp"
motion:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="16dp"
android:alpha="0" />
</ConstraintSet>
</MotionScene>

0 comments on commit 6324e9b

Please sign in to comment.