Fixed up-button behavior in various activities

This commit is contained in:
daniel oeh 2012-09-07 17:21:02 +02:00
parent 4ef98bd218
commit 9c8585b6de
7 changed files with 25 additions and 12 deletions

View File

@ -179,8 +179,9 @@ public class AddFeedActivity extends SherlockActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
startActivity(new Intent(this, MainActivity.class));
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
return true;
default:
return false;

View File

@ -187,7 +187,9 @@ public class DownloadActivity extends SherlockListActivity implements
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
break;
case MENU_SHOW_LOG:
startActivity(new Intent(this, DownloadLogActivity.class));

View File

@ -119,7 +119,9 @@ public class FeedItemlistActivity extends SherlockFragmentActivity {
onSearchRequested();
break;
case android.R.id.home:
startActivity(new Intent(this, MainActivity.class));
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
}
}

View File

@ -48,8 +48,9 @@ public class FlattrAuthActivity extends SherlockActivity {
butReturn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(FlattrAuthActivity.this,
MainActivity.class));
Intent intent = new Intent(FlattrAuthActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
@ -106,8 +107,11 @@ public class FlattrAuthActivity extends SherlockActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
startActivity(new Intent(this, PreferenceActivity.class));
if (authSuccessful) {
Intent intent = new Intent(this, PreferenceActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else {
finish();
}
break;

View File

@ -210,8 +210,9 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
startActivity(new Intent(MediaplayerActivity.this,
MainActivity.class));
Intent intent = new Intent(MediaplayerActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
break;
case R.id.disable_sleeptimer_item:
if (controller.serviceAvailable()) {

View File

@ -91,8 +91,9 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
startActivity(new Intent(PreferenceActivity.this,
MainActivity.class));
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
default:
return false;

View File

@ -87,7 +87,9 @@ public class SearchActivity extends SherlockListActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
startActivity(new Intent(this, MainActivity.class));
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
case R.id.search_item:
onSearchRequested();