查看图片在新窗口中打开,删除、修改收藏记住位置
This commit is contained in:
parent
271b19a84f
commit
31db197c83
|
@ -2,17 +2,16 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hty.browser"
|
||||
android:versionCode="4"
|
||||
android:versionName="4.11">
|
||||
android:versionName="4.13">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.Holo.Light.NoActionBar">
|
||||
android:theme="@android:style/Theme.Holo.Light">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.Holo.Light.NoActionBar"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize">
|
||||
<intent-filter>
|
||||
|
@ -28,6 +27,8 @@
|
|||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<action android:name="android.intent.action.SEARCH"/>
|
||||
<action android:name="android.intent.action.WEB_SEARCH"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="file"/>
|
||||
|
@ -35,12 +36,16 @@
|
|||
<data android:mimeType="text/plain"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".FavoriteActivity"/>
|
||||
<activity
|
||||
android:name="com.hty.browser.SettingsActivity"
|
||||
android:name=".FavoriteActivity"
|
||||
android:icon="@android:drawable/btn_star_big_on"
|
||||
android:label="收藏夹"
|
||||
android:parentActivityName=".MainActivity"/>
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:label="设置"
|
||||
android:theme="@android:style/Theme.Holo">
|
||||
</activity>
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:parentActivityName=".MainActivity"/>
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.11</h2>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.13</h2>
|
||||
<p>内置扩展的浏览器。</p>
|
||||
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
||||
<p>作者:海天鹰</p>
|
||||
|
@ -23,6 +23,8 @@ p { text-indent:2em; }
|
|||
<p><a href="https://stackoverflow.com/questions/3462582/display-the-android-webviews-favicon" target="_blank">获取网页图标</a></p>
|
||||
<p><a href="https://www.jianshu.com/p/c9a18050a249" target="_blank">字符串转Bitmap</a></p>
|
||||
<h3>更新日志:</h3>
|
||||
<h3>V4.13 (2020-08-30)</h3><ol><li>图片查看改为在新窗口中打开。</li><li>修复修改、删除收藏不能记忆位置问题。</li></ol>
|
||||
<h3>V4.12 (2020-07-17)</h3><ol><li>适配全面屏导航栏背景色。</li><li>收藏夹无标题栏自定义菜单改成标题栏菜单。</li></ol>
|
||||
<h3>V4.11 (2020-03-03)</h3><ol><li>收藏夹增加数目统计。</li><li>收藏夹增加菜单,导出HTML、CSV。</li></ol>
|
||||
<h3>V4.10 (2019-12-17)</h3><ol><li>优化视频独立播放。</li></ol>
|
||||
<h3>V4.9 (2019-11-06)</h3><ol><li>收藏夹网址增加分享功能。</li></ol>
|
||||
|
|
|
@ -16,7 +16,9 @@ import android.text.TextWatcher;
|
|||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnCreateContextMenuListener;
|
||||
import android.view.WindowManager;
|
||||
|
@ -24,7 +26,6 @@ import android.view.inputmethod.InputMethodManager;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
|
@ -40,14 +41,12 @@ import java.io.FileWriter;
|
|||
import java.lang.reflect.Field;
|
||||
|
||||
public class FavoriteActivity extends Activity {
|
||||
SimpleCursorAdapter adapter;
|
||||
ListView listView;
|
||||
EditText editText;
|
||||
InputMethodManager IMM;
|
||||
ImageButton imageButton_clear;
|
||||
InputMethodManager IMM;
|
||||
ListView listView;
|
||||
SimpleCursorAdapter adapter;
|
||||
int position = 0;
|
||||
TextView textView_title;
|
||||
Button button_favback;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -55,11 +54,8 @@ public class FavoriteActivity extends Activity {
|
|||
setContentView(R.layout.activity_favorite);
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
button_favback = (Button) findViewById(R.id.button_favback);
|
||||
button_favback.setText("<");
|
||||
textView_title = (TextView) findViewById(R.id.textView_title);
|
||||
imageButton_clear = (ImageButton) findViewById(R.id.imageButton_clear);
|
||||
imageButton_clear.setOnClickListener(new ButtonListener());
|
||||
imageButton_clear.setOnClickListener(new OnClickListener());
|
||||
imageButton_clear.setVisibility(View.GONE);
|
||||
editText = (EditText) findViewById(R.id.editText);
|
||||
editText.addTextChangedListener(new EditChangedListener());
|
||||
|
@ -87,23 +83,64 @@ public class FavoriteActivity extends Activity {
|
|||
menu.add(0, 3, 3, "分享");
|
||||
}
|
||||
});
|
||||
listView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
IMM.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
search(editText.getText().toString());
|
||||
}
|
||||
|
||||
class ButtonListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.imageButton_clear:
|
||||
editText.setText("");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
String[] sm = { "导出HTML", "导出CSV" };
|
||||
for (int i=0; i<sm.length; i++) {
|
||||
menu.add(0, i, i, sm[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case 0:
|
||||
String s = "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>\n<title>收藏夹</title>\n<style>a { text-decoration:none; }\ntable { table-layout:fixed; width:100%; border-collapse:collapse; }\nth, td { border:1px solid black; padding:5px; overflow:hidden; text-overflow: ellipsis; }\n</style>\n</head>\n<body>\n<h2 align=center>收藏夹" + adapter.getCount() + "</h2>\n<table>\n<tr><th>标题</th><th>网址</th></tr>\n";
|
||||
for (int i=0; i<adapter.getCount(); i++){
|
||||
LinearLayout layout = (LinearLayout) listView.getAdapter().getView(i, null, null);
|
||||
TextView textView_title = (TextView) layout.findViewById(R.id.title);
|
||||
TextView textView_website = (TextView) layout.findViewById(R.id.website);
|
||||
s = s + "<tr><td>" + textView_title.getText().toString() + "</td><td><a href=\"" + textView_website.getText().toString() + "\" target=\"_blank\">" + textView_website.getText().toString() + "</a></td></tr>\n";
|
||||
}
|
||||
s += "</table>\n</body>\n</html>";
|
||||
writeFile("webfav.htm", s);
|
||||
break;
|
||||
case 1:
|
||||
s = "";
|
||||
for (int i=0; i<adapter.getCount(); i++){
|
||||
LinearLayout layout = (LinearLayout) listView.getAdapter().getView(i, null, null);
|
||||
TextView textView_title = (TextView) layout.findViewById(R.id.title);
|
||||
TextView textView_website = (TextView) layout.findViewById(R.id.website);
|
||||
s = s + textView_title.getText().toString().replace(",", ",") + "," + textView_website.getText().toString() + "\n";
|
||||
}
|
||||
writeFile("webfav.csv", s);
|
||||
break;
|
||||
case android.R.id.home:
|
||||
IMM.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
|
||||
position = menuInfo.position;
|
||||
switch (item.getItemId()) {
|
||||
case 0:
|
||||
ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
|
@ -112,7 +149,6 @@ public class FavoriteActivity extends Activity {
|
|||
Toast.makeText(getApplicationContext(), "链接已复制", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 1:
|
||||
position = listView.getFirstVisiblePosition();
|
||||
int id = Integer.parseInt(((TextView) menuInfo.targetView.findViewById(R.id.id)).getText().toString());
|
||||
DBHelper helper = new DBHelper(getApplicationContext());
|
||||
helper.del(id);
|
||||
|
@ -189,12 +225,12 @@ public class FavoriteActivity extends Activity {
|
|||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -211,16 +247,22 @@ public class FavoriteActivity extends Activity {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void favback(View v) {
|
||||
IMM.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
finish();
|
||||
class OnClickListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.imageButton_clear:
|
||||
editText.setText("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void search(String s) {
|
||||
DBHelper helper = new DBHelper(this);
|
||||
Cursor cursor1 = helper.query(s);
|
||||
int count = cursor1.getCount();
|
||||
textView_title.setText("收藏夹" + count);
|
||||
setTitle("收藏夹" + count);
|
||||
String[] from = { "_id", "title", "website", "website" };
|
||||
int[] to = { R.id.id, R.id.title, R.id.website, R.id.imageView_favicon };
|
||||
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, cursor1, from, to, 0);
|
||||
|
@ -268,49 +310,16 @@ public class FavoriteActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
public void menuFav(View v) {
|
||||
String[] items = { "导出HTML", "导出CSV" };
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("收藏夹");
|
||||
builder.setIcon(android.R.drawable.btn_star_big_on);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
switch (which) {
|
||||
case 0:
|
||||
String s = "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>\n<title>收藏夹</title>\n<style>a { text-decoration:none; }\ntable { table-layout:fixed; width:100%; border-collapse:collapse; }\nth, td { border:1px solid black; padding:5px; overflow:hidden; text-overflow: ellipsis; }\n</style>\n</head>\n<body>\n<h2 align=center>收藏夹" + adapter.getCount() + "</h2>\n<table>\n<tr><th>标题</th><th>网址</th></tr>\n";
|
||||
for (int i=0; i<adapter.getCount(); i++){
|
||||
LinearLayout layout = (LinearLayout) listView.getAdapter().getView(i, null, null);
|
||||
TextView textView_title = (TextView) layout.findViewById(R.id.title);
|
||||
TextView textView_website = (TextView) layout.findViewById(R.id.website);
|
||||
s = s + "<tr><td>" + textView_title.getText().toString() + "</td><td><a href=\"" + textView_website.getText().toString() + "\" target=\"_blank\">" + textView_website.getText().toString() + "</a></td></tr>\n";
|
||||
}
|
||||
s += "</table>\n</body>\n</html>";
|
||||
writeFile("webfav.htm", s);
|
||||
break;
|
||||
case 1:
|
||||
s = "";
|
||||
for (int i=0; i<adapter.getCount(); i++){
|
||||
LinearLayout layout = (LinearLayout) listView.getAdapter().getView(i, null, null);
|
||||
TextView textView_title = (TextView) layout.findViewById(R.id.title);
|
||||
TextView textView_website = (TextView) layout.findViewById(R.id.website);
|
||||
s = s + textView_title.getText().toString() + "," + textView_website.getText().toString() + "\n";
|
||||
}
|
||||
writeFile("webfav.csv", s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
void writeFile(String filename, String s) {
|
||||
File file = new File(MainActivity.dir, filename);
|
||||
try {
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(file, false)); //false覆盖
|
||||
bw.write(s);
|
||||
bw.flush();
|
||||
BufferedWriter BW = new BufferedWriter(new FileWriter(file, false)); //false覆盖
|
||||
if(filename.endsWith(".csv")){
|
||||
BW.write('\ufeff'); // Excel通过文件的BOM头来判断文件编码
|
||||
BW.flush();
|
||||
}
|
||||
BW.write(s);
|
||||
BW.flush();
|
||||
Toast.makeText(FavoriteActivity.this, "写文件 " + MainActivity.dir + File.separator + filename + " 成功", Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e) {
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", e.toString());
|
||||
|
|
|
@ -266,8 +266,7 @@ public class MainActivity extends Activity {
|
|||
// 退出全屏
|
||||
private void quitFullScreen() {
|
||||
if (customViewCallback != null) {
|
||||
// 隐藏掉
|
||||
customViewCallback.onCustomViewHidden();
|
||||
customViewCallback.onCustomViewHidden(); // 隐藏
|
||||
}
|
||||
// RelativeLayout1.setVisibility(View.VISIBLE);
|
||||
LinearLayout1.setVisibility(View.VISIBLE);
|
||||
|
@ -404,7 +403,8 @@ public class MainActivity extends Activity {
|
|||
menu.add(0, 4, 4, "屏蔽图片");
|
||||
menu.add(0, 5, 5, "隐藏图片");
|
||||
} else if (result.getType() == HitTestResult.SRC_ANCHOR_TYPE) {
|
||||
menu.setHeaderIcon(android.R.drawable.ic_menu_sort_alphabetically);
|
||||
menu.setHeaderIcon(R.drawable.link);
|
||||
menu.add(0, 0, 0, "在新窗口打开链接");
|
||||
menu.add(0, 2, 2, "下载");
|
||||
menu.add(0, 3, 3, "复制链接");
|
||||
}
|
||||
|
@ -414,25 +414,24 @@ public class MainActivity extends Activity {
|
|||
public boolean onContextItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case 0:
|
||||
list_webView.get(currentPage).loadUrl(HTRE);
|
||||
newWindow(HTRE);
|
||||
break;
|
||||
case 1:
|
||||
ClipboardManager mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ContentValues values = new ContentValues(2);
|
||||
values.put(MediaStore.Images.Media.MIME_TYPE, "Image/jpg");
|
||||
values.put(MediaStore.Images.Media.DATA, HTRE);
|
||||
ContentResolver theContent = getContentResolver();
|
||||
Uri imageUri = theContent.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
||||
ClipData theClip = ClipData.newUri(getContentResolver(), "Image", imageUri);
|
||||
mClipboard.setPrimaryClip(theClip);
|
||||
ClipData clipData = ClipData.newUri(getContentResolver(), "Image", imageUri);
|
||||
clipboardManager.setPrimaryClip(clipData);
|
||||
break;
|
||||
case 2:
|
||||
//downloadBySystem(HTRE, "", "");
|
||||
dialog_new_download(HTRE, "", "");
|
||||
break;
|
||||
case 3:
|
||||
ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText("link", HTRE));
|
||||
clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
clipboardManager.setPrimaryClip(ClipData.newPlainText("link", HTRE));
|
||||
Toast.makeText(getApplicationContext(), "链接已复制", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 4:
|
||||
|
@ -639,14 +638,15 @@ public class MainActivity extends Activity {
|
|||
String[] items = { "新建窗口", "关闭当前窗口", "收藏当前页", "收藏夹", "查找", "分享", "视频独立播放", "视频截图", "视频在播放器中打开", "查看源码", "主页", "全屏", "广告过滤规则", "设置", "检查更新", "关于", "退出", "清除缓存" };
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("菜单");
|
||||
builder.setIcon(android.R.drawable.ic_menu_preferences);
|
||||
//builder.setIcon(android.R.drawable.ic_menu_preferences);
|
||||
builder.setIcon(R.drawable.ic_launcher);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
switch (which) {
|
||||
case 0:
|
||||
newWindow(sharedPreferences.getString("homepage","http://www.baidu.com"));
|
||||
newWindow(sharedPreferences.getString("homepage", "http://www.baidu.com"));
|
||||
break;
|
||||
case 1:
|
||||
list_webView.remove(currentPage);
|
||||
|
@ -794,7 +794,7 @@ public class MainActivity extends Activity {
|
|||
builder.setPositiveButton("保存", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String dir = Environment.getExternalStorageDirectory().getPath() + "/Pictures/Screenshots/";
|
||||
String dir = Environment.getExternalStorageDirectory().getPath() + "/DCIM/Screenshots/";
|
||||
File temp = new File(dir); // 如果文件夹不存在则创建
|
||||
if (!temp.exists()) {
|
||||
temp.mkdir();
|
||||
|
@ -813,7 +813,7 @@ public class MainActivity extends Activity {
|
|||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, BOS);
|
||||
try {
|
||||
BOS.flush();
|
||||
}catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
|
@ -852,7 +852,7 @@ public class MainActivity extends Activity {
|
|||
Uri uri = Uri.parse(value);
|
||||
intent1.setDataAndType(uri, type);
|
||||
startActivity(intent1);
|
||||
}catch (ActivityNotFoundException e){
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + e);
|
||||
Toast.makeText(getApplicationContext(), "系统默认播放器不能打开视频", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ public class MainActivity extends Activity {
|
|||
new Thread(CU).start();
|
||||
break;
|
||||
case 15:
|
||||
list_webView.get(currentPage).loadUrl("file:///android_asset/about.htm");
|
||||
newWindow("file:///android_asset/about.htm");
|
||||
break;
|
||||
case 16:
|
||||
unregisterReceiver(receiver);
|
||||
|
@ -1185,7 +1185,7 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
}
|
||||
|
||||
void newWindow(String surl){
|
||||
void newWindow(String surl) {
|
||||
WebView webView = new WebView(MainActivity.this);
|
||||
settingWebView(webView);
|
||||
webView.loadUrl(surl);
|
||||
|
@ -1196,43 +1196,28 @@ public class MainActivity extends Activity {
|
|||
button_page.setText(currentPage + 1 + "");
|
||||
}
|
||||
|
||||
void settingWebView(WebView webView){
|
||||
// 菜单
|
||||
registerForContextMenu(webView);
|
||||
// 支持获取手势焦点
|
||||
webView.requestFocusFromTouch();
|
||||
// 允许调试
|
||||
void settingWebView(WebView webView) {
|
||||
registerForContextMenu(webView); // 注册菜单
|
||||
webView.requestFocusFromTouch(); // 请求触摸焦点
|
||||
if(Build.VERSION.SDK_INT >= 19) {
|
||||
webView.setWebContentsDebuggingEnabled(true);
|
||||
webView.setWebContentsDebuggingEnabled(true); // 允许调试
|
||||
}
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
// 开启JS
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
// 开启JS能打开窗口
|
||||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
// 开启缓存
|
||||
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||
webSettings.setJavaScriptEnabled(true); // 开启JS
|
||||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);// 允许JS打开窗口
|
||||
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);// 开启缓存
|
||||
// 自适应屏幕
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
// 支持缩放
|
||||
webSettings.setSupportZoom(true);
|
||||
// 启用内置缩放控件
|
||||
webSettings.setBuiltInZoomControls(true);
|
||||
// 隐藏缩放控件
|
||||
webSettings.setDisplayZoomControls(false);
|
||||
// 开启访问文件
|
||||
webSettings.setAllowFileAccess(true);
|
||||
// 开启数据库
|
||||
webSettings.setDatabaseEnabled(true);
|
||||
// 开启localStorage
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
// 开启定位
|
||||
webSettings.setGeolocationEnabled(true);
|
||||
// 支持多窗口
|
||||
webSettings.setSupportMultipleWindows(true);
|
||||
// 允许跨域
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||
webSettings.setSupportZoom(true); // 支持缩放
|
||||
webSettings.setBuiltInZoomControls(true);// 启用内置缩放控件
|
||||
webSettings.setDisplayZoomControls(false); // 隐藏缩放控件
|
||||
webSettings.setAllowFileAccess(true);// 开启文件访问
|
||||
webSettings.setDatabaseEnabled(true); // 开启数据库
|
||||
webSettings.setDomStorageEnabled(true); // 开启localStorage
|
||||
webSettings.setGeolocationEnabled(true); // 开启定位
|
||||
webSettings.setSupportMultipleWindows(true); // 支持多窗口
|
||||
webSettings.setAllowUniversalAccessFromFileURLs(true); // 允许跨域
|
||||
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
|
|
|
@ -26,20 +26,21 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
|||
// 启动时显示
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
ETP_homepage.setSummary(SP.getString("homepage","http://www.baidu.com"));
|
||||
ETP_filter.setSummary(SP.getString("filter",""));
|
||||
ETP_highlight.setSummary(SP.getString("highlight",""));
|
||||
ETP_homepage.setSummary(SP.getString("homepage", "http://www.baidu.com"));
|
||||
ETP_filter.setSummary(SP.getString("filter", ""));
|
||||
ETP_highlight.setSummary(SP.getString("highlight", ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
// 修改后显示
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if(key.equals("homepage")){
|
||||
ETP_homepage.setSummary(sharedPreferences.getString(key,""));
|
||||
ETP_homepage.setSummary(sharedPreferences.getString(key, ""));
|
||||
}else if(key.equals("filter")){
|
||||
ETP_filter.setSummary(sharedPreferences.getString(key,""));
|
||||
ETP_filter.setSummary(sharedPreferences.getString(key, ""));
|
||||
}else if(key.equals("highlight")){
|
||||
ETP_highlight.setSummary(sharedPreferences.getString(key,""));
|
||||
ETP_highlight.setSummary(sharedPreferences.getString(key, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -6,44 +6,6 @@
|
|||
android:orientation="vertical"
|
||||
tools:context=".FavoriteActivity" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="收藏夹"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_favback"
|
||||
style="@android:style/Widget.DeviceDefault.Button.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="false"
|
||||
android:layout_centerVertical="false"
|
||||
android:alpha="0.3"
|
||||
android:background="@null"
|
||||
android:onClick="favback"
|
||||
android:text="←"
|
||||
android:textSize="30sp" />
|
||||
|
||||
<Button
|
||||
style="@android:style/Widget.DeviceDefault.Button.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:alpha="0.3"
|
||||
android:background="@null"
|
||||
android:onClick="menuFav"
|
||||
android:text="≡"
|
||||
android:textSize="30sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -124,6 +124,7 @@
|
|||
android:layout_height="100sp"
|
||||
android:layout_centerInParent="true"
|
||||
android:adjustViewBounds="false"
|
||||
android:background="@null"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/play" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue