Skip to content

Commit

Permalink
Fix remove pin appearing incorrectly for archived channels
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed May 24, 2022
1 parent 2d9aa41 commit e0ec397
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ android {
testBuildType "mockdata"

defaultConfig {
versionCode 325
versionCode 326
versionName "4.28"
minSdkVersion 22
targetSdkVersion 31
Expand Down
31 changes: 12 additions & 19 deletions src/com/irccloud/android/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3836,35 +3836,28 @@ else if (buffer.isConsole())
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (menu != null && buffer != null && buffer.getType() != null && NetworkConnection.getInstance().ready) {
if (menu.findItem(R.id.menu_pin) != null) {
menu.findItem(R.id.menu_pin).setVisible(!buffer.isPinned());
menu.findItem(R.id.menu_pin).setEnabled(!buffer.isPinned());
}
if (menu.findItem(R.id.menu_remove_pin) != null) {
menu.findItem(R.id.menu_remove_pin).setVisible(buffer.isPinned());
menu.findItem(R.id.menu_remove_pin).setEnabled(buffer.isPinned());
}
if (buffer.getArchived() == 0) {
if (menu.findItem(R.id.menu_archive) != null)
menu.findItem(R.id.menu_archive).setTitle(R.string.menu_archive);
if(buffer.isPinned()) {
if (menu.findItem(R.id.menu_pin) != null) {
menu.findItem(R.id.menu_pin).setVisible(false);
menu.findItem(R.id.menu_pin).setEnabled(false);
}
if (menu.findItem(R.id.menu_remove_pin) != null) {
menu.findItem(R.id.menu_remove_pin).setVisible(true);
menu.findItem(R.id.menu_remove_pin).setEnabled(true);
}
} else {
if (menu.findItem(R.id.menu_pin) != null) {
menu.findItem(R.id.menu_pin).setVisible(true);
menu.findItem(R.id.menu_pin).setEnabled(true);
}
if (menu.findItem(R.id.menu_remove_pin) != null) {
menu.findItem(R.id.menu_remove_pin).setVisible(false);
menu.findItem(R.id.menu_remove_pin).setEnabled(false);
}
}
} else {
if (menu.findItem(R.id.menu_archive) != null)
menu.findItem(R.id.menu_archive).setTitle(R.string.menu_unarchive);
if (menu.findItem(R.id.menu_pin) != null) {
menu.findItem(R.id.menu_pin).setVisible(false);
menu.findItem(R.id.menu_pin).setEnabled(false);
}
if (menu.findItem(R.id.menu_remove_pin) != null) {
menu.findItem(R.id.menu_remove_pin).setVisible(false);
menu.findItem(R.id.menu_remove_pin).setEnabled(false);
}
}
if (buffer.isChannel()) {
if (ChannelsList.getInstance().getChannelForBuffer(buffer.getBid()) == null) {
Expand Down

0 comments on commit e0ec397

Please sign in to comment.