mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 21:57:19 +00:00
Added setting to disable confirm sending
This commit is contained in:
parent
c60ce9e002
commit
3a586d7400
4 changed files with 65 additions and 30 deletions
|
@ -27,6 +27,7 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentSender;
|
import android.content.IntentSender;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
@ -149,18 +150,24 @@ public class FragmentCompose extends FragmentEx {
|
||||||
|
|
||||||
private AdapterAttachment adapter;
|
private AdapterAttachment adapter;
|
||||||
|
|
||||||
|
private boolean pro;
|
||||||
|
private boolean autosend;
|
||||||
|
|
||||||
private long working = -1;
|
private long working = -1;
|
||||||
private State state = State.NONE;
|
private State state = State.NONE;
|
||||||
private boolean autosave = false;
|
private boolean autosave = false;
|
||||||
private boolean busy = false;
|
private boolean busy = false;
|
||||||
private boolean pro = false;
|
|
||||||
|
|
||||||
private OpenPgpServiceConnection pgpService;
|
private OpenPgpServiceConnection pgpService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
pro = Helper.isPro(getContext());
|
pro = Helper.isPro(getContext());
|
||||||
|
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
autosend = prefs.getBoolean("autosend", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -282,6 +289,11 @@ public class FragmentCompose extends FragmentEx {
|
||||||
onDelete();
|
onDelete();
|
||||||
break;
|
break;
|
||||||
case R.id.action_send:
|
case R.id.action_send:
|
||||||
|
if (autosend) {
|
||||||
|
onAction(action);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String to = etTo.getText().toString();
|
String to = etTo.getText().toString();
|
||||||
InternetAddress ato[] = (TextUtils.isEmpty(to) ? new InternetAddress[0] : InternetAddress.parse(to));
|
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 swIdenticons;
|
||||||
private SwitchCompat swPreview;
|
private SwitchCompat swPreview;
|
||||||
|
|
||||||
private SwitchCompat swLight;
|
|
||||||
private Button btnSound;
|
|
||||||
|
|
||||||
private SwitchCompat swPull;
|
private SwitchCompat swPull;
|
||||||
private SwitchCompat swSwipe;
|
private SwitchCompat swSwipe;
|
||||||
private SwitchCompat swActionbar;
|
private SwitchCompat swActionbar;
|
||||||
|
@ -77,6 +74,10 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||||
private SwitchCompat swAutoMove;
|
private SwitchCompat swAutoMove;
|
||||||
private SwitchCompat swConfirm;
|
private SwitchCompat swConfirm;
|
||||||
private SwitchCompat swSender;
|
private SwitchCompat swSender;
|
||||||
|
private SwitchCompat swAutoSend;
|
||||||
|
|
||||||
|
private SwitchCompat swLight;
|
||||||
|
private Button btnSound;
|
||||||
|
|
||||||
private SwitchCompat swDebug;
|
private SwitchCompat swDebug;
|
||||||
|
|
||||||
|
@ -104,9 +105,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||||
swIdenticons = view.findViewById(R.id.swIdenticons);
|
swIdenticons = view.findViewById(R.id.swIdenticons);
|
||||||
swPreview = view.findViewById(R.id.swPreview);
|
swPreview = view.findViewById(R.id.swPreview);
|
||||||
|
|
||||||
swLight = view.findViewById(R.id.swLight);
|
|
||||||
btnSound = view.findViewById(R.id.btnSound);
|
|
||||||
|
|
||||||
swPull = view.findViewById(R.id.swPull);
|
swPull = view.findViewById(R.id.swPull);
|
||||||
swSwipe = view.findViewById(R.id.swSwipe);
|
swSwipe = view.findViewById(R.id.swSwipe);
|
||||||
swActionbar = view.findViewById(R.id.swActionbar);
|
swActionbar = view.findViewById(R.id.swActionbar);
|
||||||
|
@ -116,6 +114,10 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
|
||||||
swAutoMove = view.findViewById(R.id.swAutoMove);
|
swAutoMove = view.findViewById(R.id.swAutoMove);
|
||||||
swConfirm = view.findViewById(R.id.swConfirm);
|
swConfirm = view.findViewById(R.id.swConfirm);
|
||||||
swSender = view.findViewById(R.id.swSender);
|
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);
|
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.setChecked(prefs.getBoolean("pull", true));
|
||||||
swPull.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
swPull.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@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.setChecked(prefs.getBoolean("debug", false));
|
||||||
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -420,6 +420,18 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/swSender" />
|
app:layout_constraintTop_toBottomOf="@id/swSender" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/swAutoSend"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:text="@string/title_advanced_autosend"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvSenderHint"
|
||||||
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/swLight"
|
android:id="@+id/swLight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -429,7 +441,7 @@
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:text="@string/title_advanced_light"
|
android:text="@string/title_advanced_light"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvSenderHint"
|
app:layout_constraintTop_toBottomOf="@id/swAutoSend"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -141,6 +141,7 @@
|
||||||
<string name="title_advanced_automove">Confirm moving messages</string>
|
<string name="title_advanced_automove">Confirm moving messages</string>
|
||||||
<string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string>
|
<string name="title_advanced_confirm">Confirm actions that might leak privacy sensitive information</string>
|
||||||
<string name="title_advanced_sender">Allow editing sender address</string>
|
<string name="title_advanced_sender">Allow editing sender address</string>
|
||||||
|
<string name="title_advanced_autosend">Confirm sending messages</string>
|
||||||
|
|
||||||
<string name="title_advanced_updates">Check for updates</string>
|
<string name="title_advanced_updates">Check for updates</string>
|
||||||
<string name="title_advanced_debug">Debug mode</string>
|
<string name="title_advanced_debug">Debug mode</string>
|
||||||
|
|
Loading…
Reference in a new issue