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:
parent
7111f54c9b
commit
4004b6251f
@ -62,19 +62,30 @@ public class ManageRepo extends FragmentActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void finish() {
|
public void finish() {
|
||||||
Intent ret = new Intent();
|
Intent ret = new Intent();
|
||||||
if (listFragment != null && listFragment.hasChanged()) {
|
markChangedIfRequired(ret);
|
||||||
Log.i("FDroid", "Repo details have changed, prompting for update.");
|
|
||||||
ret.putExtra(REQUEST_UPDATE, true);
|
|
||||||
}
|
|
||||||
setResult(Activity.RESULT_OK, ret);
|
setResult(Activity.RESULT_OK, ret);
|
||||||
super.finish();
|
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
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
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 true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user