auto update test
This commit is contained in:
parent
741eae4060
commit
3c879ba318
|
@ -1,4 +1,4 @@
|
|||
# Android:海天鹰浏览器
|
||||
基于 Android WebView 组件的浏览器,支持收藏夹、图片广告过滤。
|
||||
基于 Android WebView 组件的浏览器,支持收藏夹、图片广告过滤、视频独立播放。
|
||||
### 主界面
|
||||

|
BIN
app-debug.apk
BIN
app-debug.apk
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hty.browser"
|
||||
android:versionCode="3"
|
||||
android:versionName="3.4">
|
||||
android:versionName="3.5">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
|
|
|
@ -5,17 +5,19 @@
|
|||
<title>海天鹰浏览器</title>
|
||||
<style>
|
||||
body{}
|
||||
p{text-indent:2em;}
|
||||
p { text-indent:2em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V3.4</h2>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V3.6</h2>
|
||||
<p>内置扩展的浏览器。</p>
|
||||
<p>扩展:[查看图片]文字链接转图片,广告图片自定义过滤。</p>
|
||||
<p>扩展:[国产]高亮,广告图片自定义过滤。</p>
|
||||
<p>作者:黄颖</p>
|
||||
<p>E-mail:sonichy@163.com</p>
|
||||
<p>QQ:84429027</p>
|
||||
<h3>更新日志:</h3>
|
||||
<h3>V3.6 (2018-05-30)</h3><ol><li>修复从收藏夹返回输入法不能自动隐藏的问题。</li></ol>
|
||||
<h3>V3.5 (2018-04-25)</h3><ol><li>收藏夹支持搜索。</li></ol>
|
||||
<h3>V3.4 (2018-03-13)</h3><ol><li>增加视频独立播放。</li><li>使用系统下载取代浏览器跳转下载、图片下载,并增加链接下载</li></ol>
|
||||
<h3>V3.3 (2018-01)</h3><ol><li>增加分享菜单。</li><li>增加:视频全屏禁用屏幕休眠。</li><li>解决网页跳转APP协议问题。</li></ol>
|
||||
<h3>V3.2 (2017-12-17)</h3><ol><li>修复:关闭查找框,高亮不消失的问题。</li><li>增加过滤iframe。</li><li>修复:EditTextPreference没有设置defaultValue,引起第一次运行点击主页菜单崩溃。</li></ol>
|
||||
|
|
|
@ -53,14 +53,14 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
db.close();
|
||||
}
|
||||
|
||||
public Cursor query(String url) {
|
||||
public Cursor query(String s) {
|
||||
db = getWritableDatabase();
|
||||
Cursor c = null;
|
||||
if (url.equalsIgnoreCase("")) {
|
||||
if (s.equals("")) {
|
||||
c = db.query(TableName, null, null, null, null, null, "_id desc");
|
||||
} else {
|
||||
c = db.query(TableName, null, "website=?", new String[] { url }, null, null, "_id desc");
|
||||
}
|
||||
c = db.query(TableName, null, "website LIKE '%" + s + "%' or title LIKE '%" + s + "%'", null, null, null, "_id desc");
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,19 +3,26 @@ package com.hty.browser;
|
|||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnCreateContextMenuListener;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
|
@ -24,42 +31,19 @@ import android.widget.Toast;
|
|||
public class FavoriteActivity extends Activity {
|
||||
SimpleCursorAdapter adapter;
|
||||
ListView listView;
|
||||
EditText editText;
|
||||
InputMethodManager IMM;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_favorite);
|
||||
DBHelper helper = new DBHelper(this);
|
||||
Cursor c = helper.query("");
|
||||
String[] from = { "_id", "title", "website" };
|
||||
int[] to = { R.id.id, R.id.title, R.id.website };
|
||||
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, c, from, to, 0);
|
||||
listView = (ListView) this.findViewById(R.id.listView1);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setDivider(new ColorDrawable(Color.GREEN));
|
||||
listView.setDividerHeight(2);
|
||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
|
||||
String url = ((TextView) arg1.findViewById(R.id.website)).getText().toString();
|
||||
Intent intent = new Intent(FavoriteActivity.this, MainActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
|
||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||
String title = ((TextView) info.targetView.findViewById(R.id.title)).getText().toString();
|
||||
menu.setHeaderTitle(title);
|
||||
menu.add(0, 0, 0, "复制链接");
|
||||
menu.add(0, 1, 1, "删除");
|
||||
}
|
||||
});
|
||||
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
editText = (EditText) findViewById(R.id.editText);
|
||||
editText.addTextChangedListener(new EditChangedListener());
|
||||
listView = (ListView) findViewById(R.id.listView1);
|
||||
search(editText.getText().toString());
|
||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,11 +57,10 @@ public class FavoriteActivity extends Activity {
|
|||
Toast.makeText(getApplicationContext(), "链接已复制", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 1:
|
||||
int id = Integer.parseInt(((TextView) menuInfo.targetView.findViewById(R.id.id)).getText()
|
||||
.toString());
|
||||
int id = Integer.parseInt(((TextView) menuInfo.targetView.findViewById(R.id.id)).getText().toString());
|
||||
DBHelper helper = new DBHelper(getApplicationContext());
|
||||
helper.del(id);
|
||||
Cursor c = helper.query("");
|
||||
Cursor c = helper.query(editText.getText().toString());
|
||||
String[] from = { "_id", "title", "website" };
|
||||
int[] to = { R.id.id, R.id.title, R.id.website };
|
||||
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, c, from, to, 0);
|
||||
|
@ -88,6 +71,59 @@ public class FavoriteActivity extends Activity {
|
|||
}
|
||||
|
||||
public void favback(View v) {
|
||||
IMM.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
finish();
|
||||
}
|
||||
|
||||
void search(String s) {
|
||||
DBHelper helper = new DBHelper(this);
|
||||
Cursor c = helper.query(s);
|
||||
String[] from = { "_id", "title", "website" };
|
||||
int[] to = { R.id.id, R.id.title, R.id.website };
|
||||
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, c, from, to, 0);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setDivider(new ColorDrawable(Color.GREEN));
|
||||
listView.setDividerHeight(2);
|
||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
|
||||
String url = ((TextView) arg1.findViewById(R.id.website)).getText().toString();
|
||||
Intent intent = new Intent(FavoriteActivity.this, MainActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
setResult(RESULT_OK, intent);
|
||||
IMM.hideSoftInputFromWindow(editText.getWindowToken(), 0);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
|
||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||
String title = ((TextView) info.targetView.findViewById(R.id.title)).getText().toString();
|
||||
menu.setHeaderTitle(title);
|
||||
menu.add(0, 0, 0, "复制链接");
|
||||
menu.add(0, 1, 1, "删除");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class EditChangedListener implements TextWatcher {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
search(s.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ import android.webkit.WebView;
|
|||
import android.webkit.WebView.FindListener;
|
||||
import android.webkit.WebView.HitTestResult;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -96,7 +95,7 @@ public class MainActivity extends Activity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
String path = Environment.getExternalStorageDirectory().getPath() + File.separator + "HTYBrowser";
|
||||
dir = new File(path);
|
||||
if (!dir.exists()) {
|
||||
|
@ -106,7 +105,7 @@ public class MainActivity extends Activity {
|
|||
//ptitle = "百度";
|
||||
//urln = "http//www.baidu.com";
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1);
|
||||
LinearLayout2 = (LinearLayout) findViewById(R.id.LinearLayout2);
|
||||
// RelativeLayout1 = (RelativeLayout)
|
||||
|
@ -194,14 +193,15 @@ public class MainActivity extends Activity {
|
|||
editText1.setText(url);
|
||||
urln = url;
|
||||
btnBack.setEnabled(true);
|
||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
String js = "";
|
||||
// link2img,宽度适应浏览器
|
||||
js = "javascript:var obj=document.getElementsByTagName('a');var aimg=new Array();var dw=document.documentElement.clientWidth-10;var dh=document.documentElement.clientHeight;for(var i=0;i<obj.length;i++){if(obj[i].innerText.indexOf('查看图片')!=-1){var img=new Image();img.src=obj[i].href;aimg[i]=img;obj[i].textContent='';obj[i].appendChild(img);(function(i){aimg[i].onload=function(){var iw=this.offsetWidth;var ih=this.offsetHeight;var bl=0;if(iw>dw){var text='';bl=(dw/iw).toFixed(2);this.style.width=dw+'px';this.style.height=dw*ih/iw+'px';text=' '+i+': W:'+dw+'/'+iw+'='+bl;this.style.border='1px solid blue';var span=document.createElement('span');span.textContent=text;span.setAttribute('style','white-space:nowrap;');this.parentNode.appendChild(span);}}})(i);}}";
|
||||
// 关键字链接高亮
|
||||
js = "javascript:var a=document.getElementsByTagName('a');for(var i=0;i<a.length;i++){if(a[i].textContent.indexOf('国产')!=-1){a[i].style.color='white';a[i].style.backgroundColor='#DA3434';}}";
|
||||
view.loadUrl(js);
|
||||
}
|
||||
|
||||
|
@ -288,12 +288,12 @@ public class MainActivity extends Activity {
|
|||
if(sharedPreferences.getBoolean("switch_adBlock",true)){
|
||||
ADBlock();
|
||||
}
|
||||
if(sharedPreferences.getBoolean("switch_iframeBlock",false)) {
|
||||
//Log.e("line292", "progress:" + newProgress);
|
||||
//if (!webView1.getUrl().contains("baidu.com")){
|
||||
iframeBlock();
|
||||
//}
|
||||
}
|
||||
if(sharedPreferences.getBoolean("switch_iframeBlock",false)) {
|
||||
//Log.e("line292", "progress:" + newProgress);
|
||||
if (!view.getUrl().contains("baidu.com")){
|
||||
iframeBlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取网页标题
|
||||
|
|
|
@ -29,7 +29,15 @@
|
|||
android:textSize="30sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="搜索"
|
||||
android:inputType="text"/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listView1"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -19,26 +19,27 @@
|
|||
android:background="#ffffff"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/LinearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal" >
|
||||
<LinearLayout
|
||||
android:id="@+id/LinearLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/border"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonBack"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_rew" />
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonBack"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_rew"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonForward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_ff" />
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonForward"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_ff"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/EditText1"
|
||||
|
@ -51,21 +52,21 @@
|
|||
android:singleLine="true"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonGo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_play" />
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonGo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_media_play"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonMenu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_menu_sort_by_size" />
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonMenu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:src="@android:drawable/ic_menu_sort_by_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1" style="?android:attr/progressBarStyleHorizontal"
|
||||
|
@ -94,7 +95,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/LinearLayout1"
|
||||
android:background="#ffffff"
|
||||
android:background="@drawable/border"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -110,34 +111,34 @@
|
|||
android:hint="查找"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true" />
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/findCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0/0" />
|
||||
android:text="0/0"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/findPrev"
|
||||
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/findNext"
|
||||
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"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/findClose"
|
||||
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