From 4004b6251f4990fbf74905cdcf748d6452ac91c4 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Thu, 27 Feb 2014 22:56:16 +1100 Subject: [PATCH] Fixed issue 474 - crash on "Up" button from ManageRepos. Not sure that the "parent" activity of ManageRepos is required in the manifest any more, due to the fact that the main use seems to be to direct the "NavUtils.navigateUpSameTask" method uses it, but this change switches to "NavUtils.navigateUpTo" and specifies the activity explicitly. --- src/org/fdroid/fdroid/ManageRepo.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/org/fdroid/fdroid/ManageRepo.java b/src/org/fdroid/fdroid/ManageRepo.java index 757def9db..102a8faa3 100644 --- a/src/org/fdroid/fdroid/ManageRepo.java +++ b/src/org/fdroid/fdroid/ManageRepo.java @@ -62,19 +62,30 @@ public class ManageRepo extends FragmentActivity { @Override public void finish() { Intent ret = new Intent(); - if (listFragment != null && listFragment.hasChanged()) { - Log.i("FDroid", "Repo details have changed, prompting for update."); - ret.putExtra(REQUEST_UPDATE, true); - } + markChangedIfRequired(ret); setResult(Activity.RESULT_OK, ret); super.finish(); } + private boolean hasChanged() { + return listFragment != null && listFragment.hasChanged(); + } + + private void markChangedIfRequired(Intent intent) { + if (hasChanged()) { + Log.i("FDroid", "Repo details have changed, prompting for update."); + intent.putExtra(REQUEST_UPDATE, true); + } + } + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: - NavUtils.navigateUpFromSameTask(this); + Intent destIntent = new Intent(this, FDroid.class); + markChangedIfRequired(destIntent); + setResult(RESULT_OK, destIntent); + NavUtils.navigateUpTo(this, destIntent); return true; } return super.onOptionsItemSelected(item);