mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 13:53:54 +01:00
* Back button on fragment * Handled back events * minor changes * removed extra lines
This commit is contained in:
parent
fd247f6321
commit
f8a8f92070
10 changed files with 115 additions and 8 deletions
|
|
@ -100,8 +100,11 @@ public class BookmarkFragment extends CommonsDaggerSupportFragment {
|
|||
|
||||
|
||||
public void onBackPressed() {
|
||||
((BookmarkListRootFragment) (adapter.getItem(tabLayout.getSelectedTabPosition())))
|
||||
.backPressed();
|
||||
if(((BookmarkListRootFragment)(adapter.getItem(tabLayout.getSelectedTabPosition()))).backPressed()) {
|
||||
// The event is handled internally by the adapter , no further action required.
|
||||
return;
|
||||
}
|
||||
// Event is not handled by the adapter ( performed back action ) change action bar.
|
||||
((BaseActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,10 +180,14 @@ public class BookmarkListRootFragment extends CommonsDaggerSupportFragment imple
|
|||
}
|
||||
}
|
||||
|
||||
public void backPressed() {
|
||||
public boolean backPressed() {
|
||||
//check mediaDetailPage fragment is not null then we check mediaDetail.is Visible or not to avoid NullPointerException
|
||||
if(mediaDetails!=null) {
|
||||
if (mediaDetails.isVisible()) {
|
||||
if(mediaDetails.backButtonClicked()) {
|
||||
// mediaDetails handled the back clicked , no further action required.
|
||||
return true;
|
||||
}
|
||||
// todo add get list fragment
|
||||
((BookmarkFragment) getParentFragment()).setupTabLayout();
|
||||
ArrayList<Integer> removed=mediaDetails.getRemovedItems();
|
||||
|
|
@ -206,6 +210,8 @@ public class BookmarkListRootFragment extends CommonsDaggerSupportFragment imple
|
|||
} else {
|
||||
moveToContributionsFragment();
|
||||
}
|
||||
// notify mediaDetails did not handled the backPressed further actions required.
|
||||
return false;
|
||||
}
|
||||
|
||||
void moveToContributionsFragment(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue