Просмотр исходного кода

chore: created layout files for defining motion

sduduzog 6 лет назад
Родитель
Сommit
c438fb1184

+ 0 - 9
app/src/main/res/layout/home_fragment.xml

@@ -50,15 +50,6 @@
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textAppearance="@style/TextAppearance.AppCompat"
         android:textSize="@dimen/_18ssp" />
         android:textSize="@dimen/_18ssp" />
 
 
-    <TextView
-        android:id="@+id/home_fragment_notes"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:padding="8dp"
-        android:text="@string/main_fragment_notes"
-        android:textAppearance="@style/TextAppearance.AppCompat"
-        android:textSize="@dimen/_18ssp" />
-
     <ImageView
     <ImageView
         android:id="@+id/home_fragment_call"
         android:id="@+id/home_fragment_call"
         android:layout_width="wrap_content"
         android:layout_width="wrap_content"

+ 112 - 0
app/src/main/res/layout/home_motion_01.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/home_fragment_time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/_42sdp"
+        android:text="@string/main_placeholder_clock"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_40ssp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.506"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/home_fragment_date"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="@dimen/_4sdp"
+        android:text="@string/main_placeholder_date"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_12sdp"
+        app:layout_constraintEnd_toEndOf="@+id/home_fragment_time"
+        app:layout_constraintStart_toStartOf="@+id/home_fragment_time"
+        app:layout_constraintTop_toBottomOf="@+id/home_fragment_time" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/home_fragment_list"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="@dimen/_16sdp"
+        android:layout_marginRight="@dimen/_16sdp"
+        android:layout_marginBottom="@dimen/_8sdp"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.0"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_bias="0.55"
+        tools:itemCount="4"
+        tools:listitem="@layout/main_fragment_list_item" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/home_fragment_list_exp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginTop="@dimen/_16sdp"
+        android:layout_marginEnd="@dimen/_16sdp"
+        android:layout_marginRight="@dimen/_16sdp"
+        android:layout_marginBottom="@dimen/_8sdp"
+        android:alpha="-2"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="parent"
+        tools:itemCount="3"
+        tools:listitem="@layout/main_fragment_list_item" />
+
+    <TextView
+        android:id="@+id/home_fragment_options"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:alpha="-3"
+        android:padding="@dimen/_8sdp"
+        android:text="@string/main_fragment_options"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_18ssp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/home_fragment_list_exp"
+        app:layout_constraintTop_toBottomOf="@+id/home_fragment_list_exp" />
+
+    <ImageView
+        android:id="@+id/home_fragment_call"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_8sdp"
+        android:layout_marginLeft="@dimen/_8sdp"
+        android:layout_marginBottom="@dimen/_8sdp"
+        android:padding="@dimen/_8sdp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:srcCompat="@drawable/ic_call"
+        tools:ignore="ContentDescription" />
+
+
+    <ImageView
+        android:id="@+id/home_fragment_camera"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="@dimen/_8sdp"
+        android:layout_marginRight="@dimen/_8sdp"
+        android:layout_marginBottom="@dimen/_8sdp"
+        android:padding="@dimen/_8sdp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:srcCompat="@drawable/ic_photo_camera"
+        tools:ignore="ContentDescription" />
+
+</androidx.constraintlayout.motion.widget.MotionLayout>

+ 115 - 0
app/src/main/res/layout/home_motion_02.xml

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/home_fragment_time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/_64sdp"
+        android:alpha="-1"
+        android:text="@string/main_placeholder_clock"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_40ssp"
+        app:layout_constraintBottom_toTopOf="@+id/home_fragment_date"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toStartOf="parent" />
+
+    <TextView
+        android:id="@+id/home_fragment_date"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:alpha="-1"
+        android:padding="@dimen/_4sdp"
+        android:text="@string/main_placeholder_date"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_12sdp"
+        app:layout_constraintBottom_toTopOf="parent"
+        app:layout_constraintEnd_toEndOf="@+id/home_fragment_time"
+        app:layout_constraintStart_toStartOf="@+id/home_fragment_time" />
+
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/home_fragment_list"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginEnd="@dimen/_16sdp"
+        android:layout_marginRight="@dimen/_16sdp"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintBottom_toTopOf="@+id/home_fragment_list_exp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/home_fragment_date"
+        app:layout_constraintVertical_chainStyle="packed"
+        tools:itemCount="4"
+        tools:listitem="@layout/main_fragment_list_item" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/home_fragment_list_exp"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginEnd="@dimen/_16sdp"
+        android:layout_marginRight="@dimen/_16sdp"
+        android:layout_marginBottom="@dimen/_32sdp"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.5"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/home_fragment_list"
+        tools:itemCount="3"
+        tools:listitem="@layout/main_fragment_list_item" />
+
+
+    <TextView
+        android:id="@+id/home_fragment_options"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_16sdp"
+        android:layout_marginLeft="@dimen/_16sdp"
+        android:layout_marginBottom="@dimen/_16sdp"
+        android:padding="@dimen/_8sdp"
+        android:text="@string/main_fragment_options"
+        android:textAppearance="@style/TextAppearance.AppCompat"
+        android:textSize="@dimen/_18ssp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="@+id/home_fragment_list_exp" />
+
+
+    <ImageView
+        android:id="@+id/home_fragment_call"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/_8sdp"
+        android:layout_marginLeft="@dimen/_8sdp"
+        android:alpha="-1"
+        android:padding="@dimen/_8sdp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="parent"
+        app:srcCompat="@drawable/ic_call"
+        tools:ignore="ContentDescription" />
+
+    <ImageView
+        android:id="@+id/home_fragment_camera"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="@dimen/_8sdp"
+        android:layout_marginRight="@dimen/_8sdp"
+        android:alpha="-1"
+        android:padding="@dimen/_8sdp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="parent"
+        app:srcCompat="@drawable/ic_photo_camera"
+        tools:ignore="ContentDescription" />
+
+</androidx.constraintlayout.motion.widget.MotionLayout>
+

+ 3 - 187
app/src/main/res/xml/home_motion_scene.xml

@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?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">
+<MotionScene xmlns:motion="http://schemas.android.com/apk/res-auto">
     <Transition
     <Transition
-        motion:constraintSetEnd="@+id/end"
-        motion:constraintSetStart="@+id/start"
+        motion:constraintSetEnd="@layout/home_motion_02"
+        motion:constraintSetStart="@layout/home_motion_01"
         motion:duration="250">
         motion:duration="250">
         <OnSwipe
         <OnSwipe
             motion:dragDirection="dragUp"
             motion:dragDirection="dragUp"
@@ -11,187 +10,4 @@
             motion:touchAnchorSide="bottom" />
             motion:touchAnchorSide="bottom" />
     </Transition>
     </Transition>
 
 
-    <ConstraintSet android:id="@+id/start">
-        <Constraint
-            android:id="@+id/home_fragment_time"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/_42sdp"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.506"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toTopOf="parent" />
-
-        <Constraint
-            android:id="@+id/home_fragment_time_format"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/_10sdp"
-            motion:layout_constraintStart_toEndOf="@+id/home_fragment_time"
-            motion:layout_constraintTop_toTopOf="@+id/home_fragment_time" />
-
-        <Constraint
-            android:id="@+id/home_fragment_date"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:padding="@dimen/_4sdp"
-            android:text="@string/main_placeholder_date"
-            motion:layout_constraintEnd_toEndOf="@+id/home_fragment_time"
-            motion:layout_constraintStart_toStartOf="@+id/home_fragment_time"
-            motion:layout_constraintTop_toBottomOf="@+id/home_fragment_time" />
-
-        <Constraint
-            android:id="@+id/home_fragment_list"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_16sdp"
-            android:layout_marginLeft="@dimen/_16sdp"
-            android:layout_marginTop="8dp"
-            android:layout_marginEnd="@dimen/_16sdp"
-            android:layout_marginRight="@dimen/_16sdp"
-            android:layout_marginBottom="@dimen/_8sdp"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.0"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toTopOf="parent"
-            motion:layout_constraintVertical_bias="0.55" />
-
-        <Constraint
-            android:id="@+id/home_fragment_list_exp"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_16sdp"
-            android:layout_marginLeft="@dimen/_16sdp"
-            android:layout_marginTop="@dimen/_16sdp"
-            android:layout_marginEnd="@dimen/_16sdp"
-            android:layout_marginRight="@dimen/_16sdp"
-            android:layout_marginBottom="@dimen/_8sdp"
-            android:alpha="-2"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="parent" />
-
-        <Constraint
-            android:id="@+id/home_fragment_options"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:alpha="-3"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintStart_toStartOf="@+id/home_fragment_list_exp"
-            motion:layout_constraintTop_toBottomOf="@+id/home_fragment_list_exp" />
-
-        <Constraint
-            android:id="@+id/home_fragment_notes"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:alpha="-3"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintEnd_toEndOf="@+id/home_fragment_list_exp"
-            motion:layout_constraintTop_toBottomOf="@+id/home_fragment_list_exp" />
-
-        <Constraint
-            android:id="@+id/home_fragment_call"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_8sdp"
-            android:layout_marginLeft="@dimen/_8sdp"
-            android:layout_marginBottom="@dimen/_8sdp"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintStart_toStartOf="parent" />
-
-        <Constraint
-            android:id="@+id/home_fragment_camera"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="@dimen/_8sdp"
-            android:layout_marginRight="@dimen/_8sdp"
-            android:layout_marginBottom="@dimen/_8sdp"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintEnd_toEndOf="parent" />
-    </ConstraintSet>
-
-    <ConstraintSet android:id="@+id/end">
-
-        <Constraint
-            android:id="@+id/home_fragment_time"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:alpha="-1"
-            motion:layout_constraintBottom_toTopOf="@+id/home_fragment_date"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toStartOf="parent" />
-
-        <Constraint
-            android:id="@+id/home_fragment_date"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:alpha="-1"
-            motion:layout_constraintBottom_toTopOf="parent"
-            motion:layout_constraintEnd_toEndOf="@+id/home_fragment_time"
-            motion:layout_constraintStart_toStartOf="@+id/home_fragment_time" />
-
-        <Constraint
-            android:id="@+id/home_fragment_list"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_16sdp"
-            android:layout_marginLeft="@dimen/_16sdp"
-            android:layout_marginEnd="@dimen/_16sdp"
-            android:layout_marginRight="@dimen/_16sdp"
-            motion:layout_constraintBottom_toTopOf="@+id/home_fragment_list_exp"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@+id/home_fragment_date"
-            motion:layout_constraintVertical_chainStyle="packed" />
-
-        <Constraint
-            android:id="@+id/home_fragment_list_exp"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_16sdp"
-            android:layout_marginLeft="@dimen/_16sdp"
-            android:layout_marginEnd="@dimen/_16sdp"
-            android:layout_marginRight="@dimen/_16sdp"
-            android:layout_marginBottom="@dimen/_32sdp"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@+id/home_fragment_list" />
-
-        <Constraint
-            android:id="@+id/home_fragment_options"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_16sdp"
-            android:layout_marginLeft="@dimen/_16sdp"
-            android:layout_marginBottom="@dimen/_16sdp"
-            motion:layout_constraintBottom_toBottomOf="parent"
-            motion:layout_constraintStart_toStartOf="@+id/home_fragment_list_exp" />
-
-        <Constraint
-            android:id="@+id/home_fragment_call"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/_8sdp"
-            android:layout_marginLeft="@dimen/_8sdp"
-            android:alpha="-1"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="parent" />
-
-        <Constraint
-            android:id="@+id/home_fragment_camera"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginEnd="@dimen/_8sdp"
-            android:layout_marginRight="@dimen/_8sdp"
-            android:alpha="-1"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintTop_toBottomOf="parent" />
-
-    </ConstraintSet>
 </MotionScene>
 </MotionScene>