Browse Source

修改横屏模式H5页面软键盘模式控制

Pq 6 months ago
parent
commit
f106627933

+ 6 - 1
student/src/main/java/com/cooleshow/student/ui/web/HtmlActivity.java

@@ -189,7 +189,6 @@ public class HtmlActivity extends BaseActivity<ActivityHtml1Binding> implements
 //        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         StyleConfig.setTheme(this);//errorView是公共的,里面有引用不同样式,故在老师端设置这个
         super.onCreate(savedInstanceState);
-        KeyboardUtils.fixAndroidBug5497(this);
         EventBus.getDefault().register(this);
         if (UserHelper.isAgreePrivacy()) {
             api = WXAPIFactory.createWXAPI(this, null);
@@ -262,6 +261,12 @@ public class HtmlActivity extends BaseActivity<ActivityHtml1Binding> implements
         } else {
             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
         }
+
+        if (orientation != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
+            //横屏模式忽略
+            KeyboardUtils.fixAndroidBug5497(this);
+        }
+
         int c_orientation = intent.getIntExtra("c_orientation", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
         isNeedResetScreenOrientation = c_orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
         LOG.i("c_orientation:" + c_orientation + "--isNeedResetScreenOrientation:" + isNeedResetScreenOrientation);

+ 1 - 1
teacher/src/main/AndroidManifest.xml

@@ -122,7 +122,7 @@
             android:name=".ui.web.HtmlActivity"
             android:configChanges="orientation|screenSize|keyboardHidden|fontScale|smallestScreenSize|screenLayout|uiMode"
             android:screenOrientation="locked"
-            android:windowSoftInputMode="adjustResize" />
+            android:windowSoftInputMode="adjustPan" />
         <activity
             android:name=".ui.web.HtmlHorizontalScreenActivity"
             android:configChanges="orientation|screenSize|keyboardHidden|fontScale|smallestScreenSize|screenLayout|uiMode"

+ 5 - 1
teacher/src/main/java/com/cooleshow/teacher/ui/web/HtmlActivity.java

@@ -193,7 +193,6 @@ public class HtmlActivity extends BaseActivity<ActivityHtml1Binding> implements
 //        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
         StyleConfig.setTheme(this);
         super.onCreate(savedInstanceState);
-        KeyboardUtils.fixAndroidBug5497(this);
         EventBus.getDefault().register(this);
         if (UserHelper.isAgreePrivacy()) {
             api = WXAPIFactory.createWXAPI(this, null);
@@ -267,6 +266,11 @@ public class HtmlActivity extends BaseActivity<ActivityHtml1Binding> implements
             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
         }
 
+        if (orientation != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
+            //横屏模式忽略
+            KeyboardUtils.fixAndroidBug5497(this);
+        }
+
         int c_orientation = intent.getIntExtra("c_orientation", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
         isNeedResetScreenOrientation = c_orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
         LOG.i("c_orientation:" + c_orientation + "--isNeedResetScreenOrientation:" + isNeedResetScreenOrientation);