Skip to content

Commit

Permalink
webview 添加状态栏占位View
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwfqin committed May 25, 2020
1 parent 03919cf commit c963aef
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 32 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
``` groovy
// 测试版
def quicklib = "4.0.0"
def quicklib = "4.0.4"
// quicklib(Base)
implementation "com.sdwfqin.quicklib:quicklib:$quicklib"
Expand Down Expand Up @@ -172,9 +172,9 @@ implementation 'com.sdwfqin.quick:widget:3.2.0'
| BaseViewModel | ViewModel基类 |
| WechatShareTools | 微信分享工具类 |
| ImagePreviewActivity | 图片预览Activity(多图/单图) |
| BaseWebView | ViewActivity基类 |
| WebViewActivity | 传入url即可 |
| WebViewLoadDataActivity | 针对非url链接的网页 |
| QuickBaseWebViewActivity | ViewActivity基类 |
| QuickWebViewActivity | 传入url即可 |
| QuickWebViewLoadDataActivity | 针对非url链接的网页 |
| GsonUtil | Gson工具类 |
| RxSchedulersUtils | compose()统一线程处理 |
| RxTimerUtil | RxJava定时任务 |
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ dependencies {
implementation project(':paylib')
implementation project(':widget')

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'

annotationProcessor compilerDependencies["arouter-compiler"]
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">

<!-- FileProvider文件共享 -->
<provider
android:name="androidx.core.content.FileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ public class ArouterConstants {
* 圆(方)形加载进度条
*/
public static final String COMPONENTS_CIRCLEPROGRESSDEMO = "/components/circleprogressdemo";

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.alibaba.android.arouter.facade.annotation.Route;
import com.qmuiteam.qmui.skin.QMUISkinManager;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import com.sdwfqin.quicklib.webview.BaseWebView;
import com.sdwfqin.quicklib.webview.QuickBaseWebViewActivity;
import com.sdwfqin.quickseed.base.ArouterConstants;
import com.sdwfqin.quickseed.utils.skin.QMUISkinCustManager;

Expand All @@ -18,7 +18,7 @@
* @date 2018/6/19
*/
@Route(path = ArouterConstants.COMPONENTS_CUSTOMWEBVIEW)
public class CustomWebviewActivity extends BaseWebView {
public class CustomWebviewActivity extends QuickBaseWebViewActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.sdwfqin.quicklib.base.BaseFragment;
import com.sdwfqin.quicklib.dialog.HintDialog;
import com.sdwfqin.quicklib.imagepreview.ImagePreviewActivity;
import com.sdwfqin.quicklib.webview.WebViewActivity;
import com.sdwfqin.quicklib.webview.QuickWebViewActivity;
import com.sdwfqin.quickseed.R;
import com.sdwfqin.quickseed.base.ArouterConstants;
import com.sdwfqin.quickseed.databinding.FragmentMainBinding;
Expand Down Expand Up @@ -88,7 +88,7 @@ protected void initClickListener() {
ARouter.getInstance().build(ArouterConstants.COMPONENTS_SHOWSVG).navigation();
break;
case 7:
WebViewActivity.launch("https://www.baidu.com");
QuickWebViewActivity.launch("https://www.baidu.com");
break;
case 8:
ARouter.getInstance().build(ArouterConstants.COMPONENTS_CUSTOMWEBVIEW).navigation();
Expand Down
4 changes: 2 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {

versionCode = 40090
versionName = "4.0.0"
versionCode = 40094
versionName = "4.0.4"

qmui = "2.0.0-alpha09"
okhttp = "4.6.0"
Expand Down
4 changes: 2 additions & 2 deletions quicklib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

<application>
<activity
android:name=".webview.WebViewActivity"
android:name=".webview.QuickWebViewActivity"
android:configChanges="orientation|keyboardHidden|screenSize" />
<activity
android:name=".webview.WebViewLoadDataActivity"
android:name=".webview.QuickWebViewLoadDataActivity"
android:configChanges="orientation|keyboardHidden|screenSize" />
<activity
android:name=".imagepreview.ImagePreviewActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.blankj.utilcode.util.StringUtils;
import com.just.agentweb.AgentWeb;
import com.just.agentweb.WebChromeClient;
import com.sdwfqin.quicklib.R;
import com.sdwfqin.quicklib.base.BaseActivity;
import com.sdwfqin.quicklib.databinding.QuickActivityWebViewBinding;

Expand All @@ -17,8 +16,7 @@
* @author zhangqin
* @date 2018/6/19
*/
public abstract class BaseWebView extends BaseActivity<QuickActivityWebViewBinding> {
protected LinearLayout mContainer;
public abstract class QuickBaseWebViewActivity extends BaseActivity<QuickActivityWebViewBinding> {

protected String mUrl;
protected AgentWeb mAgentWeb;
Expand All @@ -31,8 +29,6 @@ protected QuickActivityWebViewBinding getViewBinding() {
@Override
protected void initEventAndData() {

mContainer = (LinearLayout) findViewById(R.id.container);

if (!StringUtils.isEmpty(getUrl())) {
mUrl = getUrl();
} else {
Expand Down Expand Up @@ -60,7 +56,7 @@ protected void initClickListener() {
private void initWebView() {
mAgentWeb = AgentWeb.with(mContext)
//传入AgentWeb 的父控件 ,如果父控件为 RelativeLayout , 那么第二参数需要传入 RelativeLayout.LayoutParams ,第一个参数和第二个参数应该对应。
.setAgentWebParent(mContainer, new LinearLayout.LayoutParams(-1, -1))
.setAgentWebParent(mBinding.container, new LinearLayout.LayoutParams(-1, -1))
.useDefaultIndicator()// 使用默认进度条
.setWebChromeClient(new WebChromeClient() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @date 2018/1/16
*/
@Route(path = QuickArouterConstants.QUICK_WEBVIEW)
public class WebViewActivity extends BaseWebView {
public class QuickWebViewActivity extends QuickBaseWebViewActivity {

/**
* 加载网页
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.StringUtils;
import com.just.agentweb.AgentWeb;
import com.sdwfqin.quicklib.R;
import com.sdwfqin.quicklib.base.BaseActivity;
import com.sdwfqin.quicklib.base.QuickArouterConstants;
import com.sdwfqin.quicklib.base.QuickConstants;
Expand All @@ -20,9 +19,7 @@
* @date 2018/1/16
*/
@Route(path = QuickArouterConstants.QUICK_WEBVIEWLOADDATA)
public class WebViewLoadDataActivity extends BaseActivity<QuickActivityWebViewBinding> {

LinearLayout mContainer;
public class QuickWebViewLoadDataActivity extends BaseActivity<QuickActivityWebViewBinding> {

private String mTitle;
private String mContent;
Expand Down Expand Up @@ -50,8 +47,6 @@ protected QuickActivityWebViewBinding getViewBinding() {
@Override
protected void initEventAndData() {

mContainer = (LinearLayout) findViewById(R.id.container);

mTitle = getIntent().getStringExtra("title");
mContent = getIntent().getStringExtra("content");
mBaseUrl = getIntent().getStringExtra("baseUrl");
Expand All @@ -70,7 +65,7 @@ protected void initClickListener() {
private void initWebView() {
AgentWeb agentWeb = AgentWeb.with(mContext)
//传入AgentWeb 的父控件 ,如果父控件为 RelativeLayout , 那么第二参数需要传入 RelativeLayout.LayoutParams ,第一个参数和第二个参数应该对应。
.setAgentWebParent(mContainer, new LinearLayout.LayoutParams(-1, -1))
.setAgentWebParent(mBinding.container, new LinearLayout.LayoutParams(-1, -1))
// 使用默认进度条
.useDefaultIndicator()
// .defaultProgressBarColor()
Expand Down
19 changes: 15 additions & 4 deletions quicklib/src/main/res/layout/quick_activity_web_view.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
android:orientation="vertical">

<com.sdwfqin.widget.StatusPlaceholderView
android:id="@+id/status_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />

<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
</LinearLayout>
1 change: 1 addition & 0 deletions widget/src/main/java/com/sdwfqin/widget/AmountView.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public AmountView(Context context, AttributeSet attrs) {
super(context, attrs);

mBinding = QuickAmountViewBinding.inflate(LayoutInflater.from(context));
addView(mBinding.getRoot());
mBinding.btnDecrease.setOnClickListener(this);
mBinding.btnIncrease.setOnClickListener(this);
mBinding.etAmount.addTextChangedListener(this);
Expand Down

0 comments on commit c963aef

Please sign in to comment.