From 9c1794f9f2fcb5424273af95ba0956dcfa07e12c Mon Sep 17 00:00:00 2001 From: MrZhu <1377761348@qq.com> Date: Fri, 3 Dec 2021 19:06:18 +0800 Subject: [PATCH] =?UTF-8?q?[UPDATE]=20=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=89=B2=E7=BA=A2=E8=89=B2=EF=BC=8C=E4=BC=98=E5=8C=96cookie?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++-- .../java/com/app/jdcookie/activity/MainActivity.java | 7 ++++++- app/src/main/res/layout/activity_main.xml | 10 ++++++---- app/src/main/res/layout/item_main_layout.xml | 9 ++++----- app/src/main/res/values/colors.xml | 6 +++--- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 52598c2..77f0428 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.app.jdcookie" minSdkVersion 21 targetSdkVersion 30 - versionCode 2 - versionName "1.0.1" + versionCode 3 + versionName "1.0.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/app/jdcookie/activity/MainActivity.java b/app/src/main/java/com/app/jdcookie/activity/MainActivity.java index bafbfda..bc61d23 100644 --- a/app/src/main/java/com/app/jdcookie/activity/MainActivity.java +++ b/app/src/main/java/com/app/jdcookie/activity/MainActivity.java @@ -16,6 +16,7 @@ import android.os.Build; import android.os.Bundle; import android.text.TextUtils; +import android.util.ArraySet; import android.view.View; import android.webkit.CookieManager; import android.webkit.WebChromeClient; @@ -33,6 +34,8 @@ import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.listener.OnItemChildClickListener; +import java.util.Set; + public class MainActivity extends AppCompatActivity implements View.OnClickListener { private WebView webBridgeWebView; @@ -134,12 +137,14 @@ private void initWebView() { webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } + // WebView.setWebContentsDebuggingEnabled(BuilD); webBridgeWebView.setWebViewClient(new MyWebViewClient(webBridgeProgressBar, (cookie, pt_key) -> runOnUiThread(() -> { //限制 500 毫秒 刷新一次 long time = System.currentTimeMillis(); - if (time - oldTime > 500) { + if (time - oldTime > 500 && !adapter.getData().contains(pt_key)) { + adapter.addData(pt_key); recyclerView.scrollToPosition(adapter.getData().size() - 1); oldTime = time; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 53c42e6..d0a404c 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -49,6 +49,7 @@ style="@style/JD.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="1px" android:max="100" android:progress="20" android:progressDrawable="@drawable/drawable_webview_progress" @@ -59,12 +60,12 @@ android:id="@+id/main_web_view" android:layout_width="match_parent" android:layout_height="0dp" - android:layout_weight="1.5" /> + android:layout_weight="2" /> @@ -83,7 +84,8 @@ android:layout_height="45dp" android:layout_alignParentEnd="true" android:padding="12dp" - android:src="@drawable/icon_clear" /> + android:src="@drawable/icon_clear" + android:tint="@color/white" /> diff --git a/app/src/main/res/layout/item_main_layout.xml b/app/src/main/res/layout/item_main_layout.xml index ff44dec..4f11ff2 100644 --- a/app/src/main/res/layout/item_main_layout.xml +++ b/app/src/main/res/layout/item_main_layout.xml @@ -13,12 +13,11 @@ \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127..4ff5b81 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,8 +1,8 @@ - #FFBB86FC - #FF6200EE - #FF3700B3 + #FF5252 + #FB8383 + #FF9696 #FF03DAC5 #FF018786 #FF000000