2019-05-06 07:10:13 +00:00
|
|
|
package eu.faircode.email;
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file is part of FairEmail.
|
|
|
|
|
|
|
|
FairEmail is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
FairEmail is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
|
|
|
*/
|
|
|
|
|
2019-06-30 20:52:33 +00:00
|
|
|
import android.app.Dialog;
|
2019-10-13 09:14:06 +00:00
|
|
|
import android.content.Context;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.content.SharedPreferences;
|
2019-10-19 11:51:16 +00:00
|
|
|
import android.content.res.Configuration;
|
2019-10-13 09:14:06 +00:00
|
|
|
import android.graphics.Bitmap;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.LayoutInflater;
|
2019-05-06 12:41:03 +00:00
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuItem;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.AdapterView;
|
2019-06-14 17:12:56 +00:00
|
|
|
import android.widget.Button;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.widget.CompoundButton;
|
2019-10-13 09:14:06 +00:00
|
|
|
import android.widget.ImageView;
|
2019-06-14 17:12:56 +00:00
|
|
|
import android.widget.RadioGroup;
|
2019-10-13 09:14:06 +00:00
|
|
|
import android.widget.SeekBar;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.widget.Spinner;
|
2019-07-14 10:32:32 +00:00
|
|
|
import android.widget.Toast;
|
2019-05-06 07:10:13 +00:00
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
2019-06-30 20:52:33 +00:00
|
|
|
import androidx.appcompat.app.AlertDialog;
|
2019-05-06 07:10:13 +00:00
|
|
|
import androidx.appcompat.widget.SwitchCompat;
|
2019-09-10 06:53:07 +00:00
|
|
|
import androidx.lifecycle.Lifecycle;
|
2019-05-06 07:10:13 +00:00
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
2019-05-06 12:41:03 +00:00
|
|
|
public class FragmentOptionsDisplay extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
2019-06-14 17:12:56 +00:00
|
|
|
private Button btnTheme;
|
2019-10-19 11:51:16 +00:00
|
|
|
private SwitchCompat swLandscape;
|
2019-05-06 07:10:13 +00:00
|
|
|
private Spinner spStartup;
|
2019-08-14 10:16:25 +00:00
|
|
|
private SwitchCompat swCards;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swDate;
|
|
|
|
private SwitchCompat swThreading;
|
2019-10-12 17:40:30 +00:00
|
|
|
private SwitchCompat swIndentation;
|
2019-08-16 17:52:59 +00:00
|
|
|
private SwitchCompat swHighlightUnread;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swAvatars;
|
2019-07-22 08:40:03 +00:00
|
|
|
private SwitchCompat swGeneratedIcons;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swIdenticons;
|
|
|
|
private SwitchCompat swCircular;
|
2019-10-13 09:14:06 +00:00
|
|
|
private ImageView ivRed;
|
|
|
|
private ImageView ivGreen;
|
|
|
|
private ImageView ivBlue;
|
|
|
|
private SeekBar sbSaturation;
|
|
|
|
private SeekBar sbBrightness;
|
2019-10-14 08:51:58 +00:00
|
|
|
private SeekBar sbThreshold;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swNameEmail;
|
2019-10-03 08:19:27 +00:00
|
|
|
private SwitchCompat swDistinguishContacts;
|
2019-09-11 20:00:21 +00:00
|
|
|
private SwitchCompat swAuthentication;
|
2019-11-18 09:39:32 +00:00
|
|
|
private SwitchCompat swSubjectTop;
|
2019-11-17 19:30:33 +00:00
|
|
|
private Spinner spFontSizeSender;
|
|
|
|
private Spinner spFontSizeSubject;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swSubjectItalic;
|
2019-09-09 10:22:50 +00:00
|
|
|
private Spinner spSubjectEllipsize;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swFlags;
|
2019-09-27 09:33:07 +00:00
|
|
|
private SwitchCompat swFlagsBackground;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swPreview;
|
2019-08-12 06:39:43 +00:00
|
|
|
private SwitchCompat swPreviewItalic;
|
2019-10-20 17:35:31 +00:00
|
|
|
private Spinner spPreviewLines;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swAddresses;
|
2019-05-17 18:07:08 +00:00
|
|
|
private SwitchCompat swAttachmentsAlt;
|
2019-07-10 09:25:23 +00:00
|
|
|
|
2019-07-09 06:09:20 +00:00
|
|
|
private SwitchCompat swContrast;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swMonospaced;
|
2019-09-23 18:13:38 +00:00
|
|
|
private SwitchCompat swTextColor;
|
2019-07-10 09:25:23 +00:00
|
|
|
private SwitchCompat swCollapseQuotes;
|
2019-09-23 18:13:38 +00:00
|
|
|
private SwitchCompat swImagesInline;
|
2019-09-09 16:41:04 +00:00
|
|
|
private SwitchCompat swSeekbar;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swActionbar;
|
|
|
|
|
2019-05-06 12:41:03 +00:00
|
|
|
private final static String[] RESET_OPTIONS = new String[]{
|
2019-10-20 07:16:45 +00:00
|
|
|
"theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread",
|
2019-10-14 08:51:58 +00:00
|
|
|
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
2019-10-13 09:14:06 +00:00
|
|
|
"name_email", "distinguish_contacts", "authentication",
|
2019-11-18 09:39:32 +00:00
|
|
|
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
|
2019-10-20 17:35:31 +00:00
|
|
|
"flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses", "attachments_alt",
|
2019-09-23 18:13:38 +00:00
|
|
|
"contrast", "monospaced", "text_color",
|
2019-10-04 13:25:04 +00:00
|
|
|
"inline_images", "collapse_quotes", "seekbar", "actionbar",
|
2019-05-06 12:41:03 +00:00
|
|
|
};
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
@Override
|
|
|
|
@Nullable
|
|
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
2019-06-12 14:15:46 +00:00
|
|
|
setSubtitle(R.string.title_setup);
|
2019-05-06 12:41:03 +00:00
|
|
|
setHasOptionsMenu(true);
|
2019-05-06 07:10:13 +00:00
|
|
|
|
|
|
|
View view = inflater.inflate(R.layout.fragment_options_display, container, false);
|
|
|
|
|
|
|
|
// Get controls
|
|
|
|
|
2019-06-14 17:12:56 +00:00
|
|
|
btnTheme = view.findViewById(R.id.btnTheme);
|
2019-10-19 11:51:16 +00:00
|
|
|
swLandscape = view.findViewById(R.id.swLandscape);
|
2019-05-06 07:10:13 +00:00
|
|
|
spStartup = view.findViewById(R.id.spStartup);
|
2019-08-14 10:16:25 +00:00
|
|
|
swCards = view.findViewById(R.id.swCards);
|
2019-10-20 07:16:45 +00:00
|
|
|
swIndentation = view.findViewById(R.id.swIndentation);
|
2019-05-06 07:10:13 +00:00
|
|
|
swDate = view.findViewById(R.id.swDate);
|
|
|
|
swThreading = view.findViewById(R.id.swThreading);
|
2019-08-16 17:52:59 +00:00
|
|
|
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
|
2019-05-06 07:10:13 +00:00
|
|
|
swAvatars = view.findViewById(R.id.swAvatars);
|
2019-07-22 08:40:03 +00:00
|
|
|
swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons);
|
2019-05-06 07:10:13 +00:00
|
|
|
swIdenticons = view.findViewById(R.id.swIdenticons);
|
|
|
|
swCircular = view.findViewById(R.id.swCircular);
|
2019-10-13 09:14:06 +00:00
|
|
|
ivRed = view.findViewById(R.id.ivRed);
|
|
|
|
ivGreen = view.findViewById(R.id.ivGreen);
|
|
|
|
ivBlue = view.findViewById(R.id.ivBlue);
|
|
|
|
sbSaturation = view.findViewById(R.id.sbSaturation);
|
|
|
|
sbBrightness = view.findViewById(R.id.sbBrightness);
|
2019-10-14 08:51:58 +00:00
|
|
|
sbThreshold = view.findViewById(R.id.sbThreshold);
|
2019-05-06 07:10:13 +00:00
|
|
|
swNameEmail = view.findViewById(R.id.swNameEmail);
|
2019-10-03 08:19:27 +00:00
|
|
|
swDistinguishContacts = view.findViewById(R.id.swDistinguishContacts);
|
2019-09-11 20:00:21 +00:00
|
|
|
swAuthentication = view.findViewById(R.id.swAuthentication);
|
2019-11-18 09:39:32 +00:00
|
|
|
swSubjectTop = view.findViewById(R.id.swSubjectTop);
|
2019-11-17 19:30:33 +00:00
|
|
|
spFontSizeSender = view.findViewById(R.id.spFontSizeSender);
|
|
|
|
spFontSizeSubject = view.findViewById(R.id.spFontSizeSubject);
|
2019-05-06 07:10:13 +00:00
|
|
|
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
|
2019-09-09 10:22:50 +00:00
|
|
|
spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize);
|
2019-05-06 07:10:13 +00:00
|
|
|
swFlags = view.findViewById(R.id.swFlags);
|
2019-09-27 09:33:07 +00:00
|
|
|
swFlagsBackground = view.findViewById(R.id.swFlagsBackground);
|
2019-05-06 07:10:13 +00:00
|
|
|
swPreview = view.findViewById(R.id.swPreview);
|
2019-08-12 06:39:43 +00:00
|
|
|
swPreviewItalic = view.findViewById(R.id.swPreviewItalic);
|
2019-10-20 17:35:31 +00:00
|
|
|
spPreviewLines = view.findViewById(R.id.spPreviewLines);
|
2019-05-06 07:10:13 +00:00
|
|
|
swAddresses = view.findViewById(R.id.swAddresses);
|
2019-05-17 18:07:08 +00:00
|
|
|
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
|
2019-07-09 06:09:20 +00:00
|
|
|
swContrast = view.findViewById(R.id.swContrast);
|
2019-05-06 07:10:13 +00:00
|
|
|
swMonospaced = view.findViewById(R.id.swMonospaced);
|
2019-09-23 18:13:38 +00:00
|
|
|
swTextColor = view.findViewById(R.id.swTextColor);
|
2019-07-10 09:25:23 +00:00
|
|
|
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
|
2019-09-23 18:13:38 +00:00
|
|
|
swImagesInline = view.findViewById(R.id.swImagesInline);
|
2019-09-09 16:41:04 +00:00
|
|
|
swSeekbar = view.findViewById(R.id.swSeekbar);
|
2019-05-06 07:10:13 +00:00
|
|
|
swActionbar = view.findViewById(R.id.swActionbar);
|
|
|
|
|
2019-05-06 13:30:30 +00:00
|
|
|
setOptions();
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
// Wire controls
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
2019-06-14 17:12:56 +00:00
|
|
|
btnTheme.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
2019-10-12 15:16:53 +00:00
|
|
|
new FragmentDialogTheme().show(getParentFragmentManager(), "setup:theme");
|
2019-06-14 17:12:56 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-19 11:51:16 +00:00
|
|
|
swLandscape.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("landscape", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
spStartup.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
String[] values = getResources().getStringArray(R.array.startupValues);
|
|
|
|
prefs.edit().putString("startup", values[position]).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("startup").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-08-14 10:16:25 +00:00
|
|
|
swCards.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("cards", checked).apply();
|
2019-10-20 07:16:45 +00:00
|
|
|
swIndentation.setEnabled(checked);
|
2019-08-14 10:16:25 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-20 07:16:45 +00:00
|
|
|
swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-05-06 07:10:13 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2019-10-20 07:16:45 +00:00
|
|
|
prefs.edit().putBoolean("indentation", checked).apply();
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-20 07:16:45 +00:00
|
|
|
swDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-05-06 07:10:13 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2019-10-20 07:16:45 +00:00
|
|
|
prefs.edit().putBoolean("date", checked).apply();
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-20 07:16:45 +00:00
|
|
|
swThreading.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-10-12 17:40:30 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2019-10-20 07:16:45 +00:00
|
|
|
prefs.edit().putBoolean("threading", checked).apply();
|
2019-11-15 12:58:34 +00:00
|
|
|
WidgetUnified.update(getContext());
|
2019-10-12 17:40:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-08-16 17:52:59 +00:00
|
|
|
swHighlightUnread.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("highlight_unread", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swAvatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("avatars", checked).apply();
|
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-07-22 08:40:03 +00:00
|
|
|
swGeneratedIcons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("generated_icons", checked).apply();
|
|
|
|
swIdenticons.setEnabled(checked);
|
2019-10-13 11:54:18 +00:00
|
|
|
sbSaturation.setEnabled(swGeneratedIcons.isChecked());
|
|
|
|
sbBrightness.setEnabled(swGeneratedIcons.isChecked());
|
2019-10-14 08:51:58 +00:00
|
|
|
sbThreshold.setEnabled(swGeneratedIcons.isChecked());
|
2019-07-22 08:40:03 +00:00
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swIdenticons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("identicons", checked).apply();
|
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swCircular.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("circular", checked).apply();
|
2019-10-13 09:14:06 +00:00
|
|
|
updateColor();
|
2019-05-06 07:10:13 +00:00
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-13 09:14:06 +00:00
|
|
|
sbSaturation.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
|
|
|
prefs.edit().putInt("saturation", progress).apply();
|
|
|
|
updateColor();
|
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
sbBrightness.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
|
|
|
prefs.edit().putInt("brightness", progress).apply();
|
|
|
|
updateColor();
|
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-14 08:51:58 +00:00
|
|
|
sbThreshold.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
|
|
|
prefs.edit().putInt("threshold", progress).apply();
|
|
|
|
updateColor();
|
|
|
|
ContactInfo.clearCache();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swNameEmail.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("name_email", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-03 08:19:27 +00:00
|
|
|
swDistinguishContacts.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("distinguish_contacts", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-11 20:00:21 +00:00
|
|
|
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("authentication", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-11-18 09:39:32 +00:00
|
|
|
swSubjectTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("subject_top", checked).apply();
|
|
|
|
WidgetUnified.update(getContext());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-11-17 19:30:33 +00:00
|
|
|
spFontSizeSender.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
int[] values = getResources().getIntArray(R.array.fontSizeValues);
|
|
|
|
prefs.edit().putInt("font_size_sender", values[position]).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("font_size_sender").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
spFontSizeSubject.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
int[] values = getResources().getIntArray(R.array.fontSizeValues);
|
|
|
|
prefs.edit().putInt("font_size_subject", values[position]).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("font_size_subject").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swSubjectItalic.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("subject_italic", checked).apply();
|
2019-11-15 12:58:34 +00:00
|
|
|
WidgetUnified.update(getContext());
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-09 10:22:50 +00:00
|
|
|
spSubjectEllipsize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
String[] values = getResources().getStringArray(R.array.ellipsizeValues);
|
|
|
|
prefs.edit().putString("subject_ellipsize", values[position]).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("subject_ellipsize").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swFlags.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("flags", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-27 09:33:07 +00:00
|
|
|
swFlagsBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("flags_background", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swPreview.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("preview", checked).apply();
|
2019-08-12 06:39:43 +00:00
|
|
|
swPreviewItalic.setEnabled(checked);
|
2019-10-20 17:35:31 +00:00
|
|
|
spPreviewLines.setEnabled(checked);
|
2019-08-12 06:39:43 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swPreviewItalic.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("preview_italic", checked).apply();
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-20 17:35:31 +00:00
|
|
|
spPreviewLines.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
prefs.edit().putInt("preview_lines", position + 1).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("preview_lines").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swAddresses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("addresses", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-17 18:07:08 +00:00
|
|
|
swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("attachments_alt", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-07-09 06:09:20 +00:00
|
|
|
swContrast.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("contrast", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swMonospaced.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("monospaced", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-23 18:13:38 +00:00
|
|
|
swTextColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-07-02 08:54:09 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2019-09-23 18:13:38 +00:00
|
|
|
prefs.edit().putBoolean("text_color", checked).apply();
|
2019-07-02 08:54:09 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-07-10 09:25:23 +00:00
|
|
|
swCollapseQuotes.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("collapse_quotes", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-23 18:13:38 +00:00
|
|
|
swImagesInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("inline_images", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-09 16:41:04 +00:00
|
|
|
swSeekbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("seekbar", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("actionbar", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-05-06 12:41:03 +00:00
|
|
|
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
2019-05-06 12:41:03 +00:00
|
|
|
@Override
|
|
|
|
public void onDestroyView() {
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(getContext()).unregisterOnSharedPreferenceChangeListener(this);
|
|
|
|
super.onDestroyView();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
2019-09-10 06:53:07 +00:00
|
|
|
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
|
|
|
setOptions();
|
2019-05-06 12:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
|
inflater.inflate(R.menu.menu_options, menu);
|
|
|
|
super.onCreateOptionsMenu(menu, inflater);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case R.id.menu_default:
|
|
|
|
onMenuDefault();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onMenuDefault() {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
for (String option : RESET_OPTIONS)
|
|
|
|
editor.remove(option);
|
|
|
|
editor.apply();
|
2019-07-14 10:32:32 +00:00
|
|
|
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
|
2019-05-06 12:41:03 +00:00
|
|
|
}
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
private void setOptions() {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
2019-10-19 11:51:16 +00:00
|
|
|
boolean normal = getResources().getConfiguration()
|
|
|
|
.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL);
|
|
|
|
|
|
|
|
swLandscape.setChecked(prefs.getBoolean("landscape", true));
|
|
|
|
swLandscape.setEnabled(normal);
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
String startup = prefs.getString("startup", "unified");
|
|
|
|
String[] startupValues = getResources().getStringArray(R.array.startupValues);
|
|
|
|
for (int pos = 0; pos < startupValues.length; pos++)
|
|
|
|
if (startupValues[pos].equals(startup)) {
|
|
|
|
spStartup.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-08-14 10:16:25 +00:00
|
|
|
swCards.setChecked(prefs.getBoolean("cards", true));
|
2019-10-20 07:16:45 +00:00
|
|
|
swIndentation.setChecked(prefs.getBoolean("indentation", false));
|
|
|
|
swIndentation.setEnabled(swCards.isChecked());
|
2019-05-06 07:10:13 +00:00
|
|
|
swDate.setChecked(prefs.getBoolean("date", true));
|
|
|
|
swThreading.setChecked(prefs.getBoolean("threading", true));
|
2019-08-16 17:52:59 +00:00
|
|
|
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", false));
|
2019-05-06 07:10:13 +00:00
|
|
|
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
2019-07-22 08:40:03 +00:00
|
|
|
swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true));
|
2019-05-06 07:10:13 +00:00
|
|
|
swIdenticons.setChecked(prefs.getBoolean("identicons", false));
|
2019-07-22 08:40:03 +00:00
|
|
|
swIdenticons.setEnabled(swGeneratedIcons.isChecked());
|
2019-05-06 07:10:13 +00:00
|
|
|
swCircular.setChecked(prefs.getBoolean("circular", true));
|
2019-10-14 08:51:58 +00:00
|
|
|
|
2019-10-13 09:14:06 +00:00
|
|
|
sbSaturation.setProgress(prefs.getInt("saturation", 100));
|
2019-10-13 11:54:18 +00:00
|
|
|
sbSaturation.setEnabled(swGeneratedIcons.isChecked());
|
2019-10-13 09:14:06 +00:00
|
|
|
sbBrightness.setProgress(prefs.getInt("brightness", 100));
|
2019-10-13 11:54:18 +00:00
|
|
|
sbBrightness.setEnabled(swGeneratedIcons.isChecked());
|
2019-10-14 08:51:58 +00:00
|
|
|
sbThreshold.setProgress(prefs.getInt("threshold", 50));
|
|
|
|
sbThreshold.setEnabled(swGeneratedIcons.isChecked());
|
|
|
|
|
2019-08-25 09:14:16 +00:00
|
|
|
swNameEmail.setChecked(prefs.getBoolean("name_email", false));
|
2019-10-03 08:19:27 +00:00
|
|
|
swDistinguishContacts.setChecked(prefs.getBoolean("distinguish_contacts", false));
|
2019-09-11 20:00:21 +00:00
|
|
|
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
|
2019-11-17 19:30:33 +00:00
|
|
|
|
2019-11-18 09:39:32 +00:00
|
|
|
swSubjectTop.setChecked(prefs.getBoolean("subject_top", false));
|
|
|
|
|
2019-11-17 19:30:33 +00:00
|
|
|
int[] fontSizeValues = getResources().getIntArray(R.array.fontSizeValues);
|
|
|
|
|
|
|
|
int font_size_sender = prefs.getInt("font_size_sender", -1);
|
|
|
|
for (int pos = 0; pos < fontSizeValues.length; pos++)
|
|
|
|
if (fontSizeValues[pos] == font_size_sender) {
|
|
|
|
spFontSizeSender.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
int font_size_subject = prefs.getInt("font_size_subject", -1);
|
|
|
|
for (int pos = 0; pos < fontSizeValues.length; pos++)
|
|
|
|
if (fontSizeValues[pos] == font_size_subject) {
|
|
|
|
spFontSizeSubject.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));
|
2019-09-09 10:22:50 +00:00
|
|
|
|
|
|
|
String subject_ellipsize = prefs.getString("subject_ellipsize", "middle");
|
|
|
|
String[] ellipsizeValues = getResources().getStringArray(R.array.ellipsizeValues);
|
|
|
|
for (int pos = 0; pos < startupValues.length; pos++)
|
|
|
|
if (ellipsizeValues[pos].equals(subject_ellipsize)) {
|
|
|
|
spSubjectEllipsize.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swFlags.setChecked(prefs.getBoolean("flags", true));
|
2019-09-27 09:33:07 +00:00
|
|
|
swFlagsBackground.setChecked(prefs.getBoolean("flags_background", false));
|
2019-05-06 07:10:13 +00:00
|
|
|
swPreview.setChecked(prefs.getBoolean("preview", false));
|
2019-08-12 06:39:43 +00:00
|
|
|
swPreviewItalic.setChecked(prefs.getBoolean("preview_italic", true));
|
|
|
|
swPreviewItalic.setEnabled(swPreview.isChecked());
|
2019-10-20 17:35:31 +00:00
|
|
|
spPreviewLines.setSelection(prefs.getInt("preview_lines", 2) - 1);
|
|
|
|
spPreviewLines.setEnabled(swPreview.isChecked());
|
2019-05-06 07:10:13 +00:00
|
|
|
swAddresses.setChecked(prefs.getBoolean("addresses", false));
|
2019-05-17 18:07:08 +00:00
|
|
|
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
|
2019-07-09 06:09:20 +00:00
|
|
|
swContrast.setChecked(prefs.getBoolean("contrast", false));
|
2019-05-06 07:10:13 +00:00
|
|
|
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
|
2019-09-23 18:13:38 +00:00
|
|
|
swTextColor.setChecked(prefs.getBoolean("text_color", true));
|
2019-07-10 09:25:23 +00:00
|
|
|
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
|
2019-09-23 18:13:38 +00:00
|
|
|
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
|
2019-09-09 16:41:04 +00:00
|
|
|
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
|
2019-05-06 07:10:13 +00:00
|
|
|
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
|
2019-10-13 09:14:06 +00:00
|
|
|
|
|
|
|
updateColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateColor() {
|
|
|
|
Context context = getContext();
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
2019-10-13 11:54:18 +00:00
|
|
|
boolean identicons = prefs.getBoolean("identicons", false);
|
2019-10-13 09:14:06 +00:00
|
|
|
boolean circular = prefs.getBoolean("circular", true);
|
|
|
|
|
|
|
|
int size = Helper.dp2pixels(context, 36);
|
2019-10-14 11:52:04 +00:00
|
|
|
byte[] ahash = ImageHelper.getHash("abc@example.com");
|
|
|
|
byte[] bhash = ImageHelper.getHash("bcd@example.com");
|
|
|
|
byte[] chash = ImageHelper.getHash("cde@example.com");
|
2019-10-13 11:54:18 +00:00
|
|
|
Integer radius = (circular && !identicons ? null : Helper.dp2pixels(context, 3));
|
2019-10-13 09:14:06 +00:00
|
|
|
|
2019-10-14 11:52:04 +00:00
|
|
|
Bitmap red = (identicons
|
|
|
|
? ImageHelper.generateIdenticon(ahash, 0f, size, 5, context)
|
|
|
|
: ImageHelper.generateLetterIcon("A", 0f, size, context));
|
2019-10-13 11:54:18 +00:00
|
|
|
|
2019-10-14 11:52:04 +00:00
|
|
|
Bitmap green = (identicons
|
|
|
|
? ImageHelper.generateIdenticon(bhash, 120f, size, 5, context)
|
|
|
|
: ImageHelper.generateLetterIcon("B", 120f, size, context));
|
2019-10-13 11:54:18 +00:00
|
|
|
|
2019-10-14 11:52:04 +00:00
|
|
|
Bitmap blue = (identicons
|
|
|
|
? ImageHelper.generateIdenticon(chash, 240f, size, 5, context)
|
|
|
|
: ImageHelper.generateLetterIcon("C", 240f, size, context));
|
2019-10-13 09:14:06 +00:00
|
|
|
|
2019-10-14 11:52:04 +00:00
|
|
|
ivRed.setImageBitmap(ImageHelper.makeCircular(red, radius));
|
|
|
|
ivGreen.setImageBitmap(ImageHelper.makeCircular(green, radius));
|
|
|
|
ivBlue.setImageBitmap(ImageHelper.makeCircular(blue, radius));
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
2019-06-30 20:52:33 +00:00
|
|
|
|
2019-09-11 19:43:27 +00:00
|
|
|
public static class FragmentDialogTheme extends FragmentDialogBase {
|
2019-06-30 20:52:33 +00:00
|
|
|
@NonNull
|
|
|
|
@Override
|
|
|
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
|
|
|
View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_theme, null);
|
|
|
|
final RadioGroup rgTheme = dview.findViewById(R.id.rgTheme);
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
String theme = prefs.getString("theme", "light");
|
|
|
|
|
|
|
|
switch (theme) {
|
2019-12-26 15:15:46 +00:00
|
|
|
case "light":
|
|
|
|
case "blue_orange_light":
|
|
|
|
rgTheme.check(R.id.rbThemeBlueOrangeLight);
|
2019-06-30 20:52:33 +00:00
|
|
|
break;
|
2019-12-26 15:15:46 +00:00
|
|
|
case "yellow_purple_light":
|
|
|
|
rgTheme.check(R.id.rbThemeYellowPurpleLight);
|
|
|
|
break;
|
2019-12-26 20:03:38 +00:00
|
|
|
case "red_green_light":
|
|
|
|
rgTheme.check(R.id.rbThemeRedGreenLight);
|
2019-06-30 20:52:33 +00:00
|
|
|
break;
|
2019-09-09 07:31:55 +00:00
|
|
|
case "grey_light":
|
|
|
|
rgTheme.check(R.id.rbThemeGreyLight);
|
|
|
|
break;
|
2019-12-26 15:15:46 +00:00
|
|
|
|
|
|
|
case "dark":
|
|
|
|
case "blue_orange_dark":
|
|
|
|
rgTheme.check(R.id.rbThemeBlueOrangeDark);
|
|
|
|
break;
|
|
|
|
case "yellow_purple_dark":
|
|
|
|
rgTheme.check(R.id.rbThemeYellowPurpleDark);
|
|
|
|
break;
|
2019-12-26 20:03:38 +00:00
|
|
|
case "red_green_dark":
|
|
|
|
rgTheme.check(R.id.rbThemeRedGreenDark);
|
2019-12-26 15:15:46 +00:00
|
|
|
break;
|
2019-09-09 07:31:55 +00:00
|
|
|
case "grey_dark":
|
|
|
|
rgTheme.check(R.id.rbThemeGreyDark);
|
2019-09-08 15:22:09 +00:00
|
|
|
break;
|
2019-12-26 15:15:46 +00:00
|
|
|
|
|
|
|
case "black":
|
|
|
|
rgTheme.check(R.id.rbThemeBlack);
|
|
|
|
break;
|
2019-06-30 20:52:33 +00:00
|
|
|
case "system":
|
|
|
|
rgTheme.check(R.id.rbThemeSystem);
|
|
|
|
break;
|
2019-09-09 09:40:14 +00:00
|
|
|
case "grey_system":
|
|
|
|
rgTheme.check(R.id.rbThemeGreySystem);
|
|
|
|
break;
|
2019-06-30 20:52:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rgTheme.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
|
getActivity().getIntent().putExtra("tab", "display");
|
|
|
|
|
2019-10-12 07:02:31 +00:00
|
|
|
ContactInfo.clearCache();
|
|
|
|
|
2019-06-30 20:52:33 +00:00
|
|
|
switch (checkedId) {
|
2019-12-26 15:15:46 +00:00
|
|
|
case R.id.rbThemeBlueOrangeLight:
|
|
|
|
prefs.edit().putString("theme", "blue_orange_light").apply();
|
2019-06-30 20:52:33 +00:00
|
|
|
break;
|
2019-12-26 15:15:46 +00:00
|
|
|
case R.id.rbThemeYellowPurpleLight:
|
|
|
|
prefs.edit().putString("theme", "yellow_purple_light").apply();
|
2019-06-30 20:52:33 +00:00
|
|
|
break;
|
2019-12-26 20:03:38 +00:00
|
|
|
case R.id.rbThemeRedGreenLight:
|
|
|
|
prefs.edit().putString("theme", "red_green_light").apply();
|
2019-06-30 20:52:33 +00:00
|
|
|
break;
|
2019-09-09 07:31:55 +00:00
|
|
|
case R.id.rbThemeGreyLight:
|
|
|
|
prefs.edit().putString("theme", "grey_light").apply();
|
|
|
|
break;
|
2019-12-26 15:15:46 +00:00
|
|
|
|
|
|
|
case R.id.rbThemeBlueOrangeDark:
|
|
|
|
prefs.edit().putString("theme", "blue_orange_dark").apply();
|
|
|
|
break;
|
|
|
|
case R.id.rbThemeYellowPurpleDark:
|
|
|
|
prefs.edit().putString("theme", "yellow_purple_dark").apply();
|
|
|
|
break;
|
2019-12-26 20:03:38 +00:00
|
|
|
case R.id.rbThemeRedGreenDark:
|
|
|
|
prefs.edit().putString("theme", "red_green_dark").apply();
|
2019-12-26 15:15:46 +00:00
|
|
|
break;
|
2019-09-09 07:31:55 +00:00
|
|
|
case R.id.rbThemeGreyDark:
|
|
|
|
prefs.edit().putString("theme", "grey_dark").apply();
|
2019-09-08 15:22:09 +00:00
|
|
|
break;
|
2019-12-26 15:15:46 +00:00
|
|
|
|
|
|
|
case R.id.rbThemeBlack:
|
|
|
|
prefs.edit().putString("theme", "black").apply();
|
|
|
|
break;
|
2019-06-30 20:52:33 +00:00
|
|
|
case R.id.rbThemeSystem:
|
|
|
|
prefs.edit().putString("theme", "system").apply();
|
|
|
|
break;
|
2019-09-09 09:40:14 +00:00
|
|
|
case R.id.rbThemeGreySystem:
|
|
|
|
prefs.edit().putString("theme", "grey_system").apply();
|
|
|
|
break;
|
2019-06-30 20:52:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return new AlertDialog.Builder(getContext())
|
|
|
|
.setView(dview)
|
2019-09-12 11:23:32 +00:00
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
2019-06-30 20:52:33 +00:00
|
|
|
.create();
|
|
|
|
}
|
|
|
|
}
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|