Browse Source

Move accounts/identities to setup

main
M66B 6 years ago
parent
commit
fe9c0a4a8f
4 changed files with 66 additions and 32 deletions
  1. +0
    -20
      app/src/main/java/eu/faircode/email/ActivityView.java
  2. +34
    -6
      app/src/main/java/eu/faircode/email/FragmentSetup.java
  3. +28
    -2
      app/src/main/res/layout/fragment_setup.xml
  4. +4
    -4
      app/src/main/res/values/strings.xml

+ 0
- 20
app/src/main/java/eu/faircode/email/ActivityView.java View File

@ -111,12 +111,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
case R.string.menu_folders: case R.string.menu_folders:
onMenuFolders(); onMenuFolders();
break; break;
case R.string.menu_accounts:
onMenuAccounts();
break;
case R.string.menu_identities:
onMenuIdentities();
break;
case R.string.menu_theme: case R.string.menu_theme:
onMenuTheme(); onMenuTheme();
break; break;
@ -250,8 +244,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
ArrayAdapterDrawer drawerArray = new ArrayAdapterDrawer(this, R.layout.item_drawer); 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_unified));
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_folders)); 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_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_setup));
drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_debug)); drawerArray.add(new DrawerItem(ActivityView.this, R.string.menu_debug));
@ -276,18 +268,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
fragmentTransaction.commit(); 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() { private void onMenuTheme() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String theme = prefs.getString("theme", "light"); String theme = prefs.getString("theme", "light");


+ 34
- 6
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -42,12 +42,16 @@ import java.util.concurrent.Executors;
public class FragmentSetup extends Fragment { public class FragmentSetup extends Fragment {
private Button btnAccount; private Button btnAccount;
private Button btnIdentity;
private Button btnPermissions;
private ProgressBar pbAccount; private ProgressBar pbAccount;
private ProgressBar pbIdentity;
private TextView tvAccountDone; private TextView tvAccountDone;
private Button btnAccountManage;
private Button btnIdentity;
private ProgressBar pbIdentity;
private TextView tvIdentityDone; private TextView tvIdentityDone;
private Button btnIdentityManage;
private Button btnPermissions;
private TextView tvPermissionsDone; private TextView tvPermissionsDone;
private ExecutorService executor = Executors.newCachedThreadPool(); private ExecutorService executor = Executors.newCachedThreadPool();
@ -63,12 +67,16 @@ public class FragmentSetup extends Fragment {
// Get controls // Get controls
btnAccount = view.findViewById(R.id.btnAccount); btnAccount = view.findViewById(R.id.btnAccount);
btnIdentity = view.findViewById(R.id.btnIdentity);
btnPermissions = view.findViewById(R.id.btnPermissions);
pbAccount = view.findViewById(R.id.pbAccount); pbAccount = view.findViewById(R.id.pbAccount);
pbIdentity = view.findViewById(R.id.pbIdentity);
tvAccountDone = view.findViewById(R.id.tvAccountDone); 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); tvIdentityDone = view.findViewById(R.id.tvIdentityDone);
btnIdentityManage = view.findViewById(R.id.btnIdentityManage);
btnPermissions = view.findViewById(R.id.btnPermissions);
tvPermissionsDone = view.findViewById(R.id.tvPermissionsDone); tvPermissionsDone = view.findViewById(R.id.tvPermissionsDone);
// Wire controls // 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() { btnIdentity.setOnClickListener(new View.OnClickListener() {
private boolean once; 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() { btnPermissions.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {


+ 28
- 2
app/src/main/res/layout/fragment_setup.xml View File

@ -55,6 +55,19 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccount" /> app:layout_constraintTop_toBottomOf="@id/tvAccount" />
<Button
android:id="@+id/btnAccountManage"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:minWidth="0dp"
android:text="@string/title_setup_account_manage"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccountDone" />
<!-- identity --> <!-- identity -->
<Button <Button
@ -66,7 +79,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccountDone" />
app:layout_constraintTop_toBottomOf="@id/btnAccountManage" />
<ProgressBar <ProgressBar
android:id="@+id/pbIdentity" android:id="@+id/pbIdentity"
@ -99,6 +112,19 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvIdentity" /> app:layout_constraintTop_toBottomOf="@id/tvIdentity" />
<Button
android:id="@+id/btnIdentityManage"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:minWidth="0dp"
android:text="@string/title_setup_identity_manage"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvIdentityDone" />
<!-- permissions --> <!-- permissions -->
<Button <Button
@ -111,7 +137,7 @@
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvIdentityDone" />
app:layout_constraintTop_toBottomOf="@id/btnIdentityManage" />
<TextView <TextView
android:id="@+id/tvPermissions" android:id="@+id/tvPermissions"


+ 4
- 4
app/src/main/res/values/strings.xml View File

@ -10,8 +10,6 @@
<string name="menu_unified">Unified inbox</string> <string name="menu_unified">Unified inbox</string>
<string name="menu_folders">Folders</string> <string name="menu_folders">Folders</string>
<string name="menu_accounts">Accounts</string>
<string name="menu_identities">Identities</string>
<string name="menu_theme">Dark theme</string> <string name="menu_theme">Dark theme</string>
<string name="menu_setup">Setup</string> <string name="menu_setup">Setup</string>
<string name="menu_debug">Debug info</string> <string name="menu_debug">Debug info</string>
@ -30,10 +28,12 @@
<string name="title_setup">Setup</string> <string name="title_setup">Setup</string>
<string name="title_setup_account">Configure account</string> <string name="title_setup_account">Configure account</string>
<string name="title_setup_indentity">Configure identity</string>
<string name="title_setup_permissions">Grant permissions</string>
<string name="title_setup_account_remark">To receive email</string> <string name="title_setup_account_remark">To receive email</string>
<string name="title_setup_account_manage">Manage accounts</string>
<string name="title_setup_indentity">Configure identity</string>
<string name="title_setup_identity_remark">To send email</string> <string name="title_setup_identity_remark">To send email</string>
<string name="title_setup_identity_manage">Manage identities</string>
<string name="title_setup_permissions">Grant permissions</string>
<string name="title_setup_permissions_remark">To read contacts (optional)</string> <string name="title_setup_permissions_remark">To read contacts (optional)</string>
<string name="title_setup_done">Done</string> <string name="title_setup_done">Done</string>


Loading…
Cancel
Save