Improve ek-x functionality

This commit is contained in:
Wisest_wizard 2021-08-10 17:39:58 +05:30 committed by Wisest_wizard
parent cf51f719d1
commit aeeae8cf5a
3 changed files with 16 additions and 27 deletions

View File

@ -63,24 +63,14 @@ public class AdditionalKeyboardView extends HorizontalScrollView implements View
if (getVisibility() != View.GONE)
setVisibility(View.GONE);
return;
}
} else {
Rect r = new Rect();
getWindowVisibleDisplayFrame(r);
int visibility = View.VISIBLE;
softKbdVisible = (visibility == View.VISIBLE);
float mScreenDensity = getResources().getDisplayMetrics().density;
int MAGIC_NUMBER = 200;
int heightDiff = getRootView().getHeight() - (r.bottom - r.top);
float dp = heightDiff/ mScreenDensity;
int visibility = (dp > MAGIC_NUMBER)?View.VISIBLE:View.INVISIBLE;
softKbdVisible = (visibility == View.VISIBLE);
if (getVisibility() == visibility) return;
if (softKbdVisible)
setY(r.bottom - r.top - getHeight());
setVisibility(visibility);
if (!softKbdVisible)
setVisibility(visibility);
}
}
public void reload(int[] keys, View TargetView, View.OnKeyListener TargetListener) {

View File

@ -4,30 +4,29 @@
android:layout_height="match_parent"
android:id="@+id/relative">
<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/frame">
android:layout_height="match_parent"
android:id="@+id/linear"
android:paddingBottom="35dp">
<SurfaceView
android:id="@+id/lorieView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="match_parent"/>
</FrameLayout>
</LinearLayout>
<com.termux.x11.AdditionalKeyboardView
android:id="@+id/additionalKbd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/frame"
android:layout_alignBottom="@id/relative"/>
android:layout_below="@+id/linear"/>
<!-- Without this view AdditionalKeyboard view sometimes dissapear -->
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/frame"
android:layout_alignBottom="@id/relative"/>
android:layout_below="@+id/linear"/>
</RelativeLayout>

View File

@ -25,10 +25,10 @@
android:key="showIMEWhileExternalConnected"
android:summary="Show software keyboard while hardware keyboard is connected" />
<CheckBoxPreference
android:title="Reseed Screen While Soft Keybourd is open"
android:title="Reseed Screen While Soft Keyboard is open"
android:defaultValue="false"
android:key="Reseed"
android:summary="The screen size will be adjusted while Soft Keybourd is open. Additional Keybaord is not supported by this option." />
android:summary="The screen size will be adjusted while Soft Keyboard is open." />
<CheckBoxPreference
android:title="PIP Mode"