Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sobot_android
Sobot_module_Dev
Commits
52b2bd29
Commit
52b2bd29
authored
Feb 01, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widget 1.1.8 webview
parent
2c13748a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
70 deletions
+183
-70
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+8
-0
sobot-widget-publish-mavencentral.gradle
sobot_widget/sobot-widget-publish-mavencentral.gradle
+1
-1
AndroidBug5497Workaround.java
...com/sobot/widget/ui/webview/AndroidBug5497Workaround.java
+64
-0
SobotWebViewActivity.java
...ava/com/sobot/widget/ui/webview/SobotWebViewActivity.java
+97
-61
sobot_activity_webview.xml
sobot_widget/src/main/res/layout/sobot_activity_webview.xml
+11
-8
dimens.xml
sobot_widget/src/main/res/values/dimens.xml
+2
-0
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
52b2bd29
...
@@ -27,6 +27,7 @@ import com.sobot.widget.ui.SobotMarkConfig;
...
@@ -27,6 +27,7 @@ import com.sobot.widget.ui.SobotMarkConfig;
import
com.sobot.widget.ui.base.SobotBaseActivity
;
import
com.sobot.widget.ui.base.SobotBaseActivity
;
import
com.sobot.widget.ui.rich.HtmlToolUtils
;
import
com.sobot.widget.ui.rich.HtmlToolUtils
;
import
com.sobot.widget.ui.toast.SobotToastUtil
;
import
com.sobot.widget.ui.toast.SobotToastUtil
;
import
com.sobot.widget.ui.webview.SobotWebViewActivity
;
import
java.io.File
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -247,6 +248,13 @@ public class MainActivity extends SobotBaseActivity {
...
@@ -247,6 +248,13 @@ public class MainActivity extends SobotBaseActivity {
// SobotLogUtils.i(SobotLoginTools.getInstance().getServiceInfo().getTimezone()+"----------------------------------"+SobotLoginTools.getInstance().getServiceInfo().getTimezoneId());
// 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
@Override
...
...
sobot_widget/sobot-widget-publish-mavencentral.gradle
View file @
52b2bd29
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'widget_x'
//项目名
PUBLISH_ARTIFACT_ID
=
'widget_x'
//项目名
PUBLISH_VERSION
=
'1.1.
5
'
//版本号
PUBLISH_VERSION
=
'1.1.
8
'
//版本号
}
}
...
...
sobot_widget/src/main/java/com/sobot/widget/ui/webview/AndroidBug5497Workaround.java
0 → 100644
View file @
52b2bd29
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
sobot_widget/src/main/java/com/sobot/widget/ui/webview/SobotWebViewActivity.java
View file @
52b2bd29
This diff is collapsed.
Click to expand it.
sobot_widget/src/main/res/layout/sobot_activity_webview.xml
View file @
52b2bd29
...
@@ -5,7 +5,10 @@
...
@@ -5,7 +5,10 @@
android:background=
"@color/sobot_common_gray6"
android:background=
"@color/sobot_common_gray6"
android:orientation=
"vertical"
>
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
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -19,11 +22,11 @@
...
@@ -19,11 +22,11 @@
android:layout_width=
"fill_parent"
android:layout_width=
"fill_parent"
android:layout_height=
"5dip"
android:layout_height=
"5dip"
android:max=
"100"
android:max=
"100"
android:paddingStart=
"1dip"
android:paddingLeft=
"1dip"
android:paddingLeft=
"1dip"
android:paddingRight=
"1dip"
android:progress=
"0"
android:paddingEnd=
"1dip"
android:paddingEnd=
"1dip"
android:paddingStart=
"1dip"
/>
android:paddingRight=
"1dip"
android:progress=
"0"
/>
<com.sobot.widget.ui.webview.CustomWebview
<com.sobot.widget.ui.webview.CustomWebview
android:id=
"@+id/sobot_mWebView"
android:id=
"@+id/sobot_mWebView"
...
@@ -34,8 +37,8 @@
...
@@ -34,8 +37,8 @@
<LinearLayout
<LinearLayout
android:id=
"@+id/sobot_webview_toolsbar"
android:id=
"@+id/sobot_webview_toolsbar"
android:layout_height=
"@dimen/sobot_webview_toolsbar_height"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<View
<View
...
@@ -48,10 +51,10 @@
...
@@ -48,10 +51,10 @@
android:layout_height=
"43dp"
android:layout_height=
"43dp"
android:background=
"@color/sobot_white"
android:background=
"@color/sobot_white"
android:orientation=
"horizontal"
android:orientation=
"horizontal"
android:paddingLeft=
"15dp"
android:paddingRight=
"15dp"
android:paddingStart=
"15dp"
android:paddingStart=
"15dp"
android:paddingEnd=
"15dp"
>
android:paddingLeft=
"15dp"
android:paddingEnd=
"15dp"
android:paddingRight=
"15dp"
>
<ImageView
<ImageView
android:id=
"@+id/sobot_webview_goback"
android:id=
"@+id/sobot_webview_goback"
...
...
sobot_widget/src/main/res/values/dimens.xml
View file @
52b2bd29
...
@@ -3,5 +3,7 @@
...
@@ -3,5 +3,7 @@
<dimen
name=
"sobot_titlebar_height"
>
44dp
</dimen>
<dimen
name=
"sobot_titlebar_height"
>
44dp
</dimen>
<dimen
name=
"sobot_titlebar_title_size"
>
16sp
</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>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment