Start implementing custom theme settings.

This commit is contained in:
Alex Ning
2020-03-19 12:20:23 +08:00
parent 71e22b3e36
commit 012736bff6
29 changed files with 952 additions and 42 deletions

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12.7,4.91C15.25,6.24 17,8.92 17,12s-1.75,5.76 -4.3,7.09c1.46,-2 2.3,-4.46 2.3,-7.09s-0.84,-5.09 -2.3,-7.09M9,2c-1.05,0 -2.05,0.16 -3,0.46 4.06,1.27 7,5.06 7,9.54s-2.94,8.27 -7,9.54c0.95,0.3 1.95,0.46 3,0.46 5.52,0 10,-4.48 10,-10S14.52,2 9,2z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM18,14.48L18,18h-3.52L12,20.48 9.52,18L6,18v-3.52L3.52,12 6,9.52L6,6h3.52L12,3.52 14.48,6L18,6v3.52L20.48,12 18,14.48zM12,6.5c-3.03,0 -5.5,2.47 -5.5,5.5s2.47,5.5 5.5,5.5 5.5,-2.47 5.5,-5.5 -2.47,-5.5 -5.5,-5.5zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
<size android:width="24dp" android:height="24dp"/>
</shape>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12.7,4.91C15.25,6.24 17,8.92 17,12s-1.75,5.76 -4.3,7.09c1.46,-2 2.3,-4.46 2.3,-7.09s-0.84,-5.09 -2.3,-7.09M9,2c-1.05,0 -2.05,0.16 -3,0.46 4.06,1.27 7,5.06 7,9.54s-2.94,8.27 -7,9.54c0.95,0.3 1.95,0.46 3,0.46 5.52,0 10,-4.48 10,-10S14.52,2 9,2z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM18,14.48L18,18h-3.52L12,20.48 9.52,18L6,18v-3.52L3.52,12 6,9.52L6,6h3.52L12,3.52 14.48,6L18,6v3.52L20.48,12 18,14.48zM12,6.5c-3.03,0 -5.5,2.47 -5.5,5.5s2.47,5.5 5.5,5.5 5.5,-2.47 5.5,-5.5 -2.47,-5.5 -5.5,-5.5zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
</vector>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
tools:context=".Activity.CustomizeThemeActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout_customize_theme_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/toolbarAndTabBackgroundColor"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar_layout_customize_theme_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false"
app:toolbarId="@+id/toolbar_customize_theme_activity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_customize_theme_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_customize_theme_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -2,7 +2,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinator_layout_settings_activity"
android:background="?attr/backgroundColor">
<com.google.android.material.appbar.AppBarLayout

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/color_image_view_item_theme_color_item"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/circular_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/theme_item_name_text_view_item_theme_color_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/color_image_view_item_theme_color_item"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/theme_item_info_text_view_item_theme_color_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/theme_item_name_text_view_item_theme_color_item"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/color_image_view_item_theme_color_item"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/theme_item_name_text_view_item_theme_switch_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/theme_item_info_text_view_item_theme_switch_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/theme_item_name_text_view_item_theme_switch_item"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/theme_item_switch_item_theme_switch_item" />
<Switch
android:id="@+id/theme_item_switch_item_theme_switch_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -357,6 +357,10 @@
<string name="settings_subreddit_summary">r/Infinity_For_Reddit</string>
<string name="settings_share_title">Share</string>
<string name="settings_share_summary">Share this app to other people if you enjoy it</string>
<string name="settings_category_customization_title">Customization</string>
<string name="settings_customize_light_theme_title">Light Theme</string>
<string name="settings_customize_dark_theme_title">Dark Theme</string>
<string name="settings_customize_amoled_theme_title">Amoled Theme</string>
<string name="no_link_available">Cannot get the link</string>
@@ -460,6 +464,138 @@
<string name="save_image_before_sharing">Saving the image. Please wait.</string>
<string name="save_gif_before_sharing">Saving the gif. Please wait.</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="customize_light_theme_fragment_title">Customize Light Theme</string>
<string name="customize_dark_theme_fragment_title">Customize Dark Theme</string>
<string name="customize_amoled_theme_fragment_title">Customize Amoled Theme</string>
<string name="theme_item_color_primary">Color Primary</string>
<string name="theme_item_color_primary_detail">Applied to: Toolbar</string>
<string name="theme_item_color_primary_dark">Color Primary Dark</string>
<string name="theme_item_color_primary_dark_detail">Applied to: Status Bar</string>
<string name="theme_item_color_accent">Color Accent</string>
<string name="theme_item_color_accent_detail">Applied to: Progress Bar, etc</string>
<string name="theme_item_color_primary_light_theme">Color Primary Light Theme</string>
<string name="theme_item_color_primary_light_theme_detail">Has effect only when this theme is set as light theme.\nApplied to: background of Floating Action Button and Button</string>
<string name="theme_item_primary_text_color">Primary Text Color</string>
<string name="theme_item_primary_text_color_detail">Applied to: Primary text</string>
<string name="theme_item_secondary_text_color">Secondary Text Color</string>
<string name="theme_item_secondary_text_color_detail">Applied to: Secondary text</string>
<string name="theme_item_post_title_color">Post Title Color</string>
<string name="theme_item_post_title_color_detail">Applied to: Post title</string>
<string name="theme_item_post_content_color">Post Content Color</string>
<string name="theme_item_post_content_color_detail">Applied to: Post content</string>
<string name="theme_item_comment_color">Comment Color</string>
<string name="theme_item_comment_color_detail">Applied to: Comment</string>
<string name="theme_item_button_text_color">Button Text Color</string>
<string name="theme_item_button_text_color_detail">Applied to: Text on button</string>
<string name="theme_item_chip_text_color">Chip Text Color</string>
<string name="theme_item_chip_text_color_detail">Applied to: Subscribe Button</string>
<string name="theme_item_background_color">Background Color</string>
<string name="theme_item_background_color_detail">Applied to: Background of every page and navigation drawer</string>
<string name="theme_item_card_view_background_color">Card View Background Color</string>
<string name="theme_item_card_view_background_color_detail">Applied to: Post background and message background</string>
<string name="theme_item_comment_background_color">Comment Background Color</string>
<string name="theme_item_comment_background_color_detail">Applied to: Comment background</string>
<string name="theme_item_bottom_app_bar_background_color">Bottom Navigation Bar Color</string>
<string name="theme_item_bottom_app_bar_background_color_detail">Applied to: Bottom navigation bar</string>
<string name="theme_item_primary_icon_color">Primary Icon Color</string>
<string name="theme_item_primary_icon_color_detail">Applied to: Icons in the bottom navigation bar and the navigation drawer.</string>
<string name="theme_item_post_icon_and_info_color">Post Icon and Info Color</string>
<string name="theme_item_post_icon_and_info_color_detail">Applied to: Icons, score and the number of comments in posts</string>
<string name="theme_item_comment_icon_and_info_color">Comment Icon and Info Color</string>
<string name="theme_item_comment_icon_and_info_color_detail">Applied to: Icons and score in comments</string>
<string name="theme_item_fab_icon_color">Floating Action Button Icon Color</string>
<string name="theme_item_fab_icon_color_detail">Applied to: Floating action button icon</string>
<string name="theme_item_toolbar_primary_text_and_icon_color">Toolbar Primary Text and Icon Color</string>
<string name="theme_item_toolbar_primary_text_and_icon_color_detail">Applied to: Primary texts and icons in toolbars</string>
<string name="theme_item_toolbar_secondary_text_color">Toolbar Secondary Text Color</string>
<string name="theme_item_toolbar_secondary_text_color_detail">Applied to: Secondary texts in toolbars</string>
<string name="theme_item_circular_progress_bar_background_color">Circular Progress Bar Background Color</string>
<string name="theme_item_circular_progress_bar_background_color_detail">Applied to: Background of Circular progress bar</string>
<string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background">Background Color of Tab Layout in Expanded Toolbar</string>
<string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail">Applied to: Tab layout background (expanded toolbar)</string>
<string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color">Text Color of Tab Layout in Expanded Toolbar</string>
<string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail">Applied to: Tab layout text color (expanded toolbar)</string>
<string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">Tab Indicator Color of Tab Layout in Expanded Toolbar</string>
<string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">Applied to: Tab indicator color in tab layout (expanded toolbar)</string>
<string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background">Background Color of Tab Layout in Collapsed Toolbar</string>
<string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail">Applied to: Tab layout background (collapsed toolbar)</string>
<string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color">Text Color of Tab Layout in Collapsed Toolbar</string>
<string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">Applied to: Tab layout text color (collapsed toolbar)</string>
<string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">Tab Indicator Color of Tab Layout in Collapsed Toolbar</string>
<string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">Applied to: Tab indicator color in tab layout (collapsed toolbar)</string>
<string name="theme_item_upvoted_color">Upvoted Color</string>
<string name="theme_item_upvoted_color_detail">Applied to: Vote buttons and scores (upvoted)</string>
<string name="theme_item_downvoted_color">Downvoted Color</string>
<string name="theme_item_downvoted_color_detail">Applied to: Vote buttons and scores (downvoted)</string>
<string name="theme_item_post_type_background_color">Post Type Background Color</string>
<string name="theme_item_post_type_background_color_detail">Applied to: Background of the post type (IMAGE, TEXT, VIDEO, GIF, LINK)</string>
<string name="theme_item_post_type_text_color">Post Type Text Color</string>
<string name="theme_item_post_type_text_color_detail">Applied to: Text color of the post type (IMAGE, TEXT, VIDEO, GIF LINK)</string>
<string name="theme_item_spoiler_background_color">Spoiler Background Color</string>
<string name="theme_item_spoiler_background_color_detail">Applied to: Background of the spoiler tag</string>
<string name="theme_item_spoiler_text_color">Spoiler Text Color</string>
<string name="theme_item_spoiler_text_color_detail">Applied to: Text color in the spoiler tag</string>
<string name="theme_item_nsfw_background_color">NSFW Background Color</string>
<string name="theme_item_nsfw_background_color_detail">Applied to: Background of the NSFW tag</string>
<string name="theme_item_nsfw_text_color">NSFW text color</string>
<string name="theme_item_nsfw_text_color_detail">Applied to: Text color of the NSFW tag</string>
<string name="theme_item_flair_background_color">Flair Background Color</string>
<string name="theme_item_flair_background_color_detail">Applied to: Background of the flair tag</string>
<string name="theme_item_flair_text_color">Flair Text Color</string>
<string name="theme_item_flair_text_color_detail">Applied to: Text color of the flair tag</string>
<string name="theme_item_archived_tint">Archived Icon Color</string>
<string name="theme_item_archived_tint_detail">Applied to: Archived icon</string>
<string name="theme_item_locked_icon_tint">Locked Icon Color</string>
<string name="theme_item_locked_icon_tint_detail">Applied to: Locked icon</string>
<string name="theme_item_crosspost_icon_tint">Crosspost Icon Color</string>
<string name="theme_item_crosspost_icon_tint_detail">Applied to: Crosspost icon</string>
<string name="theme_item_stickied_post_icon_tint">Stickied Post Icon Color</string>
<string name="theme_item_stickied_post_icon_tint_detail">Applied to: Stickied post icon</string>
<string name="theme_item_subscribed_color">Subscribed</string>
<string name="theme_item_subscribed_color_detail">Applied to: Unsubscribe button</string>
<string name="theme_item_unsubscribed_color">Unsubscribed</string>
<string name="theme_item_unsubscribed_color_detail">Applied to: Sbscribe button</string>
<string name="theme_item_username_color">Username Color</string>
<string name="theme_item_username_color_detail">Applied to: Username</string>
<string name="theme_item_subreddit_color">Subreddit Color</string>
<string name="theme_item_subreddit_color_detail">Applied to: Subreddit name</string>
<string name="theme_item_author_flair_text_color">Author Flair Color</string>
<string name="theme_item_author_flair_text_color_detail">Applied to: Author flair in comments</string>
<string name="theme_item_submitter_color">Submitter</string>
<string name="theme_item_submitter_color_detail">Applied to: Submitter in comments</string>
<string name="theme_item_moderator_color">Moderator</string>
<string name="theme_item_moderator_color_detail">Applied to: Moderator in comments</string>
<string name="theme_item_single_comment_thread_background_color">Single Comment Thread Background Color</string>
<string name="theme_item_single_comment_thread_background_color_detail">Applied to: Single Comment</string>
<string name="theme_item_unread_message_background_color">Unread Message Background Color</string>
<string name="theme_item_unread_message_background_color_detail">Applied to: Unread Message Background Color</string>
<string name="theme_item_divider_color">Divider Color</string>
<string name="theme_item_divider_color_detail">Applied to: Comment divider, dividers in pages for submitting posts, etc.</string>
<string name="theme_item_no_preview_link_background_color">No-Preview Link Background Color</string>
<string name="theme_item_no_preview_link_background_color_detail">Applied to: No-preview link placeholder</string>
<string name="theme_item_vote_and_reply_unavailable_button_color">Vote and Reply Unavailable Button Color</string>
<string name="theme_item_vote_and_reply_unavailable_button_color_detail">Applied to: Vote and reply buttons (Unavailable)</string>
<string name="theme_item_comment_vertical_bar_color_1">Comment Vertical Bar Color 1</string>
<string name="theme_item_comment_vertical_bar_color_1_detail">Applied to: Comment Vertical Bar (Level 1)</string>
<string name="theme_item_comment_vertical_bar_color_2">Comment Vertical Bar Color 2</string>
<string name="theme_item_comment_vertical_bar_color_2_detail">Applied to: Comment Vertical Bar (Level 2)</string>
<string name="theme_item_comment_vertical_bar_color_3">Comment Vertical Bar Color 3</string>
<string name="theme_item_comment_vertical_bar_color_3_detail">Applied to: Comment Vertical Bar (Level 3)</string>
<string name="theme_item_comment_vertical_bar_color_4">Comment Vertical Bar Color 4</string>
<string name="theme_item_comment_vertical_bar_color_4_detail">Applied to: Comment Vertical Bar (Level 4)</string>
<string name="theme_item_comment_vertical_bar_color_5">Comment Vertical Bar Color 5</string>
<string name="theme_item_comment_vertical_bar_color_5_detail">Applied to: Comment Vertical Bar (Level 5)</string>
<string name="theme_item_comment_vertical_bar_color_6">Comment Vertical Bar Color 6</string>
<string name="theme_item_comment_vertical_bar_color_6_detail">Applied to: Comment Vertical Bar (Level 6)</string>
<string name="theme_item_comment_vertical_bar_color_7">Comment Vertical Bar Color 7</string>
<string name="theme_item_comment_vertical_bar_color_7_detail">Applied to: Comment Vertical Bar (Level 7)</string>
<string name="theme_item_nav_bar_color">Navigation Bar Color</string>
<string name="theme_item_nav_bar_color_detail">Applied to: Navigation bar</string>
<string name="theme_item_light_status_bar">Dark Status Bar Icon Color</string>
<string name="theme_item_light_nav_bar">Dark Navigation Bar Icon Color</string>
<string name="theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface">Change Status Bar Icon Color After Toolbar Collapsed In Immersive Interface</string>
<string name="theme_item_available_on_android_8">Only available for Android 8.0 or above.</string>
<string name="theme_item_available_on_android_6">Only available for Android 6.0 or above.</string>
</resources>

View File

@@ -15,4 +15,22 @@
app:key="amoled_dark"
app:title="@string/settings_amoled_dark_title" />
<PreferenceCategory
app:title="@string/settings_category_customization_title" />
<Preference
app:key="customize_light_theme"
app:icon="@drawable/ic_light_theme_preference_24dp"
app:title="@string/settings_customize_light_theme_title" />
<Preference
app:key="customize_dark_theme"
app:icon="@drawable/ic_dark_theme_preference_24dp"
app:title="@string/settings_customize_dark_theme_title" />
<Preference
app:key="customize_amoled_theme"
app:icon="@drawable/ic_dark_theme_preference_24dp"
app:title="@string/settings_customize_amoled_theme_title" />
</PreferenceScreen>