Browse Source

Refactoring

main
M66B 6 years ago
parent
commit
74b6cb037d
5 changed files with 16 additions and 4 deletions
  1. +3
    -1
      app/src/main/java/eu/faircode/email/ActivityCompose.java
  2. +4
    -2
      app/src/main/java/eu/faircode/email/ActivityView.java
  3. +2
    -0
      app/src/main/java/eu/faircode/email/FragmentCompose.java
  4. +2
    -1
      app/src/main/java/eu/faircode/email/FragmentMessage.java
  5. +5
    -0
      app/src/main/java/eu/faircode/email/FragmentSetup.java

+ 3
- 1
app/src/main/java/eu/faircode/email/ActivityCompose.java View File

@ -40,11 +40,13 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
getSupportFragmentManager().addOnBackStackChangedListener(this); getSupportFragmentManager().addOnBackStackChangedListener(this);
if (getSupportFragmentManager().getFragments().size() == 0) { if (getSupportFragmentManager().getFragments().size() == 0) {
FragmentCompose fragment = new FragmentCompose();
Bundle args = getIntent().getExtras(); Bundle args = getIntent().getExtras();
if (args == null) if (args == null)
args = new Bundle(); args = new Bundle();
FragmentCompose fragment = new FragmentCompose();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("compose"); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("compose");
fragmentTransaction.commit(); fragmentTransaction.commit();


+ 4
- 2
app/src/main/java/eu/faircode/email/ActivityView.java View File

@ -212,9 +212,10 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
if (prefs.getBoolean("eula", false)) { if (prefs.getBoolean("eula", false)) {
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
FragmentMessages fragment = new FragmentMessages();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("folder", -1); args.putLong("folder", -1);
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
@ -257,9 +258,10 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
} }
private void onMenuUnified() { private void onMenuUnified() {
FragmentMessages fragment = new FragmentMessages();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("folder", -1); args.putLong("folder", -1);
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();


+ 2
- 0
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -121,8 +121,10 @@ public class FragmentCompose extends Fragment {
public void onClick(View view) { public void onClick(View view) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", -1); args.putLong("id", -1);
FragmentIdentity fragment = new FragmentIdentity(); FragmentIdentity fragment = new FragmentIdentity();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("identity"); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("identity");
fragmentTransaction.commit(); fragmentTransaction.commit();


+ 2
- 1
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -262,9 +262,10 @@ public class FragmentMessage extends Fragment {
} }
private void onActionThread(long id) { private void onActionThread(long id) {
FragmentMessages fragment = new FragmentMessages();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("thread", id); // message ID args.putLong("thread", id); // message ID
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();


+ 5
- 0
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -86,11 +86,14 @@ public class FragmentSetup extends Fragment {
if (!once) { if (!once) {
once = true; once = true;
Bundle args = new Bundle(); Bundle args = new Bundle();
if (account != null) if (account != null)
args.putLong("id", account.id); args.putLong("id", account.id);
FragmentAccount fragment = new FragmentAccount(); FragmentAccount fragment = new FragmentAccount();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("account"); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("account");
fragmentTransaction.commit(); fragmentTransaction.commit();
@ -120,8 +123,10 @@ public class FragmentSetup extends Fragment {
Bundle args = new Bundle(); Bundle args = new Bundle();
if (identity != null) if (identity != null)
args.putLong("id", identity.id); args.putLong("id", identity.id);
FragmentIdentity fragment = new FragmentIdentity(); FragmentIdentity fragment = new FragmentIdentity();
fragment.setArguments(args); fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("identity"); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("identity");
fragmentTransaction.commit(); fragmentTransaction.commit();


Loading…
Cancel
Save