2.5.0.1
FIxed full-screen video, changed some animations, changed icon, fixed some problems with incognito mode
This commit is contained in:
parent
0cd7d6d74a
commit
6827bb9946
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="acr.browser.barebones"
|
package="acr.browser.barebones"
|
||||||
android:versionCode="43"
|
android:versionCode="44"
|
||||||
android:versionName="2.5.0.0" >
|
android:versionName="2.5.0.1" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="8"
|
android:minSdkVersion="8"
|
||||||
|
5
README
5
README
@ -2,8 +2,3 @@ This is an open source webkit based browser.
|
|||||||
|
|
||||||
I make money off a similar paid version which currently has unlimited tabs and unlimited bookmarks. Modifiying two values at the top of the main activity "barebones" will turn this into the paid version.
|
I make money off a similar paid version which currently has unlimited tabs and unlimited bookmarks. Modifiying two values at the top of the main activity "barebones" will turn this into the paid version.
|
||||||
Change static public int MAX_TABS and MAX_BOOKMARKS from 5 to 50 and you have the paid version.
|
Change static public int MAX_TABS and MAX_BOOKMARKS from 5 to 50 and you have the paid version.
|
||||||
|
|
||||||
|
|
||||||
Current issues:
|
|
||||||
- it doesn't open apps that belong to links like market:// youtube:// etc...
|
|
||||||
- can't set bookmarks as default view in fullscreen
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shareInterpolator="false">
|
||||||
<translate android:fromYDelta="-50%p"
|
<translate android:fromYDelta="-50%" android:toYDelta="0"
|
||||||
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
android:duration="@android:integer/config_shortAnimTime"/>
|
||||||
|
<alpha android:fromAlpha="0.25" android:toAlpha="1.0"
|
||||||
android:interpolator="@android:anim/linear_interpolator"
|
android:interpolator="@android:anim/linear_interpolator"
|
||||||
android:toYDelta="0%p" android:duration="500" />
|
android:duration="@android:integer/config_shortAnimTime" />
|
||||||
</set>
|
</set>
|
@ -1,9 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shareInterpolator="false">
|
||||||
<translate android:fromYDelta="0%p"
|
<translate android:fromYDelta="0" android:toYDelta="-50%"
|
||||||
android:toYDelta="-50%p"
|
android:interpolator="@android:anim/decelerate_interpolator"
|
||||||
|
android:duration="@android:integer/config_shortAnimTime"/>
|
||||||
|
<alpha android:fromAlpha="1.0" android:toAlpha="0.25"
|
||||||
android:interpolator="@android:anim/linear_interpolator"
|
android:interpolator="@android:anim/linear_interpolator"
|
||||||
android:duration="500" />
|
android:duration="@android:integer/config_shortAnimTime" />
|
||||||
</set>
|
</set>
|
Binary file not shown.
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 8.0 KiB |
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -53,6 +54,7 @@ import android.view.View.OnClickListener;
|
|||||||
import android.view.View.OnKeyListener;
|
import android.view.View.OnKeyListener;
|
||||||
import android.view.View.OnLongClickListener;
|
import android.view.View.OnLongClickListener;
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.Animation.AnimationListener;
|
import android.view.animation.Animation.AnimationListener;
|
||||||
@ -99,6 +101,8 @@ public class Barebones extends Activity {
|
|||||||
public class CustomChromeClient extends WebChromeClient {
|
public class CustomChromeClient extends WebChromeClient {
|
||||||
private Bitmap mDefaultVideoPoster;
|
private Bitmap mDefaultVideoPoster;
|
||||||
private View mVideoProgressView;
|
private View mVideoProgressView;
|
||||||
|
private FrameLayout fullScreenContainer;
|
||||||
|
private int orientation;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExceededDatabaseQuota(String url,
|
public void onExceededDatabaseQuota(String url,
|
||||||
@ -119,6 +123,7 @@ public class Barebones extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseWindow(WebView window) {
|
public void onCloseWindow(WebView window) {
|
||||||
|
closeWindow = window.getId();
|
||||||
browserHandler.sendEmptyMessage(2);
|
browserHandler.sendEmptyMessage(2);
|
||||||
super.onCloseWindow(window);
|
super.onCloseWindow(window);
|
||||||
}
|
}
|
||||||
@ -151,6 +156,7 @@ public class Barebones extends Activity {
|
|||||||
transport.setWebView(main[pageId]);
|
transport.setWebView(main[pageId]);
|
||||||
resultMsg.sendToTarget();
|
resultMsg.sendToTarget();
|
||||||
browserHandler.postDelayed(new Runnable() {
|
browserHandler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
main[pageId].loadUrl(getUrl.getText().toString());
|
main[pageId].loadUrl(getUrl.getText().toString());
|
||||||
}
|
}
|
||||||
@ -166,14 +172,12 @@ public class Barebones extends Activity {
|
|||||||
callback.invoke(origin, false, false);
|
callback.invoke(origin, false, false);
|
||||||
}
|
}
|
||||||
if (allowLocation) {
|
if (allowLocation) {
|
||||||
|
|
||||||
Log.i("Barebones: ", "onGeolocationPermissionsShowPrompt()");
|
|
||||||
|
|
||||||
final boolean remember = true;
|
final boolean remember = true;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
||||||
builder.setTitle("Locations");
|
builder.setTitle("Locations");
|
||||||
|
String org = (String) origin.subSequence(0, 50);
|
||||||
builder.setMessage(
|
builder.setMessage(
|
||||||
origin + " Would like to use your Current Location ")
|
org + " Would like to use your Current Location ")
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton("Allow",
|
.setPositiveButton("Allow",
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@ -198,23 +202,19 @@ public class Barebones extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHideCustomView() {
|
public void onHideCustomView() {
|
||||||
|
if (mCustomView == null && mCustomViewCallback == null) {
|
||||||
if (mCustomView == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// Hide the custom view.
|
mCustomView.setKeepScreenOn(false);
|
||||||
mCustomView.setVisibility(View.GONE);
|
FrameLayout screen = (FrameLayout) getWindow().getDecorView();
|
||||||
|
screen.removeView(fullScreenContainer);
|
||||||
// Remove the custom view from its container.
|
fullScreenContainer = null;
|
||||||
background.removeView(mCustomView);
|
|
||||||
mCustomView = null;
|
mCustomView = null;
|
||||||
background.setVisibility(View.VISIBLE);
|
|
||||||
uBar.setVisibility(View.VISIBLE);
|
|
||||||
mCustomViewCallback.onCustomViewHidden();
|
mCustomViewCallback.onCustomViewHidden();
|
||||||
|
setRequestedOrientation(orientation);
|
||||||
main[pageId].setVisibility(View.VISIBLE);
|
background.addView(main[pageId]);
|
||||||
|
uBar.setVisibility(View.VISIBLE);
|
||||||
// Log.i(LOGTAG, "set it to webVew");
|
uBar.bringToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -239,36 +239,50 @@ public class Barebones extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onShowCustomView(View view, int requestedOrientation,
|
public void onShowCustomView(View view, int requestedOrientation,
|
||||||
CustomViewCallback callback) {
|
CustomViewCallback callback) {
|
||||||
// Log.i(LOGTAG, "here in on ShowCustomView");
|
|
||||||
main[pageId].setVisibility(View.GONE);
|
|
||||||
uBar.setVisibility(View.GONE);
|
|
||||||
// if a view already exists then immediately terminate the new one
|
|
||||||
if (mCustomView != null) {
|
if (mCustomView != null) {
|
||||||
callback.onCustomViewHidden();
|
callback.onCustomViewHidden();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
view.setKeepScreenOn(true);
|
||||||
background.addView(view);
|
orientation = getRequestedOrientation();
|
||||||
|
FrameLayout screen = (FrameLayout) getWindow().getDecorView();
|
||||||
|
fullScreenContainer = new FrameLayout(getBaseContext());
|
||||||
|
fullScreenContainer.setBackgroundColor(getResources().getColor(
|
||||||
|
R.color.black));
|
||||||
|
background.removeView(main[pageId]);
|
||||||
|
uBar.setVisibility(View.GONE);
|
||||||
|
fullScreenContainer.addView(view,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
screen.addView(fullScreenContainer,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
mCustomView = view;
|
mCustomView = view;
|
||||||
mCustomViewCallback = callback;
|
mCustomViewCallback = callback;
|
||||||
background.setVisibility(View.VISIBLE);
|
setRequestedOrientation(requestedOrientation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowCustomView(View view,
|
public void onShowCustomView(View view,
|
||||||
WebChromeClient.CustomViewCallback callback) {
|
WebChromeClient.CustomViewCallback callback) {
|
||||||
// Log.i(LOGTAG, "here in on ShowCustomView");
|
|
||||||
main[pageId].setVisibility(View.GONE);
|
|
||||||
uBar.setVisibility(View.GONE);
|
|
||||||
// if a view already exists then immediately terminate the new one
|
|
||||||
if (mCustomView != null) {
|
if (mCustomView != null) {
|
||||||
callback.onCustomViewHidden();
|
callback.onCustomViewHidden();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
background.addView(view);
|
view.setKeepScreenOn(true);
|
||||||
|
orientation = getRequestedOrientation();
|
||||||
|
FrameLayout screen = (FrameLayout) getWindow().getDecorView();
|
||||||
|
fullScreenContainer = new FrameLayout(getBaseContext());
|
||||||
|
fullScreenContainer.setBackgroundColor(getResources().getColor(
|
||||||
|
R.color.black));
|
||||||
|
background.removeView(main[pageId]);
|
||||||
|
uBar.setVisibility(View.GONE);
|
||||||
|
fullScreenContainer.addView(view,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
screen.addView(fullScreenContainer,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
mCustomView = view;
|
mCustomView = view;
|
||||||
mCustomViewCallback = callback;
|
mCustomViewCallback = callback;
|
||||||
background.setVisibility(View.VISIBLE);
|
setRequestedOrientation(getRequestedOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
|
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
|
||||||
@ -278,8 +292,7 @@ public class Barebones extends Activity {
|
|||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType("image/*");
|
i.setType("image/*");
|
||||||
Barebones.this.startActivityForResult(
|
Barebones.this.startActivityForResult(
|
||||||
Intent.createChooser(i, "Image Browser"),
|
Intent.createChooser(i, "File Browser"), 1);
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
||||||
@ -289,8 +302,7 @@ public class Barebones extends Activity {
|
|||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType("image/*");
|
i.setType("image/*");
|
||||||
Barebones.this.startActivityForResult(
|
Barebones.this.startActivityForResult(
|
||||||
Intent.createChooser(i, "Image Browser"),
|
Intent.createChooser(i, "File Browser"), 1);
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
||||||
@ -300,8 +312,7 @@ public class Barebones extends Activity {
|
|||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType("image/*");
|
i.setType("image/*");
|
||||||
Barebones.this.startActivityForResult(
|
Barebones.this.startActivityForResult(
|
||||||
Intent.createChooser(i, "Image Browser"),
|
Intent.createChooser(i, "File Browser"), 1);
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,8 +367,7 @@ public class Barebones extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
|
||||||
if (url.contains("market://")
|
if (url.contains("market://") || url.contains("play.google.com")) {
|
||||||
|| url.contains("play.google.com")) {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||||
return true;
|
return true;
|
||||||
} else if (url.contains("youtube.com")) {
|
} else if (url.contains("youtube.com")) {
|
||||||
@ -371,14 +381,23 @@ public class Barebones extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageFinished(WebView view, final String url) {
|
public void onScaleChanged(WebView view, float oldScale, float newScale) {
|
||||||
if (view.isShown()) {
|
if (view != null) {
|
||||||
view.invalidate();
|
view.invalidate();
|
||||||
|
}
|
||||||
|
super.onScaleChanged(view, oldScale, newScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, final String url) {
|
||||||
|
if (view != null) {
|
||||||
|
view.invalidate();
|
||||||
|
}
|
||||||
|
if (view.isShown()) {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
refresh.setVisibility(View.VISIBLE);
|
refresh.setVisibility(View.VISIBLE);
|
||||||
if (showFullScreen && uBar.isShown()) {
|
if (showFullScreen && uBar.isShown()) {
|
||||||
uBar.startAnimation(slideUp);
|
uBar.startAnimation(slideUp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
@ -416,8 +435,8 @@ public class Barebones extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedSslError(WebView view, final SslErrorHandler handler,
|
public void onReceivedSslError(WebView view,
|
||||||
SslError error) {
|
final SslErrorHandler handler, SslError error) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
||||||
builder.setTitle("Warning");
|
builder.setTitle("Warning");
|
||||||
builder.setMessage(
|
builder.setMessage(
|
||||||
@ -444,21 +463,12 @@ public class Barebones extends Activity {
|
|||||||
super.onReceivedSslError(view, handler, error);
|
super.onReceivedSslError(view, handler, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScaleChanged(WebView view, float oldScale, float newScale) {
|
|
||||||
|
|
||||||
view.getSettings().setLayoutAlgorithm(
|
|
||||||
LayoutAlgorithm.NORMAL);
|
|
||||||
super.onScaleChanged(view, oldScale, newScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFormResubmission(WebView view, final Message dontResend,
|
public void onFormResubmission(WebView view, final Message dontResend,
|
||||||
final Message resend) {
|
final Message resend) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
||||||
builder.setTitle("Resend Data");
|
builder.setTitle("Form Resubmission");
|
||||||
builder.setMessage(
|
builder.setMessage("Would you like to resend the data?")
|
||||||
"Would you like to resend data?")
|
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton("Yes",
|
.setPositiveButton("Yes",
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@ -658,6 +668,14 @@ public class Barebones extends Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeView(WebView view) {
|
||||||
|
if (!showFullScreen) {
|
||||||
|
view.startAnimation(fadeOut);
|
||||||
|
}
|
||||||
|
background.removeView(view);
|
||||||
|
uBar.bringToFront();
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteBookmark(String url) {
|
private void deleteBookmark(String url) {
|
||||||
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
||||||
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
||||||
@ -1000,7 +1018,8 @@ public class Barebones extends Activity {
|
|||||||
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
||||||
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
||||||
try {
|
try {
|
||||||
BufferedReader readUrlRead = new BufferedReader(new FileReader(bookUrl));
|
BufferedReader readUrlRead = new BufferedReader(new FileReader(
|
||||||
|
bookUrl));
|
||||||
String u;
|
String u;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while ((u = readUrlRead.readLine()) != null && n < MAX_BOOKMARKS) {
|
while ((u = readUrlRead.readLine()) != null && n < MAX_BOOKMARKS) {
|
||||||
@ -1089,7 +1108,6 @@ public class Barebones extends Activity {
|
|||||||
webViewSettings.setSavePassword(true);
|
webViewSettings.setSavePassword(true);
|
||||||
webViewSettings.setSaveFormData(true);
|
webViewSettings.setSaveFormData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
webViewSettings.setBuiltInZoomControls(true);
|
webViewSettings.setBuiltInZoomControls(true);
|
||||||
webViewSettings.setSupportZoom(true);
|
webViewSettings.setSupportZoom(true);
|
||||||
webViewSettings.setUseWideViewPort(true);
|
webViewSettings.setUseWideViewPort(true);
|
||||||
@ -1124,7 +1142,7 @@ public class Barebones extends Activity {
|
|||||||
void deleteTab(final int del) {
|
void deleteTab(final int del) {
|
||||||
main[del].stopLoading();
|
main[del].stopLoading();
|
||||||
main[del].clearHistory();
|
main[del].clearHistory();
|
||||||
main[del].clearView();
|
// main[del].clearView();
|
||||||
urlToLoad[del][0] = null;
|
urlToLoad[del][0] = null;
|
||||||
urlToLoad[del][1] = null;
|
urlToLoad[del][1] = null;
|
||||||
if (API >= 11) {
|
if (API >= 11) {
|
||||||
@ -1139,7 +1157,6 @@ public class Barebones extends Activity {
|
|||||||
}
|
}
|
||||||
urlTitle[del].setPadding(leftPad, 0, rightPad, 0);
|
urlTitle[del].setPadding(leftPad, 0, rightPad, 0);
|
||||||
Animation yolo = AnimationUtils.loadAnimation(this, R.anim.down);
|
Animation yolo = AnimationUtils.loadAnimation(this, R.anim.down);
|
||||||
|
|
||||||
yolo.setAnimationListener(new AnimationListener() {
|
yolo.setAnimationListener(new AnimationListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1159,7 +1176,7 @@ public class Barebones extends Activity {
|
|||||||
|
|
||||||
});
|
});
|
||||||
urlTitle[del].startAnimation(yolo);
|
urlTitle[del].startAnimation(yolo);
|
||||||
|
uBar.bringToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -1169,7 +1186,8 @@ public class Barebones extends Activity {
|
|||||||
if (id == pageId) {
|
if (id == pageId) {
|
||||||
|
|
||||||
if (main[id].isShown()) {
|
if (main[id].isShown()) {
|
||||||
background.removeView(main[id]);
|
// background.removeView(main[id]);
|
||||||
|
removeView(main[id]);
|
||||||
}
|
}
|
||||||
for (; id <= (number - 1); id++) {
|
for (; id <= (number - 1); id++) {
|
||||||
if (urlTitle[id].isShown()) {
|
if (urlTitle[id].isShown()) {
|
||||||
@ -1186,6 +1204,13 @@ public class Barebones extends Activity {
|
|||||||
setUrlText(urlToLoad[pageId][0]);
|
setUrlText(urlToLoad[pageId][0]);
|
||||||
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
||||||
right = true;
|
right = true;
|
||||||
|
if (main[id].getProgress() < 100) {
|
||||||
|
refresh.setVisibility(View.INVISIBLE);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
refresh.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1207,6 +1232,13 @@ public class Barebones extends Activity {
|
|||||||
setUrlText(urlToLoad[pageId][0]);
|
setUrlText(urlToLoad[pageId][0]);
|
||||||
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
||||||
left = true;
|
left = true;
|
||||||
|
if (main[leftId].getProgress() < 100) {
|
||||||
|
refresh.setVisibility(View.INVISIBLE);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
refresh.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1221,6 +1253,7 @@ public class Barebones extends Activity {
|
|||||||
if (!(right || left)) {
|
if (!(right || left)) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
uBar.bringToFront();
|
||||||
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1379,7 +1412,7 @@ public class Barebones extends Activity {
|
|||||||
} catch (IllegalStateException ignored) {
|
} catch (IllegalStateException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUrl.setThreshold(2);
|
getUrl.setThreshold(1);
|
||||||
getUrl.setTokenizer(new SpaceTokenizer());
|
getUrl.setTokenizer(new SpaceTokenizer());
|
||||||
getUrl.setOnItemClickListener(new OnItemClickListener() {
|
getUrl.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
|
||||||
@ -1395,7 +1428,6 @@ public class Barebones extends Activity {
|
|||||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
|
|
||||||
Log.e("Barebones Error: ",
|
Log.e("Barebones Error: ",
|
||||||
"NullPointerException on item click");
|
"NullPointerException on item click");
|
||||||
}
|
}
|
||||||
@ -1650,7 +1682,6 @@ public class Barebones extends Activity {
|
|||||||
tenPad = (int) (10 * scale + 0.5f);
|
tenPad = (int) (10 * scale + 0.5f);
|
||||||
number = 0;
|
number = 0;
|
||||||
|
|
||||||
|
|
||||||
webpageOther = getResources().getDrawable(R.drawable.webpage);
|
webpageOther = getResources().getDrawable(R.drawable.webpage);
|
||||||
incognitoPage = getResources().getDrawable(R.drawable.incognito);
|
incognitoPage = getResources().getDrawable(R.drawable.incognito);
|
||||||
webpageOther.setBounds(0, 0, width / 2, height / 2);
|
webpageOther.setBounds(0, 0, width / 2, height / 2);
|
||||||
@ -1676,6 +1707,7 @@ public class Barebones extends Activity {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
newTab(number, homepage, true, false);
|
newTab(number, homepage, true, false);
|
||||||
tabScroll.postDelayed(new Runnable() {
|
tabScroll.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
||||||
}
|
}
|
||||||
@ -2005,22 +2037,27 @@ public class Barebones extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
|
||||||
|
if (main[pageId] != null) {
|
||||||
main[pageId].stopLoading();
|
main[pageId].stopLoading();
|
||||||
|
|
||||||
|
if (showFullScreen && !uBar.isShown()) {
|
||||||
|
uBar.startAnimation(slideDown);
|
||||||
|
}
|
||||||
if (main[pageId].canGoBack()) {
|
if (main[pageId].canGoBack()) {
|
||||||
main[pageId].goBack();
|
main[pageId].goBack();
|
||||||
} else {
|
} else {
|
||||||
deleteTab(pageId);
|
deleteTab(pageId);
|
||||||
uBar.bringToFront();
|
uBar.bringToFront();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
main[pageId].getSettings().setLayoutAlgorithm(
|
main[pageId].getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
|
||||||
LayoutAlgorithm.NORMAL);
|
|
||||||
// main[pageId].invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -2104,10 +2141,8 @@ public class Barebones extends Activity {
|
|||||||
|
|
||||||
String url = intent.getDataString();
|
String url = intent.getDataString();
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
for(int n=0;n<MAX_TABS;n++){
|
|
||||||
newTab(number, url, true, false);
|
newTab(number, url, true, false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2247,7 +2282,8 @@ public class Barebones extends Activity {
|
|||||||
share();
|
share();
|
||||||
return true;
|
return true;
|
||||||
case R.id.incognito:
|
case R.id.incognito:
|
||||||
startActivity(new Intent(FinalVars.INCOGNITO_INTENT));
|
startActivity(new Intent(
|
||||||
|
FinalVars.INCOGNITO_INTENT));
|
||||||
// newTab(number, homepage, true, true);
|
// newTab(number, homepage, true, true);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
@ -8,7 +8,7 @@ class BookmarkPage {
|
|||||||
+ "body{color: gray;}"
|
+ "body{color: gray;}"
|
||||||
+ "div {vertical-align: middle;background-color: #ffffff;}"
|
+ "div {vertical-align: middle;background-color: #ffffff;}"
|
||||||
+ "div.clickable {position:relative;}"
|
+ "div.clickable {position:relative;}"
|
||||||
+ "p.font{font-size: 60px;font-family: \"Lucida Console\"}"
|
+ "p.font{font-size: xx-large;font-family: \"Lucida Console\"}"
|
||||||
+ "div.clickable a {position:absolute;width:100%;height:100%;top:0;left:0;text-decoration:none; z-index:10; background-color:white;opacity: 0; filter: alpha(opacity=1);}"
|
+ "div.clickable a {position:absolute;width:100%;height:100%;top:0;left:0;text-decoration:none; z-index:10; background-color:white;opacity: 0; filter: alpha(opacity=1);}"
|
||||||
+ "div.space {height: 10px;}"
|
+ "div.space {height: 10px;}"
|
||||||
+ "p{padding-top: 3mm;padding-bottom: 3mm;padding-right: 2mm;padding-left: 2mm;}"
|
+ "p{padding-top: 3mm;padding-bottom: 3mm;padding-right: 2mm;padding-left: 2mm;}"
|
||||||
@ -17,7 +17,7 @@ class BookmarkPage {
|
|||||||
public static final String Part1 = "<div class=\"clickable\">"
|
public static final String Part1 = "<div class=\"clickable\">"
|
||||||
+ "<div class=\"shadow\">" + "<p class=\"font\">" + "<a href=\"";
|
+ "<div class=\"shadow\">" + "<p class=\"font\">" + "<a href=\"";
|
||||||
public static final String Part2 = "\"></a>"+
|
public static final String Part2 = "\"></a>"+
|
||||||
"<img height=\"32\" width=\"32\" src='http://getfavicon.appspot.com/";
|
"<img height=\"25\" width=\"25\" src='http://getfavicon.appspot.com/";
|
||||||
public static final String Part3 = "'/>";
|
public static final String Part3 = "'/>";
|
||||||
public static final String Part4 = "</p></div></div>";
|
public static final String Part4 = "</p></div></div>";
|
||||||
public static final String End = "</body></html>";
|
public static final String End = "</body></html>";
|
||||||
|
@ -1,55 +1,68 @@
|
|||||||
package acr.browser.barebones;
|
package acr.browser.barebones;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ZoomButtonsController;
|
||||||
|
|
||||||
public final class CustomWebView extends WebView {
|
public final class CustomWebView extends WebView {
|
||||||
|
private float location;
|
||||||
|
private boolean first = false;
|
||||||
private final int API = FinalVars.API;
|
private final int API = FinalVars.API;
|
||||||
private int hitTest;
|
|
||||||
private final boolean showFullScreen = Barebones.showFullScreen;
|
private final boolean showFullScreen = Barebones.showFullScreen;
|
||||||
private final View uBar = Barebones.uBar;
|
private final View uBar = Barebones.uBar;
|
||||||
private final Animation slideUp = Barebones.slideUp;
|
private final Animation slideUp = Barebones.slideUp;
|
||||||
private final Animation slideDown = Barebones.slideDown;
|
private final Animation slideDown = Barebones.slideDown;
|
||||||
|
private ZoomButtonsController zoomControl;
|
||||||
public CustomWebView(Context context) {
|
public CustomWebView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
getControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
if(API<11&&zoomControl!=null){
|
||||||
|
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN: {
|
case MotionEvent.ACTION_DOWN: {
|
||||||
hitTest = 0;
|
first = true;
|
||||||
try {
|
|
||||||
hitTest = getHitTestResult().getType();
|
|
||||||
} catch (NullPointerException ignored) {
|
|
||||||
}
|
|
||||||
if (API <= 10 && !this.hasFocus()) {
|
if (API <= 10 && !this.hasFocus()) {
|
||||||
this.requestFocus();
|
this.requestFocus();
|
||||||
}
|
}
|
||||||
if (showFullScreen) {
|
location = event.getY();
|
||||||
if (uBar.isShown()) {
|
break;
|
||||||
|
}
|
||||||
|
case MotionEvent.ACTION_UP:{
|
||||||
|
if (showFullScreen&&first) {
|
||||||
|
if (uBar.isShown()&&this.getScrollY()<5) {
|
||||||
uBar.startAnimation(slideUp);
|
uBar.startAnimation(slideUp);
|
||||||
|
} else if (event.getY()>location && !uBar.isShown()) {
|
||||||
} else if (this.getScrollY() <= 5
|
|
||||||
&& !uBar.isShown() && hitTest != 9) {
|
|
||||||
uBar.startAnimation(slideDown);
|
uBar.startAnimation(slideDown);
|
||||||
|
} else if (event.getY()<location && uBar.isShown()){
|
||||||
|
uBar.startAnimation(slideUp);
|
||||||
}
|
}
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
private void getControls() {
|
||||||
|
if(API<11){
|
||||||
|
try {
|
||||||
|
Class<?> webview = Class.forName("android.webkit.WebView");
|
||||||
|
Method method = webview.getMethod("getZoomButtonsController");
|
||||||
|
zoomControl = (ZoomButtonsController) method.invoke(this, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ public class HistoryPage {
|
|||||||
+ "<head><meta content=\"en-us\" http-equiv=\"Content-Language\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" /><title>History</title></head><style>"
|
+ "<head><meta content=\"en-us\" http-equiv=\"Content-Language\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" /><title>History</title></head><style>"
|
||||||
+ "div.shadow {-moz-box-shadow: 0px 0px 6px #111;-webkit-box-shadow: 0px 0px 6px #111;box-shadow: 0px 0px 6px #111;}"
|
+ "div.shadow {-moz-box-shadow: 0px 0px 6px #111;-webkit-box-shadow: 0px 0px 6px #111;box-shadow: 0px 0px 6px #111;}"
|
||||||
+ "body{color: gray;}div.space {height: 10px;} div.extra{text-align: center;}div {vertical-align: middle;}"
|
+ "body{color: gray;}div.space {height: 10px;} div.extra{text-align: center;}div {vertical-align: middle;}"
|
||||||
+ "div {background-color: #ffffff;}div.clickable {position:relative;}p.black{color: black;font-size: 40px;font-family: \"Lucida Console\"}"
|
+ "div {background-color: #ffffff;}div.clickable {position:relative;}p.black{color: black;font-size: x-large;font-family: \"Lucida Console\"}"
|
||||||
+ "p.font{font-size: 25px;font-family: \"Lucida Console\"}p{padding-left: 1mm;padding-right: 1mm;padding-top: 1mm;padding-bottom: 1mm;}"
|
+ "p.font{font-size: large;font-family: \"Lucida Console\"}p{padding-left: 1mm;padding-right: 1mm;padding-top: 1mm;padding-bottom: 1mm;}"
|
||||||
+ "div.clickable a {position:absolute; width:100%;height:100%;top:0;left:0;text-decoration:none; z-index:10; background-color:white;opacity: 0;filter: alpha(opacity=1);}"
|
+ "div.clickable a {position:absolute; width:100%;height:100%;top:0;left:0;text-decoration:none; z-index:10; background-color:white;opacity: 0;filter: alpha(opacity=1);}"
|
||||||
+ "</style><body bgcolor = #f2f2f2>";
|
+ "</style><body bgcolor = #f2f2f2>";
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -51,6 +52,7 @@ import android.view.View.OnClickListener;
|
|||||||
import android.view.View.OnKeyListener;
|
import android.view.View.OnKeyListener;
|
||||||
import android.view.View.OnLongClickListener;
|
import android.view.View.OnLongClickListener;
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.Animation.AnimationListener;
|
import android.view.animation.Animation.AnimationListener;
|
||||||
@ -97,13 +99,14 @@ public class IncognitoMode extends Activity {
|
|||||||
public class CustomChromeClient extends WebChromeClient {
|
public class CustomChromeClient extends WebChromeClient {
|
||||||
private Bitmap mDefaultVideoPoster;
|
private Bitmap mDefaultVideoPoster;
|
||||||
private View mVideoProgressView;
|
private View mVideoProgressView;
|
||||||
|
private FrameLayout fullScreenContainer;
|
||||||
|
private int orientation;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExceededDatabaseQuota(String url,
|
public void onExceededDatabaseQuota(String url,
|
||||||
String databaseIdentifier, long quota,
|
String databaseIdentifier, long quota,
|
||||||
long estimatedDatabaseSize, long totalQuota,
|
long estimatedDatabaseSize, long totalQuota,
|
||||||
QuotaUpdater quotaUpdater) {
|
QuotaUpdater quotaUpdater) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
quotaUpdater.updateQuota(totalQuota + estimatedDatabaseSize);
|
quotaUpdater.updateQuota(totalQuota + estimatedDatabaseSize);
|
||||||
super.onExceededDatabaseQuota(url, databaseIdentifier, quota,
|
super.onExceededDatabaseQuota(url, databaseIdentifier, quota,
|
||||||
estimatedDatabaseSize, totalQuota, quotaUpdater);
|
estimatedDatabaseSize, totalQuota, quotaUpdater);
|
||||||
@ -112,14 +115,19 @@ public class IncognitoMode extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onReachedMaxAppCacheSize(long requiredStorage, long quota,
|
public void onReachedMaxAppCacheSize(long requiredStorage, long quota,
|
||||||
QuotaUpdater quotaUpdater) {
|
QuotaUpdater quotaUpdater) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
quotaUpdater.updateQuota(quota + requiredStorage);
|
quotaUpdater.updateQuota(quota + requiredStorage);
|
||||||
super.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
|
super.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCloseWindow(WebView window) {
|
||||||
|
closeWindow = window.getId();
|
||||||
|
browserHandler.sendEmptyMessage(2);
|
||||||
|
super.onCloseWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getDefaultVideoPoster() {
|
public Bitmap getDefaultVideoPoster() {
|
||||||
// Log.i(LOGTAG, "here in on getDefaultVideoPoster");
|
|
||||||
if (mDefaultVideoPoster == null) {
|
if (mDefaultVideoPoster == null) {
|
||||||
mDefaultVideoPoster = BitmapFactory.decodeResource(
|
mDefaultVideoPoster = BitmapFactory.decodeResource(
|
||||||
getResources(), android.R.color.black);
|
getResources(), android.R.color.black);
|
||||||
@ -129,8 +137,6 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getVideoLoadingProgressView() {
|
public View getVideoLoadingProgressView() {
|
||||||
// Log.i(LOGTAG, "here in on getVideoLoadingPregressView");
|
|
||||||
|
|
||||||
if (mVideoProgressView == null) {
|
if (mVideoProgressView == null) {
|
||||||
LayoutInflater inflater = LayoutInflater.from(getBaseContext());
|
LayoutInflater inflater = LayoutInflater.from(getBaseContext());
|
||||||
mVideoProgressView = inflater.inflate(
|
mVideoProgressView = inflater.inflate(
|
||||||
@ -142,30 +148,19 @@ public class IncognitoMode extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateWindow(WebView view, boolean isDialog,
|
public boolean onCreateWindow(WebView view, boolean isDialog,
|
||||||
boolean isUserGesture, final Message resultMsg) {
|
boolean isUserGesture, final Message resultMsg) {
|
||||||
if (isUserGesture) {
|
|
||||||
|
newTab(number, "", true);
|
||||||
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
|
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
|
||||||
transport.setWebView(main[pageId]);
|
transport.setWebView(main[pageId]);
|
||||||
resultMsg.sendToTarget();
|
resultMsg.sendToTarget();
|
||||||
Thread get = new Thread(new Runnable(){
|
browserHandler.postDelayed(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
try {
|
|
||||||
Thread.sleep(200);
|
|
||||||
main[pageId].loadUrl(getUrl.getText().toString());
|
main[pageId].loadUrl(getUrl.getText().toString());
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}, 500);
|
||||||
|
|
||||||
});
|
|
||||||
get.start();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGeolocationPermissionsShowPrompt(final String origin,
|
public void onGeolocationPermissionsShowPrompt(final String origin,
|
||||||
@ -175,21 +170,18 @@ public class IncognitoMode extends Activity {
|
|||||||
callback.invoke(origin, false, false);
|
callback.invoke(origin, false, false);
|
||||||
}
|
}
|
||||||
if (allowLocation) {
|
if (allowLocation) {
|
||||||
|
|
||||||
Log.i("IncognitoMode: ", "onGeolocationPermissionsShowPrompt()");
|
|
||||||
|
|
||||||
final boolean remember = true;
|
final boolean remember = true;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
||||||
builder.setTitle("Locations");
|
builder.setTitle("Locations");
|
||||||
|
String org = (String) origin.subSequence(0, 50);
|
||||||
builder.setMessage(
|
builder.setMessage(
|
||||||
origin + " Would like to use your Current Location ")
|
org + " Would like to use your Current Location ")
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton("Allow",
|
.setPositiveButton("Allow",
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog,
|
public void onClick(DialogInterface dialog,
|
||||||
int id) {
|
int id) {
|
||||||
// origin, allow, remember
|
|
||||||
callback.invoke(origin, true, remember);
|
callback.invoke(origin, true, remember);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -198,7 +190,6 @@ public class IncognitoMode extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog,
|
public void onClick(DialogInterface dialog,
|
||||||
int id) {
|
int id) {
|
||||||
// origin, allow, remember
|
|
||||||
callback.invoke(origin, false, remember);
|
callback.invoke(origin, false, remember);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -209,25 +200,20 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHideCustomView() {
|
public void onHideCustomView() {
|
||||||
|
if (mCustomView == null && mCustomViewCallback == null) {
|
||||||
if (mCustomView == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Hide the custom view.
|
|
||||||
mCustomView.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
// Remove the custom view from its container.
|
|
||||||
background.removeView(mCustomView);
|
|
||||||
mCustomView = null;
|
|
||||||
background.setVisibility(View.VISIBLE);
|
|
||||||
uBar.setVisibility(View.VISIBLE);
|
|
||||||
mCustomViewCallback.onCustomViewHidden();
|
|
||||||
|
|
||||||
main[pageId].setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
// Log.i(LOGTAG, "set it to webVew");
|
|
||||||
}
|
}
|
||||||
|
mCustomView.setKeepScreenOn(false);
|
||||||
|
FrameLayout screen = (FrameLayout) getWindow().getDecorView();
|
||||||
|
screen.removeView(fullScreenContainer);
|
||||||
|
fullScreenContainer = null;
|
||||||
|
mCustomView = null;
|
||||||
|
mCustomViewCallback.onCustomViewHidden();
|
||||||
|
setRequestedOrientation(orientation);
|
||||||
|
background.addView(main[pageId]);
|
||||||
|
uBar.setVisibility(View.VISIBLE);
|
||||||
|
uBar.bringToFront();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedTitle(final WebView view, final String title) {
|
public void onReceivedTitle(final WebView view, final String title) {
|
||||||
@ -240,36 +226,50 @@ public class IncognitoMode extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public void onShowCustomView(View view, int requestedOrientation,
|
public void onShowCustomView(View view, int requestedOrientation,
|
||||||
CustomViewCallback callback) {
|
CustomViewCallback callback) {
|
||||||
// Log.i(LOGTAG, "here in on ShowCustomView");
|
|
||||||
main[pageId].setVisibility(View.GONE);
|
|
||||||
uBar.setVisibility(View.GONE);
|
|
||||||
// if a view already exists then immediately terminate the new one
|
|
||||||
if (mCustomView != null) {
|
if (mCustomView != null) {
|
||||||
callback.onCustomViewHidden();
|
callback.onCustomViewHidden();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
view.setKeepScreenOn(true);
|
||||||
background.addView(view);
|
orientation = getRequestedOrientation();
|
||||||
|
FrameLayout screen = (FrameLayout) getWindow().getDecorView();
|
||||||
|
fullScreenContainer = new FrameLayout(getBaseContext());
|
||||||
|
fullScreenContainer.setBackgroundColor(getResources().getColor(
|
||||||
|
R.color.black));
|
||||||
|
background.removeView(main[pageId]);
|
||||||
|
uBar.setVisibility(View.GONE);
|
||||||
|
fullScreenContainer.addView(view,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
screen.addView(fullScreenContainer,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
mCustomView = view;
|
mCustomView = view;
|
||||||
mCustomViewCallback = callback;
|
mCustomViewCallback = callback;
|
||||||
background.setVisibility(View.VISIBLE);
|
setRequestedOrientation(requestedOrientation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowCustomView(View view,
|
public void onShowCustomView(View view,
|
||||||
WebChromeClient.CustomViewCallback callback) {
|
WebChromeClient.CustomViewCallback callback) {
|
||||||
// Log.i(LOGTAG, "here in on ShowCustomView");
|
|
||||||
main[pageId].setVisibility(View.GONE);
|
|
||||||
uBar.setVisibility(View.GONE);
|
|
||||||
// if a view already exists then immediately terminate the new one
|
|
||||||
if (mCustomView != null) {
|
if (mCustomView != null) {
|
||||||
callback.onCustomViewHidden();
|
callback.onCustomViewHidden();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
background.addView(view);
|
view.setKeepScreenOn(true);
|
||||||
|
orientation = getRequestedOrientation();
|
||||||
|
FrameLayout screen = (FrameLayout) getWindow().getDecorView();
|
||||||
|
fullScreenContainer = new FrameLayout(getBaseContext());
|
||||||
|
fullScreenContainer.setBackgroundColor(getResources().getColor(
|
||||||
|
R.color.black));
|
||||||
|
background.removeView(main[pageId]);
|
||||||
|
uBar.setVisibility(View.GONE);
|
||||||
|
fullScreenContainer.addView(view,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
screen.addView(fullScreenContainer,
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
mCustomView = view;
|
mCustomView = view;
|
||||||
mCustomViewCallback = callback;
|
mCustomViewCallback = callback;
|
||||||
background.setVisibility(View.VISIBLE);
|
setRequestedOrientation(getRequestedOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
|
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
|
||||||
@ -279,8 +279,7 @@ public class IncognitoMode extends Activity {
|
|||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType("image/*");
|
i.setType("image/*");
|
||||||
IncognitoMode.this.startActivityForResult(
|
IncognitoMode.this.startActivityForResult(
|
||||||
Intent.createChooser(i, "Image Browser"),
|
Intent.createChooser(i, "File Browser"), 1);
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
||||||
@ -290,8 +289,7 @@ public class IncognitoMode extends Activity {
|
|||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType("image/*");
|
i.setType("image/*");
|
||||||
IncognitoMode.this.startActivityForResult(
|
IncognitoMode.this.startActivityForResult(
|
||||||
Intent.createChooser(i, "Image Browser"),
|
Intent.createChooser(i, "File Browser"), 1);
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
public void openFileChooser(ValueCallback<Uri> uploadMsg,
|
||||||
@ -301,8 +299,7 @@ public class IncognitoMode extends Activity {
|
|||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType("image/*");
|
i.setType("image/*");
|
||||||
IncognitoMode.this.startActivityForResult(
|
IncognitoMode.this.startActivityForResult(
|
||||||
Intent.createChooser(i, "Image Browser"),
|
Intent.createChooser(i, "File Browser"), 1);
|
||||||
1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,16 +349,12 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CustomWebViewClient extends WebViewClient {
|
private class IncognitoWebViewClient extends WebViewClient {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
|
||||||
if (url.contains("plus.google.com")) {
|
if (url.contains("market://") || url.contains("play.google.com")) {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
|
||||||
return true;
|
|
||||||
} else if (url.contains("market://")
|
|
||||||
|| url.contains("play.google.com")) {
|
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||||
return true;
|
return true;
|
||||||
} else if (url.contains("youtube.com")) {
|
} else if (url.contains("youtube.com")) {
|
||||||
@ -371,19 +364,27 @@ public class IncognitoMode extends Activity {
|
|||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScaleChanged(WebView view, float oldScale, float newScale) {
|
||||||
|
if (view != null) {
|
||||||
|
view.invalidate();
|
||||||
|
}
|
||||||
|
super.onScaleChanged(view, oldScale, newScale);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageFinished(WebView view, final String url) {
|
public void onPageFinished(WebView view, final String url) {
|
||||||
|
if (view != null) {
|
||||||
|
view.invalidate();
|
||||||
|
}
|
||||||
if (view.isShown()) {
|
if (view.isShown()) {
|
||||||
view.postInvalidate();
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
refresh.setVisibility(View.VISIBLE);
|
refresh.setVisibility(View.VISIBLE);
|
||||||
if (showFullScreen && uBar.isShown()) {
|
if (showFullScreen && uBar.isShown()) {
|
||||||
uBar.startAnimation(slideUp);
|
uBar.startAnimation(slideUp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
view.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||||
@ -402,6 +403,7 @@ public class IncognitoMode extends Activity {
|
|||||||
setUrlText(url);
|
setUrlText(url);
|
||||||
pageIsLoading = true;
|
pageIsLoading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
urlTitle[numberPage].setCompoundDrawables(incognitoPage, null,
|
urlTitle[numberPage].setCompoundDrawables(incognitoPage, null,
|
||||||
exitTab, null);
|
exitTab, null);
|
||||||
|
|
||||||
@ -414,22 +416,66 @@ public class IncognitoMode extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedSslError(WebView view, SslErrorHandler handler,
|
public void onReceivedSslError(WebView view,
|
||||||
SslError error) {
|
final SslErrorHandler handler, SslError error) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
||||||
|
builder.setTitle("Warning");
|
||||||
|
builder.setMessage(
|
||||||
|
"The certificate of the site is not trusted. Proceed anyway?")
|
||||||
|
.setCancelable(true)
|
||||||
|
.setPositiveButton("Yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int id) {
|
||||||
handler.proceed();
|
handler.proceed();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("No",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int id) {
|
||||||
|
handler.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
super.onReceivedSslError(view, handler, error);
|
super.onReceivedSslError(view, handler, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScaleChanged(WebView view, float oldScale, float newScale) {
|
public void onFormResubmission(WebView view, final Message dontResend,
|
||||||
|
final Message resend) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
|
||||||
|
builder.setTitle("Form Resubmission");
|
||||||
|
builder.setMessage("Would you like to resend the data?")
|
||||||
|
.setCancelable(true)
|
||||||
|
.setPositiveButton("Yes",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int id) {
|
||||||
|
|
||||||
view.getSettings().setLayoutAlgorithm(
|
resend.sendToTarget();
|
||||||
LayoutAlgorithm.NORMAL);
|
}
|
||||||
super.onScaleChanged(view, oldScale, newScale);
|
})
|
||||||
|
.setNegativeButton("No",
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int id) {
|
||||||
|
|
||||||
|
dontResend.sendToTarget();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AlertDialog alert = builder.create();
|
||||||
|
alert.show();
|
||||||
|
super.onFormResubmission(view, dontResend, resend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateHistory(final CustomWebView view) {
|
private void generateHistory(final IncognitoWebView view) {
|
||||||
|
|
||||||
Thread history = new Thread(new Runnable() {
|
Thread history = new Thread(new Runnable() {
|
||||||
|
|
||||||
@ -603,6 +649,14 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeView(WebView view) {
|
||||||
|
if (!showFullScreen) {
|
||||||
|
view.startAnimation(fadeOut);
|
||||||
|
}
|
||||||
|
background.removeView(view);
|
||||||
|
uBar.bringToFront();
|
||||||
|
}
|
||||||
|
|
||||||
private void deleteBookmark(String url) {
|
private void deleteBookmark(String url) {
|
||||||
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
||||||
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
||||||
@ -662,7 +716,7 @@ public class IncognitoMode extends Activity {
|
|||||||
switch (which) {
|
switch (which) {
|
||||||
case DialogInterface.BUTTON_POSITIVE: {
|
case DialogInterface.BUTTON_POSITIVE: {
|
||||||
int num = pageId;
|
int num = pageId;
|
||||||
newTab(number, result.getExtra(), false, true);
|
newTab(number, result.getExtra(), false);
|
||||||
// urlTitle[num].performClick();
|
// urlTitle[num].performClick();
|
||||||
pageId = num;
|
pageId = num;
|
||||||
break;
|
break;
|
||||||
@ -700,7 +754,7 @@ public class IncognitoMode extends Activity {
|
|||||||
switch (which) {
|
switch (which) {
|
||||||
case DialogInterface.BUTTON_POSITIVE: {
|
case DialogInterface.BUTTON_POSITIVE: {
|
||||||
int num = pageId;
|
int num = pageId;
|
||||||
newTab(number, result.getExtra(), false, true);
|
newTab(number, result.getExtra(), false);
|
||||||
// urlTitle[num].performClick();
|
// urlTitle[num].performClick();
|
||||||
pageId = num;
|
pageId = num;
|
||||||
break;
|
break;
|
||||||
@ -783,7 +837,7 @@ public class IncognitoMode extends Activity {
|
|||||||
switch (which) {
|
switch (which) {
|
||||||
case DialogInterface.BUTTON_POSITIVE: {
|
case DialogInterface.BUTTON_POSITIVE: {
|
||||||
int num = pageId;
|
int num = pageId;
|
||||||
newTab(number, result.getExtra(), false, true);
|
newTab(number, result.getExtra(), false);
|
||||||
// urlTitle[num].performClick();
|
// urlTitle[num].performClick();
|
||||||
pageId = num;
|
pageId = num;
|
||||||
break;
|
break;
|
||||||
@ -838,7 +892,7 @@ public class IncognitoMode extends Activity {
|
|||||||
private static SimpleAdapter adapter;
|
private static SimpleAdapter adapter;
|
||||||
private static MultiAutoCompleteTextView getUrl;
|
private static MultiAutoCompleteTextView getUrl;
|
||||||
private static final TextView[] urlTitle = new TextView[MAX_TABS];
|
private static final TextView[] urlTitle = new TextView[MAX_TABS];
|
||||||
private static final CustomWebView[] main = new CustomWebView[MAX_TABS];
|
private static final IncognitoWebView[] main = new IncognitoWebView[MAX_TABS];
|
||||||
private static Rect bounds;
|
private static Rect bounds;
|
||||||
private static ValueCallback<Uri> mUploadMessage;
|
private static ValueCallback<Uri> mUploadMessage;
|
||||||
private static ImageView refresh;
|
private static ImageView refresh;
|
||||||
@ -864,6 +918,7 @@ public class IncognitoMode extends Activity {
|
|||||||
private static int tenPad;
|
private static int tenPad;
|
||||||
private static int urlColumn;
|
private static int urlColumn;
|
||||||
private static int titleColumn;
|
private static int titleColumn;
|
||||||
|
private static int closeWindow;
|
||||||
private static View mCustomView = null;
|
private static View mCustomView = null;
|
||||||
private static CustomViewCallback mCustomViewCallback;
|
private static CustomViewCallback mCustomViewCallback;
|
||||||
private static boolean isPhone = false;
|
private static boolean isPhone = false;
|
||||||
@ -900,7 +955,7 @@ public class IncognitoMode extends Activity {
|
|||||||
private static List<Map<String, String>> list;
|
private static List<Map<String, String>> list;
|
||||||
private static Map<String, String> map;
|
private static Map<String, String> map;
|
||||||
|
|
||||||
private static Handler handler;
|
private static Handler handler, browserHandler;
|
||||||
|
|
||||||
private static DatabaseHandler historyHandler;
|
private static DatabaseHandler historyHandler;
|
||||||
|
|
||||||
@ -923,8 +978,45 @@ public class IncognitoMode extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addBookmark() {
|
||||||
|
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
||||||
|
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
||||||
|
try {
|
||||||
|
BufferedReader readUrlRead = new BufferedReader(new FileReader(
|
||||||
|
bookUrl));
|
||||||
|
String u;
|
||||||
|
int n = 0;
|
||||||
|
while ((u = readUrlRead.readLine()) != null && n < MAX_BOOKMARKS) {
|
||||||
|
if (u.contentEquals(urlToLoad[pageId][0])) {
|
||||||
|
|
||||||
|
readUrlRead.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
readUrlRead.close();
|
||||||
|
} catch (FileNotFoundException ignored) {
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
BufferedWriter bookWriter = new BufferedWriter(new FileWriter(book,
|
||||||
|
true));
|
||||||
|
BufferedWriter urlWriter = new BufferedWriter(new FileWriter(
|
||||||
|
bookUrl, true));
|
||||||
|
bookWriter.write(urlToLoad[pageId][1]);
|
||||||
|
urlWriter.write(urlToLoad[pageId][0]);
|
||||||
|
bookWriter.newLine();
|
||||||
|
urlWriter.newLine();
|
||||||
|
bookWriter.close();
|
||||||
|
urlWriter.close();
|
||||||
|
} catch (FileNotFoundException ignored) {
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
} catch (NullPointerException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
CustomWebView browserSettings(CustomWebView view) {
|
IncognitoWebView browserSettings(IncognitoWebView view) {
|
||||||
view.setAnimationCacheEnabled(false);
|
view.setAnimationCacheEnabled(false);
|
||||||
view.setDrawingCacheEnabled(false);
|
view.setDrawingCacheEnabled(false);
|
||||||
view.setDrawingCacheBackgroundColor(getResources().getColor(
|
view.setDrawingCacheBackgroundColor(getResources().getColor(
|
||||||
@ -946,18 +1038,18 @@ public class IncognitoMode extends Activity {
|
|||||||
webViewSettings.setBlockNetworkImage(false);
|
webViewSettings.setBlockNetworkImage(false);
|
||||||
webViewSettings.setAllowFileAccess(true);
|
webViewSettings.setAllowFileAccess(true);
|
||||||
webViewSettings.setLightTouchEnabled(true);
|
webViewSettings.setLightTouchEnabled(true);
|
||||||
webViewSettings.setSupportMultipleWindows(false);
|
webViewSettings.setSupportMultipleWindows(true);
|
||||||
webViewSettings.setDomStorageEnabled(true);
|
webViewSettings.setDomStorageEnabled(true);
|
||||||
webViewSettings.setAppCacheEnabled(true);
|
webViewSettings.setAppCacheEnabled(true);
|
||||||
webViewSettings.setAppCachePath(getApplicationContext().getFilesDir()
|
webViewSettings.setAppCachePath(getApplicationContext().getFilesDir()
|
||||||
.getAbsolutePath() + "/incognito_cache");
|
.getAbsolutePath() + "/cache");
|
||||||
webViewSettings.setRenderPriority(RenderPriority.HIGH);
|
webViewSettings.setRenderPriority(RenderPriority.HIGH);
|
||||||
webViewSettings.setGeolocationEnabled(true);
|
webViewSettings.setGeolocationEnabled(true);
|
||||||
webViewSettings.setGeolocationDatabasePath(getApplicationContext()
|
webViewSettings.setGeolocationDatabasePath(getApplicationContext()
|
||||||
.getFilesDir().getAbsolutePath()+"/incognito_geolocation");
|
.getFilesDir().getAbsolutePath());
|
||||||
webViewSettings.setDatabaseEnabled(true);
|
webViewSettings.setDatabaseEnabled(true);
|
||||||
webViewSettings.setDatabasePath(getApplicationContext().getFilesDir()
|
webViewSettings.setDatabasePath(getApplicationContext().getFilesDir()
|
||||||
.getAbsolutePath() + "/incognito_databases");
|
.getAbsolutePath() + "/databases");
|
||||||
enableFlash = settings.getInt("enableflash", 0);
|
enableFlash = settings.getInt("enableflash", 0);
|
||||||
switch (enableFlash) {
|
switch (enableFlash) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -977,7 +1069,6 @@ public class IncognitoMode extends Activity {
|
|||||||
webViewSettings.setUserAgentString(userAgent);
|
webViewSettings.setUserAgentString(userAgent);
|
||||||
webViewSettings.setSavePassword(false);
|
webViewSettings.setSavePassword(false);
|
||||||
webViewSettings.setSaveFormData(false);
|
webViewSettings.setSaveFormData(false);
|
||||||
|
|
||||||
webViewSettings.setBuiltInZoomControls(true);
|
webViewSettings.setBuiltInZoomControls(true);
|
||||||
webViewSettings.setSupportZoom(true);
|
webViewSettings.setSupportZoom(true);
|
||||||
webViewSettings.setUseWideViewPort(true);
|
webViewSettings.setUseWideViewPort(true);
|
||||||
@ -1012,7 +1103,7 @@ public class IncognitoMode extends Activity {
|
|||||||
void deleteTab(final int del) {
|
void deleteTab(final int del) {
|
||||||
main[del].stopLoading();
|
main[del].stopLoading();
|
||||||
main[del].clearHistory();
|
main[del].clearHistory();
|
||||||
main[del].clearView();
|
// main[del].clearView();
|
||||||
urlToLoad[del][0] = null;
|
urlToLoad[del][0] = null;
|
||||||
urlToLoad[del][1] = null;
|
urlToLoad[del][1] = null;
|
||||||
if (API >= 11) {
|
if (API >= 11) {
|
||||||
@ -1027,7 +1118,6 @@ public class IncognitoMode extends Activity {
|
|||||||
}
|
}
|
||||||
urlTitle[del].setPadding(leftPad, 0, rightPad, 0);
|
urlTitle[del].setPadding(leftPad, 0, rightPad, 0);
|
||||||
Animation yolo = AnimationUtils.loadAnimation(this, R.anim.down);
|
Animation yolo = AnimationUtils.loadAnimation(this, R.anim.down);
|
||||||
|
|
||||||
yolo.setAnimationListener(new AnimationListener() {
|
yolo.setAnimationListener(new AnimationListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1047,7 +1137,7 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
});
|
});
|
||||||
urlTitle[del].startAnimation(yolo);
|
urlTitle[del].startAnimation(yolo);
|
||||||
|
uBar.bringToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -1057,7 +1147,8 @@ public class IncognitoMode extends Activity {
|
|||||||
if (id == pageId) {
|
if (id == pageId) {
|
||||||
|
|
||||||
if (main[id].isShown()) {
|
if (main[id].isShown()) {
|
||||||
background.removeView(main[id]);
|
// background.removeView(main[id]);
|
||||||
|
removeView(main[id]);
|
||||||
}
|
}
|
||||||
for (; id <= (number - 1); id++) {
|
for (; id <= (number - 1); id++) {
|
||||||
if (urlTitle[id].isShown()) {
|
if (urlTitle[id].isShown()) {
|
||||||
@ -1074,6 +1165,13 @@ public class IncognitoMode extends Activity {
|
|||||||
setUrlText(urlToLoad[pageId][0]);
|
setUrlText(urlToLoad[pageId][0]);
|
||||||
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
||||||
right = true;
|
right = true;
|
||||||
|
if (main[id].getProgress() < 100) {
|
||||||
|
refresh.setVisibility(View.INVISIBLE);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
refresh.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1095,6 +1193,13 @@ public class IncognitoMode extends Activity {
|
|||||||
setUrlText(urlToLoad[pageId][0]);
|
setUrlText(urlToLoad[pageId][0]);
|
||||||
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
getUrl.setPadding(tenPad, 0, tenPad, 0);
|
||||||
left = true;
|
left = true;
|
||||||
|
if (main[leftId].getProgress() < 100) {
|
||||||
|
refresh.setVisibility(View.INVISIBLE);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
refresh.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1109,6 +1214,7 @@ public class IncognitoMode extends Activity {
|
|||||||
if (!(right || left)) {
|
if (!(right || left)) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
uBar.bringToFront();
|
||||||
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1248,7 +1354,7 @@ public class IncognitoMode extends Activity {
|
|||||||
} catch (IllegalStateException ignored) {
|
} catch (IllegalStateException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getUrl.setThreshold(2);
|
getUrl.setThreshold(1);
|
||||||
getUrl.setTokenizer(new SpaceTokenizer());
|
getUrl.setTokenizer(new SpaceTokenizer());
|
||||||
getUrl.setOnItemClickListener(new OnItemClickListener() {
|
getUrl.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
|
||||||
@ -1264,7 +1370,6 @@ public class IncognitoMode extends Activity {
|
|||||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
|
|
||||||
Log.e("IncognitoMode Error: ",
|
Log.e("IncognitoMode Error: ",
|
||||||
"NullPointerException on item click");
|
"NullPointerException on item click");
|
||||||
}
|
}
|
||||||
@ -1313,8 +1418,6 @@ public class IncognitoMode extends Activity {
|
|||||||
public void finish() {
|
public void finish() {
|
||||||
background.clearDisappearingChildren();
|
background.clearDisappearingChildren();
|
||||||
tabScroll.clearDisappearingChildren();
|
tabScroll.clearDisappearingChildren();
|
||||||
main[0].clearCache(true);
|
|
||||||
cookieManager.setAcceptCookie(true);
|
|
||||||
super.finish();
|
super.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1337,7 +1440,7 @@ public class IncognitoMode extends Activity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void goBookmarks(CustomWebView view) {
|
void goBookmarks(IncognitoWebView view) {
|
||||||
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
File book = new File(getBaseContext().getFilesDir(), "bookmarks");
|
||||||
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
File bookUrl = new File(getBaseContext().getFilesDir(), "bookurl");
|
||||||
try {
|
try {
|
||||||
@ -1365,9 +1468,6 @@ public class IncognitoMode extends Activity {
|
|||||||
DisplayMetrics metrics = new DisplayMetrics();
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
||||||
historyHandler = new DatabaseHandler(this);
|
historyHandler = new DatabaseHandler(this);
|
||||||
CookieSyncManager.createInstance(CONTEXT);
|
|
||||||
cookieManager = CookieManager.getInstance();
|
|
||||||
cookieManager.setAcceptCookie(false);
|
|
||||||
|
|
||||||
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
|
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
|
||||||
if (API >= 11) {
|
if (API >= 11) {
|
||||||
@ -1450,7 +1550,6 @@ public class IncognitoMode extends Activity {
|
|||||||
allowLocation = settings.getBoolean("location", false); // initializing
|
allowLocation = settings.getBoolean("location", false); // initializing
|
||||||
// location
|
// location
|
||||||
// variable
|
// variable
|
||||||
|
|
||||||
enableFlash = settings.getInt("enableflash", 0); // enable flash
|
enableFlash = settings.getInt("enableflash", 0); // enable flash
|
||||||
// boolean
|
// boolean
|
||||||
agentPicker = settings.getInt("agentchoose", 1); // which user agent to
|
agentPicker = settings.getInt("agentchoose", 1); // which user agent to
|
||||||
@ -1458,7 +1557,6 @@ public class IncognitoMode extends Activity {
|
|||||||
// 2=desktop,
|
// 2=desktop,
|
||||||
// 3=custom
|
// 3=custom
|
||||||
|
|
||||||
|
|
||||||
// initializing variables declared
|
// initializing variables declared
|
||||||
|
|
||||||
height = getResources().getDrawable(R.drawable.loading)
|
height = getResources().getDrawable(R.drawable.loading)
|
||||||
@ -1495,7 +1593,6 @@ public class IncognitoMode extends Activity {
|
|||||||
tenPad = (int) (10 * scale + 0.5f);
|
tenPad = (int) (10 * scale + 0.5f);
|
||||||
number = 0;
|
number = 0;
|
||||||
|
|
||||||
|
|
||||||
webpageOther = getResources().getDrawable(R.drawable.webpage);
|
webpageOther = getResources().getDrawable(R.drawable.webpage);
|
||||||
incognitoPage = getResources().getDrawable(R.drawable.incognito);
|
incognitoPage = getResources().getDrawable(R.drawable.incognito);
|
||||||
webpageOther.setBounds(0, 0, width / 2, height / 2);
|
webpageOther.setBounds(0, 0, width / 2, height / 2);
|
||||||
@ -1519,8 +1616,9 @@ public class IncognitoMode extends Activity {
|
|||||||
newTab.setOnClickListener(new OnClickListener() {
|
newTab.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
newTab(number, homepage, true, true);
|
newTab(number, homepage, true);
|
||||||
tabScroll.postDelayed(new Runnable() {
|
tabScroll.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
tabScroll.smoothScrollTo(urlTitle[pageId].getLeft(), 0);
|
||||||
}
|
}
|
||||||
@ -1548,7 +1646,25 @@ public class IncognitoMode extends Activity {
|
|||||||
bg.removeView(uBar);
|
bg.removeView(uBar);
|
||||||
background.addView(uBar);
|
background.addView(uBar);
|
||||||
}
|
}
|
||||||
|
browserHandler = new Handler() {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
switch (msg.what) {
|
||||||
|
case 1: {
|
||||||
|
main[pageId].loadUrl(getUrl.getText().toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
deleteTab(closeWindow);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
main[pageId].invalidate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void initializeTabs() {
|
void initializeTabs() {
|
||||||
@ -1556,24 +1672,24 @@ public class IncognitoMode extends Activity {
|
|||||||
String URL = url.getDataString();
|
String URL = url.getDataString();
|
||||||
if (URL != null) {
|
if (URL != null) {
|
||||||
// opens a new tab with the url if its there
|
// opens a new tab with the url if its there
|
||||||
newTab(number, URL, true, true);
|
newTab(number, URL, true);
|
||||||
main[number - 1].resumeTimers();
|
main[number - 1].resumeTimers();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// otherwise it opens the homepage
|
// otherwise it opens the homepage
|
||||||
newTab(number, homepage, true, true);
|
newTab(number, homepage, true);
|
||||||
main[number - 1].resumeTimers();
|
main[number - 1].resumeTimers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomWebView makeTab(final int pageToView, final String Url,
|
private IncognitoWebView makeTab(final int pageToView, final String Url,
|
||||||
final boolean display) {
|
final boolean display) {
|
||||||
CustomWebView view = new CustomWebView(CONTEXT);
|
IncognitoWebView view = new IncognitoWebView(CONTEXT);
|
||||||
view.setId(pageToView);
|
view.setId(pageToView);
|
||||||
allowLocation = settings.getBoolean("location", false);
|
allowLocation = settings.getBoolean("location", false);
|
||||||
view.setWebViewClient(new CustomWebViewClient());
|
view.setWebViewClient(new IncognitoWebViewClient());
|
||||||
view.setWebChromeClient(new CustomChromeClient());
|
view.setWebChromeClient(new CustomChromeClient());
|
||||||
if (API > 8) {
|
if (API > 8) {
|
||||||
view.setDownloadListener(new CustomDownloadListener());
|
view.setDownloadListener(new CustomDownloadListener());
|
||||||
@ -1623,8 +1739,7 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
// new tab method, takes the id of the tab to be created and the url to load
|
// new tab method, takes the id of the tab to be created and the url to load
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
int newTab(int theId, final String theUrl, final boolean display,
|
int newTab(int theId, final String theUrl, final boolean display) {
|
||||||
final boolean incognito_mode) {
|
|
||||||
Log.i("IncognitoMode", "making tab");
|
Log.i("IncognitoMode", "making tab");
|
||||||
|
|
||||||
int finalID = 0;
|
int finalID = 0;
|
||||||
@ -1655,6 +1770,7 @@ public class IncognitoMode extends Activity {
|
|||||||
});
|
});
|
||||||
urlTitle[n].startAnimation(holo);
|
urlTitle[n].startAnimation(holo);
|
||||||
urlTitle[num].setText("New Tab");
|
urlTitle[num].setText("New Tab");
|
||||||
|
|
||||||
if (display) {
|
if (display) {
|
||||||
if (API < 16) {
|
if (API < 16) {
|
||||||
urlTitle[num].setBackgroundDrawable(active);
|
urlTitle[num].setBackgroundDrawable(active);
|
||||||
@ -1729,8 +1845,7 @@ public class IncognitoMode extends Activity {
|
|||||||
title.setId(number);
|
title.setId(number);
|
||||||
title.setGravity(Gravity.CENTER_VERTICAL);
|
title.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
|
|
||||||
title.setCompoundDrawables(incognitoPage, null, exitTab,
|
title.setCompoundDrawables(incognitoPage, null, exitTab, null);
|
||||||
null);
|
|
||||||
|
|
||||||
Drawable[] drawables = title.getCompoundDrawables();
|
Drawable[] drawables = title.getCompoundDrawables();
|
||||||
bounds = drawables[2].getBounds();
|
bounds = drawables[2].getBounds();
|
||||||
@ -1759,7 +1874,6 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
urlTitle[number].setText("Incognito");
|
urlTitle[number].setText("Incognito");
|
||||||
|
|
||||||
|
|
||||||
if (theUrl != null) {
|
if (theUrl != null) {
|
||||||
main[number] = makeTab(number, theUrl, display);
|
main[number] = makeTab(number, theUrl, display);
|
||||||
} else {
|
} else {
|
||||||
@ -1793,21 +1907,27 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
|
||||||
|
if (main[pageId] != null) {
|
||||||
|
main[pageId].stopLoading();
|
||||||
|
|
||||||
|
if (showFullScreen && !uBar.isShown()) {
|
||||||
|
uBar.startAnimation(slideDown);
|
||||||
|
}
|
||||||
if (main[pageId].canGoBack()) {
|
if (main[pageId].canGoBack()) {
|
||||||
main[pageId].goBack();
|
main[pageId].goBack();
|
||||||
} else {
|
} else {
|
||||||
deleteTab(pageId);
|
deleteTab(pageId);
|
||||||
uBar.bringToFront();
|
uBar.bringToFront();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
main[pageId].getSettings().setLayoutAlgorithm(
|
main[pageId].getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
|
||||||
LayoutAlgorithm.NORMAL);
|
|
||||||
// main[pageId].invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1816,8 +1936,9 @@ public class IncognitoMode extends Activity {
|
|||||||
setContentView(R.layout.activity_main); // displays main xml layout
|
setContentView(R.layout.activity_main); // displays main xml layout
|
||||||
settings = getSharedPreferences(preferences, 0);
|
settings = getSharedPreferences(preferences, 0);
|
||||||
edit = settings.edit();
|
edit = settings.edit();
|
||||||
|
CookieSyncManager.createInstance(CONTEXT);
|
||||||
|
cookieManager = CookieManager.getInstance();
|
||||||
|
cookieManager.setAcceptCookie(false);
|
||||||
inactive = getResources().getDrawable(R.drawable.bg_inactive);
|
inactive = getResources().getDrawable(R.drawable.bg_inactive);
|
||||||
active = getResources().getDrawable(R.drawable.bg_press);
|
active = getResources().getDrawable(R.drawable.bg_press);
|
||||||
init(); // sets up random stuff
|
init(); // sets up random stuff
|
||||||
@ -1886,7 +2007,7 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
String url = intent.getDataString();
|
String url = intent.getDataString();
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
newTab(number, url, true, true);
|
newTab(number, url, true);
|
||||||
}
|
}
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
}
|
}
|
||||||
@ -1898,22 +2019,16 @@ public class IncognitoMode extends Activity {
|
|||||||
case R.id.history:
|
case R.id.history:
|
||||||
generateHistory(main[pageId]);
|
generateHistory(main[pageId]);
|
||||||
return true;
|
return true;
|
||||||
case R.id.bookmark:
|
|
||||||
return true;
|
|
||||||
case R.id.settings:
|
|
||||||
return true;
|
|
||||||
case R.id.allBookmarks:
|
case R.id.allBookmarks:
|
||||||
if (!urlToLoad[pageId][1].equals("Bookmarks")) {
|
if (!urlToLoad[pageId][1].equals("Bookmarks")) {
|
||||||
goBookmarks(main[pageId]);
|
goBookmarks(main[pageId]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.share:
|
|
||||||
return true;
|
|
||||||
case R.id.incognito:
|
case R.id.incognito:
|
||||||
newTab(number, homepage, true, true);
|
newTab(number, homepage, true);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1938,7 +2053,7 @@ public class IncognitoMode extends Activity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void openBookmarks(CustomWebView view) {
|
void openBookmarks(IncognitoWebView view) {
|
||||||
String bookmarkHtml = BookmarkPage.Heading;
|
String bookmarkHtml = BookmarkPage.Heading;
|
||||||
for (int n = 0; n < MAX_BOOKMARKS; n++) {
|
for (int n = 0; n < MAX_BOOKMARKS; n++) {
|
||||||
if (bUrl[n] != null) {
|
if (bUrl[n] != null) {
|
||||||
@ -1988,19 +2103,13 @@ public class IncognitoMode extends Activity {
|
|||||||
case R.id.history:
|
case R.id.history:
|
||||||
generateHistory(main[pageId]);
|
generateHistory(main[pageId]);
|
||||||
return true;
|
return true;
|
||||||
case R.id.bookmark:
|
|
||||||
return true;
|
|
||||||
case R.id.settings:
|
|
||||||
return true;
|
|
||||||
case R.id.allBookmarks:
|
case R.id.allBookmarks:
|
||||||
if (!urlToLoad[pageId][1].equals("Bookmarks")) {
|
if (!urlToLoad[pageId][1].equals("Bookmarks")) {
|
||||||
goBookmarks(main[pageId]);
|
goBookmarks(main[pageId]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case R.id.share:
|
|
||||||
return true;
|
|
||||||
case R.id.incognito:
|
case R.id.incognito:
|
||||||
newTab(number, homepage, true, true);
|
newTab(number, homepage, true);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -2027,6 +2136,26 @@ public class IncognitoMode extends Activity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void share() {
|
||||||
|
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
|
|
||||||
|
// set the type
|
||||||
|
shareIntent.setType("text/plain");
|
||||||
|
|
||||||
|
// add a subject
|
||||||
|
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
|
||||||
|
urlToLoad[pageId][1]);
|
||||||
|
|
||||||
|
// build the body of the message to be shared
|
||||||
|
String shareMessage = urlToLoad[pageId][0];
|
||||||
|
|
||||||
|
// add the message
|
||||||
|
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareMessage);
|
||||||
|
|
||||||
|
// start the chooser for sharing
|
||||||
|
startActivity(Intent.createChooser(shareIntent, "Share this page"));
|
||||||
|
}
|
||||||
|
|
||||||
void testForSearch() {
|
void testForSearch() {
|
||||||
String fixedQuery = query.trim();
|
String fixedQuery = query.trim();
|
||||||
main[pageId].stopLoading();
|
main[pageId].stopLoading();
|
||||||
|
68
src/acr/browser/barebones/IncognitoWebView.java
Normal file
68
src/acr/browser/barebones/IncognitoWebView.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package acr.browser.barebones;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.ZoomButtonsController;
|
||||||
|
|
||||||
|
public final class IncognitoWebView extends WebView {
|
||||||
|
private float location;
|
||||||
|
private boolean first = false;
|
||||||
|
private final int API = FinalVars.API;
|
||||||
|
private final boolean showFullScreen = IncognitoMode.showFullScreen;
|
||||||
|
private final View uBar = IncognitoMode.uBar;
|
||||||
|
private final Animation slideUp = IncognitoMode.slideUp;
|
||||||
|
private final Animation slideDown = IncognitoMode.slideDown;
|
||||||
|
private ZoomButtonsController zoomControl;
|
||||||
|
public IncognitoWebView(Context context) {
|
||||||
|
super(context);
|
||||||
|
getControls();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
if(API<11&&zoomControl!=null){
|
||||||
|
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
switch (event.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN: {
|
||||||
|
first = true;
|
||||||
|
if (API <= 10 && !this.hasFocus()) {
|
||||||
|
this.requestFocus();
|
||||||
|
}
|
||||||
|
location = event.getY();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MotionEvent.ACTION_UP:{
|
||||||
|
if (showFullScreen&&first) {
|
||||||
|
if (uBar.isShown()&&this.getScrollY()<5) {
|
||||||
|
uBar.startAnimation(slideUp);
|
||||||
|
} else if (event.getY()>location && !uBar.isShown()) {
|
||||||
|
uBar.startAnimation(slideDown);
|
||||||
|
} else if (event.getY()<location && uBar.isShown()){
|
||||||
|
uBar.startAnimation(slideUp);
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onTouchEvent(event);
|
||||||
|
}
|
||||||
|
private void getControls() {
|
||||||
|
if(API<11){
|
||||||
|
try {
|
||||||
|
Class<?> webview = Class.forName("android.webkit.WebView");
|
||||||
|
Method method = webview.getMethod("getZoomButtonsController");
|
||||||
|
zoomControl = (ZoomButtonsController) method.invoke(this, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,14 +12,14 @@ public class SpaceTokenizer implements Tokenizer {
|
|||||||
int i = cursor;
|
int i = cursor;
|
||||||
int len = text.length();
|
int len = text.length();
|
||||||
|
|
||||||
while (i < len) {
|
/*while (i < len) {
|
||||||
if (text.charAt(i) == ' ') {
|
if (text.charAt(i) == ' ') {
|
||||||
return i;
|
return i;
|
||||||
} else {
|
} else {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ public class SpaceTokenizer implements Tokenizer {
|
|||||||
@Override
|
@Override
|
||||||
public CharSequence terminateToken(CharSequence text) {
|
public CharSequence terminateToken(CharSequence text) {
|
||||||
int i = text.length();
|
int i = text.length();
|
||||||
|
return text;
|
||||||
while (i > 0 && text.charAt(i - 1) == ' ') {
|
/*while (i > 0 && text.charAt(i - 1) == ' ') {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +56,6 @@ public class SpaceTokenizer implements Tokenizer {
|
|||||||
} else {
|
} else {
|
||||||
return text + " ";
|
return text + " ";
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user