Skip to content

Commit e727d23

Browse files
WhiredPlanckBambooin
authored andcommitted
feat(ui): add animation when navigate between the fragments
1 parent 641afed commit e727d23

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

app/src/main/java/com/osfans/trime/ui/fragments/PrefFragment.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PrefFragment : PreferenceFragmentCompat() {
3333
true
3434
}
3535
get<Preference>("pref_user_data")?.setOnPreferenceClickListener {
36-
findNavController().navigate(R.id.action_prefFragment_to_userDataFragment)
36+
findNavController().navigate(R.id.action_prefFragment_to_profileFragment)
3737
true
3838
}
3939
get<Preference>("pref_keyboard")?.setOnPreferenceClickListener {

app/src/main/res/navigation/pref_nav.xml

+38-10
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,52 @@
99
android:name="com.osfans.trime.ui.fragments.PrefFragment"
1010
android:label="PrefFragment" >
1111
<action
12-
android:id="@+id/action_prefFragment_to_userDataFragment"
13-
app:destination="@id/userDataFragment" />
12+
android:id="@+id/action_prefFragment_to_profileFragment"
13+
app:destination="@id/profileFragment"
14+
app:enterAnim="@anim/nav_default_enter_anim"
15+
app:exitAnim="@anim/nav_default_exit_anim"
16+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
17+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
1418
<action
1519
android:id="@+id/action_prefFragment_to_keyboardFragment"
16-
app:destination="@id/keyboardFragment" />
20+
app:destination="@id/keyboardFragment"
21+
app:enterAnim="@anim/nav_default_enter_anim"
22+
app:exitAnim="@anim/nav_default_exit_anim"
23+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
24+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
1725
<action
1826
android:id="@+id/action_prefFragment_to_themeColorFragment"
19-
app:destination="@id/themeColorFragment" />
27+
app:destination="@id/themeColorFragment"
28+
app:enterAnim="@anim/nav_default_enter_anim"
29+
app:exitAnim="@anim/nav_default_exit_anim"
30+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
31+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
2032
<action
2133
android:id="@+id/action_prefFragment_to_otherFragment"
22-
app:destination="@id/otherFragment" />
34+
app:destination="@id/otherFragment"
35+
app:enterAnim="@anim/nav_default_enter_anim"
36+
app:exitAnim="@anim/nav_default_exit_anim"
37+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
38+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
2339
<action
2440
android:id="@+id/action_prefFragment_to_toolkitFragment"
25-
app:destination="@id/toolkitFragment" />
41+
app:destination="@id/toolkitFragment"
42+
app:enterAnim="@anim/nav_default_enter_anim"
43+
app:exitAnim="@anim/nav_default_exit_anim"
44+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
45+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
2646
<action
2747
android:id="@+id/action_prefFragment_to_aboutFragment"
28-
app:destination="@id/aboutFragment" />
48+
app:destination="@id/aboutFragment"
49+
app:enterAnim="@anim/nav_default_enter_anim"
50+
app:exitAnim="@anim/nav_default_exit_anim"
51+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
52+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
2953
</fragment>
3054
<fragment
31-
android:id="@+id/userDataFragment"
55+
android:id="@+id/profileFragment"
3256
android:name="com.osfans.trime.ui.fragments.ProfileFragment"
33-
android:label="UserDataFragment" />
57+
android:label="ProfileFragment" />
3458
<fragment
3559
android:id="@+id/keyboardFragment"
3660
android:name="com.osfans.trime.ui.fragments.KeyboardFragment"
@@ -53,7 +77,11 @@
5377
android:label="AboutFragment" >
5478
<action
5579
android:id="@+id/action_aboutFragment_to_licenseFragment"
56-
app:destination="@id/licenseFragment" />
80+
app:destination="@id/licenseFragment"
81+
app:enterAnim="@anim/nav_default_enter_anim"
82+
app:exitAnim="@anim/nav_default_exit_anim"
83+
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
84+
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
5785
</fragment>
5886
<fragment
5987
android:id="@+id/licenseFragment"

0 commit comments

Comments
 (0)