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.
This commit is contained in:
Peter Serwylo 2014-02-27 22:56:16 +11:00
parent 7111f54c9b
commit 4004b6251f

View File

@ -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);