open target=_blank in new window
This commit is contained in:
parent
aec6ce7b2c
commit
b086931d0d
|
@ -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.0">
|
android:versionName="4.1">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
|
@ -15,9 +15,10 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@android:style/Theme.Holo.Light.NoActionBar">
|
android:theme="@android:style/Theme.Holo.Light.NoActionBar">
|
||||||
<activity
|
<activity
|
||||||
android:name="com.hty.browser.MainActivity"
|
android:name=".MainActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
android:label="@string/app_name"
|
||||||
android:label="@string/app_name">
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="orientation|keyboardHidden|screenSize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
@ -25,10 +26,20 @@
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="https"/>
|
||||||
|
<data android:scheme="http"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="file"/>
|
||||||
<data android:mimeType="text/html"/>
|
<data android:mimeType="text/html"/>
|
||||||
|
<data android:mimeType="text/plain"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.hty.browser.FavoriteActivity"/>
|
<activity android:name=".FavoriteActivity"/>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.hty.browser.SettingsActivity"
|
android:name="com.hty.browser.SettingsActivity"
|
||||||
android:label="设置"
|
android:label="设置"
|
||||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.0</h2>
|
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.1</h2>
|
||||||
<p>内置扩展的浏览器。</p>
|
<p>内置扩展的浏览器。</p>
|
||||||
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
||||||
<p>作者:黄颖</p>
|
<p>作者:黄颖</p>
|
||||||
|
@ -17,11 +17,13 @@ p { text-indent:2em; }
|
||||||
<p>E-mail:sonichy@163.com</p>
|
<p>E-mail:sonichy@163.com</p>
|
||||||
<h3>参考:</h3>
|
<h3>参考:</h3>
|
||||||
<p><a href="https://gitee.com/daiji111/flying_browser/blob/master/app/src/main/java/com/daiji/feixiang/BrowserActivity.java">多窗口管理</a></p>
|
<p><a href="https://gitee.com/daiji111/flying_browser/blob/master/app/src/main/java/com/daiji/feixiang/BrowserActivity.java">多窗口管理</a></p>
|
||||||
|
<p>链接的 target=_blank 在新窗口中打开 <a href="https://www.cnblogs.com/ufreedom/p/4229590.html">一</a> <a href="https://gitee.com/daiji111/flying_browser/blob/master/app/src/main/java/com/daiji/feixiang/BrowserActivity.java">二</a></p>
|
||||||
<p><a href="https://www.jianshu.com/p/6e38e1ef203a" target="_blank">Android WebView 三种文件下载方式</a></p>
|
<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>
|
<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.0 (2019-02-13)</h3><ol><li>实现多窗口。</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>V3.12 (2019-02-27)</h3><ol><li>支持跨域。</li><li>获取网页图标。</li><li>屏蔽百度首页视频百度好看跳转下载。</li><li>Android API 19 以上开启调试,运行 adb devices 连接手机,Chrome 浏览器 chrome://inspect 查看。</li><li>增加标题按钮,点击标题按钮显示地址栏,点击网页隐藏地址栏。</li></ol>
|
<h3>V3.12 (2019-02-27)</h3><ol><li>支持跨域。</li><li>获取网页图标。</li><li>屏蔽百度首页视频百度好看跳转下载。</li><li>Android API 19 以上开启调试,运行 adb devices 连接手机,Chrome 浏览器 chrome://inspect 查看。</li><li>增加标题按钮,点击标题按钮显示地址栏,点击网页隐藏地址栏。</li></ol>
|
||||||
<h3>V3.11 (2019-02-13)</h3><ol><li>链接中的关键字屏蔽、高亮可设置。</li></ol>
|
<h3>V3.11 (2019-02-13)</h3><ol><li>链接中的关键字屏蔽、高亮可设置。</li></ol>
|
||||||
<h3>V3.10 (2019-02-10)</h3><ol><li>增加:收藏前修改,收藏后修改,修改校验。</li></ol>
|
<h3>V3.10 (2019-02-10)</h3><ol><li>增加:收藏前修改,收藏后修改,修改校验。</li></ol>
|
||||||
|
|
|
@ -46,6 +46,7 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
@ -90,12 +91,12 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
Button button_title, button_page;
|
Button button_title, button_page;
|
||||||
TextView findCount;
|
TextView textView_searchCount;
|
||||||
EditText editText1, findText;
|
EditText editText1, editText_search;
|
||||||
ImageButton btnGo, btnBack, btnForward, btnMenu, findPrev, findNext, findClose, imageButton_info;
|
ImageButton imageButton_go, imageButton_back, imageButton_forward, imageButton_menu, imageButton_searchPrev, imageButton_searchNext, imageButton_searchClose, imageButton_info;
|
||||||
// RelativeLayout RelativeLayout1;
|
// RelativeLayout RelativeLayout1;
|
||||||
LinearLayout LinearLayout1, LinearLayout2;
|
LinearLayout LinearLayout1, LinearLayout2;
|
||||||
FrameLayout webViewLayout, video, findbar;
|
FrameLayout webViewLayout, video, searchBar;
|
||||||
ImageView imageView1;
|
ImageView imageView1;
|
||||||
InputMethodManager IMM;
|
InputMethodManager IMM;
|
||||||
ProgressBar pgb1;
|
ProgressBar pgb1;
|
||||||
|
@ -129,7 +130,7 @@ public class MainActivity extends Activity {
|
||||||
// RelativeLayout1 = (RelativeLayout) findViewById(R.id.RelativeLayout1);
|
// RelativeLayout1 = (RelativeLayout) findViewById(R.id.RelativeLayout1);
|
||||||
webViewLayout = (FrameLayout) findViewById(R.id.webViewLayout);
|
webViewLayout = (FrameLayout) findViewById(R.id.webViewLayout);
|
||||||
video = (FrameLayout) findViewById(R.id.video);
|
video = (FrameLayout) findViewById(R.id.video);
|
||||||
findbar = (FrameLayout) findViewById(R.id.findbar);
|
searchBar = (FrameLayout) findViewById(R.id.searchBar);
|
||||||
pgb1 = (ProgressBar) findViewById(R.id.progressBar1);
|
pgb1 = (ProgressBar) findViewById(R.id.progressBar1);
|
||||||
// if (VERSION.SDK_INT > 18) {
|
// if (VERSION.SDK_INT > 18) {
|
||||||
// getWindow().addFlags(
|
// getWindow().addFlags(
|
||||||
|
@ -147,33 +148,33 @@ public class MainActivity extends Activity {
|
||||||
// // lp.topMargin = 45;
|
// // lp.topMargin = 45;
|
||||||
// // RelativeLayout1.setLayoutParams(lp);
|
// // RelativeLayout1.setLayoutParams(lp);
|
||||||
// }
|
// }
|
||||||
btnGo = (ImageButton) findViewById(R.id.ImageButtonGo);
|
imageButton_go = (ImageButton) findViewById(R.id.imageButton_go);
|
||||||
btnBack = (ImageButton) findViewById(R.id.ImageButtonBack);
|
imageButton_back = (ImageButton) findViewById(R.id.imageButton_back);
|
||||||
btnForward = (ImageButton) findViewById(R.id.ImageButtonForward);
|
imageButton_forward = (ImageButton) findViewById(R.id.imageButton_forward);
|
||||||
btnMenu = (ImageButton) findViewById(R.id.ImageButtonMenu);
|
imageButton_menu = (ImageButton) findViewById(R.id.imageButton_menu);
|
||||||
imageView1 = (ImageView) findViewById(R.id.imageView1);
|
imageView1 = (ImageView) findViewById(R.id.imageView1);
|
||||||
findText = (EditText) findViewById(R.id.findText);
|
editText_search = (EditText) findViewById(R.id.editText_search);
|
||||||
findCount = (TextView) findViewById(R.id.findCount);
|
textView_searchCount = (TextView) findViewById(R.id.textView_searchCount);
|
||||||
findPrev = (ImageButton) findViewById(R.id.findPrev);
|
imageButton_searchPrev = (ImageButton) findViewById(R.id.imageButton_searchPrev);
|
||||||
findNext = (ImageButton) findViewById(R.id.findNext);
|
imageButton_searchNext = (ImageButton) findViewById(R.id.imageButton_searchNext);
|
||||||
findClose = (ImageButton) findViewById(R.id.findClose);
|
imageButton_searchClose = (ImageButton) findViewById(R.id.imageButton_searchClose);
|
||||||
imageButton_info = (ImageButton) findViewById(R.id.imageButton_info);
|
imageButton_info = (ImageButton) findViewById(R.id.imageButton_info);
|
||||||
button_title = (Button) findViewById(R.id.button_title);
|
button_title = (Button) findViewById(R.id.button_title);
|
||||||
button_page = (Button) findViewById(R.id.button_page);
|
button_page = (Button) findViewById(R.id.button_page);
|
||||||
button_title.setOnClickListener(new ButtonListener());
|
button_title.setOnClickListener(new ButtonListener());
|
||||||
button_page.setOnClickListener(new ButtonListener());
|
button_page.setOnClickListener(new ButtonListener());
|
||||||
btnGo.setOnClickListener(new ButtonListener());
|
imageButton_go.setOnClickListener(new ButtonListener());
|
||||||
btnBack.setOnClickListener(new ButtonListener());
|
imageButton_back.setOnClickListener(new ButtonListener());
|
||||||
btnForward.setOnClickListener(new ButtonListener());
|
imageButton_forward.setOnClickListener(new ButtonListener());
|
||||||
btnMenu.setOnClickListener(new ButtonListener());
|
imageButton_menu.setOnClickListener(new ButtonListener());
|
||||||
imageView1.setOnClickListener(new ButtonListener());
|
imageView1.setOnClickListener(new ButtonListener());
|
||||||
findPrev.setOnClickListener(new ButtonListener());
|
imageButton_searchPrev.setOnClickListener(new ButtonListener());
|
||||||
findNext.setOnClickListener(new ButtonListener());
|
imageButton_searchNext.setOnClickListener(new ButtonListener());
|
||||||
findClose.setOnClickListener(new ButtonListener());
|
imageButton_searchClose.setOnClickListener(new ButtonListener());
|
||||||
editText1 = (EditText) findViewById(R.id.EditText1);
|
editText1 = (EditText) findViewById(R.id.EditText1);
|
||||||
editText1.setVisibility(View.GONE);
|
editText1.setVisibility(View.GONE);
|
||||||
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath()); //获取图标数据库路径
|
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath()); //获取图标数据库路径
|
||||||
newWindow();
|
getDataFromIntent(getIntent());
|
||||||
|
|
||||||
editText1.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
editText1.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -186,19 +187,19 @@ public class MainActivity extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
findText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
editText_search.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
list_webView.get(currentPage).findAllAsync(findText.getText().toString());
|
list_webView.get(currentPage).findAllAsync(editText_search.getText().toString());
|
||||||
IMM.hideSoftInputFromWindow(findText.getWindowToken(), 0);
|
IMM.hideSoftInputFromWindow(editText_search.getWindowToken(), 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
findText.addTextChangedListener(new TextWatcher() {
|
editText_search.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence text, int start, int before, int count) {
|
public void onTextChanged(CharSequence text, int start, int before, int count) {
|
||||||
// text 输入框中改变后的字符串信息
|
// text 输入框中改变后的字符串信息
|
||||||
|
@ -222,16 +223,6 @@ public class MainActivity extends Activity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Intent intent = getIntent();
|
|
||||||
if (intent.ACTION_VIEW.equals(intent.getAction())) {
|
|
||||||
urln = intent.getDataString();
|
|
||||||
loadPage(urln);
|
|
||||||
}else{
|
|
||||||
loadPage(sharedPreferences.getString("homepage","http://www.baidu.com"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CU = new Thread() {
|
CU = new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -333,42 +324,43 @@ public class MainActivity extends Activity {
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
break;
|
break;
|
||||||
case R.id.ImageButtonGo:
|
case R.id.imageButton_go:
|
||||||
loadPage(editText1.getText().toString());
|
//loadPage(editText1.getText().toString());
|
||||||
|
list_webView.get(currentPage).loadUrl(editText1.getText().toString());
|
||||||
break;
|
break;
|
||||||
case R.id.ImageButtonBack:
|
case R.id.imageButton_back:
|
||||||
if (list_webView.get(currentPage).canGoBack()) {
|
if (list_webView.get(currentPage).canGoBack()) {
|
||||||
list_webView.get(currentPage).goBack();
|
list_webView.get(currentPage).goBack();
|
||||||
btnForward.setEnabled(true);
|
imageButton_forward.setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
btnBack.setEnabled(false);
|
imageButton_back.setEnabled(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.ImageButtonForward:
|
case R.id.imageButton_forward:
|
||||||
if (list_webView.get(currentPage).canGoForward()) {
|
if (list_webView.get(currentPage).canGoForward()) {
|
||||||
list_webView.get(currentPage).goForward();
|
list_webView.get(currentPage).goForward();
|
||||||
btnBack.setEnabled(true);
|
imageButton_back.setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
btnForward.setEnabled(false);
|
imageButton_forward.setEnabled(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.ImageButtonMenu:
|
case R.id.imageButton_menu:
|
||||||
MenuDialog();
|
MenuDialog();
|
||||||
break;
|
break;
|
||||||
case R.id.imageView1:
|
case R.id.imageView1:
|
||||||
playVideo();
|
playVideo();
|
||||||
imageView1.setVisibility(View.GONE);
|
imageView1.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
case R.id.findPrev:
|
case R.id.imageButton_searchPrev:
|
||||||
list_webView.get(currentPage).findNext(false);
|
list_webView.get(currentPage).findNext(false);
|
||||||
break;
|
break;
|
||||||
case R.id.findNext:
|
case R.id.imageButton_searchNext:
|
||||||
list_webView.get(currentPage).findNext(true);
|
list_webView.get(currentPage).findNext(true);
|
||||||
break;
|
break;
|
||||||
case R.id.findClose:
|
case R.id.imageButton_searchClose:
|
||||||
findText.setText("");
|
editText_search.setText("");
|
||||||
IMM.hideSoftInputFromWindow(findText.getWindowToken(), 0);
|
IMM.hideSoftInputFromWindow(editText_search.getWindowToken(), 0);
|
||||||
findbar.setVisibility(View.GONE);
|
searchBar.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,7 +369,7 @@ public class MainActivity extends Activity {
|
||||||
private class MyWebViewDownLoadListener implements DownloadListener {
|
private class MyWebViewDownLoadListener implements DownloadListener {
|
||||||
@Override
|
@Override
|
||||||
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
||||||
Log.e("Download", url);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", url);
|
||||||
downloadBySystem(url, "", "");
|
downloadBySystem(url, "", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,6 +435,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", keyCode + ", " + event);
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
imageView1.setVisibility(View.GONE);
|
imageView1.setVisibility(View.GONE);
|
||||||
|
@ -458,18 +451,18 @@ public class MainActivity extends Activity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||||
list_webView.get(currentPage).findAllAsync(findText.getText().toString());
|
list_webView.get(currentPage).findAllAsync(editText_search.getText().toString());
|
||||||
IMM.hideSoftInputFromWindow(findText.getWindowToken(), 0);
|
IMM.hideSoftInputFromWindow(editText_search.getWindowToken(), 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (keyCode == KeyEvent.KEYCODE_F) {
|
if (keyCode == KeyEvent.KEYCODE_F) {
|
||||||
findbar.setVisibility(View.VISIBLE);
|
searchBar.setVisibility(View.VISIBLE);
|
||||||
findText.requestFocus();
|
editText_search.requestFocus();
|
||||||
list_webView.get(currentPage).findAllAsync(findText.getText().toString());
|
list_webView.get(currentPage).findAllAsync(editText_search.getText().toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (keyCode == KeyEvent.KEYCODE_ESCAPE) {
|
if (keyCode == KeyEvent.KEYCODE_ESCAPE) {
|
||||||
findbar.setVisibility(View.GONE);
|
searchBar.setVisibility(View.GONE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
|
@ -481,9 +474,9 @@ public class MainActivity extends Activity {
|
||||||
url = "http://" + url;
|
url = "http://" + url;
|
||||||
}
|
}
|
||||||
// editText1.setText(url);
|
// editText1.setText(url);
|
||||||
Log.e("webview", url);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", url);
|
||||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||||
findText.setText("");
|
editText_search.setText("");
|
||||||
list_webView.get(currentPage).loadUrl(url);
|
list_webView.get(currentPage).loadUrl(url);
|
||||||
// btnBack.setEnabled(true);
|
// btnBack.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -583,7 +576,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
Log.e("MainActivity", "onPause");
|
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "onPause");
|
||||||
pauseVideo();
|
pauseVideo();
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
imageView1.setVisibility(View.VISIBLE);
|
imageView1.setVisibility(View.VISIBLE);
|
||||||
|
@ -617,14 +610,15 @@ public class MainActivity extends Activity {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case 0:
|
case 0:
|
||||||
newWindow();
|
newWindow(sharedPreferences.getString("homepage","http://www.baidu.com"));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
list_webView.remove(currentPage);
|
list_webView.remove(currentPage);
|
||||||
if(list_webView.size() == 0){
|
if(list_webView.size() == 0){
|
||||||
newWindow();
|
newWindow(sharedPreferences.getString("homepage","http://www.baidu.com"));
|
||||||
}else{
|
}else{
|
||||||
currentPage--;
|
currentPage--;
|
||||||
|
if (currentPage < 0) currentPage = 0;
|
||||||
button_page.setText(currentPage + 1 + "");
|
button_page.setText(currentPage + 1 + "");
|
||||||
webViewLayout.removeAllViews();
|
webViewLayout.removeAllViews();
|
||||||
WebView webView = list_webView.get(currentPage);
|
WebView webView = list_webView.get(currentPage);
|
||||||
|
@ -643,7 +637,7 @@ public class MainActivity extends Activity {
|
||||||
layout.addView(ET_title);
|
layout.addView(ET_title);
|
||||||
final EditText ET_url = new EditText(MainActivity.this);
|
final EditText ET_url = new EditText(MainActivity.this);
|
||||||
ET_title.setHint("网址");
|
ET_title.setHint("网址");
|
||||||
ET_url.setText(urln);
|
ET_url.setText(list_webView.get(currentPage).getTitle());
|
||||||
layout.addView(ET_url);
|
layout.addView(ET_url);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
Bitmap icon = list_webView.get(currentPage).getFavicon();
|
Bitmap icon = list_webView.get(currentPage).getFavicon();
|
||||||
|
@ -727,9 +721,9 @@ public class MainActivity extends Activity {
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
findbar.setVisibility(View.VISIBLE);
|
searchBar.setVisibility(View.VISIBLE);
|
||||||
findText.requestFocus();
|
editText_search.requestFocus();
|
||||||
list_webView.get(currentPage).findAllAsync(findText.getText().toString());
|
list_webView.get(currentPage).findAllAsync(editText_search.getText().toString());
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
intent = new Intent();
|
intent = new Intent();
|
||||||
|
@ -859,9 +853,7 @@ public class MainActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogBlockList(){
|
void DialogBlockList(){
|
||||||
//Log.e("readfile: ", ReadFile("blockrules"));
|
|
||||||
final String[] datas = ReadFile("blockrules").split("\n");
|
final String[] datas = ReadFile("blockrules").split("\n");
|
||||||
//Log.e("readfile: ", datas.toString());
|
|
||||||
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, datas);
|
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, datas);
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setIcon(R.drawable.ic_launcher);
|
builder.setIcon(R.drawable.ic_launcher);
|
||||||
|
@ -891,7 +883,7 @@ public class MainActivity extends Activity {
|
||||||
String filepath = getFilesDir().getAbsolutePath() + "/blockrules";
|
String filepath = getFilesDir().getAbsolutePath() + "/blockrules";
|
||||||
File file = new File(filepath);
|
File file = new File(filepath);
|
||||||
//if(file.isFile() && file.exists()) {
|
//if(file.isFile() && file.exists()) {
|
||||||
Log.e("delete "+filepath, String.valueOf(file.delete()));
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", String.valueOf(file.delete()));
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -974,7 +966,7 @@ public class MainActivity extends Activity {
|
||||||
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
|
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
|
||||||
// 设置下载文件保存的路径和文件名
|
// 设置下载文件保存的路径和文件名
|
||||||
String fileName = URLUtil.guessFileName(surl, contentDisposition, mimeType);
|
String fileName = URLUtil.guessFileName(surl, contentDisposition, mimeType);
|
||||||
Log.e("fileName:", fileName);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", fileName);
|
||||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
|
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
|
||||||
// 自定义下载路径
|
// 自定义下载路径
|
||||||
//request.setDestinationUri();
|
//request.setDestinationUri();
|
||||||
|
@ -982,7 +974,7 @@ public class MainActivity extends Activity {
|
||||||
DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
|
DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
|
||||||
// 添加一个下载任务
|
// 添加一个下载任务
|
||||||
long downloadId = downloadManager.enqueue(request);
|
long downloadId = downloadManager.enqueue(request);
|
||||||
Log.e("downloadId:", downloadId+"");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", downloadId+"");
|
||||||
if(surl == urlUpdate){
|
if(surl == urlUpdate){
|
||||||
downloadIdUpdate = downloadId;
|
downloadIdUpdate = downloadId;
|
||||||
}
|
}
|
||||||
|
@ -999,10 +991,10 @@ public class MainActivity extends Activity {
|
||||||
InputStreamReader ISR = new InputStreamReader(IS);
|
InputStreamReader ISR = new InputStreamReader(IS);
|
||||||
BufferedReader bufferReader = new BufferedReader(ISR);
|
BufferedReader bufferReader = new BufferedReader(ISR);
|
||||||
String versionS = bufferReader.readLine();
|
String versionS = bufferReader.readLine();
|
||||||
Log.e("Version", versionS + " > " + versionL + " ?");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", versionS + " > " + versionL + " ?");
|
||||||
String[] AVersionS = versionS.split("\\.");
|
String[] AVersionS = versionS.split("\\.");
|
||||||
String[] AVersionL = versionL.split("\\.");
|
String[] AVersionL = versionL.split("\\.");
|
||||||
Log.e("Version", "(" + AVersionS[0] + " > " + AVersionL[0] + ") && (" + AVersionS[1] + " > " + AVersionL[1] + ")");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", "(" + AVersionS[0] + " > " + AVersionL[0] + ") && (" + AVersionS[1] + " > " + AVersionL[1] + ")");
|
||||||
if ((Integer.parseInt(AVersionS[0]) > Integer.parseInt(AVersionL[0])) || (Integer.parseInt(AVersionS[0]) == Integer.parseInt(AVersionL[0]) && Integer.parseInt(AVersionS[1]) > Integer.parseInt(AVersionL[1]))) {
|
if ((Integer.parseInt(AVersionS[0]) > Integer.parseInt(AVersionL[0])) || (Integer.parseInt(AVersionS[0]) == Integer.parseInt(AVersionL[0]) && Integer.parseInt(AVersionS[1]) > Integer.parseInt(AVersionL[1]))) {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||||
|
@ -1026,7 +1018,7 @@ public class MainActivity extends Activity {
|
||||||
} else {
|
} else {
|
||||||
if(isManualCheckUpdate) {
|
if(isManualCheckUpdate) {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
Toast.makeText(getApplicationContext(), "当前版本 " + versionL + " 是最新的版本", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "当前版本 " + versionL + " >= 服务器版本 "+ versionS + ",是最新的版本", Toast.LENGTH_SHORT).show();
|
||||||
Looper.myLooper().loop();
|
Looper.myLooper().loop();
|
||||||
}
|
}
|
||||||
Log.e("检查更新: ", "当前版本是最新的版本");
|
Log.e("检查更新: ", "当前版本是最新的版本");
|
||||||
|
@ -1042,15 +1034,15 @@ public class MainActivity extends Activity {
|
||||||
private class DownloadCompleteReceiver extends BroadcastReceiver {
|
private class DownloadCompleteReceiver extends BroadcastReceiver {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.e("onReceive.intent", intent != null ? intent.toUri(0) : null);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", intent != null ? intent.toUri(0) : null);
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
|
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
|
||||||
long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
|
long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
|
||||||
Log.e("DownloadId", downloadId + "");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", downloadId + "");
|
||||||
DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);
|
||||||
if(downloadId == downloadIdUpdate){
|
if(downloadId == downloadIdUpdate){
|
||||||
Uri uri = downloadManager.getUriForDownloadedFile(downloadId);
|
Uri uri = downloadManager.getUriForDownloadedFile(downloadId);
|
||||||
Log.e("UriDownload", uri.toString());
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", uri.toString());
|
||||||
Intent intentn = new Intent(Intent.ACTION_VIEW);
|
Intent intentn = new Intent(Intent.ACTION_VIEW);
|
||||||
intentn.setDataAndType(uri, "application/vnd.android.package-archive");
|
intentn.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||||
startActivity(intentn);
|
startActivity(intentn);
|
||||||
|
@ -1060,24 +1052,20 @@ public class MainActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void newWindow(){
|
void newWindow(String surl){
|
||||||
WebView webView = new WebView(MainActivity.this);
|
WebView webView = new WebView(MainActivity.this);
|
||||||
setWebView(webView);
|
settingWebView(webView);
|
||||||
webView.loadUrl(sharedPreferences.getString("homepage","http://www.baidu.com"));
|
webView.loadUrl(surl);
|
||||||
webViewLayout.removeAllViews();
|
webViewLayout.removeAllViews();
|
||||||
webViewLayout.addView(webView);
|
webViewLayout.addView(webView);
|
||||||
list_webView.add(webView);
|
list_webView.add(webView);
|
||||||
currentPage = list_webView.size() - 1;
|
currentPage = list_webView.size() - 1;
|
||||||
button_page.setText(currentPage + 1 + "");
|
button_page.setText(currentPage + 1 + "");
|
||||||
list_webView.get(currentPage).setFindListener(new FindListener() {
|
|
||||||
@Override
|
|
||||||
public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting) {
|
|
||||||
findCount.setText(activeMatchOrdinal + "/" + numberOfMatches);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWebView(final WebView webView){
|
void settingWebView(final WebView webView){
|
||||||
|
// 菜单
|
||||||
|
registerForContextMenu(webView);
|
||||||
// 支持获取手势焦点
|
// 支持获取手势焦点
|
||||||
webView.requestFocusFromTouch();
|
webView.requestFocusFromTouch();
|
||||||
// 允许调试
|
// 允许调试
|
||||||
|
@ -1109,40 +1097,35 @@ public class MainActivity extends Activity {
|
||||||
// 开启定位
|
// 开启定位
|
||||||
webSettings.setGeolocationEnabled(true);
|
webSettings.setGeolocationEnabled(true);
|
||||||
// 支持多窗口
|
// 支持多窗口
|
||||||
webSettings.supportMultipleWindows();
|
webSettings.setSupportMultipleWindows(true);
|
||||||
// 允许跨域
|
// 允许跨域
|
||||||
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
webSettings.setAllowUniversalAccessFromFileURLs(true);
|
||||||
|
|
||||||
webView.setWebViewClient(new WebViewClient() {
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
Log.e("OverrideUrlLoading", url);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", url);
|
||||||
// 协议过滤
|
// 协议过滤
|
||||||
if (url.startsWith("http") && !url.startsWith("https://cdn-haokanapk.baidu.com/")) {
|
if (url.startsWith("http") && !url.startsWith("https://cdn-haokanapk.baidu.com/")) {
|
||||||
view.loadUrl(url);
|
view.loadUrl(url);
|
||||||
}
|
return false;
|
||||||
/*
|
} else if (url.startsWith("tbopen://")){
|
||||||
else if(url.startsWith("tbopen://")){
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setAction("android.intent.action.VIEW");
|
|
||||||
Uri uri = Uri.parse(url);
|
|
||||||
intent.setData(uri);
|
|
||||||
intent.setClassName("com.taobao.taobao", "com.taobao.tao.detail.activity.DetailActivity");
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
*/
|
return true; // 拦截原链接
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
//super.onPageStarted(view, url, favicon);
|
//super.onPageStarted(view, url, favicon);
|
||||||
|
//Log.e(Thread.currentThread().getStackTrace()[2] + "", url);
|
||||||
button_title.setText(url);
|
button_title.setText(url);
|
||||||
button_title.setVisibility(View.VISIBLE);
|
button_title.setVisibility(View.VISIBLE);
|
||||||
editText1.setText(url);
|
editText1.setText(url);
|
||||||
editText1.setVisibility(View.GONE);
|
editText1.setVisibility(View.GONE);
|
||||||
urln = url;
|
urln = url;
|
||||||
btnBack.setEnabled(true);
|
imageButton_back.setEnabled(true);
|
||||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||||
pgb1.setVisibility(View.VISIBLE);
|
pgb1.setVisibility(View.VISIBLE);
|
||||||
imageButton_info.setImageResource(android.R.drawable.ic_menu_info_details);
|
imageButton_info.setImageResource(android.R.drawable.ic_menu_info_details);
|
||||||
|
@ -1164,14 +1147,14 @@ public class MainActivity extends Activity {
|
||||||
if (isNetworkConnected()) {
|
if (isNetworkConnected()) {
|
||||||
switch(errorCode){
|
switch(errorCode){
|
||||||
case WebViewClient.ERROR_HOST_LOOKUP: // 找不到主机,跳转百度搜索
|
case WebViewClient.ERROR_HOST_LOOKUP: // 找不到主机,跳转百度搜索
|
||||||
Log.e("ErrorHostLookup", failingUrl);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", failingUrl);
|
||||||
String url = "http://m.baidu.com/s?word=" + urlo;
|
String url = "http://m.baidu.com/s?word=" + urlo;
|
||||||
editText1.setText(url);
|
editText1.setText(url);
|
||||||
webView.loadUrl(url);
|
webView.loadUrl(url);
|
||||||
urln = url;
|
urln = url;
|
||||||
break;
|
break;
|
||||||
case WebViewClient.ERROR_UNSUPPORTED_SCHEME:
|
case WebViewClient.ERROR_UNSUPPORTED_SCHEME:
|
||||||
Log.e("ErrorUnsupportedScheme",failingUrl);
|
Log.e(Thread.currentThread().getStackTrace()[2] + "",failingUrl);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
webView.loadDataWithBaseURL(
|
webView.loadDataWithBaseURL(
|
||||||
|
@ -1183,7 +1166,35 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
webView.setWebChromeClient(new WebChromeClient() {
|
webView.setFindListener(new FindListener() {
|
||||||
|
@Override
|
||||||
|
public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting) {
|
||||||
|
if(numberOfMatches == 0){
|
||||||
|
textView_searchCount.setText(activeMatchOrdinal + "/" + numberOfMatches);
|
||||||
|
}else{
|
||||||
|
textView_searchCount.setText(activeMatchOrdinal + 1 + "/" + numberOfMatches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
webView.setDownloadListener(new MyWebViewDownLoadListener());
|
||||||
|
|
||||||
|
webView.setOnTouchListener(new OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
button_title.setVisibility(View.VISIBLE);
|
||||||
|
editText1.setVisibility(View.GONE);
|
||||||
|
webView.requestFocus();
|
||||||
|
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
webView.setWebChromeClient(new MyWebChromeClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MyWebChromeClient extends WebChromeClient {
|
||||||
|
|
||||||
// JS的alert('')提示信息转换成安卓控件提示信息
|
// JS的alert('')提示信息转换成安卓控件提示信息
|
||||||
@Override
|
@Override
|
||||||
|
@ -1247,7 +1258,7 @@ public class MainActivity extends Activity {
|
||||||
// 播放网络视频时全屏会被调用的方法
|
// 播放网络视频时全屏会被调用的方法
|
||||||
@Override
|
@Override
|
||||||
public void onShowCustomView(View view, CustomViewCallback callback) {
|
public void onShowCustomView(View view, CustomViewCallback callback) {
|
||||||
Log.e("onShowCustomView", "onShowCustomView");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", "onShowCustomView");
|
||||||
//Toast.makeText(getApplicationContext(), "onShowCustomView", Toast.LENGTH_SHORT).show();
|
//Toast.makeText(getApplicationContext(), "onShowCustomView", Toast.LENGTH_SHORT).show();
|
||||||
customViewCallback = callback;
|
customViewCallback = callback;
|
||||||
// 将video放到当前视图中
|
// 将video放到当前视图中
|
||||||
|
@ -1260,7 +1271,7 @@ public class MainActivity extends Activity {
|
||||||
// 视频播放退出全屏会被调用的
|
// 视频播放退出全屏会被调用的
|
||||||
@Override
|
@Override
|
||||||
public void onHideCustomView() {
|
public void onHideCustomView() {
|
||||||
Log.e("onHideCustomView", "onHideCustomView");
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", "onHideCustomView");
|
||||||
//Toast.makeText(getApplicationContext(), "onHideCustomView", Toast.LENGTH_SHORT).show();
|
//Toast.makeText(getApplicationContext(), "onHideCustomView", Toast.LENGTH_SHORT).show();
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
// 退出全屏
|
// 退出全屏
|
||||||
|
@ -1280,20 +1291,44 @@ public class MainActivity extends Activity {
|
||||||
super.onGeolocationPermissionsShowPrompt(origin, callback);
|
super.onGeolocationPermissionsShowPrompt(origin, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
// target="_blank" 处理
|
||||||
|
|
||||||
webView.setDownloadListener(new MyWebViewDownLoadListener());
|
|
||||||
|
|
||||||
webView.setOnTouchListener(new OnTouchListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
|
||||||
button_title.setVisibility(View.VISIBLE);
|
WebView webView = new WebView(MainActivity.this);
|
||||||
editText1.setVisibility(View.GONE);
|
settingWebView(webView);
|
||||||
webView.requestFocus();
|
webViewLayout.removeAllViews();
|
||||||
IMM.hideSoftInputFromWindow(editText1.getWindowToken(), 0);
|
webViewLayout.addView(webView);
|
||||||
return false;
|
list_webView.add(webView);
|
||||||
}
|
currentPage = list_webView.size() - 1;
|
||||||
});
|
button_page.setText(currentPage + 1 + "");
|
||||||
|
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
|
||||||
|
transport.setWebView(webView);
|
||||||
|
resultMsg.sendToTarget();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void getDataFromIntent(Intent intent) {
|
||||||
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", "intent(" + intent + ")");
|
||||||
|
if (intent.getAction().equals(Intent.ACTION_VIEW)) {
|
||||||
|
urln = intent.getDataString();
|
||||||
|
newWindow(urln);
|
||||||
|
}else{
|
||||||
|
newWindow(sharedPreferences.getString("homepage","http://www.baidu.com"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "onNewIntent(" + getIntent() + ")");
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
setIntent(intent);
|
||||||
|
if(getIntent().getDataString() != null) {
|
||||||
|
urln = getIntent().getDataString();
|
||||||
|
Log.e(Thread.currentThread().getStackTrace()[2] + "", "onNewIntent(" + urln + ")");
|
||||||
|
newWindow(urln);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -29,14 +29,14 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/ImageButtonBack"
|
android:id="@+id/imageButton_back"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:src="@android:drawable/ic_media_rew"/>
|
android:src="@android:drawable/ic_media_rew"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/ImageButtonForward"
|
android:id="@+id/imageButton_forward"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
@ -82,14 +82,14 @@
|
||||||
android:textSize="20sp"/>
|
android:textSize="20sp"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/ImageButtonGo"
|
android:id="@+id/imageButton_go"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:src="@android:drawable/ic_media_play"/>
|
android:src="@android:drawable/ic_media_play"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/ImageButtonMenu"
|
android:id="@+id/imageButton_menu"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/findbar"
|
android:id="@+id/searchBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/LinearLayout1"
|
android:layout_alignBottom="@+id/LinearLayout1"
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/findText"
|
android:id="@+id/editText_search"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
@ -156,27 +156,27 @@
|
||||||
android:textSize="20sp"/>
|
android:textSize="20sp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/findCount"
|
android:id="@+id/textView_searchCount"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="0/0"/>
|
android:text="0/0"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/findPrev"
|
android:id="@+id/imageButton_searchPrev"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:src="@android:drawable/ic_media_rew"/>
|
android:src="@android:drawable/ic_media_rew"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/findNext"
|
android:id="@+id/imageButton_searchNext"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:src="@android:drawable/ic_media_ff"/>
|
android:src="@android:drawable/ic_media_ff"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/findClose"
|
android:id="@+id/imageButton_searchClose"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
|
BIN
preview.png
BIN
preview.png
Binary file not shown.
Before Width: | Height: | Size: 536 KiB After Width: | Height: | Size: 581 KiB |
Loading…
Reference in New Issue