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) if (getVisibility() != View.GONE)
setVisibility(View.GONE); setVisibility(View.GONE);
return; return;
} } else {
Rect r = new Rect(); int visibility = View.VISIBLE;
getWindowVisibleDisplayFrame(r); softKbdVisible = (visibility == View.VISIBLE);
float mScreenDensity = getResources().getDisplayMetrics().density; if (!softKbdVisible)
int MAGIC_NUMBER = 200; setVisibility(visibility);
}
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);
} }
public void reload(int[] keys, View TargetView, View.OnKeyListener TargetListener) { public void reload(int[] keys, View TargetView, View.OnKeyListener TargetListener) {

View File

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

View File

@ -25,10 +25,10 @@
android:key="showIMEWhileExternalConnected" android:key="showIMEWhileExternalConnected"
android:summary="Show software keyboard while hardware keyboard is connected" /> android:summary="Show software keyboard while hardware keyboard is connected" />
<CheckBoxPreference <CheckBoxPreference
android:title="Reseed Screen While Soft Keybourd is open" android:title="Reseed Screen While Soft Keyboard is open"
android:defaultValue="false" android:defaultValue="false"
android:key="Reseed" 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 <CheckBoxPreference
android:title="PIP Mode" android:title="PIP Mode"