mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 02:28:18 +00:00
Added select default address extra button
This commit is contained in:
parent
c3cf7e892c
commit
27a45dcc92
4 changed files with 53 additions and 17 deletions
|
@ -88,15 +88,16 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
static final int REQUEST_IMPORT_CERTIFICATE = 6;
|
||||
static final int REQUEST_OAUTH = 7;
|
||||
static final int REQUEST_STILL = 8;
|
||||
static final int REQUEST_SELECT_IDENTITY = 9;
|
||||
static final int REQUEST_EDIT_SIGNATURE = 10;
|
||||
static final int REQUEST_CHANGE_PASSWORD = 11;
|
||||
static final int REQUEST_EDIT_ACCOUNT_COLOR = 12;
|
||||
static final int REQUEST_DELETE_ACCOUNT = 13;
|
||||
static final int REQUEST_EDIT_IDENITY_COLOR = 14;
|
||||
static final int REQUEST_IMPORT_PROVIDERS = 15;
|
||||
static final int REQUEST_GRAPH_CONTACTS = 16;
|
||||
static final int REQUEST_GRAPH_CONTACTS_OAUTH = 17;
|
||||
static final int REQUEST_DEFAULT_IDENTITY = 9;
|
||||
static final int REQUEST_SELECT_IDENTITY = 10;
|
||||
static final int REQUEST_EDIT_SIGNATURE = 11;
|
||||
static final int REQUEST_CHANGE_PASSWORD = 12;
|
||||
static final int REQUEST_EDIT_ACCOUNT_COLOR = 13;
|
||||
static final int REQUEST_DELETE_ACCOUNT = 14;
|
||||
static final int REQUEST_EDIT_IDENITY_COLOR = 15;
|
||||
static final int REQUEST_IMPORT_PROVIDERS = 16;
|
||||
static final int REQUEST_GRAPH_CONTACTS = 17;
|
||||
static final int REQUEST_GRAPH_CONTACTS_OAUTH = 18;
|
||||
static final int REQUEST_DEBUG_INFO = 7000;
|
||||
|
||||
static final int PI_CONNECTION = 1;
|
||||
|
|
|
@ -128,6 +128,7 @@ import androidx.fragment.app.FragmentActivity;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
@ -3426,7 +3427,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
break;
|
||||
case REQUEST_SELECT_IDENTITY:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
onSelectIdentity(data.getBundleExtra("args"));
|
||||
onSelectIdentity(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), data.getBundleExtra("args"));
|
||||
break;
|
||||
case REQUEST_PRINT:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
|
@ -5003,10 +5004,11 @@ public class FragmentCompose extends FragmentBase {
|
|||
}.serial().execute(this, args, "compose:picked");
|
||||
}
|
||||
|
||||
private void onSelectIdentity(Bundle args) {
|
||||
static void onSelectIdentity(Context context, LifecycleOwner owner, FragmentManager fm, Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
Log.i("MMM id="+id);
|
||||
if (id < 0) {
|
||||
getContext().startActivity(new Intent(getContext(), ActivitySetup.class)
|
||||
context.startActivity(new Intent(context, ActivitySetup.class)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
.putExtra("manual", true)
|
||||
.putExtra("scroll", true));
|
||||
|
@ -5041,14 +5043,14 @@ public class FragmentCompose extends FragmentBase {
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, EntityIdentity identity) {
|
||||
ToastEx.makeText(getContext(), R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
ToastEx.makeText(context, R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex);
|
||||
Log.unexpectedError(fm, ex);
|
||||
}
|
||||
}.serial().execute(this, args, "select:identity");
|
||||
}.serial().execute(context, owner, args, "select:identity");
|
||||
}
|
||||
|
||||
private void onPrint(Bundle args) {
|
||||
|
|
|
@ -148,6 +148,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
|
|||
private CardView cardExtra;
|
||||
private TextView tvExtra;
|
||||
private Button btnNotification;
|
||||
private Button btnDefaultIdentity;
|
||||
private Button btnSignature;
|
||||
private Button btnReorderAccounts;
|
||||
private Button btnReorderFolders;
|
||||
|
@ -244,6 +245,7 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
|
|||
cardExtra = view.findViewById(R.id.cardExtra);
|
||||
tvExtra = view.findViewById(R.id.tvExtra);
|
||||
btnNotification = view.findViewById(R.id.btnNotification);
|
||||
btnDefaultIdentity = view.findViewById(R.id.btnDefaultIdentity);
|
||||
btnSignature = view.findViewById(R.id.btnSignature);
|
||||
btnReorderAccounts = view.findViewById(R.id.btnReorderAccounts);
|
||||
btnReorderFolders = view.findViewById(R.id.btnReorderFolders);
|
||||
|
@ -765,13 +767,23 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
|
|||
}
|
||||
});
|
||||
|
||||
btnDefaultIdentity.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentDialogSelectIdentity fragment = new FragmentDialogSelectIdentity();
|
||||
fragment.setArguments(new Bundle());
|
||||
fragment.setTargetFragment(FragmentSetup.this, ActivitySetup.REQUEST_DEFAULT_IDENTITY);
|
||||
fragment.show(getParentFragmentManager(), "select:identity:default");
|
||||
}
|
||||
});
|
||||
|
||||
btnSignature.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentDialogSelectIdentity fragment = new FragmentDialogSelectIdentity();
|
||||
fragment.setArguments(new Bundle());
|
||||
fragment.setTargetFragment(FragmentSetup.this, ActivitySetup.REQUEST_SELECT_IDENTITY);
|
||||
fragment.show(getParentFragmentManager(), "select:identity");
|
||||
fragment.show(getParentFragmentManager(), "select:identity:signature");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1141,6 +1153,10 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
|
|||
|
||||
try {
|
||||
switch (requestCode) {
|
||||
case ActivitySetup.REQUEST_DEFAULT_IDENTITY:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
onSelectDefaultIdentity(data.getBundleExtra("args"));
|
||||
break;
|
||||
case ActivitySetup.REQUEST_SELECT_IDENTITY:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
onSelectIdentity(data.getBundleExtra("args"));
|
||||
|
@ -1226,6 +1242,10 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
|
|||
btnPermissions.setText(all ? R.string.title_setup_manage : R.string.title_setup_grant);
|
||||
}
|
||||
|
||||
private void onSelectDefaultIdentity(Bundle args) {
|
||||
FragmentCompose.onSelectIdentity(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), args);
|
||||
}
|
||||
|
||||
private void onSelectIdentity(Bundle args) {
|
||||
Intent intent = new Intent(getContext(), ActivitySignature.class);
|
||||
intent.putExtra("id", args.getLong("id"));
|
||||
|
|
|
@ -1111,6 +1111,19 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnNotification" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDefaultIdentity"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_person_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:tag="disable"
|
||||
android:text="@string/title_select_default_identity"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNotificationHint" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSignature"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
|
@ -1122,7 +1135,7 @@
|
|||
android:tag="disable"
|
||||
android:text="@string/title_edit_signature"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvNotificationHint" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnDefaultIdentity" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnReorderAccounts"
|
||||
|
|
Loading…
Add table
Reference in a new issue