Additional keyboard position and key size fix
This commit is contained in:
parent
bd707e9ba5
commit
50cfaae235
@ -2,5 +2,6 @@ Android NDK: WARNING:/home/twaik/TermuxX11/app/src/main/jni/lorie/Android.mk:lor
|
||||
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
|
||||
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
|
||||
Android NDK: current module
|
||||
[armeabi-v7a] Compile++ thumb: lorie <= egl-helper.cpp
|
||||
[armeabi-v7a] Compile++ thumb: lorie <= renderer.cpp
|
||||
[armeabi-v7a] Compile++ thumb: lorie <= surface.cpp
|
||||
[armeabi-v7a] SharedLibrary : liblorie.so
|
||||
|
@ -29,8 +29,7 @@
|
||||
<activity android:name=".MainActivity"
|
||||
android:theme="@style/NoActionBar"
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="fontScale|orientation|screenSize|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|screenLayout|touchscreen|uiMode|smallestScreenSize|density"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
android:configChanges="fontScale|orientation|screenSize|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|screenLayout|touchscreen|uiMode|smallestScreenSize|density">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -13,14 +13,13 @@ import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
||||
public class AdditionalKeyboardView extends HorizontalScrollView implements ViewTreeObserver.OnGlobalLayoutListener {
|
||||
private final static int KEYCODE_BASE = 300;
|
||||
public final static int PREFERENCES_KEY = KEYCODE_BASE + 1;
|
||||
@ -154,14 +153,14 @@ public class AdditionalKeyboardView extends HorizontalScrollView implements View
|
||||
toggle = false;
|
||||
}
|
||||
|
||||
setMinEms(4);
|
||||
setPadding(10*density, 0, 10*density, 0);
|
||||
setGravity(Gravity.CENTER);
|
||||
|
||||
setTextColor(TEXT_COLOR);
|
||||
setBackgroundColor(BUTTON_COLOR);
|
||||
String text = keyCodesForString.get(keyCode);
|
||||
float textWidth = getPaint().measureText(text);
|
||||
setWidth((int) (textWidth + 20 * density));
|
||||
setText(text);
|
||||
setGravity(Gravity.CENTER);
|
||||
setOnClickListener(this);
|
||||
setOnTouchListener(this);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class LorieService extends Service {
|
||||
Notification notification = new NotificationCompat.Builder(this, channelId)
|
||||
.setContentTitle("Termux:X11")
|
||||
.setSmallIcon(R.drawable.ic_x11_icon)
|
||||
.setContentText("is running in foreground")
|
||||
.setContentText("Pull down to show options")
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setPriority(priority)
|
||||
@ -176,6 +176,7 @@ public class LorieService extends Service {
|
||||
sleep(500);
|
||||
act.finish();
|
||||
stopSelf();
|
||||
System.exit(0); // This is needed to completely finish the process
|
||||
}
|
||||
|
||||
onPreferencesChanged();
|
||||
@ -359,7 +360,7 @@ public class LorieService extends Service {
|
||||
|
||||
}
|
||||
|
||||
void sleep(long millis) {
|
||||
static void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.termux.x11;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@ -11,6 +13,8 @@ import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@ -34,6 +38,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
LorieService.setMainActivity(this);
|
||||
LorieService.start(LorieService.ACTION_START_FROM_ACTIVITY);
|
||||
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN|
|
||||
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.main_activity);
|
||||
@ -46,6 +53,23 @@ public class MainActivity extends AppCompatActivity {
|
||||
setPointerIcon(PointerIcon.getSystemIcon(this, PointerIcon.TYPE_NULL));
|
||||
}
|
||||
|
||||
int orientation;
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
if (newConfig.orientation != orientation && kbd != null && kbd.getVisibility() == View.VISIBLE) {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
View view = getCurrentFocus();
|
||||
if (view == null) {
|
||||
view = new View(this);
|
||||
}
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
orientation = newConfig.orientation;
|
||||
}
|
||||
|
||||
public void onLorieServiceStart(LorieService instance) {
|
||||
SurfaceView lorieView = findViewById(R.id.lorieView);
|
||||
|
||||
|
@ -27,7 +27,8 @@ public:
|
||||
void window_change_callback(EGLNativeWindowType win, uint32_t width, uint32_t height, uint32_t physical_width, uint32_t physical_height);
|
||||
void layout_change_callback(char *layout);
|
||||
|
||||
void egl_after_init();
|
||||
void on_egl_init();
|
||||
void on_egl_uninit();
|
||||
|
||||
LorieEGLHelper helper;
|
||||
|
||||
@ -43,16 +44,21 @@ LorieBackendAndroid::LorieBackendAndroid()
|
||||
|
||||
|
||||
|
||||
void LorieBackendAndroid::egl_after_init() {
|
||||
void LorieBackendAndroid::on_egl_init() {
|
||||
renderer.init();
|
||||
}
|
||||
|
||||
void LorieBackendAndroid::on_egl_uninit() {
|
||||
renderer.uninit();
|
||||
}
|
||||
|
||||
void LorieBackendAndroid::backend_init() {
|
||||
if (!helper.init(EGL_DEFAULT_DISPLAY)) {
|
||||
LOGE("Failed to initialize EGL context");
|
||||
}
|
||||
|
||||
helper.onInit = std::bind(std::mem_fn(&LorieBackendAndroid::egl_after_init), this);
|
||||
helper.onInit = std::bind(std::mem_fn(&LorieBackendAndroid::on_egl_init), this);
|
||||
//helper.onUninit = std::bind(std::mem_fn(&LorieBackendAndroid::on_egl_uninit), this);
|
||||
|
||||
if (xkb_context == nullptr) {
|
||||
xkb_context = xkb_context_new((enum xkb_context_flags) 0);
|
||||
@ -183,10 +189,9 @@ extern "C" JNIEXPORT void JNICALL
|
||||
JNI_DECLARE(LorieService, terminate)(JNIEnv __unused *env, jobject __unused instance, jlong jcompositor) {
|
||||
if (jcompositor == 0) return;
|
||||
LorieBackendAndroid *b = fromLong(jcompositor);
|
||||
|
||||
LOGI("JNI: requested termination");
|
||||
b->terminate();
|
||||
b->self.join();
|
||||
DBG;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
|
@ -239,7 +239,7 @@ void LorieRenderer::redraw() {
|
||||
|
||||
if (cursorVisible)
|
||||
drawCursor();
|
||||
|
||||
|
||||
compositor.swap_buffers();
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ void LorieSurface::request_frame(uint32_t callback) {
|
||||
}
|
||||
|
||||
void LorieSurface::request_commit() {
|
||||
//if (!buffer) return;
|
||||
//wl_buffer_send_release (buffer);
|
||||
if (!buffer) return;
|
||||
wl_buffer_send_release (buffer);
|
||||
|
||||
if (frame_callback) {
|
||||
wl_callback_send_done (frame_callback, LorieUtils::timestamp());
|
||||
|
Loading…
x
Reference in New Issue
Block a user