收藏夹删除时记录位置,不需要从头再来
This commit is contained in:
parent
415b896d50
commit
505ec52f41
|
@ -2,7 +2,7 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.hty.browser"
|
package="com.hty.browser"
|
||||||
android:versionCode="4"
|
android:versionCode="4"
|
||||||
android:versionName="4.2">
|
android:versionName="4.3">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.2</h2>
|
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.3</h2>
|
||||||
<p>内置扩展的浏览器。</p>
|
<p>内置扩展的浏览器。</p>
|
||||||
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
||||||
<p>作者:黄颖</p>
|
<p>作者:黄颖</p>
|
||||||
|
@ -22,6 +22,7 @@ p { text-indent:2em; }
|
||||||
<p><a href="https://blog.csdn.net/lowprofile_coding/article/details/77852131" target="_blank">自动安装apk包</a></p>
|
<p><a href="https://blog.csdn.net/lowprofile_coding/article/details/77852131" target="_blank">自动安装apk包</a></p>
|
||||||
<p><a href="https://stackoverflow.com/questions/3462582/display-the-android-webviews-favicon" target="_blank">获取网页图标</a></p>
|
<p><a href="https://stackoverflow.com/questions/3462582/display-the-android-webviews-favicon" target="_blank">获取网页图标</a></p>
|
||||||
<h3>更新日志:</h3>
|
<h3>更新日志:</h3>
|
||||||
|
<h3>V4.3 (2019-04-11)</h3><ol><li>收藏夹删除收藏时记住位置。</li></ol>
|
||||||
<h3>V4.2 (2019-03-29)</h3><ol><li>下载弹出确认窗口,避免自动下载。</li></ol>
|
<h3>V4.2 (2019-03-29)</h3><ol><li>下载弹出确认窗口,避免自动下载。</li></ol>
|
||||||
<h3>V4.1 (2019-03-05)</h3><ol><li>链接的 target=_blank 在新窗口中打开。</li><li>淘宝协议自动跳转淘宝APP。</li></ol>
|
<h3>V4.1 (2019-03-05)</h3><ol><li>链接的 target=_blank 在新窗口中打开。</li><li>淘宝协议自动跳转淘宝APP。</li></ol>
|
||||||
<h3>V4.0 (2019-03-02)</h3><ol><li>实现多窗口。</li></ol>
|
<h3>V4.0 (2019-03-02)</h3><ol><li>实现多窗口。</li></ol>
|
||||||
|
@ -61,4 +62,4 @@ p { text-indent:2em; }
|
||||||
<h3>V1.1 (2016-01-22)</h3><ol><li>增加支持网页input.file转安卓文件选择器。</li><li>点击加载按钮隐藏输入法。</li><li>增加支持使用内部浏览器下载文件。</li></ol>
|
<h3>V1.1 (2016-01-22)</h3><ol><li>增加支持网页input.file转安卓文件选择器。</li><li>点击加载按钮隐藏输入法。</li><li>增加支持使用内部浏览器下载文件。</li></ol>
|
||||||
<h3>V1.0 (2016-01-21)</h3><ol><li>实现基本的浏览器界面。</li><li>实现第一个扩展[链接转图片]。</li><li>网页JS.alert转安卓Toast。</li></ol>
|
<h3>V1.0 (2016-01-21)</h3><ol><li>实现基本的浏览器界面。</li><li>实现第一个扩展[链接转图片]。</li><li>网页JS.alert转安卓Toast。</li></ol>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -13,6 +13,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -40,20 +41,43 @@ public class FavoriteActivity extends Activity {
|
||||||
EditText editText;
|
EditText editText;
|
||||||
InputMethodManager IMM;
|
InputMethodManager IMM;
|
||||||
ImageButton imageButton_clear;
|
ImageButton imageButton_clear;
|
||||||
|
int position=0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_favorite);
|
setContentView(R.layout.activity_favorite);
|
||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||||
editText = (EditText) findViewById(R.id.editText);
|
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
editText.addTextChangedListener(new EditChangedListener());
|
|
||||||
listView = (ListView) findViewById(R.id.listView1);
|
|
||||||
imageButton_clear = (ImageButton) findViewById(R.id.imageButton_clear);
|
imageButton_clear = (ImageButton) findViewById(R.id.imageButton_clear);
|
||||||
imageButton_clear.setOnClickListener(new ButtonListener());
|
imageButton_clear.setOnClickListener(new ButtonListener());
|
||||||
imageButton_clear.setVisibility(View.GONE);
|
imageButton_clear.setVisibility(View.GONE);
|
||||||
|
editText = (EditText) findViewById(R.id.editText);
|
||||||
|
editText.addTextChangedListener(new EditChangedListener());
|
||||||
|
listView = (ListView) findViewById(R.id.listView1);
|
||||||
|
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, "删除");
|
||||||
|
menu.add(0, 2, 2, "修改");
|
||||||
|
}
|
||||||
|
});
|
||||||
search(editText.getText().toString());
|
search(editText.getText().toString());
|
||||||
IMM = (InputMethodManager) getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ButtonListener implements View.OnClickListener {
|
class ButtonListener implements View.OnClickListener {
|
||||||
|
@ -78,6 +102,7 @@ public class FavoriteActivity extends Activity {
|
||||||
Toast.makeText(getApplicationContext(), "链接已复制", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "链接已复制", Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
position = listView.getFirstVisiblePosition();
|
||||||
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());
|
DBHelper helper = new DBHelper(getApplicationContext());
|
||||||
helper.del(id);
|
helper.del(id);
|
||||||
|
@ -182,7 +207,7 @@ public class FavoriteActivity extends Activity {
|
||||||
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, cursor1, from, to, 0);
|
adapter = new SimpleCursorAdapter(this, R.layout.favorite_row, cursor1, from, to, 0);
|
||||||
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder(){
|
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder(){
|
||||||
public boolean setViewValue(View view, Cursor cursor, int columnIndex){
|
public boolean setViewValue(View view, Cursor cursor, int columnIndex){
|
||||||
//Log.e("L192", view.toString() + columnIndex);
|
//Log.e(Thread.currentThread().getStackTrace()[2] + "", view.toString() + columnIndex);
|
||||||
if (view.getId() == R.id.imageView_favicon) {
|
if (view.getId() == R.id.imageView_favicon) {
|
||||||
String website = cursor.getString(columnIndex);
|
String website = cursor.getString(columnIndex);
|
||||||
if (website.startsWith("https://")) {
|
if (website.startsWith("https://")) {
|
||||||
|
@ -200,45 +225,19 @@ public class FavoriteActivity extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", position + "");
|
||||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
listView.setSelection(position);
|
||||||
@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, "删除");
|
|
||||||
menu.add(0, 2, 2, "修改");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class EditChangedListener implements TextWatcher {
|
class EditChangedListener implements TextWatcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
if(s.toString().equals("")){
|
if(s.toString().equals("")){
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -86,7 +87,9 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_row="3"
|
android:layout_row="3"
|
||||||
android:layout_column="1"
|
android:layout_column="1"
|
||||||
android:layout_margin="5dp"/>
|
android:layout_marginLeft="15dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"/>
|
||||||
|
|
||||||
</GridLayout>
|
</GridLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Loading…
Reference in New Issue