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

@ -1,5 +1,7 @@
package ml.docilealligator.infinityforreddit.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
@ -10,6 +12,7 @@ import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -17,6 +20,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -29,18 +35,27 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Adapter.CustomThemeListingRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.AsyncTask.ChangeThemeNameAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.DeleteThemeAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCustomThemeAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.InsertCustomThemeAsyncTask;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeViewModel;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Fragment.CreateThemeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.CustomThemeOptionsBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Fragment.SelectBaseThemeBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
public class CustomThemeListingActivity extends BaseActivity implements CustomThemeOptionsBottomSheetFragment.CustomThemeOptionsBottomSheetFragmentListener {
import static android.content.ClipDescription.MIMETYPE_TEXT_PLAIN;
public class CustomThemeListingActivity extends BaseActivity implements
CustomThemeOptionsBottomSheetFragment.CustomThemeOptionsBottomSheetFragmentListener,
CreateThemeBottomSheetFragment.SelectBaseThemeBottomSheetFragmentListener {
@BindView(R.id.coordinator_layout_custom_theme_listing_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_customize_theme_listing_activity)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_customize_theme_listing_activity)
@ -94,8 +109,8 @@ public class CustomThemeListingActivity extends BaseActivity implements CustomTh
customThemeViewModel.getAllCustomThemes().observe(this, adapter::setUserThemes);
fab.setOnClickListener(view -> {
SelectBaseThemeBottomSheetFragment selectBaseThemeBottomSheetFragment = new SelectBaseThemeBottomSheetFragment();
selectBaseThemeBottomSheetFragment.show(getSupportFragmentManager(), selectBaseThemeBottomSheetFragment.getTag());
CreateThemeBottomSheetFragment createThemeBottomSheetFragment = new CreateThemeBottomSheetFragment();
createThemeBottomSheetFragment.show(getSupportFragmentManager(), createThemeBottomSheetFragment.getTag());
});
}
@ -124,10 +139,10 @@ public class CustomThemeListingActivity extends BaseActivity implements CustomTh
}
@Override
public void changeName(String oldName) {
public void changeName(String oldThemeName) {
View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_theme_name, null);
EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_theme_name_dialog);
themeNameEditText.setText(oldName);
themeNameEditText.setText(oldThemeName);
themeNameEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
@ -141,13 +156,9 @@ public class CustomThemeListingActivity extends BaseActivity implements CustomTh
if (imm != null) {
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
}
new ChangeThemeNameAsyncTask(redditDataRoomDatabase, oldName, themeNameEditText.getText().toString()).execute();
})
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {
if (imm != null) {
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
}
new ChangeThemeNameAsyncTask(redditDataRoomDatabase, oldThemeName, themeNameEditText.getText().toString()).execute();
})
.setNegativeButton(R.string.cancel, null)
.setOnDismissListener(dialogInterface -> {
if (imm != null) {
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
@ -157,12 +168,31 @@ public class CustomThemeListingActivity extends BaseActivity implements CustomTh
}
@Override
public void delete(String name) {
public void shareTheme(String themeName) {
new GetCustomThemeAsyncTask(redditDataRoomDatabase, themeName, customTheme -> {
if (customTheme != null) {
String jsonModel = customTheme.getJSONModel();
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null) {
ClipData clip = ClipData.newPlainText("simple text", jsonModel);
clipboard.setPrimaryClip(clip);
Snackbar.make(coordinatorLayout, R.string.theme_copied, Snackbar.LENGTH_SHORT).show();
} else {
Snackbar.make(coordinatorLayout, R.string.copy_theme_faied, Snackbar.LENGTH_SHORT).show();
}
} else {
Snackbar.make(coordinatorLayout, R.string.cannot_find_theme, Snackbar.LENGTH_SHORT).show();
}
}).execute();
}
@Override
public void delete(String themeName) {
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.delete_theme)
.setMessage(getString(R.string.delete_theme_dialog_message, name))
.setMessage(getString(R.string.delete_theme_dialog_message, themeName))
.setPositiveButton(R.string.yes, (dialogInterface, i)
-> new DeleteThemeAsyncTask(redditDataRoomDatabase, name, (isLightTheme, isDarkTheme, isAmoledTheme) -> {
-> new DeleteThemeAsyncTask(redditDataRoomDatabase, themeName, (isLightTheme, isDarkTheme, isAmoledTheme) -> {
if (isLightTheme) {
CustomThemeSharedPreferencesUtils.insertThemeToSharedPreferences(
CustomThemeWrapper.getIndigo(CustomThemeListingActivity.this), lightThemeSharedPreferences);
@ -187,8 +217,101 @@ public class CustomThemeListingActivity extends BaseActivity implements CustomTh
EventBus.getDefault().unregister(this);
}
public void shareTheme(CustomTheme customTheme) {
if (customTheme != null) {
String jsonModel = customTheme.getJSONModel();
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null) {
ClipData clip = ClipData.newPlainText("simple text", jsonModel);
clipboard.setPrimaryClip(clip);
Snackbar.make(coordinatorLayout, R.string.theme_copied, Snackbar.LENGTH_SHORT).show();
} else {
Snackbar.make(coordinatorLayout, R.string.copy_theme_faied, Snackbar.LENGTH_SHORT).show();
}
} else {
Snackbar.make(coordinatorLayout, R.string.cannot_find_theme, Snackbar.LENGTH_SHORT).show();
}
}
@Subscribe
public void onRecreateActivityEvent(RecreateActivityEvent recreateActivityEvent) {
recreate();
}
@Override
public void importTheme() {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null) {
// If it does contain data, decide if you can handle the data.
if (!clipboard.hasPrimaryClip()) {
Snackbar.make(coordinatorLayout, R.string.no_data_in_clipboard, Snackbar.LENGTH_SHORT).show();
} else if (clipboard.getPrimaryClipDescription() != null &&
!clipboard.getPrimaryClipDescription().hasMimeType(MIMETYPE_TEXT_PLAIN)) {
// since the clipboard has data but it is not plain text
Snackbar.make(coordinatorLayout, R.string.no_data_in_clipboard, Snackbar.LENGTH_SHORT).show();
} else if (clipboard.getPrimaryClip() != null){
ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
String json = item.getText().toString();
try {
CustomTheme customTheme = new Gson().fromJson(json, CustomTheme.class);
checkDuplicateAndImportTheme(customTheme, true);
} catch (JsonSyntaxException e) {
Snackbar.make(coordinatorLayout, R.string.parse_theme_failed, Snackbar.LENGTH_SHORT).show();
}
}
}
}
private void checkDuplicateAndImportTheme(CustomTheme customTheme, boolean checkDuplicate) {
new InsertCustomThemeAsyncTask(redditDataRoomDatabase, lightThemeSharedPreferences,
darkThemeSharedPreferences, amoledThemeSharedPreferences, customTheme, checkDuplicate,
new InsertCustomThemeAsyncTask.InsertCustomThemeAsyncTaskListener() {
@Override
public void success() {
Snackbar.make(coordinatorLayout, R.string.import_theme_success, Snackbar.LENGTH_SHORT).show();
}
@Override
public void duplicate() {
new MaterialAlertDialogBuilder(CustomThemeListingActivity.this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.duplicate_theme_name_dialog_title)
.setMessage(getString(R.string.duplicate_theme_name_dialog_message, customTheme.name))
.setPositiveButton(R.string.rename, (dialogInterface, i)
-> {
View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_theme_name, null);
EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_theme_name_dialog);
themeNameEditText.setText(customTheme.name);
themeNameEditText.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
new MaterialAlertDialogBuilder(CustomThemeListingActivity.this, R.style.MaterialAlertDialogTheme)
.setTitle(R.string.edit_theme_name)
.setView(dialogView)
.setPositiveButton(R.string.ok, (editTextDialogInterface, i1)
-> {
if (imm != null) {
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
}
if (!themeNameEditText.getText().toString().equals("")) {
customTheme.name = themeNameEditText.getText().toString();
}
checkDuplicateAndImportTheme(customTheme, true);
})
.setNegativeButton(R.string.cancel, null)
.setOnDismissListener(editTextDialogInterface -> {
if (imm != null) {
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
}
})
.show();
})
.setNegativeButton(R.string.override, (dialogInterface, i) -> {
checkDuplicateAndImportTheme(customTheme, false);
})
.show();
}
}).execute();
}
}

View File

@ -198,7 +198,8 @@ public class CustomizeThemeActivity extends BaseActivity {
}
CustomTheme customTheme = CustomTheme.convertSettingsItemsToCustomTheme(customThemeSettingsItems, themeName);
new InsertCustomThemeAsyncTask(redditDataRoomDatabase, lightThemeSharedPreferences,
darkThemeSharedPreferences, amoledThemeSharedPreferences, customTheme, () -> {
darkThemeSharedPreferences, amoledThemeSharedPreferences, customTheme,
false, () -> {
Toast.makeText(CustomizeThemeActivity.this, R.string.saved, Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new RecreateActivityEvent());
finish();

View File

@ -18,6 +18,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.CustomThemeListingActivity;
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme;
import ml.docilealligator.infinityforreddit.Fragment.CustomThemeOptionsBottomSheetFragment;
@ -90,7 +91,7 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<
activity.startActivity(intent);
});
((UserCustomThemeViewHolder) holder).shareImageView.setOnClickListener(view -> {
((CustomThemeListingActivity) activity).shareTheme(customTheme);
});
((UserCustomThemeViewHolder) holder).itemView.setOnClickListener(view -> {
CustomThemeOptionsBottomSheetFragment customThemeOptionsBottomSheetFragment = new CustomThemeOptionsBottomSheetFragment();

View File

@ -13,22 +13,27 @@ public class InsertCustomThemeAsyncTask extends AsyncTask<Void, Void, Void> {
private SharedPreferences darkThemeSharedPreferences;
private SharedPreferences amoledThemeSharedPreferences;
private CustomTheme customTheme;
private boolean checkDuplicate;
private InsertCustomThemeAsyncTaskListener insertCustomThemeAsyncTaskListener;
private boolean isDuplicate = false;
public interface InsertCustomThemeAsyncTaskListener {
void success();
default void duplicate() {}
}
public InsertCustomThemeAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase,
SharedPreferences lightThemeSharedPreferences,
SharedPreferences darkThemeSharedPreferences,
SharedPreferences amoledThemeSharedPreferences, CustomTheme customTheme,
SharedPreferences amoledThemeSharedPreferences,
CustomTheme customTheme, boolean checkDuplicate,
InsertCustomThemeAsyncTaskListener insertCustomThemeAsyncTaskListener) {
this.redditDataRoomDatabase = redditDataRoomDatabase;
this.lightThemeSharedPreferences = lightThemeSharedPreferences;
this.darkThemeSharedPreferences = darkThemeSharedPreferences;
this.amoledThemeSharedPreferences = amoledThemeSharedPreferences;
this.customTheme = customTheme;
this.checkDuplicate = checkDuplicate;
this.insertCustomThemeAsyncTaskListener = insertCustomThemeAsyncTaskListener;
}
@ -46,6 +51,12 @@ public class InsertCustomThemeAsyncTask extends AsyncTask<Void, Void, Void> {
redditDataRoomDatabase.customThemeDao().unsetAmoledTheme();
CustomThemeSharedPreferencesUtils.insertThemeToSharedPreferences(customTheme, amoledThemeSharedPreferences);
}
if (checkDuplicate) {
if (redditDataRoomDatabase.customThemeDao().getCustomTheme(customTheme.name) != null) {
isDuplicate = true;
return null;
}
}
redditDataRoomDatabase.customThemeDao().insert(customTheme);
return null;
}
@ -53,6 +64,10 @@ public class InsertCustomThemeAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
insertCustomThemeAsyncTaskListener.success();
if (isDuplicate) {
insertCustomThemeAsyncTaskListener.duplicate();
} else {
insertCustomThemeAsyncTaskListener.success();
}
}
}

View File

@ -5,6 +5,8 @@ import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import com.google.gson.Gson;
import java.util.ArrayList;
@Entity(tableName = "custom_themes")
@ -150,10 +152,17 @@ public class CustomTheme {
@ColumnInfo(name = "is_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface")
public boolean isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface;
public CustomTheme() {}
public CustomTheme(@NonNull String name) {
this.name = name;
}
public String getJSONModel() {
Gson gson = new Gson();
return gson.toJson(this);
}
public static CustomTheme convertSettingsItemsToCustomTheme(ArrayList<CustomThemeSettingsItem> customThemeSettingsItems, String themeName) {
CustomTheme customTheme = new CustomTheme(themeName);

View File

@ -98,7 +98,7 @@ public class CopyTextBottomSheetFragment extends RoundedBottomSheetDialogFragmen
clipboard.setPrimaryClip(clip);
Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity, R.string.copy_failed, Toast.LENGTH_SHORT).show();
Toast.makeText(activity, R.string.copy_link_failed, Toast.LENGTH_SHORT).show();
}
}

View File

@ -22,25 +22,37 @@ import ml.docilealligator.infinityforreddit.R;
/**
* A simple {@link Fragment} subclass.
*/
public class SelectBaseThemeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
public class CreateThemeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
@BindView(R.id.light_theme_text_view_select_base_theme_bottom_sheet_fragment)
@BindView(R.id.import_theme_text_view_create_theme_bottom_sheet_fragment)
TextView importTextView;
@BindView(R.id.light_theme_text_view_create_theme_bottom_sheet_fragment)
TextView lightThemeTextView;
@BindView(R.id.dark_theme_text_view_select_base_theme_bottom_sheet_fragment)
@BindView(R.id.dark_theme_text_view_create_theme_bottom_sheet_fragment)
TextView darkThemeTextView;
@BindView(R.id.amoled_theme_text_view_select_base_theme_bottom_sheet_fragment)
@BindView(R.id.amoled_theme_text_view_create_theme_bottom_sheet_fragment)
TextView amoledThemeTextView;
private Activity activity;
public SelectBaseThemeBottomSheetFragment() {
public interface SelectBaseThemeBottomSheetFragmentListener {
void importTheme();
}
public CreateThemeBottomSheetFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_select_base_theme_bottom_sheet, container, false);
View rootView = inflater.inflate(R.layout.fragment_create_theme_bottom_sheet, container, false);
ButterKnife.bind(this, rootView);
importTextView.setOnClickListener(view -> {
((SelectBaseThemeBottomSheetFragmentListener) activity).importTheme();
dismiss();
});
lightThemeTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
intent.putExtra(CustomizeThemeActivity.EXTRA_CREATE_THEME, true);

View File

@ -7,8 +7,6 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -16,7 +14,6 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import butterknife.BindView;
import butterknife.ButterKnife;
@ -47,8 +44,9 @@ public class CustomThemeOptionsBottomSheetFragment extends RoundedBottomSheetDia
}
public interface CustomThemeOptionsBottomSheetFragmentListener {
void changeName(String oldName);
void delete(String name);
void changeName(String oldThemeName);
void shareTheme(String themeName);
void delete(String themeName);
}
@Override
@ -68,6 +66,7 @@ public class CustomThemeOptionsBottomSheetFragment extends RoundedBottomSheetDia
});
shareThemeTextView.setOnClickListener(view -> {
((CustomThemeOptionsBottomSheetFragmentListener) activity).shareTheme(themeName);
dismiss();
});

View File

@ -130,7 +130,7 @@ public class ShareLinkBottomSheetFragment extends RoundedBottomSheetDialogFragme
clipboard.setPrimaryClip(clip);
Toast.makeText(activity, R.string.copy_success, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity, R.string.copy_failed, Toast.LENGTH_SHORT).show();
Toast.makeText(activity, R.string.copy_link_failed, Toast.LENGTH_SHORT).show();
}
}

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>