mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix back button issue in ShareActivity
This commit is contained in:
parent
95ecfbd3c2
commit
4cb6fb86f8
4 changed files with 14 additions and 3 deletions
|
|
@ -498,7 +498,7 @@ public class CategorizationFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void backButtonDialog() {
|
||||
public void backButtonDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
builder.setMessage("Are you sure you want to go back? The image will not have any categories saved.")
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ public class ContributionsActivity
|
|||
}
|
||||
requestAuthToken();
|
||||
initDrawer();
|
||||
setTitle(getString(R.string.title_activity_contributions));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -67,6 +67,12 @@ public class NavigationBaseActivity extends BaseActivity implements HamburgerMen
|
|||
});
|
||||
}
|
||||
|
||||
public void initBack() {
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
private void setDrawerPaneWidth() {
|
||||
ViewGroup.LayoutParams params = drawerPane.getLayoutParams();
|
||||
// set width to lowerBound of 80% of the screen size
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ public class ShareActivity
|
|||
uploadController = new UploadController(this);
|
||||
setContentView(R.layout.activity_share);
|
||||
ButterKnife.bind(this);
|
||||
initDrawer();
|
||||
initBack();
|
||||
app = CommonsApplication.getInstance();
|
||||
backgroundImageView = (SimpleDraweeView)findViewById(R.id.backgroundImage);
|
||||
|
||||
|
|
@ -444,7 +444,11 @@ public class ShareActivity
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
NavUtils.navigateUpFromSameTask(this);
|
||||
if(categorizationFragment!=null && categorizationFragment.isVisible()) {
|
||||
categorizationFragment.backButtonDialog();
|
||||
} else {
|
||||
onBackPressed();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue