Browse Source

Scroll up when navigating from new messages notification

main
M66B 6 years ago
parent
commit
187fc532a5
3 changed files with 14 additions and 9 deletions
  1. +1
    -1
      app/src/main/java/eu/faircode/email/ActivitySetup.java
  2. +9
    -8
      app/src/main/java/eu/faircode/email/ActivityView.java
  3. +4
    -0
      app/src/main/java/eu/faircode/email/FragmentMessages.java

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

@ -98,7 +98,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
public void onBackStackChanged() {
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
if (hasAccount)
startActivity(new Intent(this, ActivityView.class).putExtra("setup", true));
startActivity(new Intent(this, ActivityView.class));
finish();
}
}


+ 9
- 8
app/src/main/java/eu/faircode/email/ActivityView.java View File

@ -82,7 +82,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private ListView drawerList;
private ActionBarDrawerToggle drawerToggle;
private boolean newIntent = false;
private boolean newMessages = false;
private long attachment = -1;
private static final int ATTACHMENT_BUFFER_SIZE = 8192; // bytes
@ -357,10 +357,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
@Override
protected void onNewIntent(Intent intent) {
if (intent.getBooleanExtra("setup", false))
intent.getExtras().remove("setup");
else
newIntent = true;
checkIntent(intent);
super.onNewIntent(intent);
}
@ -378,9 +374,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
iff.addAction(ACTION_STORE_ATTACHMENT);
lbm.registerReceiver(receiver, iff);
if (newIntent) {
newIntent = false;
getSupportFragmentManager().popBackStack("unified", 0);
if (newMessages) {
newMessages = false;
FragmentManager fm = getSupportFragmentManager();
fm.popBackStack("unified", 0);
FragmentMessages fragment = (FragmentMessages) fm.findFragmentById(R.id.content_frame);
fragment.onNewMessages();
}
}
@ -439,6 +438,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
intent.setAction(null);
setIntent(intent);
newMessages = true;
Bundle args = new Bundle();
args.putLong("time", new Date().getTime());


+ 4
- 0
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -670,4 +670,8 @@ public class FragmentMessages extends FragmentEx {
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("folders");
fragmentTransaction.commit();
}
void onNewMessages() {
rvMessage.scrollToPosition(0);
}
}

Loading…
Cancel
Save