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/>.
|
|
|
|
|
2021-01-01 07:56:36 +00:00
|
|
|
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
2019-05-06 07:10:13 +00:00
|
|
|
*/
|
|
|
|
|
2019-10-13 09:14:06 +00:00
|
|
|
import android.content.Context;
|
2019-12-27 16:11:07 +00:00
|
|
|
import android.content.DialogInterface;
|
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;
|
2020-03-03 13:36:34 +00:00
|
|
|
import android.graphics.Color;
|
2019-12-29 17:36:26 +00:00
|
|
|
import android.net.Uri;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.os.Bundle;
|
2020-07-02 10:27:22 +00:00
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.TextWatcher;
|
2019-05-06 07:10:13 +00:00
|
|
|
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;
|
2020-03-03 13:36:34 +00:00
|
|
|
import android.view.Window;
|
2019-05-06 07:10:13 +00:00
|
|
|
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;
|
2020-07-02 10:27:22 +00:00
|
|
|
import android.widget.EditText;
|
2021-07-13 08:37:02 +00:00
|
|
|
import android.widget.ImageButton;
|
2019-10-13 09:14:06 +00:00
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.SeekBar;
|
2019-05-06 07:10:13 +00:00
|
|
|
import android.widget.Spinner;
|
2020-01-23 16:02:52 +00:00
|
|
|
import android.widget.TextView;
|
2019-05-06 07:10:13 +00:00
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.appcompat.widget.SwitchCompat;
|
2021-06-23 12:19:21 +00:00
|
|
|
import androidx.constraintlayout.widget.Group;
|
2020-03-03 13:36:34 +00:00
|
|
|
import androidx.fragment.app.FragmentActivity;
|
2019-09-10 06:53:07 +00:00
|
|
|
import androidx.lifecycle.Lifecycle;
|
2019-05-06 07:10:13 +00:00
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
2020-10-06 17:10:13 +00:00
|
|
|
import com.flask.colorpicker.ColorPickerView;
|
|
|
|
import com.flask.colorpicker.builder.ColorPickerClickListener;
|
|
|
|
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
|
|
|
|
|
2021-01-08 13:46:44 +00:00
|
|
|
import java.text.NumberFormat;
|
|
|
|
|
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-05-06 07:10:13 +00:00
|
|
|
private Spinner spStartup;
|
2019-08-14 10:16:25 +00:00
|
|
|
private SwitchCompat swCards;
|
2020-09-25 07:09:41 +00:00
|
|
|
private SwitchCompat swBeige;
|
2021-06-27 06:40:39 +00:00
|
|
|
private SwitchCompat swTabularBackground;
|
2021-02-17 10:32:56 +00:00
|
|
|
private SwitchCompat swShadow;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swDate;
|
2021-05-16 15:17:48 +00:00
|
|
|
private SwitchCompat swDateBold;
|
2020-03-04 12:23:47 +00:00
|
|
|
private SwitchCompat swNavBarColorize;
|
2020-07-01 10:21:42 +00:00
|
|
|
private SwitchCompat swPortrait2;
|
2020-03-04 12:23:47 +00:00
|
|
|
private SwitchCompat swLandscape;
|
|
|
|
private SwitchCompat swLandscape3;
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swThreading;
|
2020-06-04 14:10:38 +00:00
|
|
|
private SwitchCompat swThreadingUnread;
|
2019-10-12 17:40:30 +00:00
|
|
|
private SwitchCompat swIndentation;
|
2020-03-11 08:25:45 +00:00
|
|
|
private SwitchCompat swSeekbar;
|
2020-03-04 12:23:47 +00:00
|
|
|
private SwitchCompat swActionbar;
|
2020-03-26 16:53:11 +00:00
|
|
|
private SwitchCompat swActionbarColor;
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2019-08-16 17:52:59 +00:00
|
|
|
private SwitchCompat swHighlightUnread;
|
2020-10-07 11:51:15 +00:00
|
|
|
private ViewButtonColor btnHighlightColor;
|
2019-12-30 10:44:09 +00:00
|
|
|
private SwitchCompat swColorStripe;
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swAvatars;
|
2021-07-13 08:37:02 +00:00
|
|
|
private SwitchCompat swBimi;
|
|
|
|
private ImageButton ibBimi;
|
2021-07-16 13:05:54 +00:00
|
|
|
private TextView tvGravatarsHint;
|
|
|
|
private SwitchCompat swGravatars;
|
2020-06-30 09:19:17 +00:00
|
|
|
private SwitchCompat swFavicons;
|
2021-07-03 14:41:54 +00:00
|
|
|
private TextView tvFaviconsHint;
|
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;
|
2021-01-08 13:46:44 +00:00
|
|
|
private TextView tvSaturation;
|
2019-10-13 09:14:06 +00:00
|
|
|
private SeekBar sbSaturation;
|
2021-01-08 13:46:44 +00:00
|
|
|
private TextView tvBrightness;
|
2019-10-13 09:14:06 +00:00
|
|
|
private SeekBar sbBrightness;
|
2021-01-08 13:46:44 +00:00
|
|
|
private TextView tvThreshold;
|
2019-10-14 08:51:58 +00:00
|
|
|
private SeekBar sbThreshold;
|
2021-06-06 10:10:43 +00:00
|
|
|
private Spinner spNameEmail;
|
2020-02-09 10:37:16 +00:00
|
|
|
private SwitchCompat swPreferContact;
|
2021-02-28 16:37:06 +00:00
|
|
|
private SwitchCompat swOnlyContact;
|
2019-10-03 08:19:27 +00:00
|
|
|
private SwitchCompat swDistinguishContacts;
|
2020-05-05 20:39:58 +00:00
|
|
|
private SwitchCompat swShowRecipients;
|
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;
|
2020-03-22 17:43:22 +00:00
|
|
|
private SwitchCompat swHighlightSubject;
|
2019-09-09 10:22:50 +00:00
|
|
|
private Spinner spSubjectEllipsize;
|
2020-01-27 16:35:38 +00:00
|
|
|
private SwitchCompat swKeywords;
|
2020-06-25 07:14:05 +00:00
|
|
|
private SwitchCompat swLabels;
|
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;
|
2021-02-11 15:24:32 +00:00
|
|
|
private TextView tvPreviewLinesHint;
|
2020-03-23 15:12:34 +00:00
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
private SwitchCompat swAddresses;
|
2020-07-02 10:27:22 +00:00
|
|
|
private EditText etMessageZoom;
|
2020-08-20 06:52:09 +00:00
|
|
|
private SwitchCompat swOverviewMode;
|
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;
|
2020-11-01 14:44:44 +00:00
|
|
|
private SwitchCompat swMonospacedPre;
|
2021-07-04 09:58:54 +00:00
|
|
|
private SwitchCompat swBackgroundColor;
|
2019-09-23 18:13:38 +00:00
|
|
|
private SwitchCompat swTextColor;
|
2020-02-20 15:08:33 +00:00
|
|
|
private SwitchCompat swTextSize;
|
2020-06-28 13:59:02 +00:00
|
|
|
private SwitchCompat swTextFont;
|
2020-05-03 17:29:02 +00:00
|
|
|
private SwitchCompat swTextAlign;
|
2020-09-13 06:34:48 +00:00
|
|
|
private SwitchCompat swTextSeparators;
|
2019-07-10 09:25:23 +00:00
|
|
|
private SwitchCompat swCollapseQuotes;
|
2020-11-16 08:45:21 +00:00
|
|
|
private SwitchCompat swImagesPlaceholders;
|
2019-09-23 18:13:38 +00:00
|
|
|
private SwitchCompat swImagesInline;
|
2021-04-17 12:14:24 +00:00
|
|
|
private SwitchCompat swButtonExtra;
|
2020-03-22 17:43:22 +00:00
|
|
|
private SwitchCompat swAttachmentsAlt;
|
2020-06-29 07:14:52 +00:00
|
|
|
private SwitchCompat swThumbnails;
|
2019-05-06 07:10:13 +00:00
|
|
|
|
2020-04-22 10:10:30 +00:00
|
|
|
private SwitchCompat swParseClasses;
|
2020-03-23 14:48:13 +00:00
|
|
|
private SwitchCompat swAuthentication;
|
|
|
|
|
2021-06-23 12:19:21 +00:00
|
|
|
private Group grpGravatars;
|
|
|
|
|
2021-01-08 13:46:44 +00:00
|
|
|
private NumberFormat NF = NumberFormat.getNumberInstance();
|
|
|
|
|
2019-05-06 12:41:03 +00:00
|
|
|
private final static String[] RESET_OPTIONS = new String[]{
|
2021-06-27 06:40:39 +00:00
|
|
|
"theme", "startup", "cards", "beige", "tabular_card_bg", "shadow_unread",
|
2021-05-16 15:17:48 +00:00
|
|
|
"date", "date_bold", "navbar_colorize", "portrait2", "landscape", "landscape3",
|
2020-06-04 14:10:38 +00:00
|
|
|
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
|
2020-10-07 11:51:15 +00:00
|
|
|
"highlight_unread", "highlight_color", "color_stripe",
|
2021-07-16 13:05:54 +00:00
|
|
|
"avatars", "bimi", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
2021-06-06 10:10:43 +00:00
|
|
|
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients",
|
2020-10-07 11:51:15 +00:00
|
|
|
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
|
2020-06-25 07:14:05 +00:00
|
|
|
"keywords_header", "labels_header", "flags", "flags_background",
|
2020-03-23 15:01:17 +00:00
|
|
|
"preview", "preview_italic", "preview_lines",
|
2020-06-24 18:28:16 +00:00
|
|
|
"addresses",
|
2020-11-01 14:44:44 +00:00
|
|
|
"message_zoom", "overview_mode", "contrast", "monospaced", "monospaced_pre",
|
2021-07-04 09:58:54 +00:00
|
|
|
"background_color", "text_color", "text_size", "text_font", "text_align", "text_separators",
|
2021-04-17 12:14:24 +00:00
|
|
|
"collapse_quotes", "image_placeholders", "inline_images", "button_extra", "attachments_alt", "thumbnails",
|
2020-04-22 10:10:30 +00:00
|
|
|
"parse_classes", "authentication"
|
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-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);
|
2020-09-25 07:09:41 +00:00
|
|
|
swBeige = view.findViewById(R.id.swBeige);
|
2021-06-27 06:40:39 +00:00
|
|
|
swTabularBackground = view.findViewById(R.id.swTabularCardBackground);
|
2021-02-17 10:32:56 +00:00
|
|
|
swShadow = view.findViewById(R.id.swShadow);
|
2019-05-06 07:10:13 +00:00
|
|
|
swDate = view.findViewById(R.id.swDate);
|
2021-05-16 15:17:48 +00:00
|
|
|
swDateBold = view.findViewById(R.id.swDateBold);
|
2020-03-04 12:23:47 +00:00
|
|
|
swNavBarColorize = view.findViewById(R.id.swNavBarColorize);
|
2020-07-01 10:21:42 +00:00
|
|
|
swPortrait2 = view.findViewById(R.id.swPortrait2);
|
2020-03-04 12:23:47 +00:00
|
|
|
swLandscape = view.findViewById(R.id.swLandscape);
|
|
|
|
swLandscape3 = view.findViewById(R.id.swLandscape3);
|
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swThreading = view.findViewById(R.id.swThreading);
|
2020-06-04 14:10:38 +00:00
|
|
|
swThreadingUnread = view.findViewById(R.id.swThreadingUnread);
|
2020-03-04 12:23:47 +00:00
|
|
|
swIndentation = view.findViewById(R.id.swIndentation);
|
2020-03-11 08:25:45 +00:00
|
|
|
swSeekbar = view.findViewById(R.id.swSeekbar);
|
2020-03-04 12:23:47 +00:00
|
|
|
swActionbar = view.findViewById(R.id.swActionbar);
|
2020-03-26 16:53:11 +00:00
|
|
|
swActionbarColor = view.findViewById(R.id.swActionbarColor);
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2019-08-16 17:52:59 +00:00
|
|
|
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
|
2020-10-07 11:51:15 +00:00
|
|
|
btnHighlightColor = view.findViewById(R.id.btnHighlightColor);
|
2019-12-30 10:44:09 +00:00
|
|
|
swColorStripe = view.findViewById(R.id.swColorStripe);
|
2019-05-06 07:10:13 +00:00
|
|
|
swAvatars = view.findViewById(R.id.swAvatars);
|
2021-07-13 08:37:02 +00:00
|
|
|
swBimi = view.findViewById(R.id.swBimi);
|
|
|
|
ibBimi = view.findViewById(R.id.ibBimi);
|
2021-07-16 13:05:54 +00:00
|
|
|
swGravatars = view.findViewById(R.id.swGravatars);
|
|
|
|
tvGravatarsHint = view.findViewById(R.id.tvGravatarsHint);
|
2020-06-30 09:19:17 +00:00
|
|
|
swFavicons = view.findViewById(R.id.swFavicons);
|
2021-07-03 14:41:54 +00:00
|
|
|
tvFaviconsHint = view.findViewById(R.id.tvFaviconsHint);
|
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);
|
2021-01-08 13:46:44 +00:00
|
|
|
tvSaturation = view.findViewById(R.id.tvSaturation);
|
2019-10-13 09:14:06 +00:00
|
|
|
sbSaturation = view.findViewById(R.id.sbSaturation);
|
2021-01-08 13:46:44 +00:00
|
|
|
tvBrightness = view.findViewById(R.id.tvBrightness);
|
2019-10-13 09:14:06 +00:00
|
|
|
sbBrightness = view.findViewById(R.id.sbBrightness);
|
2021-01-08 13:46:44 +00:00
|
|
|
tvThreshold = view.findViewById(R.id.tvThreshold);
|
2019-10-14 08:51:58 +00:00
|
|
|
sbThreshold = view.findViewById(R.id.sbThreshold);
|
2021-06-06 10:10:43 +00:00
|
|
|
spNameEmail = view.findViewById(R.id.spNameEmail);
|
2020-02-09 10:37:16 +00:00
|
|
|
swPreferContact = view.findViewById(R.id.swPreferContact);
|
2021-02-28 16:37:06 +00:00
|
|
|
swOnlyContact = view.findViewById(R.id.swOnlyContact);
|
2019-10-03 08:19:27 +00:00
|
|
|
swDistinguishContacts = view.findViewById(R.id.swDistinguishContacts);
|
2020-05-05 20:39:58 +00:00
|
|
|
swShowRecipients = view.findViewById(R.id.swShowRecipients);
|
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);
|
2020-03-22 17:43:22 +00:00
|
|
|
swHighlightSubject = view.findViewById(R.id.swHighlightSubject);
|
2019-09-09 10:22:50 +00:00
|
|
|
spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize);
|
2020-01-27 16:35:38 +00:00
|
|
|
swKeywords = view.findViewById(R.id.swKeywords);
|
2020-06-25 07:14:05 +00:00
|
|
|
swLabels = view.findViewById(R.id.swLabels);
|
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);
|
2021-02-11 15:24:32 +00:00
|
|
|
tvPreviewLinesHint = view.findViewById(R.id.tvPreviewLinesHint);
|
2019-05-06 07:10:13 +00:00
|
|
|
swAddresses = view.findViewById(R.id.swAddresses);
|
2020-07-02 10:27:22 +00:00
|
|
|
etMessageZoom = view.findViewById(R.id.etMessageZoom);
|
2020-08-20 06:52:09 +00:00
|
|
|
swOverviewMode = view.findViewById(R.id.swOverviewMode);
|
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);
|
2020-11-01 14:44:44 +00:00
|
|
|
swMonospacedPre = view.findViewById(R.id.swMonospacedPre);
|
2021-07-04 09:58:54 +00:00
|
|
|
swBackgroundColor = view.findViewById(R.id.swBackgroundColor);
|
2019-09-23 18:13:38 +00:00
|
|
|
swTextColor = view.findViewById(R.id.swTextColor);
|
2020-02-20 15:08:33 +00:00
|
|
|
swTextSize = view.findViewById(R.id.swTextSize);
|
2020-06-28 13:59:02 +00:00
|
|
|
swTextFont = view.findViewById(R.id.swTextFont);
|
2020-05-03 17:29:02 +00:00
|
|
|
swTextAlign = view.findViewById(R.id.swTextAlign);
|
2020-09-13 06:34:48 +00:00
|
|
|
swTextSeparators = view.findViewById(R.id.swTextSeparators);
|
2019-07-10 09:25:23 +00:00
|
|
|
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
|
2020-11-16 08:45:21 +00:00
|
|
|
swImagesPlaceholders = view.findViewById(R.id.swImagesPlaceholders);
|
2019-09-23 18:13:38 +00:00
|
|
|
swImagesInline = view.findViewById(R.id.swImagesInline);
|
2021-04-17 12:14:24 +00:00
|
|
|
swButtonExtra = view.findViewById(R.id.swButtonExtra);
|
2020-03-22 17:43:22 +00:00
|
|
|
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
|
2020-06-29 07:14:52 +00:00
|
|
|
swThumbnails = view.findViewById(R.id.swThumbnails);
|
2020-04-22 10:10:30 +00:00
|
|
|
swParseClasses = view.findViewById(R.id.swParseClasses);
|
2020-03-23 14:48:13 +00:00
|
|
|
swAuthentication = view.findViewById(R.id.swAuthentication);
|
2019-05-06 07:10:13 +00:00
|
|
|
|
2021-06-23 12:19:21 +00:00
|
|
|
grpGravatars = view.findViewById(R.id.grpGravatars);
|
|
|
|
|
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-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();
|
2020-09-25 07:09:41 +00:00
|
|
|
swBeige.setEnabled(checked);
|
2021-06-27 06:40:39 +00:00
|
|
|
swTabularBackground.setEnabled(!checked);
|
2021-02-17 10:32:56 +00:00
|
|
|
swShadow.setEnabled(checked);
|
2019-10-20 07:16:45 +00:00
|
|
|
swIndentation.setEnabled(checked);
|
2019-08-14 10:16:25 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-09-25 07:09:41 +00:00
|
|
|
swBeige.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2021-05-12 16:32:19 +00:00
|
|
|
getActivity().getIntent().putExtra("tab", "display");
|
2020-09-25 07:09:41 +00:00
|
|
|
prefs.edit().putBoolean("beige", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-27 06:40:39 +00:00
|
|
|
swTabularBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("tabular_card_bg", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-02-17 10:32:56 +00:00
|
|
|
swShadow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("shadow_unread", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
swDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-05-06 07:10:13 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-04 12:23:47 +00:00
|
|
|
prefs.edit().putBoolean("date", checked).apply();
|
2021-05-16 15:17:48 +00:00
|
|
|
swDateBold.setEnabled(checked);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swDateBold.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("date_bold", checked).apply();
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
swNavBarColorize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-05-06 07:10:13 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-04 12:23:47 +00:00
|
|
|
prefs.edit().putBoolean("navbar_colorize", checked).apply();
|
|
|
|
setNavigationBarColor(
|
|
|
|
checked ? Helper.resolveColor(getContext(), R.attr.colorPrimaryDark) : Color.BLACK);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-01 10:21:42 +00:00
|
|
|
swPortrait2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("portrait2", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
swLandscape.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("landscape", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swLandscape3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("landscape3", 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();
|
2020-06-04 14:10:38 +00:00
|
|
|
swThreadingUnread.setEnabled(checked);
|
2020-01-01 19:52:23 +00:00
|
|
|
WidgetUnified.updateData(getContext());
|
2019-10-12 17:40:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-04 14:10:38 +00:00
|
|
|
swThreadingUnread.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("threading_unread", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("indentation", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-11 08:25:45 +00:00
|
|
|
swSeekbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("seekbar", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-04 12:23:47 +00:00
|
|
|
swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("actionbar", checked).apply();
|
2020-03-26 16:53:11 +00:00
|
|
|
swActionbarColor.setEnabled(checked);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swActionbarColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("actionbar_color", checked).apply();
|
2020-03-04 12:23:47 +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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-10-07 11:51:15 +00:00
|
|
|
btnHighlightColor.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
Context context = getContext();
|
|
|
|
int editTextColor = Helper.resolveColor(context, android.R.attr.editTextColor);
|
|
|
|
int highlightColor = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorAccent));
|
|
|
|
|
|
|
|
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
|
|
|
|
.with(context)
|
|
|
|
.setTitle(R.string.title_advanced_highlight_color)
|
|
|
|
.initialColor(highlightColor)
|
|
|
|
.showColorEdit(true)
|
|
|
|
.setColorEditTextColor(editTextColor)
|
|
|
|
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
|
|
|
|
.density(6)
|
|
|
|
.lightnessSliderOnly()
|
|
|
|
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
|
|
|
|
prefs.edit().putInt("highlight_color", selectedColor).apply();
|
|
|
|
btnHighlightColor.setColor(selectedColor);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
prefs.edit().remove("highlight_color").apply();
|
|
|
|
btnHighlightColor.setColor(Helper.resolveColor(context, R.attr.colorAccent));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
builder.build().show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-12-30 10:44:09 +00:00
|
|
|
swColorStripe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("color_stripe", checked).apply();
|
2020-05-15 13:32:58 +00:00
|
|
|
WidgetUnified.updateData(getContext());
|
2019-12-30 10:44:09 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-16 13:05:54 +00:00
|
|
|
swBimi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2020-01-17 15:59:29 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2021-07-16 13:05:54 +00:00
|
|
|
prefs.edit().putBoolean("bimi", checked).apply();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2020-01-17 15:59:29 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-16 13:05:54 +00:00
|
|
|
ibBimi.setOnClickListener(new View.OnClickListener() {
|
2021-07-03 14:41:54 +00:00
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2021-07-16 13:05:54 +00:00
|
|
|
Helper.view(v.getContext(), Uri.parse("https://bimigroup.org/"), true);
|
2021-07-15 05:33:40 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-16 13:05:54 +00:00
|
|
|
swGravatars.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2021-07-15 05:33:40 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2021-07-16 13:05:54 +00:00
|
|
|
prefs.edit().putBoolean("gravatars", checked).apply();
|
2021-07-13 08:37:02 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-16 13:05:54 +00:00
|
|
|
tvGravatarsHint.getPaint().setUnderlineText(true);
|
|
|
|
tvGravatarsHint.setOnClickListener(new View.OnClickListener() {
|
2021-07-13 08:37:02 +00:00
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2021-07-16 13:05:54 +00:00
|
|
|
Helper.view(v.getContext(), Uri.parse(Helper.GRAVATAR_PRIVACY_URI), true);
|
2021-07-13 08:37:02 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-30 09:19:17 +00:00
|
|
|
swFavicons.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("favicons", checked).apply();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2020-06-30 09:19:17 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-03 14:41:54 +00:00
|
|
|
tvFaviconsHint.getPaint().setUnderlineText(true);
|
|
|
|
tvFaviconsHint.setOnClickListener(new View.OnClickListener() {
|
2020-01-23 16:02:52 +00:00
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2021-07-03 14:41:54 +00:00
|
|
|
Helper.view(v.getContext(), Uri.parse(Helper.FAVICON_PRIVACY_URI), true);
|
2020-01-23 16:02:52 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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);
|
2020-01-17 15:59:29 +00:00
|
|
|
sbSaturation.setEnabled(checked);
|
|
|
|
sbBrightness.setEnabled(checked);
|
|
|
|
sbThreshold.setEnabled(checked);
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-07-22 08:40:03 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-10-13 09:14:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-10-13 09:14:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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();
|
2020-06-30 10:51:16 +00:00
|
|
|
ContactInfo.clearCache(getContext());
|
2019-10-14 08:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-06 10:10:43 +00:00
|
|
|
spNameEmail.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
2019-05-06 07:10:13 +00:00
|
|
|
@Override
|
2021-06-06 10:10:43 +00:00
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
prefs.edit().putInt("email_format", position).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("email_format").apply();
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-02-09 10:37:16 +00:00
|
|
|
swPreferContact.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("prefer_contact", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-02-28 16:37:06 +00:00
|
|
|
swOnlyContact.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("only_contact", 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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-05 20:39:58 +00:00
|
|
|
swShowRecipients.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("show_recipients", 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();
|
2020-01-01 19:52:23 +00:00
|
|
|
WidgetUnified.updateData(getContext());
|
2019-11-18 09:39:32 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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();
|
2020-01-01 19:52:23 +00:00
|
|
|
WidgetUnified.updateData(getContext());
|
2019-05-06 07:10:13 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-22 17:43:22 +00:00
|
|
|
swHighlightSubject.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("highlight_subject", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-01-27 16:35:38 +00:00
|
|
|
swKeywords.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("keywords_header", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-25 07:14:05 +00:00
|
|
|
swLabels.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("labels_header", checked).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
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-02-11 15:24:32 +00:00
|
|
|
tvPreviewLinesHint.setText(getString(R.string.title_advanced_preview_lines_hint, NF.format(HtmlHelper.PREVIEW_SIZE)));
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-02 10:27:22 +00:00
|
|
|
etMessageZoom.addTextChangedListener(new TextWatcher() {
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
try {
|
2020-07-02 10:48:24 +00:00
|
|
|
int zoom = (s.length() > 0 ? Integer.parseInt(s.toString()) : 0);
|
|
|
|
if (zoom == 0)
|
2020-07-02 10:27:22 +00:00
|
|
|
prefs.edit().remove("message_zoom").apply();
|
|
|
|
else
|
2020-07-02 10:48:24 +00:00
|
|
|
prefs.edit().putInt("message_zoom", zoom).apply();
|
2020-07-02 10:27:22 +00:00
|
|
|
} catch (NumberFormatException ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-08-20 06:52:09 +00:00
|
|
|
swOverviewMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("overview_mode", 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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-11-01 14:44:44 +00:00
|
|
|
swMonospacedPre.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("monospaced_pre", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-04 09:58:54 +00:00
|
|
|
String theme = prefs.getString("theme", "blue_orange_system");
|
|
|
|
boolean bw = "black_and_white".equals(theme);
|
|
|
|
|
|
|
|
swBackgroundColor.setEnabled(!bw);
|
|
|
|
swBackgroundColor.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("background_color", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swTextColor.setEnabled(!bw);
|
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
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-02-20 15:08:33 +00:00
|
|
|
swTextSize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("text_size", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-28 13:59:02 +00:00
|
|
|
swTextFont.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("text_font", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-05-03 17:29:02 +00:00
|
|
|
swTextAlign.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("text_align", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-09-13 06:34:48 +00:00
|
|
|
swTextSeparators.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("text_separators", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-11-16 08:45:21 +00:00
|
|
|
swImagesPlaceholders.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("image_placeholders", 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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-04-17 12:14:24 +00:00
|
|
|
swButtonExtra.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("button_extra", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-22 17:43:22 +00:00
|
|
|
swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("attachments_alt", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-29 07:14:52 +00:00
|
|
|
swThumbnails.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("thumbnails", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-04-22 10:10:30 +00:00
|
|
|
swParseClasses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("parse_classes", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-23 14:48:13 +00:00
|
|
|
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("authentication", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-05-12 06:45:56 +00:00
|
|
|
// Initialize
|
2021-06-27 06:13:56 +00:00
|
|
|
FragmentDialogTheme.setBackground(getContext(), view, false);
|
2021-06-29 15:54:05 +00:00
|
|
|
grpGravatars.setVisibility(ContactInfo.canGravatars() ? View.VISIBLE : View.GONE);
|
2021-06-23 12:19:21 +00:00
|
|
|
|
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) {
|
2020-07-02 10:27:22 +00:00
|
|
|
if ("message_zoom".equals(key))
|
|
|
|
return;
|
|
|
|
|
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) {
|
2021-02-05 10:15:02 +00:00
|
|
|
if (item.getItemId() == R.id.menu_default) {
|
2021-06-26 13:50:20 +00:00
|
|
|
FragmentOptions.reset(getContext(), RESET_OPTIONS, new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
setNavigationBarColor(Color.BLACK);
|
|
|
|
}
|
|
|
|
});
|
2021-02-05 10:15:02 +00:00
|
|
|
return true;
|
2019-05-06 12:41:03 +00:00
|
|
|
}
|
2021-02-05 10:15:02 +00:00
|
|
|
return super.onOptionsItemSelected(item);
|
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);
|
|
|
|
|
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));
|
2020-09-25 08:19:15 +00:00
|
|
|
swBeige.setChecked(prefs.getBoolean("beige", true));
|
2021-06-27 06:40:39 +00:00
|
|
|
swTabularBackground.setChecked(prefs.getBoolean("tabular_card_bg", false));
|
2021-02-17 10:32:56 +00:00
|
|
|
swShadow.setChecked(prefs.getBoolean("shadow_unread", false));
|
2020-09-25 07:09:41 +00:00
|
|
|
swBeige.setEnabled(swCards.isChecked());
|
2021-06-27 06:40:39 +00:00
|
|
|
swTabularBackground.setEnabled(!swCards.isChecked());
|
2021-02-17 10:32:56 +00:00
|
|
|
swShadow.setEnabled(swCards.isChecked());
|
2019-05-06 07:10:13 +00:00
|
|
|
swDate.setChecked(prefs.getBoolean("date", true));
|
2021-05-16 15:17:48 +00:00
|
|
|
swDateBold.setChecked(prefs.getBoolean("date_bold", false));
|
|
|
|
swDateBold.setEnabled(swDate.isChecked());
|
2020-03-04 12:23:47 +00:00
|
|
|
swNavBarColorize.setChecked(prefs.getBoolean("navbar_colorize", false));
|
2020-07-01 10:21:42 +00:00
|
|
|
swPortrait2.setChecked(prefs.getBoolean("portrait2", false));
|
2020-03-04 12:23:47 +00:00
|
|
|
swLandscape.setChecked(prefs.getBoolean("landscape", true));
|
|
|
|
swLandscape.setEnabled(normal);
|
2021-02-17 08:14:04 +00:00
|
|
|
swLandscape3.setChecked(prefs.getBoolean("landscape3", true));
|
2020-08-07 14:09:25 +00:00
|
|
|
swLandscape3.setEnabled(normal);
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swThreading.setChecked(prefs.getBoolean("threading", true));
|
2020-06-04 14:10:38 +00:00
|
|
|
swThreadingUnread.setChecked(prefs.getBoolean("threading_unread", false));
|
|
|
|
swThreadingUnread.setEnabled(swThreading.isChecked());
|
2020-03-04 12:23:47 +00:00
|
|
|
swIndentation.setChecked(prefs.getBoolean("indentation", false));
|
2021-06-27 07:31:20 +00:00
|
|
|
swIndentation.setEnabled(swCards.isChecked() && swThreading.isChecked());
|
2020-03-11 08:25:45 +00:00
|
|
|
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
|
2020-03-04 12:23:47 +00:00
|
|
|
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
|
2020-03-26 16:53:11 +00:00
|
|
|
swActionbarColor.setChecked(prefs.getBoolean("actionbar_color", false));
|
|
|
|
swActionbarColor.setEnabled(swActionbar.isChecked());
|
2020-03-04 12:23:47 +00:00
|
|
|
|
2020-03-08 20:25:20 +00:00
|
|
|
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", true));
|
2020-10-07 11:51:15 +00:00
|
|
|
|
|
|
|
btnHighlightColor.setColor(prefs.getInt("highlight_color",
|
|
|
|
Helper.resolveColor(getContext(), R.attr.colorUnreadHighlight)));
|
|
|
|
|
2019-12-30 10:44:09 +00:00
|
|
|
swColorStripe.setChecked(prefs.getBoolean("color_stripe", true));
|
2019-05-06 07:10:13 +00:00
|
|
|
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
2021-07-13 08:37:02 +00:00
|
|
|
swBimi.setChecked(prefs.getBoolean("bimi", false));
|
2021-07-16 13:05:54 +00:00
|
|
|
swGravatars.setChecked(prefs.getBoolean("gravatars", false));
|
2020-06-30 09:19:17 +00:00
|
|
|
swFavicons.setChecked(prefs.getBoolean("favicons", false));
|
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
|
|
|
|
2021-01-08 13:46:44 +00:00
|
|
|
int saturation = prefs.getInt("saturation", 100);
|
|
|
|
tvSaturation.setText(getString(R.string.title_advanced_color_saturation, NF.format(saturation)));
|
|
|
|
sbSaturation.setProgress(saturation);
|
2019-10-13 11:54:18 +00:00
|
|
|
sbSaturation.setEnabled(swGeneratedIcons.isChecked());
|
2021-01-08 13:46:44 +00:00
|
|
|
|
|
|
|
int brightness = prefs.getInt("brightness", 100);
|
|
|
|
tvBrightness.setText(getString(R.string.title_advanced_color_value, NF.format(brightness)));
|
|
|
|
sbBrightness.setProgress(brightness);
|
2019-10-13 11:54:18 +00:00
|
|
|
sbBrightness.setEnabled(swGeneratedIcons.isChecked());
|
2021-01-08 13:46:44 +00:00
|
|
|
|
|
|
|
int threshold = prefs.getInt("threshold", 50);
|
|
|
|
tvThreshold.setText(getString(R.string.title_advanced_color_threshold, NF.format(threshold)));
|
|
|
|
sbThreshold.setProgress(threshold);
|
2019-10-14 08:51:58 +00:00
|
|
|
sbThreshold.setEnabled(swGeneratedIcons.isChecked());
|
|
|
|
|
2021-06-06 10:10:43 +00:00
|
|
|
MessageHelper.AddressFormat email_format = MessageHelper.getAddressFormat(getContext());
|
|
|
|
spNameEmail.setSelection(email_format.ordinal());
|
2020-02-09 10:37:16 +00:00
|
|
|
swPreferContact.setChecked(prefs.getBoolean("prefer_contact", false));
|
2021-02-28 16:37:06 +00:00
|
|
|
swOnlyContact.setChecked(prefs.getBoolean("only_contact", false));
|
2019-10-03 08:19:27 +00:00
|
|
|
swDistinguishContacts.setChecked(prefs.getBoolean("distinguish_contacts", false));
|
2020-05-06 13:31:12 +00:00
|
|
|
swShowRecipients.setChecked(prefs.getBoolean("show_recipients", false));
|
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));
|
2020-03-22 17:43:22 +00:00
|
|
|
swHighlightSubject.setChecked(prefs.getBoolean("highlight_subject", false));
|
2019-09-09 10:22:50 +00:00
|
|
|
|
2020-07-04 07:26:11 +00:00
|
|
|
String subject_ellipsize = prefs.getString("subject_ellipsize", "full");
|
2019-09-09 10:22:50 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-01-27 16:35:38 +00:00
|
|
|
swKeywords.setChecked(prefs.getBoolean("keywords_header", false));
|
2020-06-25 07:14:05 +00:00
|
|
|
swLabels.setChecked(prefs.getBoolean("labels_header", true));
|
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());
|
2020-07-02 10:27:22 +00:00
|
|
|
|
2019-05-06 07:10:13 +00:00
|
|
|
swAddresses.setChecked(prefs.getBoolean("addresses", false));
|
2020-07-02 10:27:22 +00:00
|
|
|
|
|
|
|
int message_zoom = prefs.getInt("message_zoom", 0);
|
|
|
|
etMessageZoom.setText(message_zoom == 0 ? null : Integer.toString(message_zoom));
|
2020-08-20 06:52:09 +00:00
|
|
|
swOverviewMode.setChecked(prefs.getBoolean("overview_mode", false));
|
2020-07-02 10:27:22 +00:00
|
|
|
|
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));
|
2020-11-01 14:44:44 +00:00
|
|
|
swMonospacedPre.setChecked(prefs.getBoolean("monospaced_pre", false));
|
2021-07-04 09:58:54 +00:00
|
|
|
swBackgroundColor.setChecked(prefs.getBoolean("background_color", false));
|
2019-09-23 18:13:38 +00:00
|
|
|
swTextColor.setChecked(prefs.getBoolean("text_color", true));
|
2020-02-20 15:08:33 +00:00
|
|
|
swTextSize.setChecked(prefs.getBoolean("text_size", true));
|
2020-06-28 13:59:02 +00:00
|
|
|
swTextFont.setChecked(prefs.getBoolean("text_font", true));
|
2020-05-03 17:29:02 +00:00
|
|
|
swTextAlign.setChecked(prefs.getBoolean("text_align", true));
|
2020-11-16 08:58:19 +00:00
|
|
|
swTextSeparators.setChecked(prefs.getBoolean("text_separators", true));
|
2019-07-10 09:25:23 +00:00
|
|
|
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
|
2020-11-16 08:45:21 +00:00
|
|
|
swImagesPlaceholders.setChecked(prefs.getBoolean("image_placeholders", true));
|
2019-09-23 18:13:38 +00:00
|
|
|
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
|
2021-04-17 12:14:24 +00:00
|
|
|
swButtonExtra.setChecked(prefs.getBoolean("button_extra", false));
|
2020-03-22 17:43:22 +00:00
|
|
|
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
|
2020-06-29 07:14:52 +00:00
|
|
|
swThumbnails.setChecked(prefs.getBoolean("thumbnails", true));
|
2019-10-13 09:14:06 +00:00
|
|
|
|
2020-11-09 11:49:04 +00:00
|
|
|
swParseClasses.setChecked(prefs.getBoolean("parse_classes", true));
|
2020-03-23 14:48:13 +00:00
|
|
|
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
|
|
|
|
|
2019-10-13 09:14:06 +00:00
|
|
|
updateColor();
|
|
|
|
}
|
|
|
|
|
2020-03-03 13:36:34 +00:00
|
|
|
private void setNavigationBarColor(int color) {
|
|
|
|
FragmentActivity activity = getActivity();
|
|
|
|
if (activity == null)
|
|
|
|
return;
|
|
|
|
Window window = activity.getWindow();
|
|
|
|
if (window == null)
|
|
|
|
return;
|
|
|
|
window.setNavigationBarColor(color);
|
|
|
|
}
|
|
|
|
|
2019-10-13 09:14:06 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|