mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-26 17:44:45 +01:00
Still implementing custom themes.
This commit is contained in:
parent
0694c471c4
commit
3dca261dea
@ -27,6 +27,7 @@
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".Activity.CustomizeThemeActivity"
|
||||
android:label="@string/customize_theme_activity_label"
|
||||
android:parentActivityName=".Activity.MainActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
|
@ -1,8 +1,12 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@ -11,6 +15,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
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 javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
@ -18,13 +24,17 @@ import javax.inject.Named;
|
||||
import butterknife.BindView;
|
||||
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.CustomTheme.CustomThemeViewModel;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
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;
|
||||
|
||||
public class CustomThemeListingActivity extends BaseActivity {
|
||||
public class CustomThemeListingActivity extends BaseActivity implements CustomThemeOptionsBottomSheetFragment.CustomThemeOptionsBottomSheetFragmentListener {
|
||||
|
||||
@BindView(R.id.appbar_layout_customize_theme_listing_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@ -32,6 +42,8 @@ public class CustomThemeListingActivity extends BaseActivity {
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.recycler_view_customize_theme_listing_activity)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.fab_custom_theme_listing_activity)
|
||||
FloatingActionButton fab;
|
||||
@Inject
|
||||
@Named("default")
|
||||
SharedPreferences sharedPreferences;
|
||||
@ -64,6 +76,11 @@ public class CustomThemeListingActivity extends BaseActivity {
|
||||
new CustomThemeViewModel.Factory(redditDataRoomDatabase))
|
||||
.get(CustomThemeViewModel.class);
|
||||
customThemeViewModel.getAllCustomThemes().observe(this, adapter::setUserThemes);
|
||||
|
||||
fab.setOnClickListener(view -> {
|
||||
SelectBaseThemeBottomSheetFragment selectBaseThemeBottomSheetFragment = new SelectBaseThemeBottomSheetFragment();
|
||||
selectBaseThemeBottomSheetFragment.show(getSupportFragmentManager(), selectBaseThemeBottomSheetFragment.getTag());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,4 +106,42 @@ public class CustomThemeListingActivity extends BaseActivity {
|
||||
protected void applyCustomTheme() {
|
||||
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeName(String oldName) {
|
||||
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.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
}
|
||||
new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
|
||||
.setTitle(R.string.edit_theme_name)
|
||||
.setView(dialogView)
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i)
|
||||
-> {
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
|
||||
}
|
||||
new ChangeThemeNameAsyncTask(redditDataRoomDatabase, oldName, themeNameEditText.getText().toString());
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
|
||||
}
|
||||
})
|
||||
.setOnDismissListener(dialogInterface -> {
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String name) {
|
||||
new DeleteThemeAsyncTask(redditDataRoomDatabase, name).execute();
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,12 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
@ -43,9 +45,12 @@ public class CustomizeThemeActivity extends BaseActivity {
|
||||
public static final int EXTRA_AMOLED_THEME = CustomThemeSharedPreferencesUtils.AMOLED;
|
||||
public static final String EXTRA_THEME_NAME = "ETN";
|
||||
public static final String EXTRA_IS_PREDEFIINED_THEME = "EIPT";
|
||||
public static final String EXTRA_CREATE_THEME = "ECT";
|
||||
private static final String CUSTOM_THEME_SETTINGS_ITEMS_STATE = "CTSIS";
|
||||
private static final String THEME_NAME_STATE = "TNS";
|
||||
|
||||
@BindView(R.id.coordinator_customize_theme_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_customize_theme_activity)
|
||||
AppBarLayout appBarLayout;
|
||||
@BindView(R.id.toolbar_customize_theme_activity)
|
||||
@ -88,6 +93,10 @@ public class CustomizeThemeActivity extends BaseActivity {
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (getIntent().getBooleanExtra(EXTRA_CREATE_THEME, false)) {
|
||||
setTitle(R.string.customize_theme_activity_create_theme_label);
|
||||
}
|
||||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
@ -132,7 +141,6 @@ public class CustomizeThemeActivity extends BaseActivity {
|
||||
themeName = customTheme.name;
|
||||
}
|
||||
|
||||
setTitle(themeName);
|
||||
adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme);
|
||||
recyclerView.setAdapter(adapter);
|
||||
adapter.setCustomThemeSettingsItem(customThemeSettingsItems);
|
||||
@ -142,14 +150,12 @@ public class CustomizeThemeActivity extends BaseActivity {
|
||||
themeName = getIntent().getStringExtra(EXTRA_THEME_NAME);
|
||||
adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme);
|
||||
recyclerView.setAdapter(adapter);
|
||||
setTitle(themeName);
|
||||
if (isPredefinedTheme) {
|
||||
customThemeSettingsItems = CustomThemeSettingsItem.convertCustomThemeToSettingsItem(
|
||||
CustomizeThemeActivity.this,
|
||||
CustomThemeWrapper.getPredefinedCustomTheme(this, themeName),
|
||||
androidVersion);
|
||||
|
||||
setTitle(themeName);
|
||||
adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme);
|
||||
recyclerView.setAdapter(adapter);
|
||||
adapter.setCustomThemeSettingsItem(customThemeSettingsItems);
|
||||
@ -184,13 +190,20 @@ public class CustomizeThemeActivity extends BaseActivity {
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_save_customize_theme_activity:
|
||||
CustomTheme customTheme = CustomTheme.convertSettingsItemsToCustomTheme(customThemeSettingsItems, themeName);
|
||||
new InsertCustomThemeAsyncTask(redditDataRoomDatabase, lightThemeSharedPreferences,
|
||||
darkThemeSharedPreferences, amoledThemeSharedPreferences, customTheme, () -> {
|
||||
Toast.makeText(CustomizeThemeActivity.this, R.string.saved, Toast.LENGTH_SHORT).show();
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
finish();
|
||||
}).execute();
|
||||
if (adapter != null) {
|
||||
themeName = adapter.getThemeName();
|
||||
if (themeName.equals("")) {
|
||||
Snackbar.make(coordinatorLayout, R.string.no_theme_name, Snackbar.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
CustomTheme customTheme = CustomTheme.convertSettingsItemsToCustomTheme(customThemeSettingsItems, themeName);
|
||||
new InsertCustomThemeAsyncTask(redditDataRoomDatabase, lightThemeSharedPreferences,
|
||||
darkThemeSharedPreferences, amoledThemeSharedPreferences, customTheme, () -> {
|
||||
Toast.makeText(CustomizeThemeActivity.this, R.string.saved, Toast.LENGTH_SHORT).show();
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
finish();
|
||||
}).execute();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -201,8 +214,10 @@ public class CustomizeThemeActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelableArrayList(CUSTOM_THEME_SETTINGS_ITEMS_STATE, customThemeSettingsItems);
|
||||
outState.putString(THEME_NAME_STATE, themeName);
|
||||
if (adapter != null) {
|
||||
outState.putParcelableArrayList(CUSTOM_THEME_SETTINGS_ITEMS_STATE, customThemeSettingsItems);
|
||||
outState.putString(THEME_NAME_STATE, adapter.getThemeName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,8 @@
|
||||
package ml.docilealligator.infinityforreddit.Adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -10,6 +10,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -19,6 +20,7 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.CustomThemeOptionsBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
|
||||
public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
@ -27,12 +29,12 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<
|
||||
private static final int VIEW_TYPE_PREDEFINED_THEME_DIVIDER = 2;
|
||||
private static final int VIEW_TYPE_USER_THEME_DIVIDER = 3;
|
||||
|
||||
private Context context;
|
||||
private AppCompatActivity activity;
|
||||
private ArrayList<CustomTheme> predefinedCustomThemes;
|
||||
private ArrayList<CustomTheme> userCustomThemes;
|
||||
|
||||
public CustomThemeListingRecyclerViewAdapter(Context context, ArrayList<CustomTheme> predefinedCustomThemes) {
|
||||
this.context = context;
|
||||
public CustomThemeListingRecyclerViewAdapter(AppCompatActivity activity, ArrayList<CustomTheme> predefinedCustomThemes) {
|
||||
this.activity = activity;
|
||||
this.predefinedCustomThemes = predefinedCustomThemes;
|
||||
userCustomThemes = new ArrayList<>();
|
||||
}
|
||||
@ -72,25 +74,30 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<
|
||||
((PredefinedCustomThemeViewHolder) holder).colorPrimaryView.setBackgroundTintList(ColorStateList.valueOf(customTheme.colorPrimary));
|
||||
((PredefinedCustomThemeViewHolder) holder).nameTextView.setText(customTheme.name);
|
||||
((PredefinedCustomThemeViewHolder) holder).itemView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(context, CustomizeThemeActivity.class);
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, customTheme.name);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_IS_PREDEFIINED_THEME, true);
|
||||
context.startActivity(intent);
|
||||
activity.startActivity(intent);
|
||||
});
|
||||
} else if (holder instanceof UserCustomThemeViewHolder) {
|
||||
CustomTheme customTheme = userCustomThemes.get(position - predefinedCustomThemes.size() - 2);
|
||||
((UserCustomThemeViewHolder) holder).colorPrimaryView.setBackgroundTintList(ColorStateList.valueOf(customTheme.colorPrimary));
|
||||
((UserCustomThemeViewHolder) holder).nameTextView.setText(customTheme.name);
|
||||
((UserCustomThemeViewHolder) holder).deleteImageView.setOnClickListener(view -> {
|
||||
|
||||
((UserCustomThemeViewHolder) holder).createThemeImageView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, customTheme.name);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_CREATE_THEME, true);
|
||||
activity.startActivity(intent);
|
||||
});
|
||||
((UserCustomThemeViewHolder) holder).shareImageView.setOnClickListener(view -> {
|
||||
|
||||
});
|
||||
((UserCustomThemeViewHolder) holder).itemView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(context, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, customTheme.name);
|
||||
context.startActivity(intent);
|
||||
CustomThemeOptionsBottomSheetFragment customThemeOptionsBottomSheetFragment = new CustomThemeOptionsBottomSheetFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(CustomThemeOptionsBottomSheetFragment.EXTRA_THEME_NAME, customTheme.name);
|
||||
customThemeOptionsBottomSheetFragment.setArguments(bundle);
|
||||
customThemeOptionsBottomSheetFragment.show(activity.getSupportFragmentManager(), customThemeOptionsBottomSheetFragment.getTag());
|
||||
});
|
||||
} else if (holder instanceof PreDefinedThemeDividerViewHolder) {
|
||||
((TextView) ((PreDefinedThemeDividerViewHolder) holder).itemView).setText(R.string.predefined_themes);
|
||||
@ -115,6 +122,8 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<
|
||||
View colorPrimaryView;
|
||||
@BindView(R.id.name_text_view_item_predefined_custom_theme)
|
||||
TextView nameTextView;
|
||||
@BindView(R.id.add_image_view_item_predefined_custom_theme)
|
||||
ImageView createThemeImageView;
|
||||
|
||||
public PredefinedCustomThemeViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -128,8 +137,8 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter<
|
||||
View colorPrimaryView;
|
||||
@BindView(R.id.name_text_view_item_user_custom_theme)
|
||||
TextView nameTextView;
|
||||
@BindView(R.id.delete_image_view_item_user_custom_theme)
|
||||
ImageView deleteImageView;
|
||||
@BindView(R.id.add_image_view_item_user_custom_theme)
|
||||
ImageView createThemeImageView;
|
||||
@BindView(R.id.share_image_view_item_user_custom_theme)
|
||||
ImageView shareImageView;
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
package ml.docilealligator.infinityforreddit.Adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -11,6 +14,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
@ -40,7 +45,7 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
return VIEW_TYPE_THEME_NAME;
|
||||
} else if (position > 3 && position < customThemeSettingsItems.size() - 3) {
|
||||
} else if (position > 3 && position < customThemeSettingsItems.size() - 2) {
|
||||
return VIEW_TYPE_COLOR;
|
||||
}
|
||||
|
||||
@ -82,7 +87,36 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
} else if (holder instanceof ThemeNameItemViewHolder) {
|
||||
((ThemeNameItemViewHolder) holder).themeNameTextView.setText(themeName);
|
||||
holder.itemView.setOnClickListener(view -> {
|
||||
|
||||
View dialogView = activity.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(themeName);
|
||||
themeNameEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
}
|
||||
new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme)
|
||||
.setTitle(R.string.edit_theme_name)
|
||||
.setView(dialogView)
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i)
|
||||
-> {
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
|
||||
}
|
||||
themeName = themeNameEditText.getText().toString();
|
||||
((ThemeNameItemViewHolder) holder).themeNameTextView.setText(themeName);
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
|
||||
}
|
||||
})
|
||||
.setOnDismissListener(dialogInterface -> {
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(themeNameEditText.getWindowToken(), 0);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -99,6 +133,10 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public String getThemeName() {
|
||||
return themeName;
|
||||
}
|
||||
|
||||
class ThemeColorItemViewHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.color_image_view_item_custom_theme_color_item)
|
||||
View colorImageView;
|
||||
@ -135,10 +173,6 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
public ThemeNameItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
if (isPredefinedTheme) {
|
||||
descriptionTextView.setText(activity.getString(R.string.theme_name_forbid_change_description));
|
||||
itemView.setOnClickListener(view ->{});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package ml.docilealligator.infinityforreddit.AsyncTask;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
|
||||
public class ChangeThemeNameAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
private RedditDataRoomDatabase redditDataRoomDatabase;
|
||||
private String oldName;
|
||||
private String newName;
|
||||
|
||||
public ChangeThemeNameAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String oldName, String newName) {
|
||||
this.redditDataRoomDatabase = redditDataRoomDatabase;
|
||||
this.oldName = oldName;
|
||||
this.newName = newName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
redditDataRoomDatabase.customThemeDao().updateName(oldName, newName);
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package ml.docilealligator.infinityforreddit.AsyncTask;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
|
||||
public class DeleteThemeAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
private RedditDataRoomDatabase redditDataRoomDatabase;
|
||||
private String themeName;
|
||||
|
||||
public DeleteThemeAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, String themeName) {
|
||||
this.redditDataRoomDatabase = redditDataRoomDatabase;
|
||||
this.themeName = themeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
redditDataRoomDatabase.customThemeDao().deleteCustomTheme(themeName);
|
||||
return null;
|
||||
}
|
||||
}
|
@ -25,6 +25,15 @@ public interface CustomThemeDao {
|
||||
@Query("SELECT * FROM custom_themes WHERE is_amoled_theme = 1 LIMIT 1")
|
||||
CustomTheme getAmoledCustomTheme();
|
||||
|
||||
@Query("SELECT * FROM custom_themes WHERE is_light_theme = 1 LIMIT 1")
|
||||
LiveData<CustomTheme> getLightCustomThemeLiveData();
|
||||
|
||||
@Query("SELECT * FROM custom_themes WHERE is_dark_theme = 1 LIMIT 1")
|
||||
LiveData<CustomTheme> getDarkCustomThemeLiveData();
|
||||
|
||||
@Query("SELECT * FROM custom_themes WHERE is_amoled_theme = 1 LIMIT 1")
|
||||
LiveData<CustomTheme> getAmoledCustomThemeLiveData();
|
||||
|
||||
@Query("SELECT * FROM custom_themes WHERE name = :name COLLATE NOCASE LIMIT 1")
|
||||
CustomTheme getCustomTheme(String name);
|
||||
|
||||
@ -39,4 +48,7 @@ public interface CustomThemeDao {
|
||||
|
||||
@Query("DELETE FROM custom_themes WHERE name = :name")
|
||||
void deleteCustomTheme(String name);
|
||||
|
||||
@Query("UPDATE custom_themes SET name = :newName WHERE name = :oldName")
|
||||
void updateName(String oldName, String newName);
|
||||
}
|
||||
|
@ -8,12 +8,30 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
|
||||
public class CustomThemeRepository {
|
||||
private LiveData<List<CustomTheme>> mAllCustomThemes;
|
||||
private LiveData<CustomTheme> mCurrentLightCustomTheme;
|
||||
private LiveData<CustomTheme> mCurrentDarkCustomTheme;
|
||||
private LiveData<CustomTheme> mCurrentAmoledCustomTheme;
|
||||
|
||||
CustomThemeRepository(RedditDataRoomDatabase redditDataRoomDatabase) {
|
||||
mAllCustomThemes = redditDataRoomDatabase.customThemeDao().getAllCustomThemes();
|
||||
mCurrentLightCustomTheme = redditDataRoomDatabase.customThemeDao().getLightCustomThemeLiveData();
|
||||
mCurrentDarkCustomTheme = redditDataRoomDatabase.customThemeDao().getDarkCustomThemeLiveData();
|
||||
mCurrentAmoledCustomTheme = redditDataRoomDatabase.customThemeDao().getAmoledCustomThemeLiveData();
|
||||
}
|
||||
|
||||
LiveData<List<CustomTheme>> getAllCustomThemes() {
|
||||
return mAllCustomThemes;
|
||||
}
|
||||
|
||||
LiveData<CustomTheme> getCurrentLightCustomTheme() {
|
||||
return mCurrentLightCustomTheme;
|
||||
}
|
||||
|
||||
LiveData<CustomTheme> getCurrentDarkCustomTheme() {
|
||||
return mCurrentDarkCustomTheme;
|
||||
}
|
||||
|
||||
LiveData<CustomTheme> getCurrentAmoledCustomTheme() {
|
||||
return mCurrentAmoledCustomTheme;
|
||||
}
|
||||
}
|
||||
|
@ -11,16 +11,34 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
|
||||
public class CustomThemeViewModel extends ViewModel {
|
||||
private LiveData<List<CustomTheme>> mAllCustomThemes;
|
||||
private LiveData<CustomTheme> mCurrentLightTheme;
|
||||
private LiveData<CustomTheme> mCurrentDarkTheme;
|
||||
private LiveData<CustomTheme> mCurrentAmoledTheme;
|
||||
|
||||
public CustomThemeViewModel(RedditDataRoomDatabase redditDataRoomDatabase) {
|
||||
CustomThemeRepository customThemeRepository = new CustomThemeRepository(redditDataRoomDatabase);
|
||||
mAllCustomThemes = customThemeRepository.getAllCustomThemes();
|
||||
mCurrentLightTheme = customThemeRepository.getCurrentLightCustomTheme();
|
||||
mCurrentDarkTheme = customThemeRepository.getCurrentDarkCustomTheme();
|
||||
mCurrentAmoledTheme = customThemeRepository.getCurrentAmoledCustomTheme();
|
||||
}
|
||||
|
||||
public LiveData<List<CustomTheme>> getAllCustomThemes() {
|
||||
return mAllCustomThemes;
|
||||
}
|
||||
|
||||
public LiveData<CustomTheme> getCurrentLightThemeLiveData() {
|
||||
return mCurrentLightTheme;
|
||||
}
|
||||
|
||||
public LiveData<CustomTheme> getCurrentDarkThemeLiveData() {
|
||||
return mCurrentDarkTheme;
|
||||
}
|
||||
|
||||
public LiveData<CustomTheme> getCurrentAmoledThemeLiveData() {
|
||||
return mCurrentAmoledTheme;
|
||||
}
|
||||
|
||||
public static class Factory extends ViewModelProvider.NewInstanceFactory {
|
||||
private RedditDataRoomDatabase mRedditDataRoomDatabase;
|
||||
|
||||
|
@ -546,8 +546,8 @@ public class CustomThemeWrapper {
|
||||
public static CustomTheme getIndigoAmoled(Context context) {
|
||||
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_indigo_amoled));
|
||||
customTheme.isLightTheme = false;
|
||||
customTheme.isDarkTheme = true;
|
||||
customTheme.isAmoledTheme = false;
|
||||
customTheme.isDarkTheme = false;
|
||||
customTheme.isAmoledTheme = true;
|
||||
customTheme.colorPrimary = Color.parseColor("#000000");
|
||||
customTheme.colorPrimaryDark = Color.parseColor("#000000");
|
||||
customTheme.colorAccent = Color.parseColor("#FF4081");
|
||||
|
@ -0,0 +1,92 @@
|
||||
package ml.docilealligator.infinityforreddit.Fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
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;
|
||||
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;
|
||||
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class CustomThemeOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment {
|
||||
|
||||
public static final String EXTRA_THEME_NAME = "ETN";
|
||||
@BindView(R.id.theme_name_text_view_custom_theme_options_bottom_sheet_fragment)
|
||||
TextView themeNameTextView;
|
||||
@BindView(R.id.edit_theme_text_view_custom_theme_options_bottom_sheet_fragment)
|
||||
TextView editThemeTextView;
|
||||
@BindView(R.id.share_theme_text_view_custom_theme_options_bottom_sheet_fragment)
|
||||
TextView shareThemeTextView;
|
||||
@BindView(R.id.change_theme_name_text_view_custom_theme_options_bottom_sheet_fragment)
|
||||
TextView changeThemeNameTextView;
|
||||
@BindView(R.id.delete_theme_text_view_custom_theme_options_bottom_sheet_fragment)
|
||||
TextView deleteTextView;
|
||||
private String themeName;
|
||||
private Activity activity;
|
||||
|
||||
public CustomThemeOptionsBottomSheetFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public interface CustomThemeOptionsBottomSheetFragmentListener {
|
||||
void changeName(String oldName);
|
||||
void delete(String name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_custom_theme_options_bottom_sheet, container, false);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
themeName = getArguments().getString(EXTRA_THEME_NAME);
|
||||
themeNameTextView.setText(themeName);
|
||||
|
||||
editThemeTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, themeName);
|
||||
startActivity(intent);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
shareThemeTextView.setOnClickListener(view -> {
|
||||
dismiss();
|
||||
});
|
||||
|
||||
changeThemeNameTextView.setOnClickListener(view -> {
|
||||
((CustomThemeOptionsBottomSheetFragmentListener) activity).changeName(themeName);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
deleteTextView.setOnClickListener(view -> {
|
||||
((CustomThemeOptionsBottomSheetFragmentListener) activity).delete(themeName);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
activity = (AppCompatActivity) context;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package ml.docilealligator.infinityforreddit.Fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class SelectBaseThemeBottomSheetFragment extends RoundedBottomSheetDialogFragment {
|
||||
|
||||
@BindView(R.id.light_theme_text_view_select_base_theme_bottom_sheet_fragment)
|
||||
TextView lightThemeTextView;
|
||||
@BindView(R.id.dark_theme_text_view_select_base_theme_bottom_sheet_fragment)
|
||||
TextView darkThemeTextView;
|
||||
@BindView(R.id.amoled_theme_text_view_select_base_theme_bottom_sheet_fragment)
|
||||
TextView amoledThemeTextView;
|
||||
private Activity activity;
|
||||
public SelectBaseThemeBottomSheetFragment() {
|
||||
// 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);
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
lightThemeTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_CREATE_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_IS_PREDEFIINED_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, getString(R.string.theme_name_indigo));
|
||||
startActivity(intent);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
darkThemeTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_CREATE_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_IS_PREDEFIINED_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, getString(R.string.theme_name_indigo_dark));
|
||||
startActivity(intent);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
amoledThemeTextView.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(activity, CustomizeThemeActivity.class);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_CREATE_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_IS_PREDEFIINED_THEME, true);
|
||||
intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_NAME, getString(R.string.theme_name_indigo_amoled));
|
||||
startActivity(intent);
|
||||
dismiss();
|
||||
});
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
activity = (Activity) context;
|
||||
}
|
||||
}
|
@ -137,6 +137,6 @@ public class ShareLinkBottomSheetFragment extends RoundedBottomSheetDialogFragme
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
this.activity = (AppCompatActivity) context;
|
||||
activity = (AppCompatActivity) context;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
@ -21,10 +22,12 @@ import javax.inject.Inject;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Activity.CustomThemeListingActivity;
|
||||
import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeViewModel;
|
||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||
|
||||
@ -40,7 +43,10 @@ public class ThemePreferenceFragment extends PreferenceFragmentCompat {
|
||||
|
||||
private AppCompatActivity activity;
|
||||
@Inject
|
||||
RedditDataRoomDatabase redditDataRoomDatabase;
|
||||
@Inject
|
||||
CustomThemeWrapper customThemeWrapper;
|
||||
public CustomThemeViewModel customThemeViewModel;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
@ -143,6 +149,40 @@ public class ThemePreferenceFragment extends PreferenceFragmentCompat {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
customThemeViewModel = new ViewModelProvider(this,
|
||||
new CustomThemeViewModel.Factory(redditDataRoomDatabase))
|
||||
.get(CustomThemeViewModel.class);
|
||||
customThemeViewModel.getCurrentLightThemeLiveData().observe(this, customTheme -> {
|
||||
if (customizeLightThemePreference != null) {
|
||||
if (customTheme != null) {
|
||||
customizeLightThemePreference.setVisible(true);
|
||||
customizeLightThemePreference.setSummary(customTheme.name);
|
||||
} else {
|
||||
customizeLightThemePreference.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
customThemeViewModel.getCurrentDarkThemeLiveData().observe(this, customTheme -> {
|
||||
if (customizeDarkThemePreference != null) {
|
||||
if (customTheme != null) {
|
||||
customizeDarkThemePreference.setVisible(true);
|
||||
customizeDarkThemePreference.setSummary(customTheme.name);
|
||||
} else {
|
||||
customizeDarkThemePreference.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
customThemeViewModel.getCurrentAmoledThemeLiveData().observe(this, customTheme -> {
|
||||
if (customizeAmoledThemePreference != null) {
|
||||
if (customTheme != null) {
|
||||
customizeAmoledThemePreference.setVisible(true);
|
||||
customizeAmoledThemePreference.setSummary(customTheme.name);
|
||||
} else {
|
||||
customizeAmoledThemePreference.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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="M3,5A2,2 0,0 1,5 3H19A2,2 0,0 1,21 5V19A2,2 0,0 1,19 21H5C3.89,21 3,20.1 3,19V5M5,5V19H19V5H5M11,7H13A2,2 0,0 1,15 9V17H13V13H11V17H9V9A2,2 0,0 1,11 7M11,9V11H13V9H11Z"/>
|
||||
</vector>
|
@ -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="M3,5A2,2 0,0 1,5 3H19A2,2 0,0 1,21 5V19A2,2 0,0 1,19 21H5C3.89,21 3,20.1 3,19V5M5,5V19H19V5H5M11,7H13A2,2 0,0 1,15 9V17H13V13H11V17H9V9A2,2 0,0 1,11 7M11,9V11H13V9H11Z"/>
|
||||
</vector>
|
@ -38,4 +38,14 @@
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_custom_theme_listing_activity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:layout_gravity="bottom|end"
|
||||
app:backgroundTint="?attr/colorPrimaryLightTheme"
|
||||
app:srcCompat="@drawable/ic_add_bottom_app_bar_24dp"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -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_customize_theme_activity"
|
||||
tools:context=".Activity.CustomizeThemeActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
|
10
app/src/main/res/layout/dialog_edit_theme_name.xml
Normal file
10
app/src/main/res/layout/dialog_edit_theme_name.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/theme_name_edit_text_edit_theme_name_dialog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="24dp"
|
||||
android:background="#00000000"
|
||||
android:hint="@string/theme_name_hint"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/theme_name_text_view_custom_theme_options_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/edit_theme_text_view_custom_theme_options_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/edit_theme"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_edit_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/change_theme_name_text_view_custom_theme_options_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/change_theme_name"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_edit_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_theme_text_view_custom_theme_options_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/share_theme"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_share_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delete_theme_text_view_custom_theme_options_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/delete_theme"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_delete_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/light_theme_text_view_select_base_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/create_light_theme"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_light_theme_preference_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dark_theme_text_view_select_base_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/create_dark_theme"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_dark_theme_preference_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amoled_theme_text_view_select_base_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/create_amoled_theme"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
android:drawableStart="@drawable/ic_amoled_theme_preference_24dp"
|
||||
android:drawablePadding="48dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground" />
|
||||
|
||||
<TextView
|
||||
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/create_theme_info"
|
||||
android:textColor="?attr/secondaryTextColor"
|
||||
android:textSize="?attr/font_default" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
@ -16,10 +16,19 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name_text_view_item_predefined_custom_theme"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_image_view_item_predefined_custom_theme"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="32dp"
|
||||
android:src="@drawable/ic_add_24dp" />
|
||||
|
||||
</LinearLayout>
|
@ -24,12 +24,12 @@
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete_image_view_item_user_custom_theme"
|
||||
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_delete_24dp"
|
||||
android:src="@drawable/ic_add_24dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless" />
|
||||
|
||||
<ImageView
|
||||
|
@ -20,6 +20,8 @@
|
||||
<string name="create_multi_reddit_activity_label">Create Multireddit</string>
|
||||
<string name="subreddit_multiselection_activity_label">Select Subreddits</string>
|
||||
<string name="custom_theme_listing_activity_label">Custom Themes</string>
|
||||
<string name="customize_theme_activity_label">Customize Theme</string>
|
||||
<string name="customize_theme_activity_create_theme_label">Create Theme</string>
|
||||
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
@ -468,7 +470,6 @@
|
||||
<string name="save_gif_before_sharing">Saving the gif. Please wait.</string>
|
||||
|
||||
<string name="theme_name_description">Tap to change the name of this theme.</string>
|
||||
<string name="theme_name_forbid_change_description">You cannot change the name of this predefined theme.</string>
|
||||
<string name="theme_item_is_light_theme">Set as Light Theme</string>
|
||||
<string name="theme_item_is_dark_theme">Set as Dark Theme</string>
|
||||
<string name="theme_item_is_amoled_theme">Set as Amoled Theme</string>
|
||||
@ -604,9 +605,20 @@
|
||||
|
||||
<string name="predefined_themes">Predefined Themes</string>
|
||||
<string name="user_themes">Your Themes</string>
|
||||
<string name="no_theme_name">What is the name of this theme?</string>
|
||||
<string name="theme_name_hint">Theme Name</string>
|
||||
<string name="theme_name_indigo">Indigo</string>
|
||||
<string name="theme_name_indigo_dark">Indigo Dark</string>
|
||||
<string name="theme_name_indigo_amoled">Indigo Amoled</string>
|
||||
<string name="create_light_theme">Create a Light Theme\nBase on Indigo Theme</string>
|
||||
<string name="create_dark_theme">Create a Dark Theme\nBase on Indigo Dark Theme</string>
|
||||
<string name="create_amoled_theme">Create an Amoled Theme\nBase on Indigo Amoled Theme</string>
|
||||
<string name="create_theme_info">If you want to create a theme based on another theme, click the \"+\" button on a theme instead.</string>
|
||||
<string name="edit_theme_name">Edit Theme Name</string>
|
||||
<string name="edit_theme">Edit Theme</string>
|
||||
<string name="delete_theme">Delete Theme</string>
|
||||
<string name="share_theme">Share Theme</string>
|
||||
<string name="change_theme_name">Change Name</string>
|
||||
|
||||
<string name="color_picker">Color Picker</string>
|
||||
<string name="invalid_color">Invalid Color</string>
|
||||
|
@ -21,17 +21,20 @@
|
||||
<Preference
|
||||
app:key="customize_light_theme"
|
||||
app:icon="@drawable/ic_light_theme_preference_24dp"
|
||||
app:title="@string/settings_customize_light_theme_title" />
|
||||
app:title="@string/settings_customize_light_theme_title"
|
||||
app:isPreferenceVisible="false" />
|
||||
|
||||
<Preference
|
||||
app:key="customize_dark_theme"
|
||||
app:icon="@drawable/ic_dark_theme_preference_24dp"
|
||||
app:title="@string/settings_customize_dark_theme_title" />
|
||||
app:title="@string/settings_customize_dark_theme_title"
|
||||
app:isPreferenceVisible="false" />
|
||||
|
||||
<Preference
|
||||
app:key="customize_amoled_theme"
|
||||
app:icon="@drawable/ic_dark_theme_preference_24dp"
|
||||
app:title="@string/settings_customize_amoled_theme_title" />
|
||||
app:icon="@drawable/ic_amoled_theme_preference_24dp"
|
||||
app:title="@string/settings_customize_amoled_theme_title"
|
||||
app:isPreferenceVisible="false" />
|
||||
|
||||
<Preference
|
||||
app:key="manage_themes"
|
||||
|
Loading…
x
Reference in New Issue
Block a user