这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.content.Context;
import android.graphics.Rect;
import android.inputmethodservice.InputMethodService;
import android.os.Bundle;
import java.lang.reflect.Method;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -118,6 +120,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

@Override
public void onGlobalLayout() {
if (isMIUI() || isHyperOS()) return;
if (mActivity == null || !mActivity.isVisible()) return;

View bottomSpaceView = mActivity.getTermuxActivityBottomSpaceView();
Expand Down Expand Up @@ -281,4 +284,34 @@ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
}
}

private boolean isMIUI() {
try {
String miuiVersion = getSystemProperty("ro.miui.ui.version.name");
return !miuiVersion.isEmpty();
} catch (Exception e) {
e.printStackTrace();
return false;
}
}

private boolean isHyperOS() {
try {
String hyperOSVersion = getSystemProperty("ro.mi.os.version.name");
return !hyperOSVersion.isEmpty();
} catch (Exception e) {
e.printStackTrace();
return false;
}
}

private String getSystemProperty(String key) {
try {
Class<?> systemPropertiesClass = Class.forName("android.os.SystemProperties");
Method getMethod = systemPropertiesClass.getMethod("get", String.class);
return (String) getMethod.invoke(null, key);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}