Skip to content

Commit

Permalink
[UPDATE] 修改主题色红色,优化cookie显示
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuSky committed Dec 3, 2021
1 parent b61278c commit 9c1794f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#e5e5e5"
android:background="@color/purple_500"
android:orientation="horizontal">

<TextView
Expand All @@ -73,7 +74,7 @@
android:layout_centerInParent="true"
android:gravity="center"
android:text="京东pt_key列表,点击复制"
android:textColor="@color/purple_200"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />

Expand All @@ -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" />
</RelativeLayout>


Expand Down
9 changes: 4 additions & 5 deletions app/src/main/res/layout/item_main_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@

<TextView
android:id="@+id/item_main_text"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="12dp"
android:layout_marginStart="15dp"
android:paddingTop="15dp"
android:paddingEnd="12dp"
android:paddingBottom="15dp"
android:text="这里是cookie"
android:textColor="#333"
Expand All @@ -37,8 +36,8 @@
<View
android:layout_width="match_parent"
android:layout_height="2px"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="#e3e3e3" />

</LinearLayout>
6 changes: 3 additions & 3 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="purple_200">#FF5252</color>
<color name="purple_500">#FB8383</color>
<color name="purple_700">#FF9696</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
Expand Down

0 comments on commit 9c1794f

Please sign in to comment.