Implemented share and import themes. Fixed some issues of custom theme.

This commit is contained in:
Alex Ning
2020-03-27 18:08:58 +08:00
parent f40b9cbde0
commit 1cfdaf41fa
19 changed files with 276 additions and 53 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:pathData="M13,5v6h1.17L12,13.17 9.83,11L11,11L11,5h2m2,-2L9,3v6L5,9l7,7 7,-7h-4L15,3zM19,18L5,18v2h14v-2z"
android:fillColor="#FFFFFF"/>
</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:pathData="M13,5v6h1.17L12,13.17 9.83,11L11,11L11,5h2m2,-2L9,3v6L5,9l7,7 7,-7h-4L15,3zM19,18L5,18v2h14v-2z"
android:fillColor="#000000"/>
</vector>

View File

@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/coordinator_layout_custom_theme_listing_activity"
tools:context=".Activity.CustomThemeListingActivity">
<com.google.android.material.appbar.AppBarLayout

View File

@@ -27,7 +27,8 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

View File

@@ -14,12 +14,21 @@
android:background="?attr/toolbarAndTabBackgroundColor"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_search_result_activity"
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false"
app:toolbarId="@+id/toolbar_search_result_activity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_search_result_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.tabs.TabLayout
android:id="@+id/tab_layout_search_result_activity"

View File

@@ -28,7 +28,8 @@
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

View File

@@ -28,7 +28,8 @@
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
</com.google.android.material.appbar.CollapsingToolbarLayout>

View File

@@ -11,7 +11,25 @@
android:orientation="vertical">
<TextView
android:id="@+id/light_theme_text_view_select_base_theme_bottom_sheet_fragment"
android:id="@+id/import_theme_text_view_create_theme_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:text="@string/import_theme"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:drawableStart="@drawable/ic_import_day_night_24dp"
android:drawablePadding="48dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/light_theme_text_view_create_theme_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
@@ -29,7 +47,7 @@
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/dark_theme_text_view_select_base_theme_bottom_sheet_fragment"
android:id="@+id/dark_theme_text_view_create_theme_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
@@ -47,7 +65,7 @@
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/amoled_theme_text_view_select_base_theme_bottom_sheet_fragment"
android:id="@+id/amoled_theme_text_view_create_theme_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"

View File

@@ -23,15 +23,6 @@
android:layout_gravity="center_vertical"
android:textColor="?attr/primaryTextColor" />
<ImageView
android:id="@+id/add_image_view_item_user_custom_theme"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="32dp"
android:src="@drawable/ic_add_day_night_24dp"
android:background="?attr/selectableItemBackgroundBorderless" />
<ImageView
android:id="@+id/share_image_view_item_user_custom_theme"
android:layout_width="24dp"
@@ -41,4 +32,13 @@
android:src="@drawable/ic_share_24dp"
android:background="?attr/selectableItemBackgroundBorderless" />
<ImageView
android:id="@+id/add_image_view_item_user_custom_theme"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="32dp"
android:src="@drawable/ic_add_day_night_24dp"
android:background="?attr/selectableItemBackgroundBorderless" />
</LinearLayout>

View File

@@ -431,7 +431,7 @@
<string name="copy_link">Copy Link</string>
<string name="copy_success">Copied</string>
<string name="copy_failed">Cannot copy the link</string>
<string name="copy_link_failed">Cannot copy the link</string>
<string name="copy_text">Copy</string>
<string name="copy_all">Copy All</string>
<string name="copy_markdown">Copy Markdown</string>
@@ -620,6 +620,20 @@
<string name="delete_theme_dialog_message">Are you sure to delete %1$s?</string>
<string name="share_theme">Share Theme</string>
<string name="change_theme_name">Change Name</string>
<string name="theme_copied">Copied! Paste and share it to other people.</string>
<string name="copy_theme_faied">Cannot copy the theme configuration</string>
<string name="cannot_find_theme">Cannot find this theme</string>
<string name="import_theme">Import Theme</string>
<string name="no_data_in_clipboard">Cannot find data in clipboard</string>
<string name="import_theme_success">Import theme successful</string>
<string name="parse_theme_failed">Parse Theme Failed</string>
<string name="share_theme_to_subreddit_dialog_title">Share it to r/Infinity_For_Reddit?</string>
<string name="share_theme_to_subreddit_dialog_message">The theme configuration is copied!
Do you want to share it to r/Infinity so that other people can use it?</string>
<string name="duplicate_theme_name_dialog_title">Duplicate Theme Found</string>
<string name="duplicate_theme_name_dialog_message">A theme in the database is also called %1$s. Do you want to change the name of this imported theme?</string>
<string name="rename">Rename</string>
<string name="override">Override</string>
<string name="color_picker">Color Picker</string>
<string name="invalid_color">Invalid Color</string>