Commit 52b2bd29 by zhengnw@sobot.com

widget 1.1.8 webview

parent 2c13748a
......@@ -27,6 +27,7 @@ import com.sobot.widget.ui.SobotMarkConfig;
import com.sobot.widget.ui.base.SobotBaseActivity;
import com.sobot.widget.ui.rich.HtmlToolUtils;
import com.sobot.widget.ui.toast.SobotToastUtil;
import com.sobot.widget.ui.webview.SobotWebViewActivity;
import java.io.File;
import java.util.HashMap;
......@@ -247,6 +248,13 @@ public class MainActivity extends SobotBaseActivity {
// SobotLogUtils.i(SobotLoginTools.getInstance().getServiceInfo().getTimezone()+"----------------------------------"+SobotLoginTools.getInstance().getServiceInfo().getTimezoneId());
// }
// });
// Intent intent = new Intent(MainActivity.this, SobotWebViewActivity.class);
// intent.putExtra("url", "https://www.sobot.com/ticketclient/index.html?sysNum=75574e5fa29a48458d1f57ab5489a4c5&deployId=442eb27d9c5c4ab9a3a21023f82207a9");
//// 是否隐藏头部导航栏 默认false显示, true 隐藏
// intent.putExtra("isHideTitleBar", true);
//// 是否隐藏底部工具栏 默认false显示, true 隐藏
// intent.putExtra("isHideToolBar", true);
// startActivity(intent);
}
@Override
......
......@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'widget_x' //项目名
PUBLISH_VERSION = '1.1.5' //版本号
PUBLISH_VERSION = '1.1.8' //版本号
}
......
package com.sobot.widget.ui.webview;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
/**
* 解决WebView中输入时弹出软键盘,挡住输入框的问题
*/
public class AndroidBug5497Workaround {
// For more information, see https://issuetracker.google.com/issues/36911528
// To use this class, simply invoke assistActivity() on an Activity that already has its content view set.
public static void assistActivity (Activity activity) {
new AndroidBug5497Workaround(activity);
}
private View mChildOfContent;
private int usableHeightPrevious;
private FrameLayout.LayoutParams frameLayoutParams;
private AndroidBug5497Workaround(Activity activity) {
FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content);
mChildOfContent = content.getChildAt(0);
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
possiblyResizeChildOfContent();
}
});
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
}
private int frameLayoutHeight = 0;
private void possiblyResizeChildOfContent() {
int usableHeightNow = computeUsableHeight();
if (usableHeightNow != usableHeightPrevious) {
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
if (heightDifference > (usableHeightSansKeyboard/4)) {
// keyboard probably just became visible
frameLayoutHeight = frameLayoutParams.height;// !!!修改前保存原有高度
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
} else {
// keyboard probably just became hidden
if(0 != frameLayoutHeight) {
frameLayoutParams.height = frameLayoutHeight;// !!!收起键盘恢复原有高度
}
}
mChildOfContent.requestLayout();
usableHeightPrevious = usableHeightNow;
}
}
private int computeUsableHeight() {
Rect r = new Rect();
mChildOfContent.getWindowVisibleDisplayFrame(r);
return (r.bottom - r.top);
}
}
\ No newline at end of file
......@@ -5,7 +5,10 @@
android:background="@color/sobot_common_gray6"
android:orientation="vertical">
<include layout="@layout/sobot_common_layout_titlebar" />
<include
layout="@layout/sobot_common_layout_titlebar"
android:layout_height="@dimen/sobot_webview_titlebar_height"
android:layout_width="match_parent" />
<LinearLayout
android:layout_width="match_parent"
......@@ -19,11 +22,11 @@
android:layout_width="fill_parent"
android:layout_height="5dip"
android:max="100"
android:paddingStart="1dip"
android:paddingLeft="1dip"
android:paddingRight="1dip"
android:progress="0"
android:paddingEnd="1dip"
android:paddingStart="1dip" />
android:paddingRight="1dip"
android:progress="0" />
<com.sobot.widget.ui.webview.CustomWebview
android:id="@+id/sobot_mWebView"
......@@ -34,8 +37,8 @@
<LinearLayout
android:id="@+id/sobot_webview_toolsbar"
android:layout_height="@dimen/sobot_webview_toolsbar_height"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="vertical">
<View
......@@ -48,10 +51,10 @@
android:layout_height="43dp"
android:background="@color/sobot_white"
android:orientation="horizontal"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingStart="15dp"
android:paddingEnd="15dp">
android:paddingLeft="15dp"
android:paddingEnd="15dp"
android:paddingRight="15dp">
<ImageView
android:id="@+id/sobot_webview_goback"
......
......@@ -3,5 +3,7 @@
<dimen name="sobot_titlebar_height">44dp</dimen>
<dimen name="sobot_titlebar_title_size">16sp</dimen>
<dimen name="sobot_webview_titlebar_height">@dimen/sobot_titlebar_height</dimen>
<dimen name="sobot_webview_toolsbar_height">@dimen/sobot_titlebar_height</dimen>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment