收藏前修改,收藏后修改,修改值校验
This commit is contained in:
parent
eb05d03808
commit
ec032b205b
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.8">
|
||||
android:versionName="3.10">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="16"
|
||||
|
@ -45,7 +45,6 @@
|
|||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<!-- GPS权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_GPS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
|
||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V3.8</h2>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V3.10</h2>
|
||||
<p>内置扩展的浏览器。</p>
|
||||
<p>扩展:[国产]高亮,广告图片自定义过滤。</p>
|
||||
<p>作者:黄颖</p>
|
||||
|
@ -20,6 +20,8 @@ p { text-indent:2em; }
|
|||
<p><a href="https://www.jianshu.com/p/6e38e1ef203a" target="_blank">Android WebView 三种文件下载方式</a></p>
|
||||
<p><a href="https://blog.csdn.net/lowprofile_coding/article/details/77852131" target="_blank">自动安装apk包</a></p>
|
||||
<h3>更新日志:</h3>
|
||||
<h3>V3.10 (2019-02-10)</h3><ol><li>增加:收藏前修改,收藏后修改,修改校验。</li></ol>
|
||||
<h3>V3.9 (2018-12-20)</h3><ol><li>视频独立播放JS读不到iframe里的video,使用跳转iframe代替。</li></ol>
|
||||
<h3>V3.8 (2018-07-14)</h3><ol><li>增加定位权限。</li></ol>
|
||||
<h3>V3.7 (2018-06-13)</h3><ol><li>增加自动更新。</li></ol>
|
||||
<h3>V3.6 (2018-05-30)</h3><ol><li>修复从收藏夹返回输入法不能自动隐藏的问题。</li></ol>
|
||||
|
|
|
@ -12,7 +12,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
public static final String DATABASE_NAME = MainActivity.dir + File.separator + "webfav.db";
|
||||
private final static int VERSION = 1;
|
||||
String TableName = "webfav";
|
||||
static String TableName = "webfav";
|
||||
private SQLiteDatabase db;
|
||||
private static DBHelper mInstance = null;
|
||||
|
||||
|
@ -39,10 +39,6 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
// onCreate(db);
|
||||
switch (newVersion) {
|
||||
case 6:
|
||||
db.execSQL("alter table battery rename to battery_temp");
|
||||
db.execSQL("CREATE TABLE battery (_id INTEGER PRIMARY KEY ,time TEXT,level INTEGER, voltage INTEGER, current INTEGER , temperature INTEGER, cpu INTEGER)");
|
||||
db.execSQL("insert into battery select *,'' from battery_temp");
|
||||
db.execSQL("drop table battery_temp");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -77,4 +73,4 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
if (db != null)
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
package com.hty.browser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
|
@ -23,11 +27,14 @@ import android.widget.AdapterView;
|
|||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class FavoriteActivity extends Activity {
|
||||
SimpleCursorAdapter adapter;
|
||||
ListView listView;
|
||||
|
@ -66,6 +73,92 @@ public class FavoriteActivity extends Activity {
|
|||
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, c, from, to, 0);
|
||||
listView.setAdapter(adapter);
|
||||
break;
|
||||
case 2:
|
||||
final String sid = ((TextView) menuInfo.targetView.findViewById(R.id.id)).getText().toString();
|
||||
final String stitle = ((TextView) menuInfo.targetView.findViewById(R.id.title)).getText().toString();
|
||||
final String surl = ((TextView) menuInfo.targetView.findViewById(R.id.website)).getText().toString();
|
||||
LinearLayout layout = new LinearLayout(FavoriteActivity.this);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
final EditText ET_title = new EditText(FavoriteActivity.this);
|
||||
ET_title.setHint("标题");
|
||||
ET_title.setText(stitle);
|
||||
layout.addView(ET_title);
|
||||
final EditText ET_url = new EditText(FavoriteActivity.this);
|
||||
ET_title.setHint("网址");
|
||||
ET_url.setText(surl);
|
||||
layout.addView(ET_url);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(FavoriteActivity.this);
|
||||
builder.setIcon(android.R.drawable.btn_star_big_on);
|
||||
builder.setTitle("修改收藏");
|
||||
builder.setView(layout);
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String stitle = ET_title.getText().toString();
|
||||
String surl = ET_url.getText().toString();
|
||||
Field field = null;
|
||||
try {
|
||||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
if (!stitle.equals("") && surl.startsWith("http")) {
|
||||
DBHelper dbHelper = new DBHelper(getApplicationContext());
|
||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("website", surl);
|
||||
values.put("title", stitle);
|
||||
db.update(DBHelper.TableName, values, "_id = " + sid, null);
|
||||
IMM.hideSoftInputFromWindow(ET_title.getWindowToken(), 0);
|
||||
Cursor c = dbHelper.query(editText.getText().toString());
|
||||
String[] from = { "_id", "title", "website" };
|
||||
int[] to = { R.id.id, R.id.title, R.id.website };
|
||||
adapter = new SimpleCursorAdapter(FavoriteActivity.this, R.layout.favorite_row, c, from, to, 0);
|
||||
listView.setAdapter(adapter);
|
||||
try {
|
||||
//关闭
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} else {
|
||||
if (stitle.equals("")){
|
||||
ET_title.setError("标题不能为空!");
|
||||
}
|
||||
if (!surl.startsWith("http")){
|
||||
ET_url.setError("网址错误!");
|
||||
}
|
||||
try {
|
||||
//设置dialog不可关闭
|
||||
field.set(dialog, false);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
IMM.hideSoftInputFromWindow(ET_title.getWindowToken(), 0);
|
||||
Field field = null;
|
||||
try {
|
||||
//通过反射获取dialog中的私有属性mShowing
|
||||
field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");
|
||||
field.setAccessible(true);//设置该属性可以访问
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
try {
|
||||
field.set(dialog, true);
|
||||
dialog.dismiss();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -104,6 +197,7 @@ public class FavoriteActivity extends Activity {
|
|||
menu.setHeaderTitle(title);
|
||||
menu.add(0, 0, 0, "复制链接");
|
||||
menu.add(0, 1, 1, "删除");
|
||||
menu.add(0, 2, 2, "修改");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@
|
|||
<solid android:color="#CBCED6" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 第二条进度条颜色 -->
|
||||
<!-- 第二条进度条 -->
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
|
|
|
@ -34,9 +34,14 @@
|
|||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/border_edittext"
|
||||
android:ems="10"
|
||||
android:hint="搜索"
|
||||
android:inputType="text"/>
|
||||
android:inputType="text"
|
||||
android:padding="3dp"/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listView1"
|
||||
|
|
|
@ -46,11 +46,13 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="输入网址"
|
||||
android:imeOptions="actionGo"
|
||||
android:inputType="textUri"
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ImageButtonGo"
|
||||
|
@ -67,18 +69,26 @@
|
|||
android:src="@android:drawable/ic_menu_sort_by_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1" style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:progressDrawable="@drawable/progressbar_color"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/WebView1"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/WebView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar1"
|
||||
style="@android:style/Widget.Holo.ProgressBar.Horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignTop="@+id/WebView1"
|
||||
android:progressDrawable="@drawable/progressbar_color"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
|
@ -108,10 +118,13 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="查找"
|
||||
android:imeOptions="actionSearch"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true"/>
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/findCount"
|
||||
|
|
BIN
preview.png
BIN
preview.png
Binary file not shown.
Before Width: | Height: | Size: 825 KiB After Width: | Height: | Size: 371 KiB |
Loading…
Reference in New Issue