Search in sources :

Example 1 with ChoosethemesmallBinding

use of me.ccrama.redditslide.databinding.ChoosethemesmallBinding in project Slide by ccrama.

the class SettingsThemeFragment method setupSettingsThemeBase.

void setupSettingsThemeBase() {
    final LinearLayout themeBase = (LinearLayout) context.findViewById(R.id.settings_theme_base);
    themeBase.setOnClickListener(v -> {
        final ChoosethemesmallBinding choosethemesmallBinding = ChoosethemesmallBinding.inflate(context.getLayoutInflater());
        final View root = choosethemesmallBinding.getRoot();
        final TextView title = choosethemesmallBinding.title;
        title.setBackgroundColor(Palette.getDefaultColor());
        if (SettingValues.isNight()) {
            choosethemesmallBinding.nightmsg.setVisibility(View.VISIBLE);
        }
        for (final Pair<Integer, Integer> pair : ColorPreferences.themePairList) {
            root.findViewById(pair.first).setOnClickListener(v1 -> {
                SettingsThemeFragment.changed = true;
                final String[] names = new ColorPreferences(context).getFontStyle().getTitle().split("_");
                final String name = names[names.length - 1];
                final String newName = name.replace("(", "");
                for (final ColorPreferences.Theme theme : ColorPreferences.Theme.values()) {
                    if (theme.toString().contains(newName) && theme.getThemeType() == pair.second) {
                        back = theme.getThemeType();
                        new ColorPreferences(context).setFontStyle(theme);
                        context.restartActivity();
                        break;
                    }
                }
            });
        }
        new AlertDialog.Builder(context).setView(root).show();
    });
}
Also used : ColorPreferences(me.ccrama.redditslide.Visuals.ColorPreferences) ChoosethemesmallBinding(me.ccrama.redditslide.databinding.ChoosethemesmallBinding) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Aggregations

View (android.view.View)1 AdapterView (android.widget.AdapterView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 ColorPreferences (me.ccrama.redditslide.Visuals.ColorPreferences)1 ChoosethemesmallBinding (me.ccrama.redditslide.databinding.ChoosethemesmallBinding)1