mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Recover notifications state on come back to contributions list from media details fragment
This commit is contained in:
parent
8aca9aa6b2
commit
0ef52659b3
1 changed files with 8 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ public class ContributionsActivity extends AuthenticatedActivity implements Frag
|
||||||
private NearbyFragment nearbyFragment;
|
private NearbyFragment nearbyFragment;
|
||||||
public boolean isContributionsFragmentVisible = true; // False means nearby fragment is visible
|
public boolean isContributionsFragmentVisible = true; // False means nearby fragment is visible
|
||||||
private Menu menu;
|
private Menu menu;
|
||||||
|
private boolean isThereUnreadNotifications = false;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -208,6 +209,11 @@ public class ContributionsActivity extends AuthenticatedActivity implements Frag
|
||||||
menu.findItem(R.id.notifications).setEnabled(false);
|
menu.findItem(R.id.notifications).setEnabled(false);
|
||||||
}
|
}
|
||||||
this.menu = menu;
|
this.menu = menu;
|
||||||
|
if (!isThereUnreadNotifications) {
|
||||||
|
menu.findItem(R.id.notifications).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_notifications_white_24dp));
|
||||||
|
} else {
|
||||||
|
menu.findItem(R.id.notifications).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_notifications_white_with_marker));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,8 +225,10 @@ public class ContributionsActivity extends AuthenticatedActivity implements Frag
|
||||||
|
|
||||||
public void updateNotificationIcon(int unreadNotificationListSize) {
|
public void updateNotificationIcon(int unreadNotificationListSize) {
|
||||||
if (unreadNotificationListSize==0) {
|
if (unreadNotificationListSize==0) {
|
||||||
|
isThereUnreadNotifications = false;
|
||||||
menu.findItem(R.id.notifications).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_notifications_white_24dp));
|
menu.findItem(R.id.notifications).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_notifications_white_24dp));
|
||||||
} else {
|
} else {
|
||||||
|
isThereUnreadNotifications = true;
|
||||||
menu.findItem(R.id.notifications).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_notifications_white_with_marker));
|
menu.findItem(R.id.notifications).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_notifications_white_with_marker));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue