|
|
@ -26,6 +26,9 @@ import android.graphics.Bitmap;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
import android.text.SpannableStringBuilder;
|
|
|
|
|
|
|
|
import android.text.Spanned;
|
|
|
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuInflater;
|
|
|
@ -34,6 +37,7 @@ import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.Window;
|
|
|
|
import android.view.Window;
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
import android.widget.CompoundButton;
|
|
|
|
import android.widget.ImageButton;
|
|
|
|
import android.widget.ImageButton;
|
|
|
@ -55,6 +59,8 @@ import com.flask.colorpicker.builder.ColorPickerClickListener;
|
|
|
|
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
|
|
|
|
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
public class FragmentOptionsDisplay extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
public class FragmentOptionsDisplay extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
|
|
private Button btnTheme;
|
|
|
|
private Button btnTheme;
|
|
|
@ -145,7 +151,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|
|
|
private SwitchCompat swOverrideWidth;
|
|
|
|
private SwitchCompat swOverrideWidth;
|
|
|
|
|
|
|
|
|
|
|
|
private SwitchCompat swContrast;
|
|
|
|
private SwitchCompat swContrast;
|
|
|
|
private SwitchCompat swMonospaced;
|
|
|
|
private Spinner spDisplayFont;
|
|
|
|
private SwitchCompat swMonospacedPre;
|
|
|
|
private SwitchCompat swMonospacedPre;
|
|
|
|
private SwitchCompat swBackgroundColor;
|
|
|
|
private SwitchCompat swBackgroundColor;
|
|
|
|
private SwitchCompat swTextColor;
|
|
|
|
private SwitchCompat swTextColor;
|
|
|
@ -183,7 +189,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|
|
|
"keywords_header", "labels_header", "flags", "flags_background",
|
|
|
|
"keywords_header", "labels_header", "flags", "flags_background",
|
|
|
|
"preview", "preview_italic", "preview_lines",
|
|
|
|
"preview", "preview_italic", "preview_lines",
|
|
|
|
"addresses",
|
|
|
|
"addresses",
|
|
|
|
"message_zoom", "overview_mode", "override_width", "contrast", "monospaced", "monospaced_pre",
|
|
|
|
"message_zoom", "overview_mode", "override_width",
|
|
|
|
|
|
|
|
"display_font", "contrast", "monospaced_pre",
|
|
|
|
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
|
|
|
|
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
|
|
|
|
"collapse_quotes", "image_placeholders", "inline_images", "button_extra", "attachments_alt", "thumbnails",
|
|
|
|
"collapse_quotes", "image_placeholders", "inline_images", "button_extra", "attachments_alt", "thumbnails",
|
|
|
|
"parse_classes",
|
|
|
|
"parse_classes",
|
|
|
@ -286,7 +293,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|
|
|
swOverviewMode = view.findViewById(R.id.swOverviewMode);
|
|
|
|
swOverviewMode = view.findViewById(R.id.swOverviewMode);
|
|
|
|
swOverrideWidth = view.findViewById(R.id.swOverrideWidth);
|
|
|
|
swOverrideWidth = view.findViewById(R.id.swOverrideWidth);
|
|
|
|
swContrast = view.findViewById(R.id.swContrast);
|
|
|
|
swContrast = view.findViewById(R.id.swContrast);
|
|
|
|
swMonospaced = view.findViewById(R.id.swMonospaced);
|
|
|
|
spDisplayFont = view.findViewById(R.id.spDisplayFont);
|
|
|
|
swMonospacedPre = view.findViewById(R.id.swMonospacedPre);
|
|
|
|
swMonospacedPre = view.findViewById(R.id.swMonospacedPre);
|
|
|
|
swBackgroundColor = view.findViewById(R.id.swBackgroundColor);
|
|
|
|
swBackgroundColor = view.findViewById(R.id.swBackgroundColor);
|
|
|
|
swTextColor = view.findViewById(R.id.swTextColor);
|
|
|
|
swTextColor = view.findViewById(R.id.swTextColor);
|
|
|
@ -306,6 +313,22 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|
|
|
|
|
|
|
|
|
|
|
grpGravatars = view.findViewById(R.id.grpGravatars);
|
|
|
|
grpGravatars = view.findViewById(R.id.grpGravatars);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StyleHelper.FontDescriptor> fonts = StyleHelper.getFonts(getContext());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<CharSequence> fn = new ArrayList<>();
|
|
|
|
|
|
|
|
fn.add("-");
|
|
|
|
|
|
|
|
for (int i = 0; i < fonts.size(); i++) {
|
|
|
|
|
|
|
|
StyleHelper.FontDescriptor font = fonts.get(i);
|
|
|
|
|
|
|
|
SpannableStringBuilder ssb = new SpannableStringBuilderEx(font.toString());
|
|
|
|
|
|
|
|
ssb.setSpan(StyleHelper.getTypefaceSpan(font.type, getContext()),
|
|
|
|
|
|
|
|
0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
|
|
|
|
|
fn.add(ssb);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, fn);
|
|
|
|
|
|
|
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
|
|
|
|
|
|
spDisplayFont.setAdapter(adapter);
|
|
|
|
|
|
|
|
|
|
|
|
setOptions();
|
|
|
|
setOptions();
|
|
|
|
|
|
|
|
|
|
|
|
// Wire controls
|
|
|
|
// Wire controls
|
|
|
@ -1004,10 +1027,18 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
swMonospaced.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
spDisplayFont.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
prefs.edit().putBoolean("monospaced", checked).apply();
|
|
|
|
if (position == 0)
|
|
|
|
|
|
|
|
prefs.edit().remove("display_font").apply();
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
prefs.edit().putString("display_font", fonts.get(position - 1).type).apply();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
prefs.edit().remove("display_font").apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -1323,7 +1354,17 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|
|
|
swOverrideWidth.setChecked(prefs.getBoolean("override_width", false));
|
|
|
|
swOverrideWidth.setChecked(prefs.getBoolean("override_width", false));
|
|
|
|
|
|
|
|
|
|
|
|
swContrast.setChecked(prefs.getBoolean("contrast", false));
|
|
|
|
swContrast.setChecked(prefs.getBoolean("contrast", false));
|
|
|
|
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
|
|
|
|
|
|
|
|
|
|
|
|
String display_font = prefs.getString("display_font", "");
|
|
|
|
|
|
|
|
List<StyleHelper.FontDescriptor> fonts = StyleHelper.getFonts(getContext());
|
|
|
|
|
|
|
|
for (int pos = 0; pos < fonts.size(); pos++) {
|
|
|
|
|
|
|
|
StyleHelper.FontDescriptor font = fonts.get(pos);
|
|
|
|
|
|
|
|
if (font.type.equals(display_font)) {
|
|
|
|
|
|
|
|
spDisplayFont.setSelection(pos + 1);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
swMonospacedPre.setChecked(prefs.getBoolean("monospaced_pre", false));
|
|
|
|
swMonospacedPre.setChecked(prefs.getBoolean("monospaced_pre", false));
|
|
|
|
swBackgroundColor.setChecked(prefs.getBoolean("background_color", false));
|
|
|
|
swBackgroundColor.setChecked(prefs.getBoolean("background_color", false));
|
|
|
|
swTextColor.setChecked(prefs.getBoolean("text_color", true));
|
|
|
|
swTextColor.setChecked(prefs.getBoolean("text_color", true));
|
|
|
|