From fe9c0a4a8f8188ae4531d1b473abf54c3e6316c6 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 4 Aug 2018 15:13:19 +0000 Subject: [PATCH] Move accounts/identities to setup --- .../java/eu/faircode/email/ActivityView.java | 20 ---------- .../java/eu/faircode/email/FragmentSetup.java | 40 ++++++++++++++++--- app/src/main/res/layout/fragment_setup.xml | 30 +++++++++++++- app/src/main/res/values/strings.xml | 8 ++-- 4 files changed, 66 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityView.java b/app/src/main/java/eu/faircode/email/ActivityView.java index 5c6d681b..dc88e52f 100644 --- a/app/src/main/java/eu/faircode/email/ActivityView.java +++ b/app/src/main/java/eu/faircode/email/ActivityView.java @@ -111,12 +111,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack case R.string.menu_folders: onMenuFolders(); break; - case R.string.menu_accounts: - onMenuAccounts(); - break; - case R.string.menu_identities: - onMenuIdentities(); - break; case R.string.menu_theme: onMenuTheme(); break; @@ -250,8 +244,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(this, R.layout.item_drawer); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_unified)); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_folders)); - drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_accounts)); - drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_identities)); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_theme, "dark".equals(prefs.getString("theme", "light")))); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_setup)); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_debug)); @@ -276,18 +268,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack fragmentTransaction.commit(); } - private void onMenuAccounts() { - FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); - fragmentTransaction.replace(R.id.content_frame, new FragmentAccounts()).addToBackStack("accounts"); - fragmentTransaction.commit(); - } - - private void onMenuIdentities() { - FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); - fragmentTransaction.replace(R.id.content_frame, new FragmentIdentities()).addToBackStack("identities"); - fragmentTransaction.commit(); - } - private void onMenuTheme() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String theme = prefs.getString("theme", "light"); diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index 8f50183c..3a828470 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -42,12 +42,16 @@ import java.util.concurrent.Executors; public class FragmentSetup extends Fragment { private Button btnAccount; - private Button btnIdentity; - private Button btnPermissions; private ProgressBar pbAccount; - private ProgressBar pbIdentity; private TextView tvAccountDone; + private Button btnAccountManage; + + private Button btnIdentity; + private ProgressBar pbIdentity; private TextView tvIdentityDone; + private Button btnIdentityManage; + + private Button btnPermissions; private TextView tvPermissionsDone; private ExecutorService executor = Executors.newCachedThreadPool(); @@ -63,12 +67,16 @@ public class FragmentSetup extends Fragment { // Get controls btnAccount = view.findViewById(R.id.btnAccount); - btnIdentity = view.findViewById(R.id.btnIdentity); - btnPermissions = view.findViewById(R.id.btnPermissions); pbAccount = view.findViewById(R.id.pbAccount); - pbIdentity = view.findViewById(R.id.pbIdentity); tvAccountDone = view.findViewById(R.id.tvAccountDone); + btnAccountManage = view.findViewById(R.id.btnAccountManage); + + btnIdentity = view.findViewById(R.id.btnIdentity); + pbIdentity = view.findViewById(R.id.pbIdentity); tvIdentityDone = view.findViewById(R.id.tvIdentityDone); + btnIdentityManage = view.findViewById(R.id.btnIdentityManage); + + btnPermissions = view.findViewById(R.id.btnPermissions); tvPermissionsDone = view.findViewById(R.id.tvPermissionsDone); // Wire controls @@ -107,6 +115,16 @@ public class FragmentSetup extends Fragment { } }); + btnAccountManage.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //getFragmentManager().popBackStack(); + FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction.replace(R.id.content_frame, new FragmentAccounts()).addToBackStack("accounts"); + fragmentTransaction.commit(); + } + }); + btnIdentity.setOnClickListener(new View.OnClickListener() { private boolean once; @@ -140,6 +158,16 @@ public class FragmentSetup extends Fragment { } }); + btnIdentityManage.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + //getFragmentManager().popBackStack(); + FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); + fragmentTransaction.replace(R.id.content_frame, new FragmentIdentities()).addToBackStack("identities"); + fragmentTransaction.commit(); + } + }); + btnPermissions.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/res/layout/fragment_setup.xml b/app/src/main/res/layout/fragment_setup.xml index 2e680d1b..545fcf0d 100644 --- a/app/src/main/res/layout/fragment_setup.xml +++ b/app/src/main/res/layout/fragment_setup.xml @@ -55,6 +55,19 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvAccount" /> +