Added setting to disable confirm sending

pull/147/head
M66B 6 years ago
parent c60ce9e002
commit 3a586d7400

@ -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

@ -420,6 +420,18 @@
app:layout_constraintStart_toStartOf="parent"
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
android:id="@+id/swLight"
android:layout_width="match_parent"
@ -429,7 +441,7 @@
android:layout_marginEnd="12dp"
android:text="@string/title_advanced_light"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSenderHint"
app:layout_constraintTop_toBottomOf="@id/swAutoSend"
app:switchPadding="12dp" />
<Button

@ -141,6 +141,7 @@
<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_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_debug">Debug mode</string>

Loading…
Cancel
Save