关于这一点,我需要您的建议。
对于这一点,我想删除所有建议/自动更正:
package com.sanoj.goproxy;
import android.graphics.Bitmap;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
ProgressBar superProgressBar;
ImageView superImageView;
WebView superWebView;
LinearLayout superLinearLayout;
SwipeRefreshLayout superSwipeLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
superSwipeLayout = findViewById(R.id.mySwipeLayout);
superLinearLayout = findViewById(R.id.myLinearLayout);
superProgressBar = findViewById(R.id.myProgressBar);
superImageView = findViewById(R.id.myImageView);
superWebView = findViewById(R.id.myWebView);
superProgressBar.setMax(100);
superWebView.loadUrl("http://safebrowser.tk");
superWebView.getSettings().setJavaScriptEnabled(true);
superWebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
superLinearLayout.setVisibility(View.VISIBLE);
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
superLinearLayout.setVisibility(View.GONE);
superSwipeLayout.setRefreshing(false);
super.onPageFinished(view, url);
}
});
superWebView.setWebChromeClient(new WebChromeClient(){
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
superProgressBar.setProgress(newProgress);
}
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
getSupportActionBar().setTitle(title);
}
@Override
public void onReceivedIcon(WebView view, Bitmap icon) {
super.onReceivedIcon(view, icon);
superImageView.setImageBitmap(icon);
}
});
superSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
superWebView.reload();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.super_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.menu_back:
onBackPressed();
break;
case R.id.menu_forward:
onForwardPressed();
break;
case R.id.menu_refresh:
superWebView.reload();
break;
}
return super.onOptionsItemSelected(item);
}
private void onForwardPressed(){
if (superWebView.canGoForward()){
superWebView.goForward();
} else {
Toast.makeText(getApplicationContext(), "Can't Go Further..!", Toast.LENGTH_LONG).show();
}
}
@Override
public void onBackPressed() {
if (superWebView.canGoBack()){
superWebView.goBack();
}else {
finish();
}
}
}
。
这将避免存储字典。
是否可以在没有root权限的情况下以编程方式清除用户词典?