收藏夹增加导出HTML,CSV、
This commit is contained in:
parent
132cc2f602
commit
271b19a84f
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hty.browser"
|
||||
android:versionCode="4"
|
||||
android:versionName="4.10">
|
||||
android:versionName="4.11">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.10</h2>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.11</h2>
|
||||
<p>内置扩展的浏览器。</p>
|
||||
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
||||
<p>作者:海天鹰</p>
|
||||
|
@ -23,6 +23,7 @@ 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.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>
|
||||
<h3>V4.8 (2019-10-25)</h3><ol><li>协议过滤:去除淘宝跳转,增加ftp。</li><li>修复:退出前未反注册广播。</li></ol>
|
||||
|
|
|
@ -24,6 +24,7 @@ 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;
|
||||
|
@ -33,6 +34,9 @@ import android.widget.SimpleCursorAdapter;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class FavoriteActivity extends Activity {
|
||||
|
@ -42,6 +46,8 @@ public class FavoriteActivity extends Activity {
|
|||
InputMethodManager IMM;
|
||||
ImageButton imageButton_clear;
|
||||
int position = 0;
|
||||
TextView textView_title;
|
||||
Button button_favback;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -49,6 +55,9 @@ 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.setVisibility(View.GONE);
|
||||
|
@ -210,6 +219,8 @@ public class FavoriteActivity extends Activity {
|
|||
void search(String s) {
|
||||
DBHelper helper = new DBHelper(this);
|
||||
Cursor cursor1 = helper.query(s);
|
||||
int count = cursor1.getCount();
|
||||
textView_title.setText("收藏夹" + 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);
|
||||
|
@ -257,4 +268,53 @@ 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();
|
||||
Toast.makeText(FavoriteActivity.this, "写文件 " + MainActivity.dir + File.separator + filename + " 成功", Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception e) {
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -101,12 +101,11 @@ import android.widget.Toast;
|
|||
public class MainActivity extends Activity {
|
||||
Button button_title, button_page;
|
||||
TextView textView_searchCount, textView_filesize;
|
||||
EditText editText1, editText_search, editText_download_path;
|
||||
ImageButton imageButton_go, imageButton_back, imageButton_forward, imageButton_menu, imageButton_searchPrev, imageButton_searchNext, imageButton_searchClose, imageButton_info;
|
||||
EditText editText_url, editText_search, editText_download_path;
|
||||
ImageButton button_back, button_forward, button_menu, button_go, button_search_prev, button_search_next, button_search_close, button_info, button_play;
|
||||
// RelativeLayout RelativeLayout1;
|
||||
LinearLayout LinearLayout1, LinearLayout2;
|
||||
FrameLayout webViewLayout, video, searchBar;
|
||||
ImageView imageView1;
|
||||
InputMethodManager IMM;
|
||||
ProgressBar pgb1;
|
||||
String urlo = "", HTRE = "", ptitle = "", urln = "";
|
||||
|
@ -142,6 +141,7 @@ public class MainActivity extends Activity {
|
|||
webViewLayout = (FrameLayout) findViewById(R.id.webViewLayout);
|
||||
video = (FrameLayout) findViewById(R.id.video);
|
||||
searchBar = (FrameLayout) findViewById(R.id.searchBar);
|
||||
searchBar.setVisibility(View.GONE);
|
||||
pgb1 = (ProgressBar) findViewById(R.id.progressBar1);
|
||||
// if (VERSION.SDK_INT > 18) {
|
||||
// getWindow().addFlags(
|
||||
|
@ -159,39 +159,40 @@ public class MainActivity extends Activity {
|
|||
// // lp.topMargin = 45;
|
||||
// // RelativeLayout1.setLayoutParams(lp);
|
||||
// }
|
||||
imageButton_go = (ImageButton) findViewById(R.id.imageButton_go);
|
||||
imageButton_back = (ImageButton) findViewById(R.id.imageButton_back);
|
||||
imageButton_forward = (ImageButton) findViewById(R.id.imageButton_forward);
|
||||
imageButton_menu = (ImageButton) findViewById(R.id.imageButton_menu);
|
||||
imageView1 = (ImageView) findViewById(R.id.imageView1);
|
||||
button_go = (ImageButton) findViewById(R.id.button_go);
|
||||
button_back = (ImageButton) findViewById(R.id.button_back);
|
||||
button_forward = (ImageButton) findViewById(R.id.button_forward);
|
||||
button_menu = (ImageButton) findViewById(R.id.button_menu);
|
||||
button_play = (ImageButton) findViewById(R.id.button_play);
|
||||
button_play.setVisibility(View.GONE);
|
||||
editText_search = (EditText) findViewById(R.id.editText_search);
|
||||
textView_searchCount = (TextView) findViewById(R.id.textView_searchCount);
|
||||
imageButton_searchPrev = (ImageButton) findViewById(R.id.imageButton_searchPrev);
|
||||
imageButton_searchNext = (ImageButton) findViewById(R.id.imageButton_searchNext);
|
||||
imageButton_searchClose = (ImageButton) findViewById(R.id.imageButton_searchClose);
|
||||
imageButton_info = (ImageButton) findViewById(R.id.imageButton_info);
|
||||
textView_searchCount = (TextView) findViewById(R.id.textView_search_count);
|
||||
button_search_prev = (ImageButton) findViewById(R.id.button_search_prev);
|
||||
button_search_next = (ImageButton) findViewById(R.id.button_search_next);
|
||||
button_search_close = (ImageButton) findViewById(R.id.button_search_close);
|
||||
button_info = (ImageButton) findViewById(R.id.imageButton_info);
|
||||
button_title = (Button) findViewById(R.id.button_title);
|
||||
button_page = (Button) findViewById(R.id.button_page);
|
||||
button_title.setOnClickListener(new ButtonListener());
|
||||
button_page.setOnClickListener(new ButtonListener());
|
||||
imageButton_go.setOnClickListener(new ButtonListener());
|
||||
imageButton_back.setOnClickListener(new ButtonListener());
|
||||
imageButton_forward.setOnClickListener(new ButtonListener());
|
||||
imageButton_menu.setOnClickListener(new ButtonListener());
|
||||
imageView1.setOnClickListener(new ButtonListener());
|
||||
imageButton_searchPrev.setOnClickListener(new ButtonListener());
|
||||
imageButton_searchNext.setOnClickListener(new ButtonListener());
|
||||
imageButton_searchClose.setOnClickListener(new ButtonListener());
|
||||
editText1 = (EditText) findViewById(R.id.EditText1);
|
||||
editText1.setVisibility(View.GONE);
|
||||
button_go.setOnClickListener(new ButtonListener());
|
||||
button_back.setOnClickListener(new ButtonListener());
|
||||
button_forward.setOnClickListener(new ButtonListener());
|
||||
button_menu.setOnClickListener(new ButtonListener());
|
||||
button_play.setOnClickListener(new ButtonListener());
|
||||
button_search_prev.setOnClickListener(new ButtonListener());
|
||||
button_search_next.setOnClickListener(new ButtonListener());
|
||||
button_search_close.setOnClickListener(new ButtonListener());
|
||||
editText_url = (EditText) findViewById(R.id.editText_url);
|
||||
editText_url.setVisibility(View.GONE);
|
||||
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath()); //获取图标数据库路径
|
||||
getDataFromIntent(getIntent());
|
||||
|
||||
editText1.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
editText_url.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_GO) {
|
||||
loadPage(editText1.getText().toString());
|
||||
loadPage(editText_url.getText().toString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -306,7 +307,7 @@ public class MainActivity extends Activity {
|
|||
switch (v.getId()) {
|
||||
case R.id.button_title:
|
||||
button_title.setVisibility(View.GONE);
|
||||
editText1.setVisibility(View.VISIBLE);
|
||||
editText_url.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case R.id.button_page:
|
||||
List<String> list_title = new ArrayList<>();
|
||||
|
@ -327,48 +328,48 @@ public class MainActivity extends Activity {
|
|||
webViewLayout.addView(webView);
|
||||
button_page.setText(which + 1 + "");
|
||||
button_title.setText(webView.getTitle());
|
||||
editText1.setText(webView.getUrl());
|
||||
imageButton_info.setImageBitmap(webView.getFavicon());
|
||||
editText_url.setText(webView.getUrl());
|
||||
button_info.setImageBitmap(webView.getFavicon());
|
||||
currentPage = which;
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
break;
|
||||
case R.id.imageButton_go:
|
||||
case R.id.button_go:
|
||||
//loadPage(editText1.getText().toString());
|
||||
list_webView.get(currentPage).loadUrl(editText1.getText().toString());
|
||||
list_webView.get(currentPage).loadUrl(editText_url.getText().toString());
|
||||
break;
|
||||
case R.id.imageButton_back:
|
||||
case R.id.button_back:
|
||||
if (list_webView.get(currentPage).canGoBack()) {
|
||||
list_webView.get(currentPage).goBack();
|
||||
imageButton_forward.setEnabled(true);
|
||||
button_forward.setEnabled(true);
|
||||
} else {
|
||||
imageButton_back.setEnabled(false);
|
||||
button_back.setEnabled(false);
|
||||
}
|
||||
break;
|
||||
case R.id.imageButton_forward:
|
||||
case R.id.button_forward:
|
||||
if (list_webView.get(currentPage).canGoForward()) {
|
||||
list_webView.get(currentPage).goForward();
|
||||
imageButton_back.setEnabled(true);
|
||||
button_back.setEnabled(true);
|
||||
} else {
|
||||
imageButton_forward.setEnabled(false);
|
||||
button_forward.setEnabled(false);
|
||||
}
|
||||
break;
|
||||
case R.id.imageButton_menu:
|
||||
case R.id.button_menu:
|
||||
MenuDialog();
|
||||
break;
|
||||
case R.id.imageView1:
|
||||
case R.id.button_play:
|
||||
playVideo();
|
||||
imageView1.setVisibility(View.GONE);
|
||||
button_play.setVisibility(View.GONE);
|
||||
break;
|
||||
case R.id.imageButton_searchPrev:
|
||||
case R.id.button_search_prev:
|
||||
list_webView.get(currentPage).findNext(false);
|
||||
break;
|
||||
case R.id.imageButton_searchNext:
|
||||
case R.id.button_search_next:
|
||||
list_webView.get(currentPage).findNext(true);
|
||||
break;
|
||||
case R.id.imageButton_searchClose:
|
||||
case R.id.button_search_close:
|
||||
editText_search.setText("");
|
||||
IMM.hideSoftInputFromWindow(editText_search.getWindowToken(), 0);
|
||||
searchBar.setVisibility(View.GONE);
|
||||
|
@ -450,7 +451,7 @@ public class MainActivity extends Activity {
|
|||
Log.e(Thread.currentThread().getStackTrace()[2] + "", keyCode + ", " + event);
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (isFullScreen) {
|
||||
imageView1.setVisibility(View.GONE);
|
||||
button_play.setVisibility(View.GONE);
|
||||
quitFullScreen();
|
||||
} else {
|
||||
if (list_webView.get(currentPage).canGoBack()) {
|
||||
|
@ -487,7 +488,7 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
// editText1.setText(url);
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", url);
|
||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||
IMM.hideSoftInputFromWindow(editText_url.getWindowToken(), 0);
|
||||
editText_search.setText("");
|
||||
list_webView.get(currentPage).loadUrl(url);
|
||||
// btnBack.setEnabled(true);
|
||||
|
@ -614,7 +615,7 @@ public class MainActivity extends Activity {
|
|||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "onPause");
|
||||
pauseVideo();
|
||||
if (isFullScreen) {
|
||||
imageView1.setVisibility(View.VISIBLE);
|
||||
button_play.setVisibility(View.VISIBLE);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
@ -634,11 +635,11 @@ public class MainActivity extends Activity {
|
|||
list_webView.get(currentPage).loadUrl(js);
|
||||
}
|
||||
|
||||
void MenuDialog() {
|
||||
private void MenuDialog() {
|
||||
String[] items = { "新建窗口", "关闭当前窗口", "收藏当前页", "收藏夹", "查找", "分享", "视频独立播放", "视频截图", "视频在播放器中打开", "查看源码", "主页", "全屏", "广告过滤规则", "设置", "检查更新", "关于", "退出", "清除缓存" };
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("菜单");
|
||||
builder.setIcon(R.drawable.ic_launcher);
|
||||
builder.setIcon(android.R.drawable.ic_menu_preferences);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
@ -659,8 +660,8 @@ public class MainActivity extends Activity {
|
|||
WebView webView = list_webView.get(currentPage);
|
||||
webViewLayout.addView(webView);
|
||||
button_title.setText(webView.getTitle());
|
||||
editText1.setText(webView.getUrl());
|
||||
imageButton_info.setImageBitmap(webView.getFavicon());
|
||||
editText_url.setText(webView.getUrl());
|
||||
button_info.setImageBitmap(webView.getFavicon());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -937,8 +938,8 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
}
|
||||
String content="";
|
||||
for(int i=0;i<rulelist.size();i++){
|
||||
content += rulelist.get(i)+"\n";
|
||||
for(int i=0; i<rulelist.size(); i++){
|
||||
content += rulelist.get(i) + "\n";
|
||||
}
|
||||
FileOutputStream outStream = null;
|
||||
try {
|
||||
|
@ -1064,7 +1065,7 @@ public class MainActivity extends Activity {
|
|||
|
||||
void ADBlock(){
|
||||
String s = ReadFile("blockrules");
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + s);
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + s);
|
||||
if(!"".equals(s)) {
|
||||
String rules = s.replace("\n", ",");
|
||||
if (rules.endsWith(",")) {
|
||||
|
@ -1256,13 +1257,13 @@ public class MainActivity extends Activity {
|
|||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", url);
|
||||
button_title.setText(url);
|
||||
button_title.setVisibility(View.VISIBLE);
|
||||
editText1.setText(url);
|
||||
editText1.setVisibility(View.GONE);
|
||||
editText_url.setText(url);
|
||||
editText_url.setVisibility(View.GONE);
|
||||
urln = url;
|
||||
imageButton_back.setEnabled(true);
|
||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||
button_back.setEnabled(true);
|
||||
IMM.hideSoftInputFromWindow(editText_url.getWindowToken(), 0);
|
||||
pgb1.setVisibility(View.VISIBLE);
|
||||
imageButton_info.setImageResource(android.R.drawable.ic_menu_info_details);
|
||||
button_info.setImageResource(android.R.drawable.ic_menu_info_details);
|
||||
// if(favicon != null) {
|
||||
// imageButton_info.setImageBitmap(favicon);
|
||||
// }
|
||||
|
@ -1283,7 +1284,7 @@ public class MainActivity extends Activity {
|
|||
case WebViewClient.ERROR_HOST_LOOKUP: // 找不到主机,跳转百度搜索
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", failingUrl);
|
||||
String url = "http://m.baidu.com/s?word=" + urlo;
|
||||
editText1.setText(url);
|
||||
editText_url.setText(url);
|
||||
view.loadUrl(url);
|
||||
urln = url;
|
||||
break;
|
||||
|
@ -1318,8 +1319,8 @@ public class MainActivity extends Activity {
|
|||
public boolean onTouch(View v, MotionEvent event) {
|
||||
button_title.requestFocus();
|
||||
button_title.setVisibility(View.VISIBLE);
|
||||
editText1.setVisibility(View.GONE);
|
||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||
editText_url.setVisibility(View.GONE);
|
||||
IMM.hideSoftInputFromWindow(editText_url.getWindowToken(), 0);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
@ -1361,18 +1362,18 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
}
|
||||
// 链接关键字屏蔽
|
||||
if(sharedPreferences.getBoolean("switch_filter",false)){
|
||||
String sf = sharedPreferences.getString("filter","");
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + sf);
|
||||
if(sharedPreferences.getBoolean("switch_filter", false)){
|
||||
String sf = sharedPreferences.getString("filter", "");
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + sf);
|
||||
if(!sf.equals("")) {
|
||||
String js = "javascript:var s='"+sf+"';var sl=s.split(';');var a=document.getElementsByTagName('a');for(var i=0;i<a.length;i++){for(var j=0;j<sl.length;j++){if(a[i].textContent.indexOf(sl[j])!=-1){a[i].textContent='';}}}";
|
||||
view.loadUrl(js);
|
||||
}
|
||||
}
|
||||
// 链接关键字高亮
|
||||
if(sharedPreferences.getBoolean("switch_highlight",false)){
|
||||
String shl = sharedPreferences.getString("highlight","");
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + shl);
|
||||
if(sharedPreferences.getBoolean("switch_highlight", false)){
|
||||
String shl = sharedPreferences.getString("highlight", "");
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + shl);
|
||||
if(!shl.equals("")) {
|
||||
String js = "javascript:var s='"+shl+"';var sl=s.split(';');var a=document.getElementsByTagName('a');for(var i=0;i<a.length;i++){for(var j=0;j<sl.length;j++){if(a[i].textContent.indexOf(sl[j])!=-1){a[i].style.color='white';a[i].style.backgroundColor='#DA3434';}}}";
|
||||
view.loadUrl(js);
|
||||
|
@ -1395,7 +1396,7 @@ public class MainActivity extends Activity {
|
|||
|
||||
// 接收网站图标(favicon)
|
||||
public void onReceivedIcon(WebView view, Bitmap icon) {
|
||||
imageButton_info.setImageBitmap(icon);
|
||||
button_info.setImageBitmap(icon);
|
||||
}
|
||||
|
||||
// 播放网络视频时全屏会被调用的方法
|
||||
|
@ -1455,7 +1456,7 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
|
||||
void getDataFromIntent(Intent intent) {
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", "intent(" + intent + ")");
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "intent(" + intent + ")");
|
||||
if (intent.getAction().equals(Intent.ACTION_VIEW)) {
|
||||
urln = intent.getDataString();
|
||||
newWindow(urln);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?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"
|
||||
|
@ -10,24 +9,38 @@
|
|||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="收藏夹"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:clickable="true"
|
||||
android:onClick="favback"
|
||||
android:text=" × "
|
||||
android:textSize="30sp" />
|
||||
|
||||
<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>
|
||||
|
||||
|
@ -61,7 +74,7 @@
|
|||
android:background="#ffffff"
|
||||
android:paddingLeft="-15dp"
|
||||
android:paddingRight="-15dp"
|
||||
android:src="@android:drawable/ic_notification_clear_all"/>
|
||||
android:src="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
tools:context="com.hty.browser.MainActivity" >
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/video"
|
||||
|
@ -29,18 +27,18 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_back"
|
||||
android:id="@+id/button_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_rew"/>
|
||||
android:src="@android:drawable/ic_media_rew" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_forward"
|
||||
android:id="@+id/button_forward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_ff"/>
|
||||
android:src="@android:drawable/ic_media_ff" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_page"
|
||||
|
@ -66,10 +64,10 @@
|
|||
android:layout_weight="1"
|
||||
android:background="#ffffff"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"/>
|
||||
android:singleLine="true" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/EditText1"
|
||||
android:id="@+id/editText_url"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
@ -82,18 +80,18 @@
|
|||
android:textSize="20sp"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_go"
|
||||
android:id="@+id/button_go"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_play"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_menu"
|
||||
android:id="@+id/button_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_menu_sort_by_size"/>
|
||||
android:src="@android:drawable/ic_menu_sort_by_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -120,14 +118,14 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView1"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/play"
|
||||
android:visibility="gone" />
|
||||
<ImageButton
|
||||
android:id="@+id/button_play"
|
||||
android:layout_width="100sp"
|
||||
android:layout_height="100sp"
|
||||
android:layout_centerInParent="true"
|
||||
android:adjustViewBounds="false"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/play" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/searchBar"
|
||||
|
@ -135,7 +133,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/LinearLayout1"
|
||||
android:background="@drawable/border"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -153,34 +151,34 @@
|
|||
android:inputType="textUri"
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="20sp"/>
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_searchCount"
|
||||
android:id="@+id/textView_search_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0/0"/>
|
||||
android:text="0/0" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_searchPrev"
|
||||
android:id="@+id/button_search_prev"
|
||||
android:layout_width="30sp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/arrow_up_float" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button_search_next"
|
||||
android:layout_width="30sp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/arrow_down_float" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/button_search_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_rew"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_searchNext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_ff"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton_searchClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_menu_close_clear_cancel"/>
|
||||
android:src="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
|
Loading…
Reference in New Issue