Close thread view when last message has been moved/deleted
This commit is contained in:
parent
7a1e52de48
commit
705ba76509
2 changed files with 31 additions and 10 deletions
|
@ -364,16 +364,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||
int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case android.R.id.home: {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
if (fragmentManager.getBackStackEntryCount() > 0) {
|
||||
fragmentManager.popBackStack();
|
||||
} else if (mMessageListFragment.isManualSearch()) {
|
||||
onBackPressed();
|
||||
} else if (!mSingleFolderMode) {
|
||||
onAccounts();
|
||||
} else {
|
||||
onShowFolderList();
|
||||
}
|
||||
goBack();
|
||||
return true;
|
||||
}
|
||||
case R.id.compose: {
|
||||
|
@ -722,4 +713,18 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||
// Remove action button for remote search
|
||||
configureMenu(mMenu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goBack() {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
if (fragmentManager.getBackStackEntryCount() > 0) {
|
||||
fragmentManager.popBackStack();
|
||||
} else if (mMessageListFragment.isManualSearch()) {
|
||||
onBackPressed();
|
||||
} else if (!mSingleFolderMode) {
|
||||
onAccounts();
|
||||
} else {
|
||||
onShowFolderList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,6 +429,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
private static final int ACTION_REFRESH_TITLE = 2;
|
||||
private static final int ACTION_PROGRESS = 3;
|
||||
private static final int ACTION_REMOTE_SEARCH_FINISHED = 4;
|
||||
private static final int ACTION_GO_BACK = 5;
|
||||
|
||||
|
||||
public void folderLoading(String folder, boolean loading) {
|
||||
|
@ -462,6 +463,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
});
|
||||
}
|
||||
|
||||
public void goBack() {
|
||||
android.os.Message msg = android.os.Message.obtain(this, ACTION_GO_BACK);
|
||||
sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
// The following messages don't need an attached activity.
|
||||
|
@ -494,6 +500,10 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
MessageListFragment.this.progress(progress);
|
||||
break;
|
||||
}
|
||||
case ACTION_GO_BACK: {
|
||||
mFragmentListener.goBack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2748,6 +2758,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
void onCompose(Account account);
|
||||
boolean startSearch(Account account, String folderName);
|
||||
void remoteSearchStarted();
|
||||
void goBack();
|
||||
}
|
||||
|
||||
public void onReverseSort() {
|
||||
|
@ -3017,6 +3028,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||
if (mIsThreadDisplay && data.getCount() == 0) {
|
||||
mHandler.goBack();
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the "Loading..." view
|
||||
mPullToRefreshView.setEmptyView(null);
|
||||
|
||||
|
|
Loading…
Reference in a new issue