rename color theme to color palette

This commit is contained in:
sk 2022-12-20 12:23:59 +01:00
parent ec7235c03a
commit aec4479e19
4 changed files with 36 additions and 37 deletions

View File

@ -51,7 +51,6 @@ import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.updater.GithubSelfUpdater;
import java.util.ArrayList;
import java.util.Objects;
import java.util.function.Consumer;
import androidx.annotation.DrawableRes;
@ -103,7 +102,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
GlobalUserPreferences.disableMarquee=i.checked;
GlobalUserPreferences.save();
}));
items.add(new ColorPicker());
items.add(new ColorPalettePicker());
items.add(new HeaderItem(R.string.settings_behavior));
items.add(new SwitchItem(R.string.settings_gif, R.drawable.ic_fluent_gif_24_regular, GlobalUserPreferences.playGifs, i->{
@ -485,7 +484,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
}
}
public class ColorPicker extends Item{
public class ColorPalettePicker extends Item{
@Override
public int getViewType(){
return 8;
@ -586,7 +585,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
case 5 -> new HeaderViewHolder(true);
case 6 -> new FooterViewHolder();
case 7 -> new UpdateViewHolder();
case 8 -> new ColorPickerViewHolder();
case 8 -> new ColorPalettePickerViewHolder();
default -> throw new IllegalStateException("Unexpected value: "+viewType);
};
}
@ -715,18 +714,18 @@ public class SettingsFragment extends MastodonToolbarFragment{
}
}
}
private class ColorPickerViewHolder extends BindableViewHolder<ColorPicker>{
private class ColorPalettePickerViewHolder extends BindableViewHolder<ColorPalettePicker>{
private final Button button;
private final PopupMenu popupMenu;
private final ImageView icon;
@SuppressLint("ClickableViewAccessibility")
public ColorPickerViewHolder(){
public ColorPalettePickerViewHolder(){
super(getActivity(), R.layout.item_settings_color_picker, list);
icon=findViewById(R.id.icon);
button=findViewById(R.id.color_picker_button);
button=findViewById(R.id.color_palette_button);
popupMenu=new PopupMenu(getActivity(), button, Gravity.CENTER_HORIZONTAL);
popupMenu.inflate(R.menu.color_picker);
popupMenu.inflate(R.menu.color_palettes);
popupMenu.getMenu().findItem(R.id.m3_color).setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
popupMenu.setOnMenuItemClickListener(SettingsFragment.this::onColorPreferenceClick);
button.setOnTouchListener(popupMenu.getDragToOpenListener());
@ -734,17 +733,17 @@ public class SettingsFragment extends MastodonToolbarFragment{
}
@Override
public void onBind(ColorPicker item){
public void onBind(ColorPalettePicker item){
icon.setImageResource(R.drawable.ic_fluent_color_24_regular);
button.setText(switch(GlobalUserPreferences.color){
case MATERIAL3 -> R.string.sk_color_theme_material3;
case PINK -> R.string.sk_color_theme_pink;
case PURPLE -> R.string.sk_color_theme_purple;
case GREEN -> R.string.sk_color_theme_green;
case BLUE -> R.string.sk_color_theme_blue;
case BROWN -> R.string.sk_color_theme_brown;
case RED -> R.string.sk_color_theme_red;
case YELLOW -> R.string.sk_color_theme_yellow;
case MATERIAL3 -> R.string.sk_color_palette_material3;
case PINK -> R.string.sk_color_palette_pink;
case PURPLE -> R.string.sk_color_palette_purple;
case GREEN -> R.string.sk_color_palette_green;
case BLUE -> R.string.sk_color_palette_blue;
case BROWN -> R.string.sk_color_palette_brown;
case RED -> R.string.sk_color_palette_red;
case YELLOW -> R.string.sk_color_palette_yellow;
default -> throw new IllegalStateException("Unexpected value: "+GlobalUserPreferences.color);
});
}

View File

@ -27,10 +27,10 @@
android:textSize="16sp"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/sk_settings_color_picker"/>
android:text="@string/sk_settings_color_palette"/>
<Button
android:id="@+id/color_picker_button"
android:id="@+id/color_palette_button"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:background="@drawable/bg_inline_button"
@ -41,6 +41,6 @@
android:stateListAnimator="@null"
android:textColor="?android:textColorPrimary"
android:textSize="16sp"
tools:text="@string/sk_color_theme_pink" />
tools:text="@string/sk_color_palette_pink" />
</org.joinmastodon.android.ui.views.AutoOrientationLinearLayout>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/m3_color" android:title="@string/sk_color_theme_material3"/>
<item android:id="@+id/pink_color" android:title="@string/sk_color_theme_pink"/>
<item android:id="@+id/purple_color" android:title="@string/sk_color_theme_purple"/>
<item android:id="@+id/green_color" android:title="@string/sk_color_theme_green"/>
<item android:id="@+id/blue_color" android:title="@string/sk_color_theme_blue"/>
<item android:id="@+id/brown_color" android:title="@string/sk_color_theme_brown"/>
<item android:id="@+id/red_color" android:title="@string/sk_color_theme_red"/>
<item android:id="@+id/yellow_color" android:title="@string/sk_color_theme_yellow"/>
<item android:id="@+id/m3_color" android:title="@string/sk_color_palette_material3"/>
<item android:id="@+id/pink_color" android:title="@string/sk_color_palette_pink"/>
<item android:id="@+id/purple_color" android:title="@string/sk_color_palette_purple"/>
<item android:id="@+id/green_color" android:title="@string/sk_color_palette_green"/>
<item android:id="@+id/blue_color" android:title="@string/sk_color_palette_blue"/>
<item android:id="@+id/brown_color" android:title="@string/sk_color_palette_brown"/>
<item android:id="@+id/red_color" android:title="@string/sk_color_palette_red"/>
<item android:id="@+id/yellow_color" android:title="@string/sk_color_palette_yellow"/>
</menu>

View File

@ -40,15 +40,15 @@
<string name="sk_settings_show_federated_timeline">Show federated timeline</string>
<string name="sk_notification_type_status">Posts</string>
<string name="sk_notify_posts">Post notifications</string>
<string name="sk_settings_color_picker">Color theme</string>
<string name="sk_color_theme_material3">System</string>
<string name="sk_color_theme_pink">Pink</string>
<string name="sk_color_theme_purple">Purple</string>
<string name="sk_color_theme_green">Green</string>
<string name="sk_color_theme_blue">Blue</string>
<string name="sk_color_theme_brown">Brown</string>
<string name="sk_color_theme_red">Red</string>
<string name="sk_color_theme_yellow">Yellow</string>
<string name="sk_settings_color_palette">Color palette</string>
<string name="sk_color_palette_material3">System</string>
<string name="sk_color_palette_pink">Pink</string>
<string name="sk_color_palette_purple">Purple</string>
<string name="sk_color_palette_green">Green</string>
<string name="sk_color_palette_blue">Blue</string>
<string name="sk_color_palette_brown">Brown</string>
<string name="sk_color_palette_red">Red</string>
<string name="sk_color_palette_yellow">Yellow</string>
<string name="sk_poll_allow_multiple">Allow multiple choices</string>
<string name="sk_translate_post">Translate</string>
<string name="sk_translate_show_original">Show original</string>