fix alt text editor theme

closes sk22#700
This commit is contained in:
sk 2023-07-17 22:51:45 +02:00
parent 8aec4a2717
commit a74c285f77
2 changed files with 8 additions and 2 deletions

View File

@ -23,11 +23,13 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import org.joinmastodon.android.GlobalUserPreferences;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonAPIController;
import org.joinmastodon.android.model.Attachment;
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
import org.joinmastodon.android.ui.photoviewer.PhotoViewer;
import org.joinmastodon.android.ui.utils.ColorPalette;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.ui.views.FixedAspectRatioImageView;
@ -61,6 +63,7 @@ public class ComposeImageDescriptionFragment extends MastodonToolbarFragment imp
public void onAttach(Activity activity){
super.onAttach(activity);
themeWrapper=new ContextThemeWrapper(activity, R.style.Theme_Mastodon_Dark);
ColorPalette.palettes.get(GlobalUserPreferences.color).apply(themeWrapper, GlobalUserPreferences.ThemePreference.DARK);
setTitle(R.string.add_alt_text);
}

View File

@ -2,7 +2,6 @@ package org.joinmastodon.android.ui.utils;
import static org.joinmastodon.android.GlobalUserPreferences.ColorPreference;
import static org.joinmastodon.android.GlobalUserPreferences.ThemePreference;
import static org.joinmastodon.android.GlobalUserPreferences.theme;
import static org.joinmastodon.android.GlobalUserPreferences.trueBlackTheme;
import android.content.Context;
@ -49,7 +48,11 @@ public class ColorPalette {
public ColorPalette dark(@StyleRes int res, @StyleRes int auto) { dark = res; autoDark = auto; return this; }
public ColorPalette black(@StyleRes int res, @StyleRes int auto) { dark = res; autoBlack = auto; return this; }
public void apply(Context context) {
public void apply(Context context) {
apply(context, GlobalUserPreferences.theme);
}
public void apply(Context context, ThemePreference theme) {
if (!((dark != 0 && autoDark != 0) || (black != 0 && autoBlack != 0) || light != 0 || base != 0)) {
throw new IllegalStateException("Invalid color scheme definition");
}