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