Save light, dark and amoled Material You themes to database. Add 'Apply Material You' option. Test MotionLayout.

This commit is contained in:
Alex Ning
2021-07-02 23:16:18 +08:00
parent 992cf0dda1
commit e3578c59dd
14 changed files with 303 additions and 47 deletions

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<ml.docilealligator.infinityforreddit.customviews.ClickableMotionLayout 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"
android:id="@+id/motion_layout"
tools:context=".activities.MotionTestActivity"
app:layoutDescription="@xml/activity_motion_test_scene">
<View
android:id="@+id/button"
android:background="@color/colorAccent"
android:layout_width="64dp"
android:layout_height="64dp" />
</ml.docilealligator.infinityforreddit.customviews.ClickableMotionLayout>

View File

@@ -458,8 +458,11 @@
<string name="settings_customize_amoled_theme_title">Amoled Theme</string>
<string name="settings_manage_themes_title">Manage Themes</string>
<string name="settings_category_material_you_title">Material You</string>
<string name="settings_enable_material_you_warning_summary">Make sure you don\'t have themes named\n\"Material You\",\n\"Material You Dark\" or\n\"Material You Amoled\".\nOtherwise, rename them before enabling Material You.</string>
<string name="settings_enable_material_you_title">Enable Material You</string>
<string name="settings_enable_material_you_summary">Personalize Infinity based on Your Wallpaper</string>
<string name="settings_apply_material_you_title">Apply Material You</string>
<string name="settings_apply_material_you_summary">In case Infinity did not change the theme</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">Custom themes cannot be applied to settings page (except toolbar, status bar and navigation bar).</string>
<string name="settings_advanced_master_title">Advanced</string>
<string name="settings_delete_all_subreddits_data_in_database_title">Delete All Subreddits in Database</string>

View File

@@ -0,0 +1,45 @@
<?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
android:id="@+id/transition_to_end"
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:autoTransition="animateToStart"
motion:duration="100">
<OnSwipe
motion:touchAnchorId="@+id/button"
motion:touchAnchorSide="right"
motion:onTouchUp="autoCompleteToEnd"
motion:dragDirection="dragRight" />
</Transition>
<Transition
android:id="@+id/transition_to_start"
motion:constraintSetStart="@+id/end"
motion:constraintSetEnd="@+id/start"
motion:autoTransition="animateToEnd">
</Transition>
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/button"
android:layout_width="64dp"
android:layout_height="64dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintTop_toTopOf="parent" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/button"
android:layout_width="64dp"
android:layout_height="64dp"
motion:layout_constraintBottom_toBottomOf="parent"
motion:layout_constraintStart_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"/>
</ConstraintSet>
</MotionScene>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ConstraintSet android:id="@+id/start">
<Constraint android:id="@+id/material_card_view_item_post_with_preview" />
</ConstraintSet>
<ConstraintSet android:id="@+id/end">
<Constraint android:id="@id/material_card_view_item_post_with_preview"
android:layout_width="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_percent="0.7" />
</ConstraintSet>
<Transition
app:constraintSetEnd="@id/end"
app:constraintSetStart="@+id/start">
<OnSwipe
app:dragDirection="dragRight"
app:touchAnchorId="@id/material_card_view_item_post_with_preview"
app:touchAnchorSide="right" />
</Transition>
</MotionScene>

View File

@@ -12,6 +12,7 @@
<SwitchPreference
app:defaultValue="false"
app:key="amoled_dark"
app:icon="@drawable/ic_amoled_theme_preference_24dp"
app:title="@string/settings_amoled_dark_title" />
<PreferenceCategory
@@ -40,9 +41,19 @@
app:icon="@drawable/ic_edit_24dp"
app:title="@string/settings_manage_themes_title" />
<Preference
app:icon="@drawable/ic_info_preference_24dp"
app:summary="@string/settings_custom_theme_cannot_apply_to_settings_page_summary"
app:enabled="false" />
<PreferenceCategory
app:title="@string/settings_category_material_you_title" />
<Preference
app:icon="@drawable/ic_info_preference_24dp"
app:summary="@string/settings_enable_material_you_warning_summary"
app:enabled="false" />
<SwitchPreference
app:defaultValue="false"
app:key="enable_material_you"
@@ -50,8 +61,8 @@
app:summary="@string/settings_enable_material_you_summary" />
<Preference
app:icon="@drawable/ic_info_preference_24dp"
app:summary="@string/settings_custom_theme_cannot_apply_to_settings_page_summary"
app:enabled="false" />
app:key="apply_material_you"
app:title="@string/settings_apply_material_you_title"
app:summary="@string/settings_apply_material_you_summary" />
</PreferenceScreen>