-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
177 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/app/jdcookie/activity/SetActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.app.jdcookie.activity; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.webkit.CookieManager; | ||
import android.webkit.ValueCallback; | ||
import android.widget.Toast; | ||
|
||
import com.app.jdcookie.R; | ||
|
||
public class SetActivity extends AppCompatActivity implements View.OnClickListener { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_set); | ||
|
||
|
||
findViewById(R.id.set_back_image).setOnClickListener(this); | ||
findViewById(R.id.set_clear_cookie_layout).setOnClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
if (v.getId() == R.id.set_back_image) { | ||
|
||
onBackPressed(); | ||
} else if (v.getId() == R.id.set_clear_cookie_layout) { | ||
//清除浏览器的cookie | ||
CookieManager instance = CookieManager.getInstance(); | ||
instance.removeAllCookies(value -> Toast.makeText(SetActivity.this, "清除" + (value ? "成功" : "失败"), Toast.LENGTH_SHORT).show()); | ||
instance.flush(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
tools:context=".activity.SetActivity"> | ||
|
||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="45dp" | ||
android:background="@color/purple_200" | ||
android:orientation="horizontal"> | ||
|
||
<ImageView | ||
android:id="@+id/set_back_image" | ||
android:layout_width="45dp" | ||
android:layout_height="45dp" | ||
android:padding="16dp" | ||
android:src="@drawable/icon_back" | ||
app:tint="#fff" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerInParent="true" | ||
android:text="设置" | ||
android:textColor="#fff" | ||
android:textSize="16sp" /> | ||
|
||
</RelativeLayout> | ||
|
||
|
||
<androidx.core.widget.NestedScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fillViewport="true"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#eee" | ||
android:orientation="vertical"> | ||
|
||
|
||
<LinearLayout | ||
android:id="@+id/set_clear_cookie_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="45dp" | ||
android:layout_marginTop="5dp" | ||
android:background="#fff" | ||
android:gravity="center" | ||
android:orientation="horizontal" | ||
android:paddingStart="12dp" | ||
android:paddingEnd="12dp"> | ||
|
||
<TextView | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:text="清除浏览器Cookie" | ||
android:textColor="#333" | ||
android:textSize="14sp" /> | ||
|
||
<ImageView | ||
android:layout_width="25dp" | ||
android:layout_height="25dp" | ||
android:src="@drawable/icon_arrow_more" /> | ||
|
||
</LinearLayout> | ||
|
||
|
||
</LinearLayout> | ||
|
||
|
||
</androidx.core.widget.NestedScrollView> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters