diff --git a/android/KMAPro/kMAPro/build.gradle b/android/KMAPro/kMAPro/build.gradle index ba17b41084..1c04bf6ce6 100644 --- a/android/KMAPro/kMAPro/build.gradle +++ b/android/KMAPro/kMAPro/build.gradle @@ -117,7 +117,7 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.2.0-alpha02' + implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' implementation 'com.google.android.material:material:1.0.0' api(name: 'keyman-engine', ext: 'aar') implementation "com.google.firebase:firebase-analytics:17.2.1" diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java index df8d185d20..0716ac2f53 100644 --- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java +++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java @@ -386,92 +386,54 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi invalidateOptionsMenu(); } - + @SuppressLint("RestrictedApi") @Override public boolean onPrepareOptionsMenu(final Menu menu) { final MenuItem _overflowMenuItem = menu.findItem(R.id.action_overflow); - - if(_overflowMenuItem!=null) { - final ViewGroup _rootView = (ViewGroup) _overflowMenuItem.getActionView(); - - _rootView.findViewById(R.id.counterBackground).setBackground( - this.getResources().getDrawable(R.drawable.ic_light_action_overflow)); - - _rootView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - PopupMenu _popup = new PopupMenu(context, _rootView); - getMenuInflater().inflate(R.menu.overflow_menu, _popup.getMenu()); - - updateUpdateCountIndicator( - _popup.getMenu().findItem(R.id.action_update_keyboards), - KMManager.getUpdateTool().getOpenUpdateCount(),true); - - _popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { - public boolean onMenuItemClick(MenuItem theItem) { - return onOptionsItemSelected(theItem); - } - }); - - MenuPopupHelper _menuHelper = new MenuPopupHelper(context, (MenuBuilder) _popup.getMenu(), _rootView); - _menuHelper.setForceShowIcon(true); - _menuHelper.show(); - } - }); - return super.onPrepareOptionsMenu(menu); + if (_overflowMenuItem != null) { + MenuItem updateKeyboards = this.menu.findItem(R.id.action_update_keyboards); + updateUpdateCountIndicator(updateKeyboards, + KMManager.getUpdateTool().getOpenUpdateCount(), true); } - - final MenuItem _keyboardupdate = menu.findItem(R.id.action_update_keyboards); - if(_keyboardupdate==null) - return super.onPrepareOptionsMenu(menu); - - final ViewGroup _rootView = (ViewGroup) _keyboardupdate.getActionView(); - - _rootView.findViewById(R.id.counterBackground).setBackground( - this.getResources().getDrawable(R.drawable.ic_cloud_download)); - - _rootView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - onOptionsItemSelected(_keyboardupdate); - } - }); return super.onPrepareOptionsMenu(menu); } private void updateUpdateCountIndicator(int anUpdateCount) { - if (menu == null) + if (menu == null) { return; + } final MenuItem _overflowMenuItem = menu.findItem(R.id.action_overflow); - if (_overflowMenuItem != null) - updateUpdateCountIndicator(_overflowMenuItem,anUpdateCount,false); + if (_overflowMenuItem != null) { + updateUpdateCountIndicator(_overflowMenuItem, anUpdateCount, false); + } final MenuItem _keyboardupdate = menu.findItem(R.id.action_update_keyboards); - if (_keyboardupdate != null) - updateUpdateCountIndicator(_keyboardupdate,anUpdateCount,true); - + if (_keyboardupdate != null) { + updateUpdateCountIndicator(_keyboardupdate, anUpdateCount, true); + } } private void updateUpdateCountIndicator(MenuItem theItem, int anUpdateCount, boolean aHideMenuitem) { final ViewGroup _rootView = (ViewGroup) theItem.getActionView(); - if(anUpdateCount==0) - { - if(aHideMenuitem) + if(anUpdateCount==0) { + if (aHideMenuitem) { theItem.setVisible(false); - else if(_rootView!=null) + } else if (_rootView != null) { _rootView.findViewById(R.id.update_count_indicator).setVisibility(View.GONE); - } - else { - if(aHideMenuitem) + } + } else { + if(aHideMenuitem) { theItem.setVisible(true); - else if(_rootView!=null) - _rootView.findViewById(R.id.update_count_indicator).setVisibility(View.VISIBLE); + } else if(_rootView!=null) { + _rootView.findViewById(R.id.update_count_indicator).setVisibility(View.VISIBLE); + } } - if(_rootView==null) + if(_rootView==null) { return; + } TextView _t = _rootView.findViewById(R.id.update_count_indicator); _t.setText(String.valueOf(anUpdateCount)); @@ -778,6 +740,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == PERMISSION_REQUEST_STORAGE) { // Request for storage permission if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { diff --git a/android/KMAPro/kMAPro/src/main/res/drawable-xxxhdpi/ic_light_action_overflow.png b/android/KMAPro/kMAPro/src/main/res/drawable-xxxhdpi/ic_light_action_overflow.png new file mode 100644 index 0000000000..c32d61b388 Binary files /dev/null and b/android/KMAPro/kMAPro/src/main/res/drawable-xxxhdpi/ic_light_action_overflow.png differ diff --git a/android/KMAPro/kMAPro/src/main/res/layout/titlebar.xml b/android/KMAPro/kMAPro/src/main/res/layout/titlebar.xml index e76d908e9f..f5165568dc 100644 --- a/android/KMAPro/kMAPro/src/main/res/layout/titlebar.xml +++ b/android/KMAPro/kMAPro/src/main/res/layout/titlebar.xml @@ -5,4 +5,5 @@ android:id="@+id/titlebar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" - android:layout_alignParentTop="true" /> + android:layout_alignParentTop="true" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> diff --git a/android/KMAPro/kMAPro/src/main/res/menu/main.xml b/android/KMAPro/kMAPro/src/main/res/menu/main.xml index cc407ea789..a8c587ece6 100644 --- a/android/KMAPro/kMAPro/src/main/res/menu/main.xml +++ b/android/KMAPro/kMAPro/src/main/res/menu/main.xml @@ -20,6 +20,47 @@ android:id="@+id/action_overflow" app:showAsAction="ifRoom" android:title="@string/action_overflow" - app:actionLayout="@layout/update_count_view" /> + android:icon="@drawable/ic_light_action_overflow" > + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/KMAPro/kMAPro/src/main/res/menu/overflow_menu.xml b/android/KMAPro/kMAPro/src/main/res/menu/overflow_menu.xml deleted file mode 100644 index bd04923669..0000000000 --- a/android/KMAPro/kMAPro/src/main/res/menu/overflow_menu.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/KMEA/app/build.gradle b/android/KMEA/app/build.gradle index 2b8aed7919..2ef76b57d1 100644 --- a/android/KMEA/app/build.gradle +++ b/android/KMEA/app/build.gradle @@ -66,7 +66,7 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.2.0-alpha02' + implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' implementation 'com.google.android.material:material:1.0.0' implementation 'commons-io:commons-io:2.6' diff --git a/android/history.md b/android/history.md index 7eb9150e98..217363fbd9 100644 --- a/android/history.md +++ b/android/history.md @@ -1,5 +1,9 @@ # Keyman for Android Version History +## 2020-08-31 13.0.6217 stable +* Bug fix: + * Fix overflow menu for hdpi devices (#3536) + ## 2020-07-17 13.0.6216 stable * Bug fix: * Make sure switch to system keyboard works on lock screen for Android P (#3358)