2019-05-09 06:15:10 +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/>.
|
|
|
|
|
2022-01-01 08:46:36 +00:00
|
|
|
Copyright 2018-2022 by Marcel Bokhorst (M66B)
|
2019-05-09 06:15:10 +00:00
|
|
|
*/
|
|
|
|
|
2022-03-23 08:24:54 +00:00
|
|
|
import static android.app.Activity.RESULT_OK;
|
|
|
|
|
2019-10-16 13:12:39 +00:00
|
|
|
import android.content.Intent;
|
2019-05-09 06:15:10 +00:00
|
|
|
import android.content.SharedPreferences;
|
2022-03-23 08:24:54 +00:00
|
|
|
import android.media.RingtoneManager;
|
|
|
|
import android.net.Uri;
|
2019-05-09 06:15:10 +00:00
|
|
|
import android.os.Bundle;
|
2021-05-10 20:38:33 +00:00
|
|
|
import android.text.SpannableStringBuilder;
|
|
|
|
import android.text.Spanned;
|
2019-05-09 06:15:10 +00:00
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.AdapterView;
|
2021-05-10 20:38:33 +00:00
|
|
|
import android.widget.ArrayAdapter;
|
2019-10-16 13:12:39 +00:00
|
|
|
import android.widget.Button;
|
2019-05-09 06:15:10 +00:00
|
|
|
import android.widget.CompoundButton;
|
2021-06-10 13:48:17 +00:00
|
|
|
import android.widget.RadioButton;
|
|
|
|
import android.widget.RadioGroup;
|
2019-05-09 06:15:10 +00:00
|
|
|
import android.widget.Spinner;
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.appcompat.widget.SwitchCompat;
|
2019-09-10 06:53:07 +00:00
|
|
|
import androidx.lifecycle.Lifecycle;
|
2019-10-16 13:12:39 +00:00
|
|
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
2019-05-09 06:15:10 +00:00
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
2021-05-10 20:38:33 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2021-06-10 13:48:17 +00:00
|
|
|
import java.util.Objects;
|
2021-05-10 20:38:33 +00:00
|
|
|
|
2019-05-09 06:15:10 +00:00
|
|
|
public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
2019-06-15 06:49:46 +00:00
|
|
|
private SwitchCompat swKeyboard;
|
2020-11-27 19:04:26 +00:00
|
|
|
private SwitchCompat swKeyboardNoFullscreen;
|
2021-03-02 08:06:18 +00:00
|
|
|
private SwitchCompat swSuggestNames;
|
2019-09-12 15:33:33 +00:00
|
|
|
private SwitchCompat swSuggestSent;
|
|
|
|
private SwitchCompat swSuggestReceived;
|
2020-03-30 11:53:55 +00:00
|
|
|
private SwitchCompat swSuggestFrequently;
|
2019-10-16 13:12:39 +00:00
|
|
|
private Button btnLocalContacts;
|
2022-03-23 08:38:40 +00:00
|
|
|
private Button btnBlockedSenders;
|
2021-08-19 19:44:21 +00:00
|
|
|
private SwitchCompat swPrefixOnce;
|
2021-12-23 18:12:02 +00:00
|
|
|
private SwitchCompat swPrefixCount;
|
2021-06-10 13:48:17 +00:00
|
|
|
private RadioGroup rgRe;
|
|
|
|
private RadioGroup rgFwd;
|
2022-02-21 12:14:51 +00:00
|
|
|
private SwitchCompat swSendChips;
|
2020-03-15 10:40:04 +00:00
|
|
|
private SwitchCompat swSendReminders;
|
|
|
|
private Spinner spSendDelayed;
|
2021-08-24 09:27:20 +00:00
|
|
|
private SwitchCompat swAttachNew;
|
2022-02-15 19:05:02 +00:00
|
|
|
private Spinner spAnswerAction;
|
2021-03-31 19:10:57 +00:00
|
|
|
private SwitchCompat swSendPending;
|
2022-03-23 08:24:54 +00:00
|
|
|
private Button btnSound;
|
2020-03-15 10:40:04 +00:00
|
|
|
|
2020-07-24 08:15:13 +00:00
|
|
|
private Spinner spComposeFont;
|
2020-10-07 16:01:26 +00:00
|
|
|
private SwitchCompat swSeparateReply;
|
2019-11-07 07:56:54 +00:00
|
|
|
private SwitchCompat swExtendedReply;
|
2020-11-20 13:35:07 +00:00
|
|
|
private SwitchCompat swWriteBelow;
|
2019-11-07 10:15:02 +00:00
|
|
|
private SwitchCompat swQuoteReply;
|
2020-11-14 08:36:11 +00:00
|
|
|
private SwitchCompat swQuoteLimit;
|
2020-03-25 12:32:11 +00:00
|
|
|
private SwitchCompat swResizeReply;
|
2020-02-16 12:29:19 +00:00
|
|
|
private Spinner spSignatureLocation;
|
2021-08-13 20:50:09 +00:00
|
|
|
private SwitchCompat swSignatureNew;
|
2020-06-12 07:42:09 +00:00
|
|
|
private SwitchCompat swSignatureReply;
|
2020-06-12 07:49:15 +00:00
|
|
|
private SwitchCompat swSignatureForward;
|
2021-02-07 09:30:26 +00:00
|
|
|
private Button btnEditSignature;
|
2020-07-17 09:23:45 +00:00
|
|
|
private SwitchCompat swDiscardDelete;
|
2021-04-03 10:52:22 +00:00
|
|
|
private SwitchCompat swReplyMove;
|
2020-03-15 10:40:04 +00:00
|
|
|
|
2021-03-24 06:30:50 +00:00
|
|
|
private SwitchCompat swAutoLink;
|
2020-03-15 10:40:04 +00:00
|
|
|
private SwitchCompat swPlainOnly;
|
|
|
|
private SwitchCompat swFormatFlowed;
|
|
|
|
private SwitchCompat swUsenetSignature;
|
|
|
|
private SwitchCompat swRemoveSignatures;
|
2019-10-02 07:26:32 +00:00
|
|
|
private SwitchCompat swReceipt;
|
2020-03-07 07:20:55 +00:00
|
|
|
private Spinner spReceiptType;
|
2022-01-26 07:19:01 +00:00
|
|
|
private SwitchCompat swReceiptLegacy;
|
2019-07-14 11:35:52 +00:00
|
|
|
private SwitchCompat swLookupMx;
|
2019-05-09 06:15:10 +00:00
|
|
|
|
|
|
|
private final static String[] RESET_OPTIONS = new String[]{
|
2021-03-02 08:06:18 +00:00
|
|
|
"keyboard", "keyboard_no_fullscreen",
|
|
|
|
"suggest_names", "suggest_sent", "suggested_received", "suggest_frequently",
|
2021-08-24 09:13:53 +00:00
|
|
|
"alt_re", "alt_fwd",
|
2022-02-21 12:14:51 +00:00
|
|
|
"send_reminders", "send_chips", "send_delayed",
|
2022-03-23 08:24:54 +00:00
|
|
|
"attach_new", "answer_action", "send_pending", "sound_sent",
|
2021-12-23 18:12:02 +00:00
|
|
|
"compose_font", "prefix_once", "prefix_count", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
|
2021-08-13 20:50:09 +00:00
|
|
|
"signature_location", "signature_new", "signature_reply", "signature_forward",
|
2021-04-03 10:52:22 +00:00
|
|
|
"discard_delete", "reply_move",
|
2021-03-24 06:30:50 +00:00
|
|
|
"auto_link", "plain_only", "format_flowed", "usenet_signature", "remove_signatures",
|
2022-01-26 07:19:01 +00:00
|
|
|
"receipt_default", "receipt_type", "receipt_legacy", "lookup_mx"
|
2019-05-09 06:15:10 +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-09 06:15:10 +00:00
|
|
|
setHasOptionsMenu(true);
|
|
|
|
|
|
|
|
View view = inflater.inflate(R.layout.fragment_options_send, container, false);
|
|
|
|
|
|
|
|
// Get controls
|
|
|
|
|
2019-06-15 06:49:46 +00:00
|
|
|
swKeyboard = view.findViewById(R.id.swKeyboard);
|
2020-11-27 19:04:26 +00:00
|
|
|
swKeyboardNoFullscreen = view.findViewById(R.id.swKeyboardNoFullscreen);
|
2021-03-02 08:06:18 +00:00
|
|
|
swSuggestNames = view.findViewById(R.id.swSuggestNames);
|
2019-09-12 15:33:33 +00:00
|
|
|
swSuggestSent = view.findViewById(R.id.swSuggestSent);
|
|
|
|
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
|
2020-03-30 11:53:55 +00:00
|
|
|
swSuggestFrequently = view.findViewById(R.id.swSuggestFrequently);
|
2019-10-16 13:12:39 +00:00
|
|
|
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
|
2022-03-23 08:38:40 +00:00
|
|
|
btnBlockedSenders = view.findViewById(R.id.btnBlockedSenders);
|
2021-08-19 19:44:21 +00:00
|
|
|
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
2021-12-23 18:12:02 +00:00
|
|
|
swPrefixCount = view.findViewById(R.id.swPrefixCount);
|
2021-06-10 13:48:17 +00:00
|
|
|
rgRe = view.findViewById(R.id.rgRe);
|
|
|
|
rgFwd = view.findViewById(R.id.rgFwd);
|
2022-02-21 12:14:51 +00:00
|
|
|
swSendChips = view.findViewById(R.id.swSendChips);
|
2020-03-15 10:40:04 +00:00
|
|
|
swSendReminders = view.findViewById(R.id.swSendReminders);
|
|
|
|
spSendDelayed = view.findViewById(R.id.spSendDelayed);
|
2021-08-24 09:27:20 +00:00
|
|
|
swAttachNew = view.findViewById(R.id.swAttachNew);
|
2022-02-15 19:05:02 +00:00
|
|
|
spAnswerAction = view.findViewById(R.id.spAnswerAction);
|
2021-03-31 19:10:57 +00:00
|
|
|
swSendPending = view.findViewById(R.id.swSendPending);
|
2022-03-23 08:24:54 +00:00
|
|
|
btnSound = view.findViewById(R.id.btnSound);
|
2020-03-15 10:40:04 +00:00
|
|
|
|
2021-03-31 19:10:57 +00:00
|
|
|
spComposeFont = view.findViewById(R.id.spComposeFont);
|
2020-10-07 16:01:26 +00:00
|
|
|
swSeparateReply = view.findViewById(R.id.swSeparateReply);
|
2019-11-07 07:56:54 +00:00
|
|
|
swExtendedReply = view.findViewById(R.id.swExtendedReply);
|
2020-11-20 13:35:07 +00:00
|
|
|
swWriteBelow = view.findViewById(R.id.swWriteBelow);
|
2019-11-07 10:15:02 +00:00
|
|
|
swQuoteReply = view.findViewById(R.id.swQuoteReply);
|
2020-11-14 08:36:11 +00:00
|
|
|
swQuoteLimit = view.findViewById(R.id.swQuoteLimit);
|
2020-03-25 12:32:11 +00:00
|
|
|
swResizeReply = view.findViewById(R.id.swResizeReply);
|
2020-02-16 12:29:19 +00:00
|
|
|
spSignatureLocation = view.findViewById(R.id.spSignatureLocation);
|
2021-08-13 20:50:09 +00:00
|
|
|
swSignatureNew = view.findViewById(R.id.swSignatureNew);
|
2020-06-12 07:42:09 +00:00
|
|
|
swSignatureReply = view.findViewById(R.id.swSignatureReply);
|
2020-06-12 07:49:15 +00:00
|
|
|
swSignatureForward = view.findViewById(R.id.swSignatureForward);
|
2021-02-07 09:30:26 +00:00
|
|
|
btnEditSignature = view.findViewById(R.id.btnEditSignature);
|
2020-07-17 09:23:45 +00:00
|
|
|
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
|
2021-04-03 10:52:22 +00:00
|
|
|
swReplyMove = view.findViewById(R.id.swReplyMove);
|
2020-03-15 10:40:04 +00:00
|
|
|
|
2021-03-24 06:30:50 +00:00
|
|
|
swAutoLink = view.findViewById(R.id.swAutoLink);
|
2020-03-15 10:40:04 +00:00
|
|
|
swPlainOnly = view.findViewById(R.id.swPlainOnly);
|
|
|
|
swFormatFlowed = view.findViewById(R.id.swFormatFlowed);
|
|
|
|
swUsenetSignature = view.findViewById(R.id.swUsenetSignature);
|
|
|
|
swRemoveSignatures = view.findViewById(R.id.swRemoveSignatures);
|
2019-10-02 07:26:32 +00:00
|
|
|
swReceipt = view.findViewById(R.id.swReceipt);
|
2020-03-07 07:20:55 +00:00
|
|
|
spReceiptType = view.findViewById(R.id.spReceiptType);
|
2022-01-26 07:19:01 +00:00
|
|
|
swReceiptLegacy = view.findViewById(R.id.swReceiptLegacy);
|
2019-07-14 11:35:52 +00:00
|
|
|
swLookupMx = view.findViewById(R.id.swLookupMx);
|
2019-05-09 06:15:10 +00:00
|
|
|
|
2022-02-10 15:05:52 +00:00
|
|
|
List<StyleHelper.FontDescriptor> fonts = StyleHelper.getFonts(getContext());
|
2021-05-10 20:38:33 +00:00
|
|
|
|
|
|
|
List<CharSequence> fn = new ArrayList<>();
|
2021-10-06 05:48:03 +00:00
|
|
|
fn.add("-");
|
2022-02-07 11:28:19 +00:00
|
|
|
for (int i = 0; i < fonts.size(); i++) {
|
2022-02-10 15:05:52 +00:00
|
|
|
StyleHelper.FontDescriptor font = fonts.get(i);
|
|
|
|
SpannableStringBuilder ssb = new SpannableStringBuilderEx(font.toString());
|
2022-02-11 06:58:50 +00:00
|
|
|
ssb.setSpan(StyleHelper.getTypefaceSpan(font.type, getContext()),
|
|
|
|
0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
2021-05-10 20:38:33 +00:00
|
|
|
fn.add(ssb);
|
|
|
|
}
|
|
|
|
|
|
|
|
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, fn);
|
|
|
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
|
|
|
spComposeFont.setAdapter(adapter);
|
|
|
|
|
2019-05-09 06:15:10 +00:00
|
|
|
setOptions();
|
|
|
|
|
|
|
|
// Wire controls
|
|
|
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
2019-06-15 06:49:46 +00:00
|
|
|
swKeyboard.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("keyboard", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-11-27 19:04:26 +00:00
|
|
|
swKeyboardNoFullscreen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("keyboard_no_fullscreen", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-03-02 08:06:18 +00:00
|
|
|
swSuggestNames.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("suggest_names", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-09-12 15:33:33 +00:00
|
|
|
swSuggestSent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-08-23 13:06:59 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2019-09-12 15:33:33 +00:00
|
|
|
prefs.edit().putBoolean("suggest_sent", checked).apply();
|
2020-03-30 12:15:29 +00:00
|
|
|
swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
|
2019-09-12 15:33:33 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swSuggestReceived.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("suggest_received", checked).apply();
|
2020-03-30 12:15:29 +00:00
|
|
|
swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
|
2019-08-23 13:06:59 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-30 11:53:55 +00:00
|
|
|
swSuggestFrequently.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("suggest_frequently", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-10-16 13:12:39 +00:00
|
|
|
btnLocalContacts.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
|
|
|
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_MANAGE_LOCAL_CONTACTS));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-23 08:38:40 +00:00
|
|
|
btnBlockedSenders.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
|
|
|
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_MANAGE_LOCAL_CONTACTS)
|
|
|
|
.putExtra("junk", true));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-08-19 19:44:21 +00:00
|
|
|
swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("prefix_once", checked).apply();
|
2022-02-18 11:54:01 +00:00
|
|
|
swPrefixCount.setEnabled(checked);
|
2021-12-23 18:12:02 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swPrefixCount.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("prefix_count", checked).apply();
|
2021-08-19 19:44:21 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-10 13:48:17 +00:00
|
|
|
rgRe.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
|
prefs.edit().putBoolean("alt_re", checkedId == R.id.rbRe2).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
rgFwd.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
|
prefs.edit().putBoolean("alt_fwd", checkedId == R.id.rbFwd2).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-02-21 12:14:51 +00:00
|
|
|
swSendChips.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("send_chips", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swSendReminders.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-05-09 06:15:10 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putBoolean("send_reminders", checked).apply();
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
spSendDelayed.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
2019-11-07 07:56:54 +00:00
|
|
|
@Override
|
2020-03-15 10:40:04 +00:00
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
int[] values = getResources().getIntArray(R.array.sendDelayedValues);
|
|
|
|
prefs.edit().putInt("send_delayed", values[position]).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("send_delayed").apply();
|
2019-11-07 07:56:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-08-24 09:27:20 +00:00
|
|
|
swAttachNew.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("attach_new", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-02-15 19:05:02 +00:00
|
|
|
spAnswerAction.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
2021-08-24 09:13:53 +00:00
|
|
|
@Override
|
2022-02-15 19:05:02 +00:00
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
String[] values = getResources().getStringArray(R.array.answerValues);
|
|
|
|
prefs.edit().putString("answer_action", values[position]).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("sender_ellipsize").apply();
|
2021-08-24 09:13:53 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-03-31 19:10:57 +00:00
|
|
|
swSendPending.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("send_pending", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-03-23 08:24:54 +00:00
|
|
|
btnSound.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
String sound = prefs.getString("sound_sent", null);
|
|
|
|
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
|
|
|
|
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
|
|
|
|
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.title_advanced_sound));
|
|
|
|
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
|
|
|
|
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
|
|
|
|
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, sound == null ? null : Uri.parse(sound));
|
|
|
|
startActivityForResult(Helper.getChooser(getContext(), intent), ActivitySetup.REQUEST_SOUND_OUTBOUND);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-24 08:15:13 +00:00
|
|
|
spComposeFont.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
2022-02-11 08:36:32 +00:00
|
|
|
if (position == 0)
|
2020-07-24 08:15:13 +00:00
|
|
|
prefs.edit().remove("compose_font").apply();
|
|
|
|
else
|
2022-02-11 08:36:32 +00:00
|
|
|
prefs.edit().putString("compose_font", fonts.get(position - 1).type).apply();
|
2020-07-24 08:15:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
prefs.edit().remove("compose_font").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-10-07 16:01:26 +00:00
|
|
|
swSeparateReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("separate_reply", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swSeparateReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("separate_reply", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swExtendedReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2020-01-27 18:19:25 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putBoolean("extended_reply", checked).apply();
|
2020-01-27 18:19:25 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-11-20 13:35:07 +00:00
|
|
|
swWriteBelow.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("write_below", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swQuoteReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2020-03-07 18:02:46 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putBoolean("quote_reply", checked).apply();
|
2020-11-14 08:36:11 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
swQuoteLimit.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("quote_limit", checked).apply();
|
2020-03-07 18:02:46 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-25 12:32:11 +00:00
|
|
|
swResizeReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-05-09 16:04:18 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-25 12:32:11 +00:00
|
|
|
prefs.edit().putBoolean("resize_reply", checked).apply();
|
2020-01-07 14:49:34 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-25 12:32:11 +00:00
|
|
|
spSignatureLocation.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
2019-05-09 16:04:18 +00:00
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
2020-03-25 12:32:11 +00:00
|
|
|
prefs.edit().putInt("signature_location", position).apply();
|
2019-05-09 16:04:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
2020-03-25 12:32:11 +00:00
|
|
|
prefs.edit().remove("signature_location").apply();
|
2019-05-09 16:04:18 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-08-13 20:50:09 +00:00
|
|
|
swSignatureNew.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("signature_new", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-12 07:42:09 +00:00
|
|
|
swSignatureReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("signature_reply", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-12 07:49:15 +00:00
|
|
|
swSignatureForward.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("signature_forward", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-02-07 09:30:26 +00:00
|
|
|
btnEditSignature.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(v.getContext());
|
|
|
|
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_VIEW_IDENTITIES));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-17 09:23:45 +00:00
|
|
|
swDiscardDelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("discard_delete", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-04-03 10:52:22 +00:00
|
|
|
swReplyMove.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("reply_move", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-03-24 06:30:50 +00:00
|
|
|
swAutoLink.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("auto_link", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-10-02 07:26:32 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putBoolean("plain_only", checked).apply();
|
2019-10-02 07:26:32 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swFormatFlowed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2020-03-07 07:20:55 +00:00
|
|
|
@Override
|
2020-03-15 10:40:04 +00:00
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("format_flowed", checked).apply();
|
2020-03-07 07:20:55 +00:00
|
|
|
}
|
2020-03-15 10:40:04 +00:00
|
|
|
});
|
2020-03-07 07:20:55 +00:00
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swUsenetSignature.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2020-03-07 07:20:55 +00:00
|
|
|
@Override
|
2020-03-15 10:40:04 +00:00
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("usenet_signature", checked).apply();
|
2020-03-07 07:20:55 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swRemoveSignatures.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2020-01-18 09:54:19 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putBoolean("remove_signatures", checked).apply();
|
2020-01-18 09:54:19 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swReceipt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
2019-07-14 11:35:52 +00:00
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putBoolean("receipt_default", checked).apply();
|
2019-07-14 11:35:52 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
spReceiptType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
2019-05-09 06:15:10 +00:00
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().putInt("receipt_type", position).apply();
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
2020-03-15 10:40:04 +00:00
|
|
|
prefs.edit().remove("receipt_type").apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-01-26 07:19:01 +00:00
|
|
|
swReceiptLegacy.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("receipt_legacy", checked).apply();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swLookupMx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
prefs.edit().putBoolean("lookup_mx", checked).apply();
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-05-12 06:45:56 +00:00
|
|
|
// Initialize
|
2021-06-27 06:13:56 +00:00
|
|
|
FragmentDialogTheme.setBackground(getContext(), view, false);
|
2021-05-12 06:45:56 +00:00
|
|
|
|
2021-06-10 13:48:17 +00:00
|
|
|
String re1 = getString(R.string.title_subject_reply, "");
|
|
|
|
String re2 = getString(R.string.title_subject_reply_alt, "");
|
|
|
|
((RadioButton) view.findViewById(R.id.rbRe1)).setText(re1);
|
|
|
|
((RadioButton) view.findViewById(R.id.rbRe2)).setText(re2);
|
2021-07-28 12:47:19 +00:00
|
|
|
boolean re = !Objects.equals(re1, re2);
|
|
|
|
for (int i = 0; i < rgRe.getChildCount(); i++)
|
|
|
|
rgRe.getChildAt(i).setEnabled(re);
|
2021-06-10 13:48:17 +00:00
|
|
|
|
|
|
|
String fwd1 = getString(R.string.title_subject_forward, "");
|
|
|
|
String fwd2 = getString(R.string.title_subject_forward_alt, "");
|
|
|
|
((RadioButton) view.findViewById(R.id.rbFwd1)).setText(fwd1);
|
|
|
|
((RadioButton) view.findViewById(R.id.rbFwd2)).setText(fwd2);
|
2021-07-28 12:47:19 +00:00
|
|
|
boolean fwd = !Objects.equals(fwd1, fwd2);
|
|
|
|
for (int i = 0; i < rgFwd.getChildCount(); i++)
|
|
|
|
rgFwd.getChildAt(i).setEnabled(fwd);
|
2021-06-10 13:48:17 +00:00
|
|
|
|
2019-05-09 06:15:10 +00:00
|
|
|
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
@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-09 06:15:10 +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, null);
|
2021-02-05 10:15:02 +00:00
|
|
|
return true;
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|
2021-02-05 10:15:02 +00:00
|
|
|
return super.onOptionsItemSelected(item);
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void setOptions() {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
2019-06-15 06:49:46 +00:00
|
|
|
swKeyboard.setChecked(prefs.getBoolean("keyboard", true));
|
2020-11-27 19:04:26 +00:00
|
|
|
swKeyboardNoFullscreen.setChecked(prefs.getBoolean("keyboard_no_fullscreen", false));
|
2021-03-02 08:06:18 +00:00
|
|
|
swSuggestNames.setChecked(prefs.getBoolean("suggest_names", true));
|
2019-11-08 18:42:35 +00:00
|
|
|
swSuggestSent.setChecked(prefs.getBoolean("suggest_sent", true));
|
2019-09-12 15:33:33 +00:00
|
|
|
swSuggestReceived.setChecked(prefs.getBoolean("suggest_received", false));
|
2020-03-30 11:53:55 +00:00
|
|
|
swSuggestFrequently.setChecked(prefs.getBoolean("suggest_frequently", false));
|
2020-03-30 12:15:29 +00:00
|
|
|
swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
|
2021-06-10 13:48:17 +00:00
|
|
|
|
2021-08-19 19:44:21 +00:00
|
|
|
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
|
2021-12-23 18:12:02 +00:00
|
|
|
swPrefixCount.setChecked(prefs.getBoolean("prefix_count", false));
|
|
|
|
swPrefixCount.setEnabled(swPrefixOnce.isChecked());
|
2021-06-10 13:48:17 +00:00
|
|
|
rgRe.check(prefs.getBoolean("alt_re", false) ? R.id.rbRe2 : R.id.rbRe1);
|
|
|
|
rgFwd.check(prefs.getBoolean("alt_fwd", false) ? R.id.rbFwd2 : R.id.rbFwd1);
|
|
|
|
|
2022-02-24 10:00:01 +00:00
|
|
|
swSendChips.setChecked(prefs.getBoolean("send_chips", true));
|
2020-03-15 10:40:04 +00:00
|
|
|
swSendReminders.setChecked(prefs.getBoolean("send_reminders", true));
|
|
|
|
|
|
|
|
int send_delayed = prefs.getInt("send_delayed", 0);
|
|
|
|
int[] sendDelayedValues = getResources().getIntArray(R.array.sendDelayedValues);
|
|
|
|
for (int pos = 0; pos < sendDelayedValues.length; pos++)
|
|
|
|
if (sendDelayedValues[pos] == send_delayed) {
|
|
|
|
spSendDelayed.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-08-24 09:27:20 +00:00
|
|
|
swAttachNew.setChecked(prefs.getBoolean("attach_new", true));
|
2022-02-15 19:05:02 +00:00
|
|
|
|
|
|
|
boolean reply_all = prefs.getBoolean("reply_all", false);
|
|
|
|
String answer_action = prefs.getString("answer_action", reply_all ? "reply_all" : "reply");
|
|
|
|
String[] answerValues = getResources().getStringArray(R.array.answerValues);
|
|
|
|
for (int pos = 0; pos < answerValues.length; pos++)
|
|
|
|
if (answerValues[pos].equals(answer_action)) {
|
|
|
|
spAnswerAction.setSelection(pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-03-31 19:10:57 +00:00
|
|
|
swSendPending.setChecked(prefs.getBoolean("send_pending", true));
|
|
|
|
|
2022-02-11 08:36:32 +00:00
|
|
|
String compose_font = prefs.getString("compose_font", "");
|
2022-02-10 15:05:52 +00:00
|
|
|
List<StyleHelper.FontDescriptor> fonts = StyleHelper.getFonts(getContext());
|
2022-02-07 11:28:19 +00:00
|
|
|
for (int pos = 0; pos < fonts.size(); pos++) {
|
2022-02-10 15:05:52 +00:00
|
|
|
StyleHelper.FontDescriptor font = fonts.get(pos);
|
|
|
|
if (font.type.equals(compose_font)) {
|
2021-10-06 05:48:03 +00:00
|
|
|
spComposeFont.setSelection(pos + 1);
|
2020-07-24 08:15:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-02-07 11:28:19 +00:00
|
|
|
}
|
2020-07-24 08:15:13 +00:00
|
|
|
|
2020-10-07 16:01:26 +00:00
|
|
|
swSeparateReply.setChecked(prefs.getBoolean("separate_reply", false));
|
2019-11-07 07:56:54 +00:00
|
|
|
swExtendedReply.setChecked(prefs.getBoolean("extended_reply", false));
|
2020-11-20 13:35:07 +00:00
|
|
|
swWriteBelow.setChecked(prefs.getBoolean("write_below", false));
|
2019-11-07 10:15:02 +00:00
|
|
|
swQuoteReply.setChecked(prefs.getBoolean("quote_reply", true));
|
2020-11-15 07:53:39 +00:00
|
|
|
swQuoteLimit.setChecked(prefs.getBoolean("quote_limit", true));
|
2020-03-25 12:32:11 +00:00
|
|
|
swResizeReply.setChecked(prefs.getBoolean("resize_reply", true));
|
2020-02-16 12:29:19 +00:00
|
|
|
|
|
|
|
int signature_location = prefs.getInt("signature_location", 1);
|
|
|
|
spSignatureLocation.setSelection(signature_location);
|
|
|
|
|
2021-08-13 20:50:09 +00:00
|
|
|
swSignatureNew.setChecked(prefs.getBoolean("signature_new", true));
|
2020-06-12 07:42:09 +00:00
|
|
|
swSignatureReply.setChecked(prefs.getBoolean("signature_reply", true));
|
2020-06-12 07:49:15 +00:00
|
|
|
swSignatureForward.setChecked(prefs.getBoolean("signature_forward", true));
|
2021-09-13 05:19:54 +00:00
|
|
|
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", true));
|
2021-04-03 10:52:22 +00:00
|
|
|
swReplyMove.setChecked(prefs.getBoolean("reply_move", false));
|
2020-06-12 07:42:09 +00:00
|
|
|
|
2021-03-24 06:30:50 +00:00
|
|
|
swAutoLink.setChecked(prefs.getBoolean("auto_link", false));
|
2020-03-15 10:40:04 +00:00
|
|
|
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
|
|
|
|
swFormatFlowed.setChecked(prefs.getBoolean("format_flowed", false));
|
|
|
|
swUsenetSignature.setChecked(prefs.getBoolean("usenet_signature", false));
|
|
|
|
swRemoveSignatures.setChecked(prefs.getBoolean("remove_signatures", false));
|
|
|
|
swReceipt.setChecked(prefs.getBoolean("receipt_default", false));
|
|
|
|
|
2020-03-07 07:20:55 +00:00
|
|
|
int receipt_type = prefs.getInt("receipt_type", 2);
|
|
|
|
spReceiptType.setSelection(receipt_type);
|
2019-05-09 06:15:10 +00:00
|
|
|
|
2022-01-26 07:19:01 +00:00
|
|
|
swReceiptLegacy.setChecked(prefs.getBoolean("receipt_legacy", false));
|
|
|
|
|
2020-03-15 10:40:04 +00:00
|
|
|
swLookupMx.setChecked(prefs.getBoolean("lookup_mx", false));
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|
2022-03-23 08:24:54 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
|
|
try {
|
|
|
|
switch (requestCode) {
|
|
|
|
case ActivitySetup.REQUEST_SOUND_OUTBOUND:
|
|
|
|
if (resultCode == RESULT_OK && data != null)
|
|
|
|
onSelectSound(data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onSelectSound(Uri uri) {
|
|
|
|
Log.i("Selected ringtone=" + uri);
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
|
|
|
if (uri == null) // no/silent sound
|
|
|
|
prefs.edit().remove("sound_sent").apply();
|
|
|
|
else {
|
|
|
|
if ("content".equals(uri.getScheme()))
|
|
|
|
prefs.edit().putString("sound_sent", uri.toString()).apply();
|
|
|
|
else
|
|
|
|
prefs.edit().remove("sound_sent").apply();
|
|
|
|
}
|
|
|
|
}
|
2019-05-09 06:15:10 +00:00
|
|
|
}
|