diff --git a/app.apk b/app.apk
index 48f60c8..05c32db 100644
Binary files a/app.apk and b/app.apk differ
diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml
index 0c20d15..7414c78 100644
--- a/main/AndroidManifest.xml
+++ b/main/AndroidManifest.xml
@@ -1,8 +1,23 @@
+ package="com.hty.browser"
+ android:versionCode="4"
+ android:versionName="4.30">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:label="@string/app_name"
+ android:launchMode="singleInstance"
+ android:theme="@android:style/Theme.Holo.Light.NoActionBar">
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+ android:parentActivityName=".MainActivity" />
+
+ android:parentActivityName=".MainActivity" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/main/assets/about.htm b/main/assets/about.htm
index aae1037..8be4e15 100644
--- a/main/assets/about.htm
+++ b/main/assets/about.htm
@@ -9,7 +9,7 @@ p { text-indent:2em; }
-
海天鹰浏览器 V4.29
+
海天鹰浏览器 V4.30
内置扩展的浏览器。
扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。
作者:海天鹰
@@ -23,6 +23,7 @@ p { text-indent:2em; }
获取网页图标
字符串转Bitmap
更新日志:
+V4.30 (2023-03-23)
- 收藏夹测试 ExpandableListView 控件
V4.29 (2023-03-01)
- 收藏夹增加分类。
- 收藏夹分类的修改和删除。
- 修改导出HTML和CSV方法。
- 新建收藏和修改收藏编辑框设置最大行数,避免窗口撑大不完整。
V4.28 (2022-11-07)
- 资源探查脚本支持返回多个对象。
分类标题增加数量。
使用 <details> 代替 <div>,分类可折叠。
V4.27 (2022-10-22)
- 修改收藏夹数据库目录。
- 收藏夹增加分享数据库功能。
diff --git a/main/java/com/hty/browser/DBHelper.java b/main/java/com/hty/browser/DBHelper.java
index 4bbed35..fc9daf5 100644
--- a/main/java/com/hty/browser/DBHelper.java
+++ b/main/java/com/hty/browser/DBHelper.java
@@ -11,7 +11,7 @@ import android.database.sqlite.SQLiteOpenHelper;
public class DBHelper extends SQLiteOpenHelper {
public static final String filename = "webfav.db";
public static final String DATABASE_NAME = MainActivity.dir + File.separator + filename;
- private final static int VERSION = 3;
+ private final static int VERSION = 4;
static String TableName = "webfav";
private SQLiteDatabase db;
private static DBHelper mInstance = null;
@@ -32,23 +32,32 @@ public class DBHelper extends SQLiteOpenHelper {
this.db = db;
db.execSQL("CREATE TABLE webfav (_id INTEGER PRIMARY KEY , website TEXT, title TEXT, category TEXT)");
db.execSQL("CREATE TABLE category (_id INTEGER PRIMARY KEY , category TEXT)");
+ ContentValues values = new ContentValues();
+ values.put("category", "");
+ db.insert("category", null, values);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
switch (newVersion) {
- case 3:
- db.execSQL("CREATE TABLE category (_id INTEGER PRIMARY KEY , category TEXT)");
- String sql = "ALTER TABLE " + TableName + " ADD COLUMN category TEXT default ''";
- db.execSQL(sql);
- break;
+ case 3:
+ db.execSQL("CREATE TABLE category (_id INTEGER PRIMARY KEY , category TEXT)");
+ String sql = "ALTER TABLE " + TableName + " ADD COLUMN category TEXT default ''";
+ db.execSQL(sql);
+ break;
+ case 4:
+ ContentValues values = new ContentValues();
+ values.put("category", "");
+ db.insert("category", null, values);
+ break;
}
}
- public void insert(String tableName, ContentValues values) {
+ public long insert(String tableName, ContentValues values) {
db = getWritableDatabase();
- db.insert(tableName, null, values);
+ long i = db.insert(tableName, null, values);
db.close();
+ return i;
}
public Cursor query(String s) {
@@ -62,34 +71,29 @@ public class DBHelper extends SQLiteOpenHelper {
return c;
}
- public Cursor queryCategoty(String s) {
+ public Cursor queryCategory(String s) {
db = getWritableDatabase();
- Cursor c;
- if (s.equals("无分类")) {
- c = db.query(TableName, null, "category = ''", null, null, null, "_id desc");
- } else {
- c = db.query(TableName, null, "category = '" + s + "'", null, null, null, "_id desc");
- }
+ Cursor c = db.query(TableName, null, "category = '" + s + "'", null, null, null, "_id desc");
+ return c;
+ }
+
+ public Cursor category() {
+ db = getWritableDatabase();
+ Cursor c = db.query("category", null, null, null, null, null, "category asc");
return c;
}
public Cursor category(String s) {
db = getWritableDatabase();
- Cursor c;
- if (s.equals("")) {
- c = db.query("category", null, null, null, null, null, "category asc");
- } else {
- c = db.query("category", null, "category = '" + s + "'", null, null, null, null);
- }
+ Cursor c = db.query("category", null, "category = '" + s + "'", null, null, null, null);
return c;
}
- public void del(int id) {
+ public int del(int id) {
if (db == null)
db = getWritableDatabase();
- db.delete(TableName, "_id=?", new String[] { String.valueOf(id) });
- // Log.e("id", id + "");
- // db.ExecuteNonQuery(CommandType.Text, "VACUUM");
+ int i = db.delete(TableName, "_id=?", new String[] { String.valueOf(id) });
+ return i;
}
@Override
diff --git a/main/java/com/hty/browser/FavoriteActivity.java b/main/java/com/hty/browser/FavoriteActivity.java
index fc2d855..defeed8 100644
--- a/main/java/com/hty/browser/FavoriteActivity.java
+++ b/main/java/com/hty/browser/FavoriteActivity.java
@@ -159,7 +159,7 @@ public class FavoriteActivity extends Activity {
if (radioButton == null)
break;
final String title = radioButton.getText().toString();
- if (title.equals("无分类"))
+ if (title.equals(""))
break;
builder.setTitle(title);
final EditText editText_rename = new EditText(FavoriteActivity.this);
@@ -291,9 +291,8 @@ public class FavoriteActivity extends Activity {
layout.addView(editText_url);
final Spinner spinner = new Spinner(this);
ArrayList list = new ArrayList<>();
- list.add("");
DBHelper helper = new DBHelper(this);
- Cursor cursor = helper.category("");
+ Cursor cursor = helper.category();
if (cursor != null) {
while (cursor.moveToNext()) {
String s = cursor.getString(cursor.getColumnIndex("category"));
@@ -327,19 +326,21 @@ public class FavoriteActivity extends Activity {
values.put("website", surl);
values.put("title", stitle);
values.put("category", spinner.getSelectedItem().toString());
- db.update(DBHelper.TableName, values, "_id = " + sid, null);
- IMM.hideSoftInputFromWindow(editText_title.getWindowToken(), 0);
- RadioButton radioButton = (RadioButton) findViewById(radioGroup.getCheckedRadioButtonId());
- if (radioButton == null)
- search(0, editText.getText().toString());
- else
- search(1, radioButton.getText().toString());
- try {
- //关闭
- field.set(dialog, true);
- dialog.dismiss();
- } catch (Exception ex) {
- }
+ int i = db.update(DBHelper.TableName, values, "_id = " + sid, null);
+ if (i != -1) {
+ IMM.hideSoftInputFromWindow(editText_title.getWindowToken(), 0);
+ RadioButton radioButton = (RadioButton) findViewById(radioGroup.getCheckedRadioButtonId());
+ if (radioButton == null)
+ search(0, editText.getText().toString());
+ else
+ search(1, radioButton.getText().toString());
+ try { //关闭
+ field.set(dialog, true);
+ dialog.dismiss();
+ } catch (Exception ex) {
+ }
+ } else
+ Toast.makeText(getApplicationContext(), "修改失败", Toast.LENGTH_SHORT).show();
} else {
if (stitle.equals("")){
editText_title.setError("标题不能为空!");
@@ -380,8 +381,11 @@ public class FavoriteActivity extends Activity {
position = listView.getFirstVisiblePosition();
int id = Integer.parseInt(((TextView) menuInfo.targetView.findViewById(R.id.id)).getText().toString());
helper = new DBHelper(getApplicationContext());
- helper.del(id);
- search(0, editText.getText().toString());
+ int i = helper.del(id);
+ if (i != -1)
+ search(0, editText.getText().toString());
+ else
+ Toast.makeText(getApplicationContext(), "删除失败", Toast.LENGTH_SHORT).show();
break;
}
return true;
@@ -414,7 +418,7 @@ public class FavoriteActivity extends Activity {
if (type == 0) {
cursor1 = helper.query(s);
} else if (type == 1) {
- cursor1 = helper.queryCategoty(s);
+ cursor1 = helper.queryCategory(s);
}
int count = cursor1.getCount();
setTitle("收藏夹 - " + s + " " + count);
@@ -449,15 +453,11 @@ public class FavoriteActivity extends Activity {
IMM.hideSoftInputFromWindow(editText.getWindowToken(), 0);
radioGroup.removeAllViews();
DBHelper helper = new DBHelper(this);
- Cursor cursor = helper.category("");
+ Cursor cursor = helper.category();
if (cursor != null) {
- RadioButton radioButton = new RadioButton(this);
- radioButton.setText("无分类");
- radioButton.setOnClickListener(new RadioButtonOnClickListener());
- radioGroup.addView(radioButton);
while (cursor.moveToNext()) {
String s = cursor.getString(cursor.getColumnIndex("category"));
- radioButton = new RadioButton(this);
+ RadioButton radioButton = new RadioButton(this);
radioButton.setText(s);
radioButton.setOnClickListener(new RadioButtonOnClickListener());
radioGroup.addView(radioButton);
@@ -496,7 +496,7 @@ public class FavoriteActivity extends Activity {
}
BW.write(s);
BW.flush();
- Toast.makeText(FavoriteActivity.this, "写文件 " + MainActivity.dir + File.separator + filename + " 成功", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getApplicationContext(), "写文件 " + MainActivity.dir + File.separator + filename + " 成功", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(Thread.currentThread().getStackTrace()[2] + "", e.toString());
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
diff --git a/main/java/com/hty/browser/MainActivity.java b/main/java/com/hty/browser/MainActivity.java
index 1413fe7..61224d4 100644
--- a/main/java/com/hty/browser/MainActivity.java
+++ b/main/java/com/hty/browser/MainActivity.java
@@ -673,7 +673,7 @@ public class MainActivity extends Activity {
}
private void MenuDialog() {
- String[] items = { "新建窗口", "关闭当前窗口", "收藏当前页", "收藏夹", "查找", "分享", "网页信息", "视频独立播放", "视频截图", "视频在播放器中打开", "资源探查", "查看源码", "保存", "全屏", "广告过滤规则", "清除当前页面缓存", "设置", "检查更新", "关于", "退出" };
+ String[] items = { "新建窗口", "关闭当前窗口", "收藏当前页", "收藏夹", "查找", "分享", "网页信息", "视频独立播放", "视频截图", "视频在播放器中打开", "资源探查", "查看源码", "保存", "全屏", "广告过滤规则", "清除当前页面缓存", "设置", "检查更新", "关于", "退出", "ExpandableListView" };
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("菜单");
//builder.setIcon(android.R.drawable.ic_menu_preferences);
@@ -719,7 +719,7 @@ public class MainActivity extends Activity {
ArrayList list = new ArrayList<>();
list.add("");
DBHelper helper = new DBHelper(MainActivity.this);
- Cursor cursor = helper.category("");
+ Cursor cursor = helper.category();
if (cursor != null) {
while (cursor.moveToNext()) {
String s = cursor.getString(cursor.getColumnIndex("category"));
@@ -959,6 +959,10 @@ public class MainActivity extends Activity {
unregisterReceiver(receiver);
MainActivity.this.finish();
break;
+ case 20:
+ intent = new Intent(MainActivity.this, FavoriteActivity1.class);
+ startActivityForResult(intent, 0);
+ break;
}
}
});
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index aba79e7..b1396a4 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -1,5 +1,4 @@
-
-
- 海天鹰浏览器
- Settings
-
+
+
+ 海天鹰浏览器
+