Fixed: Fixed extra keys not showing properly on Android 5

Related issue #739
This commit is contained in:
agnostic-apollo
2022-04-26 02:33:21 +05:00
parent 677a580042
commit 55dcd09a09
3 changed files with 18 additions and 7 deletions

View File

@@ -60,7 +60,7 @@ import com.termux.shared.theme.ThemeUtils;
* in {@link ExtraKeysView#ExtraKeysView(Context, AttributeSet)} by calling the respective functions.
* If you extend {@link ExtraKeysView}, you can also set them in the constructor, but do call super().
*
* After this you will have to make a call to {@link ExtraKeysView#reload(ExtraKeysInfo) and pass
* After this you will have to make a call to {@link ExtraKeysView#reload(ExtraKeysInfo, float) and pass
* it the {@link ExtraKeysInfo} to load and display the extra keys. Read its class javadocs for more
* info on how to create it.
*
@@ -379,9 +379,11 @@ public final class ExtraKeysView extends GridLayout {
* Reload this instance of {@link ExtraKeysView} with the info passed in {@code extraKeysInfo}.
*
* @param extraKeysInfo The {@link ExtraKeysInfo} that defines the necessary info for the extra keys.
* @param heightPx The height in pixels of the parent surrounding the {@link ExtraKeysView}. It must
* be a single child.
*/
@SuppressLint("ClickableViewAccessibility")
public void reload(ExtraKeysInfo extraKeysInfo) {
public void reload(ExtraKeysInfo extraKeysInfo, float heightPx) {
if (extraKeysInfo == null)
return;
@@ -469,7 +471,11 @@ public final class ExtraKeysView extends GridLayout {
LayoutParams param = new GridLayout.LayoutParams();
param.width = 0;
param.height = 0;
if(Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
param.height = (int)(heightPx + 0.5);
} else {
param.height = 0;
}
param.setMargins(0, 0, 0, 0);
param.columnSpec = GridLayout.spec(col, GridLayout.FILL, 1.f);
param.rowSpec = GridLayout.spec(row, GridLayout.FILL, 1.f);