mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-09 10:33:41 +02:00
Added setting to disable confirm sending
This commit is contained in:
@@ -27,6 +27,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Typeface;
|
||||
@@ -149,18 +150,24 @@ public class FragmentCompose extends FragmentEx {
|
||||
|
||||
private AdapterAttachment adapter;
|
||||
|
||||
private boolean pro;
|
||||
private boolean autosend;
|
||||
|
||||
private long working = -1;
|
||||
private State state = State.NONE;
|
||||
private boolean autosave = false;
|
||||
private boolean busy = false;
|
||||
private boolean pro = false;
|
||||
|
||||
private OpenPgpServiceConnection pgpService;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
pro = Helper.isPro(getContext());
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
autosend = prefs.getBoolean("autosend", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,6 +289,11 @@ public class FragmentCompose extends FragmentEx {
|
||||
onDelete();
|
||||
break;
|
||||
case R.id.action_send:
|
||||
if (autosend) {
|
||||
onAction(action);
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
String to = etTo.getText().toString();
|
||||
InternetAddress ato[] = (TextUtils.isEmpty(to) ? new InternetAddress[0] : InternetAddress.parse(to));
|
||||
|
||||
@@ -65,9 +65,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||
private SwitchCompat swIdenticons;
|
||||
private SwitchCompat swPreview;
|
||||
|
||||
private SwitchCompat swLight;
|
||||
private Button btnSound;
|
||||
|
||||
private SwitchCompat swPull;
|
||||
private SwitchCompat swSwipe;
|
||||
private SwitchCompat swActionbar;
|
||||
@@ -77,6 +74,10 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||
private SwitchCompat swAutoMove;
|
||||
private SwitchCompat swConfirm;
|
||||
private SwitchCompat swSender;
|
||||
private SwitchCompat swAutoSend;
|
||||
|
||||
private SwitchCompat swLight;
|
||||
private Button btnSound;
|
||||
|
||||
private SwitchCompat swDebug;
|
||||
|
||||
@@ -104,9 +105,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||
swIdenticons = view.findViewById(R.id.swIdenticons);
|
||||
swPreview = view.findViewById(R.id.swPreview);
|
||||
|
||||
swLight = view.findViewById(R.id.swLight);
|
||||
btnSound = view.findViewById(R.id.btnSound);
|
||||
|
||||
swPull = view.findViewById(R.id.swPull);
|
||||
swSwipe = view.findViewById(R.id.swSwipe);
|
||||
swActionbar = view.findViewById(R.id.swActionbar);
|
||||
@@ -116,6 +114,10 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||
swAutoMove = view.findViewById(R.id.swAutoMove);
|
||||
swConfirm = view.findViewById(R.id.swConfirm);
|
||||
swSender = view.findViewById(R.id.swSender);
|
||||
swAutoSend = view.findViewById(R.id.swAutoSend);
|
||||
|
||||
swLight = view.findViewById(R.id.swLight);
|
||||
btnSound = view.findViewById(R.id.btnSound);
|
||||
|
||||
swDebug = view.findViewById(R.id.swDebug);
|
||||
|
||||
@@ -252,28 +254,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||
}
|
||||
});
|
||||
|
||||
swLight.setChecked(prefs.getBoolean("light", false));
|
||||
swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("light", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
btnSound.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String sound = prefs.getString("sound", 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, false);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, sound == null ? null : Uri.parse(sound));
|
||||
startActivityForResult(Helper.getChooser(getContext(), intent), ActivitySetup.REQUEST_SOUND);
|
||||
}
|
||||
});
|
||||
|
||||
swPull.setChecked(prefs.getBoolean("pull", true));
|
||||
swPull.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
@@ -346,6 +326,36 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||
}
|
||||
});
|
||||
|
||||
swAutoSend.setChecked(!prefs.getBoolean("autosend", false));
|
||||
swAutoSend.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("autosend", !checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swLight.setChecked(prefs.getBoolean("light", false));
|
||||
swLight.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("light", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
btnSound.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String sound = prefs.getString("sound", 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, false);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, sound == null ? null : Uri.parse(sound));
|
||||
startActivityForResult(Helper.getChooser(getContext(), intent), ActivitySetup.REQUEST_SOUND);
|
||||
}
|
||||
});
|
||||
|
||||
swDebug.setChecked(prefs.getBoolean("debug", false));
|
||||
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user