Skip to content

Commit

Permalink
Merge pull request #7832 from keymanapp/fix/android/tablet-keyboard-u…
Browse files Browse the repository at this point in the history
…pdate

fix(android/app): Toggle keyboard update notifications for landscape and tablets
  • Loading branch information
darcywong00 authored Nov 30, 2022
2 parents 607570f + adaaa3d commit e78f5fd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public void onConfigurationChanged(Configuration newConfig) {
@SuppressLint("RestrictedApi")
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
this.menu = menu;
final MenuItem _overflowMenuItem = menu.findItem(R.id.action_overflow);
if (_overflowMenuItem != null) {
MenuItem updateKeyboards = this.menu.findItem(R.id.action_update_keyboards);
Expand All @@ -372,8 +373,8 @@ private void updateUpdateCountIndicator(int anUpdateCount) {
}

final MenuItem _keyboardupdate = menu.findItem(R.id.action_update_keyboards);
if (_keyboardupdate != null) {
updateUpdateCountIndicator(_keyboardupdate, anUpdateCount, true);
if (_keyboardupdate != null && anUpdateCount > 0) {
_keyboardupdate.setVisible(true);
}
}

Expand Down Expand Up @@ -452,6 +453,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
KMManager.getUpdateTool().executeOpenUpdates();
// Dismiss icon
updateUpdateCountIndicator(0);
final MenuItem _keyboardupdate = menu.findItem(R.id.action_update_keyboards);
if (_keyboardupdate != null && _keyboardupdate.isVisible()) {
_keyboardupdate.setVisible(false);
}

return true;
default:
return super.onOptionsItemSelected(item);
Expand Down
8 changes: 5 additions & 3 deletions android/KMAPro/kMAPro/src/main/res/menu-land/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
android:title="@string/action_settings"
android:icon="@drawable/ic_settings" />

<item
<!-- hidden until updates available -->
<item
android:id="@+id/action_update_keyboards"
android:title="@string/action_install_updates"
app:showAsAction="always"
app:actionLayout="@layout/update_count_view"/>
android:title="@string/action_install_updates"
android:visible="false"
android:icon="@drawable/ic_cloud_download" />

</menu>
10 changes: 6 additions & 4 deletions android/KMAPro/kMAPro/src/main/res/menu-sw600dp/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
android:title="@string/action_settings"
android:icon="@drawable/ic_settings" />

<!-- hidden until updates available -->
<item
android:id="@+id/action_update_keyboards"
android:title="@string/action_install_updates"
app:showAsAction="always"
app:actionLayout="@layout/update_count_view"/>
android:id="@+id/action_update_keyboards"
app:showAsAction="always"
android:title="@string/action_install_updates"
android:visible="false"
android:icon="@drawable/ic_cloud_download" />

</menu>

0 comments on commit e78f5fd

Please sign in to comment.