Browse Source

Assorted Bugfixes

- Fixes tab location ability.
- Improves browser stability
- allow renaming of bookmarks
- better objectification of the code
- oh I can't remember, it's late and I'm tired
master
Anthony Restaino 11 years ago
parent
commit
4042488b56
  1. 11
      res/anim/left.xml
  2. 10
      res/anim/right.xml
  3. BIN
      res/drawable-xhdpi/ic_launcher.png
  4. BIN
      res/drawable-xhdpi/progress_bar.9.png
  5. 4
      res/layout/two_line_autocomplete.xml
  6. 2
      res/values-zh-rCN/strings.xml
  7. 906
      src/acr/browser/barebones/activities/BrowserActivity.java
  8. 944
      src/acr/browser/barebones/activities/IncognitoModeActivity.java
  9. 11
      src/acr/browser/barebones/activities/SettingsActivity.java
  10. 222
      src/acr/browser/barebones/customwebview/CustomWebView.java
  11. 226
      src/acr/browser/barebones/customwebview/IncognitoWebView.java
  12. 3
      src/acr/browser/barebones/incognitoclasses/IncognitoChromeClient.java
  13. 2
      src/acr/browser/barebones/incognitoclasses/IncognitoLongClickListener.java
  14. 1
      src/acr/browser/barebones/utilities/FinalVariables.java
  15. 2
      src/acr/browser/barebones/utilities/Utils.java
  16. 3
      src/acr/browser/barebones/webviewclasses/CustomChromeClient.java
  17. 2
      src/acr/browser/barebones/webviewclasses/WebPageLongClickListener.java

11
res/anim/left.xml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="9%p" android:duration="150"
/>
</set>

10
res/anim/right.xml

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="-9%p" android:duration="150"
/>
</set>

BIN
res/drawable-xhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
res/drawable-xhdpi/progress_bar.9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 176 B

4
res/layout/two_line_autocomplete.xml

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
android:textColor="#000000"
android:textAppearance="?android:attr/textAppearanceMedium"
android:paddingLeft="6dip"
android:paddingTop="10dip"/>
android:paddingTop="2dip"/>
<TextView
android:id="@+id/url"
android:clickable="false"
@ -27,5 +27,5 @@ @@ -27,5 +27,5 @@
android:paddingLeft="6dip"
android:maxLines="1"
android:paddingTop="2dip"
android:paddingBottom="10dip"/>
android:paddingBottom="2dip"/>
</LinearLayout>

2
res/values-zh-rCN/strings.xml

@ -53,7 +53,5 @@ @@ -53,7 +53,5 @@
<string name="menu_new_tab">新建标签</string>
<string name="stock_browser_unavailable">(没有检测到系统自带浏览器)</string>
<string name="stock_browser_available">(检测到系统自带浏览器)</string>
<string name="fullScreenOption">浏览网页时隐藏状态栏</string>
<string name="clear_cookies">清除 cookies</string>
</resources>

906
src/acr/browser/barebones/activities/BrowserActivity.java

File diff suppressed because it is too large Load Diff

944
src/acr/browser/barebones/activities/IncognitoModeActivity.java

File diff suppressed because it is too large Load Diff

11
src/acr/browser/barebones/activities/SettingsActivity.java

@ -95,6 +95,9 @@ public class SettingsActivity extends Activity { @@ -95,6 +95,9 @@ public class SettingsActivity extends Activity {
case 7:
searchText.setText("Yandex");
break;
case 8:
searchText.setText("DuckDuckGo Lite");
break;
}
back.setBackgroundResource(R.drawable.button);
@ -224,8 +227,8 @@ public class SettingsActivity extends Activity { @@ -224,8 +227,8 @@ public class SettingsActivity extends Activity {
AlertDialog.Builder picker = new AlertDialog.Builder(
SettingsActivity.this);
picker.setTitle("Search Engine");
CharSequence[] chars = { "Google (Suggested)", "Bing", "Yahoo",
"StartPage", "DuckDuckGo (Privacy)" , "Baidu (Chinese)", "Yandex (Russian)"};
CharSequence[] chars = { "Google", "Bing", "Yahoo",
"StartPage", "DuckDuckGo (Privacy)" , "Baidu (Chinese)", "Yandex (Russian)", "DuckDuckGo Lite (Privacy)"};
int n = settings.getInt("search", 1);
@ -259,6 +262,9 @@ public class SettingsActivity extends Activity { @@ -259,6 +262,9 @@ public class SettingsActivity extends Activity {
case 7:
searchText.setText("Yandex");
break;
case 8:
searchText.setText("DuckDuckGo Lite");
break;
}
}
});
@ -466,7 +472,6 @@ public class SettingsActivity extends Activity { @@ -466,7 +472,6 @@ public class SettingsActivity extends Activity {
"Adobe Flash does not support Android 4.3 and will "
+ "crash the browser, please do not report crashes that occur if you enable flash.");
}
}
});

222
src/acr/browser/barebones/customwebview/CustomWebView.java

@ -2,7 +2,9 @@ package acr.browser.barebones.customwebview; @@ -2,7 +2,9 @@ package acr.browser.barebones.customwebview;
import acr.browser.barebones.activities.BrowserActivity;
import acr.browser.barebones.utilities.FinalVariables;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Point;
import android.util.DisplayMetrics;
import android.view.Display;
@ -14,50 +16,63 @@ import android.view.WindowManager; @@ -14,50 +16,63 @@ import android.view.WindowManager;
import android.view.animation.Animation;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebSettings.RenderPriority;
public final class CustomWebView extends WebView {
private float location;
private boolean first = false;
final int API = FinalVariables.API;
final boolean showFullScreen = BrowserActivity.showFullScreen;
static final int API = FinalVariables.API;
public static boolean showFullScreen;;
final View uBar = BrowserActivity.uBar;
final Animation slideUp = BrowserActivity.slideUp;
final Animation slideDown = BrowserActivity.slideDown;
static Context CONTEXT;
static String defaultUser;
public WebSettings settings;
public CustomWebView(Context context) {
super(context);
defaultUser = BrowserActivity.defaultUser;
showFullScreen = BrowserActivity.showFullScreen;
mGestureDetector = new GestureDetector(context,
new CustomGestureListener());
CONTEXT = context;
WebSettings settings = this.getSettings();
settings = getSettings();
browserInitialization(context);
settingsInitialization(context, settings);
settingsInitialization(context);
}
@SuppressWarnings("deprecation")
public void browserInitialization(Context context) {
this.setDrawingCacheBackgroundColor(0x00000000);
this.setFocusableInTouchMode(true);
this.setFocusable(true);
this.setAnimationCacheEnabled(false);
this.setDrawingCacheEnabled(true);
this.setBackgroundColor(context.getResources().getColor(
setDrawingCacheBackgroundColor(0x00000000);
setFocusableInTouchMode(true);
setFocusable(true);
setAnimationCacheEnabled(false);
setDrawingCacheEnabled(true);
setBackgroundColor(context.getResources().getColor(
android.R.color.white));
this.setWillNotCacheDrawing(false);
this.setAlwaysDrawnWithCacheEnabled(true);
this.setScrollbarFadingEnabled(true);
this.setSaveEnabled(true);
if (API >= 16) {
getRootView().setBackground(null);
} else {
getRootView().setBackgroundDrawable(null);
}
setWillNotCacheDrawing(false);
setAlwaysDrawnWithCacheEnabled(true);
setScrollbarFadingEnabled(true);
setSaveEnabled(true);
}
@SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
public void settingsInitialization(Context context, WebSettings settings) {
public void settingsInitialization(Context context) {
SharedPreferences preferences = context.getSharedPreferences(
"settings", 0);
settings.setDomStorageEnabled(true);
settings.setAppCacheEnabled(true);
settings.setAppCachePath(context.getFilesDir().getAbsolutePath()
+ "/cache");
if (API < 18) {
settings.setLightTouchEnabled(true);
}
settings.setAllowFileAccess(true);
settings.setDatabaseEnabled(true);
settings.setDatabasePath(context.getFilesDir().getAbsolutePath()
@ -68,54 +83,168 @@ public final class CustomWebView extends WebView { @@ -68,54 +83,168 @@ public final class CustomWebView extends WebView {
settings.setDisplayZoomControls(false);
settings.setAllowContentAccess(true);
}
if (preferences.getBoolean("java", true)) {
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (API < 14) {
switch (preferences.getInt("textsize", 3)) {
case 1:
settings.setTextSize(WebSettings.TextSize.LARGEST);
break;
case 2:
settings.setTextSize(WebSettings.TextSize.LARGER);
break;
case 3:
settings.setTextSize(WebSettings.TextSize.NORMAL);
break;
case 4:
settings.setTextSize(WebSettings.TextSize.SMALLER);
break;
case 5:
settings.setTextSize(WebSettings.TextSize.SMALLEST);
break;
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
first = true;
if (API <= 10 && !hasFocus()) {
requestFocus();
} else {
switch (preferences.getInt("textsize", 3)) {
case 1:
settings.setTextZoom(200);
break;
case 2:
settings.setTextZoom(150);
break;
case 3:
settings.setTextZoom(100);
break;
case 4:
settings.setTextZoom(75);
break;
case 5:
settings.setTextZoom(50);
break;
}
}
settings.setSupportMultipleWindows(preferences.getBoolean("newwindow",
true));
switch (preferences.getInt("enableflash", 0)) {
case 0:
break;
case 1: {
settings.setPluginState(PluginState.ON_DEMAND);
break;
}
location = event.getY();
case 2: {
settings.setPluginState(PluginState.ON);
break;
}
case MotionEvent.ACTION_UP: {
default:
break;
}
if (preferences.getBoolean("passwords", false)) {
if (API < 18) {
settings.setSavePassword(true);
}
settings.setSaveFormData(true);
}
if (API < 18) {
try {
settings.setRenderPriority(RenderPriority.HIGH);
} catch (SecurityException ignored) {
if (showFullScreen && first) {
if (uBar.isShown() && getScrollY() < 5) {
uBar.startAnimation(slideUp);
} else if ((event.getY() - location) > 20.0 && !uBar.isShown()) {
uBar.startAnimation(slideDown);
} else if ((event.getY() - location) < -20.0 && uBar.isShown()) {
uBar.startAnimation(slideUp);
}
first = false;
}
settings.setGeolocationEnabled(preferences
.getBoolean("location", false));
settings.setGeolocationDatabasePath(context.getFilesDir()
.getAbsolutePath());
settings.setUseWideViewPort(preferences
.getBoolean("wideviewport", true));
settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode",
true));
if (preferences.getBoolean("textreflow", false)) {
settings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
} else {
settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
}
settings.setBlockNetworkImage(preferences.getBoolean("blockimages",
false));
settings.setLoadsImagesAutomatically(true);
switch (preferences.getInt("agentchoose", 1)) {
case 1:
getSettings().setUserAgentString(defaultUser);
break;
case 2:
getSettings().setUserAgentString(
FinalVariables.DESKTOP_USER_AGENT);
break;
case 3:
getSettings().setUserAgentString(
FinalVariables.MOBILE_USER_AGENT);
break;
case 4:
getSettings().setUserAgentString(
preferences.getString("userAgentString", defaultUser));
break;
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
mGestureDetector.onTouchEvent(event);
return super.onTouchEvent(event);
}
@Override
protected void onWindowVisibilityChanged(int visibility) {
if (API >= 11) {
this.setActivated(visibility == View.VISIBLE);
setActivated(visibility == View.VISIBLE);
}
this.setEnabled(visibility == View.VISIBLE);
setEnabled(visibility == View.VISIBLE);
super.onWindowVisibilityChanged(visibility);
}
private final GestureDetector mGestureDetector;
private class CustomGestureListener extends SimpleOnGestureListener {
private final int SWIPE_THRESHOLD = 100;
private final int SWIPE_VELOCITY_THRESHOLD = 100;
final int SWIPE_THRESHOLD = 100;
final int SWIPE_VELOCITY_THRESHOLD = 100;
@Override
public boolean onDown(MotionEvent e) {
first = true;
return super.onDown(e);
}
@Override
public void onLongPress(MotionEvent e) {
if (BrowserActivity.currentId != -1) {
BrowserActivity.onLongClick();
}
super.onLongPress(e);
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
if (showFullScreen && first) {
if (uBar.isShown() && getScrollY() < 5) {
uBar.startAnimation(slideUp);
} else if (distanceY < -5 && !uBar.isShown()) {
uBar.startAnimation(slideDown);
} else if (distanceY > 5 && uBar.isShown()) {
uBar.startAnimation(slideUp);
}
first = false;
}
return super.onScroll(e1, e2, distanceX, distanceY);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
@ -136,18 +265,17 @@ public final class CustomWebView extends WebView { @@ -136,18 +265,17 @@ public final class CustomWebView extends WebView {
width = size.x;
}
if ((width - e1.getX() < width/12) || (e1.getX() < width/12)) {
if ((width - e1.getX() < width / 12)
|| (e1.getX() < width / 12)) {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD
&& Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
BrowserActivity.goBack();
return false;
BrowserActivity.goBack(CustomWebView.this);
} else {
BrowserActivity.goForward();
return false;
BrowserActivity.goForward(CustomWebView.this);
}
}
}
@ -156,7 +284,7 @@ public final class CustomWebView extends WebView { @@ -156,7 +284,7 @@ public final class CustomWebView extends WebView {
} catch (Exception exception) {
exception.printStackTrace();
}
return false;
return super.onFling(e1, e2, velocityX, velocityY);
}
}

226
src/acr/browser/barebones/customwebview/IncognitoWebView.java

@ -2,7 +2,9 @@ package acr.browser.barebones.customwebview; @@ -2,7 +2,9 @@ package acr.browser.barebones.customwebview;
import acr.browser.barebones.activities.IncognitoModeActivity;
import acr.browser.barebones.utilities.FinalVariables;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Point;
import android.util.DisplayMetrics;
import android.view.Display;
@ -14,50 +16,63 @@ import android.view.WindowManager; @@ -14,50 +16,63 @@ import android.view.WindowManager;
import android.view.animation.Animation;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebSettings.RenderPriority;
public final class IncognitoWebView extends WebView {
private float location;
private boolean first = false;
final int API = FinalVariables.API;
final boolean showFullScreen = IncognitoModeActivity.showFullScreen;
final View uBar = IncognitoModeActivity.urlBar;
static final int API = FinalVariables.API;
public static boolean showFullScreen;;
final View uBar = IncognitoModeActivity.uBar;
final Animation slideUp = IncognitoModeActivity.slideUp;
final Animation slideDown = IncognitoModeActivity.slideDown;
static Context CONTEXT;
static String defaultUser;
public WebSettings settings;
public IncognitoWebView(Context context) {
super(context);
defaultUser = IncognitoModeActivity.defaultUser;
showFullScreen = IncognitoModeActivity.showFullScreen;
mGestureDetector = new GestureDetector(context,
new CustomGestureListener());
CONTEXT = context;
WebSettings settings = this.getSettings();
settings = getSettings();
browserInitialization(context);
settingsInitialization(context, settings);
settingsInitialization(context);
}
@SuppressWarnings("deprecation")
public void browserInitialization(Context context) {
this.setDrawingCacheBackgroundColor(0x00000000);
this.setFocusableInTouchMode(true);
this.setFocusable(true);
this.setAnimationCacheEnabled(false);
this.setDrawingCacheEnabled(true);
this.setBackgroundColor(context.getResources().getColor(
setDrawingCacheBackgroundColor(0x00000000);
setFocusableInTouchMode(true);
setFocusable(true);
setAnimationCacheEnabled(false);
setDrawingCacheEnabled(true);
setBackgroundColor(context.getResources().getColor(
android.R.color.white));
this.setWillNotCacheDrawing(false);
this.setAlwaysDrawnWithCacheEnabled(true);
this.setScrollbarFadingEnabled(true);
this.setSaveEnabled(true);
if (API >= 16) {
getRootView().setBackground(null);
} else {
getRootView().setBackgroundDrawable(null);
}
setWillNotCacheDrawing(false);
setAlwaysDrawnWithCacheEnabled(true);
setScrollbarFadingEnabled(true);
setSaveEnabled(true);
}
@SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
public void settingsInitialization(Context context, WebSettings settings) {
public void settingsInitialization(Context context) {
SharedPreferences preferences = context.getSharedPreferences(
"settings", 0);
settings.setDomStorageEnabled(true);
settings.setAppCacheEnabled(true);
settings.setAppCachePath(context.getFilesDir().getAbsolutePath()
+ "/cache");
if (API < 18) {
settings.setLightTouchEnabled(true);
}
settings.setAllowFileAccess(true);
settings.setDatabaseEnabled(true);
settings.setDatabasePath(context.getFilesDir().getAbsolutePath()
@ -68,54 +83,168 @@ public final class IncognitoWebView extends WebView { @@ -68,54 +83,168 @@ public final class IncognitoWebView extends WebView {
settings.setDisplayZoomControls(false);
settings.setAllowContentAccess(true);
}
if (preferences.getBoolean("java", true)) {
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (API < 14) {
switch (preferences.getInt("textsize", 3)) {
case 1:
settings.setTextSize(WebSettings.TextSize.LARGEST);
break;
case 2:
settings.setTextSize(WebSettings.TextSize.LARGER);
break;
case 3:
settings.setTextSize(WebSettings.TextSize.NORMAL);
break;
case 4:
settings.setTextSize(WebSettings.TextSize.SMALLER);
break;
case 5:
settings.setTextSize(WebSettings.TextSize.SMALLEST);
break;
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
first = true;
if (API <= 10 && !hasFocus()) {
requestFocus();
} else {
switch (preferences.getInt("textsize", 3)) {
case 1:
settings.setTextZoom(200);
break;
case 2:
settings.setTextZoom(150);
break;
case 3:
settings.setTextZoom(100);
break;
case 4:
settings.setTextZoom(75);
break;
case 5:
settings.setTextZoom(50);
break;
}
}
settings.setSupportMultipleWindows(preferences.getBoolean("newwindow",
true));
switch (preferences.getInt("enableflash", 0)) {
case 0:
break;
case 1: {
settings.setPluginState(PluginState.ON_DEMAND);
break;
}
location = event.getY();
case 2: {
settings.setPluginState(PluginState.ON);
break;
}
case MotionEvent.ACTION_UP: {
default:
break;
}
if (preferences.getBoolean("passwords", false)) {
if (API < 18) {
settings.setSavePassword(true);
}
settings.setSaveFormData(true);
}
if (API < 18) {
try {
settings.setRenderPriority(RenderPriority.HIGH);
} catch (SecurityException ignored) {
if (showFullScreen && first) {
if (uBar.isShown() && getScrollY() < 5) {
uBar.startAnimation(slideUp);
} else if ((event.getY() - location) > 20.0 && !uBar.isShown()) {
uBar.startAnimation(slideDown);
} else if ((event.getY() - location) < -20.0 && uBar.isShown()) {
uBar.startAnimation(slideUp);
}
first = false;
}
settings.setGeolocationEnabled(preferences
.getBoolean("location", false));
settings.setGeolocationDatabasePath(context.getFilesDir()
.getAbsolutePath());
settings.setUseWideViewPort(preferences
.getBoolean("wideviewport", true));
settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode",
true));
if (preferences.getBoolean("textreflow", false)) {
settings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
} else {
settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
}
settings.setBlockNetworkImage(preferences.getBoolean("blockimages",
false));
settings.setLoadsImagesAutomatically(true);
switch (preferences.getInt("agentchoose", 1)) {
case 1:
getSettings().setUserAgentString(defaultUser);
break;
case 2:
getSettings().setUserAgentString(
FinalVariables.DESKTOP_USER_AGENT);
break;
case 3:
getSettings().setUserAgentString(
FinalVariables.MOBILE_USER_AGENT);
break;
case 4:
getSettings().setUserAgentString(
preferences.getString("userAgentString", defaultUser));
break;
}
}
return mGestureDetector.onTouchEvent(event)
|| super.onTouchEvent(event);
@Override
public boolean onTouchEvent(MotionEvent event) {
mGestureDetector.onTouchEvent(event);
return super.onTouchEvent(event);
}
@Override
protected void onWindowVisibilityChanged(int visibility) {
if (API >= 11) {
this.setActivated(visibility == View.VISIBLE);
setActivated(visibility == View.VISIBLE);
}
this.setEnabled(visibility == View.VISIBLE);
setEnabled(visibility == View.VISIBLE);
super.onWindowVisibilityChanged(visibility);
}
private final GestureDetector mGestureDetector;
private class CustomGestureListener extends SimpleOnGestureListener {
private final int SWIPE_THRESHOLD = 100;
private final int SWIPE_VELOCITY_THRESHOLD = 100;
final int SWIPE_THRESHOLD = 100;
final int SWIPE_VELOCITY_THRESHOLD = 100;
@Override
public boolean onDown(MotionEvent e) {
first = true;
return super.onDown(e);
}
@Override
public void onLongPress(MotionEvent e) {
if (IncognitoModeActivity.currentId != -1) {
IncognitoModeActivity.onLongClick();
}
super.onLongPress(e);
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
if (showFullScreen && first) {
if (uBar.isShown() && getScrollY() < 5) {
uBar.startAnimation(slideUp);
} else if (distanceY < -5 && !uBar.isShown()) {
uBar.startAnimation(slideDown);
} else if (distanceY > 5 && uBar.isShown()) {
uBar.startAnimation(slideUp);
}
first = false;
}
return super.onScroll(e1, e2, distanceX, distanceY);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
@ -136,18 +265,17 @@ public final class IncognitoWebView extends WebView { @@ -136,18 +265,17 @@ public final class IncognitoWebView extends WebView {
width = size.x;
}
if ((width - e1.getX() < width/12) || (e1.getX() < width/12)) {
if ((width - e1.getX() < width / 12)
|| (e1.getX() < width / 12)) {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD
&& Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
IncognitoModeActivity.goBack();
return false;
IncognitoModeActivity.goBack(IncognitoWebView.this);
} else {
IncognitoModeActivity.goForward();
return false;
IncognitoModeActivity.goForward(IncognitoWebView.this);
}
}
}
@ -156,7 +284,7 @@ public final class IncognitoWebView extends WebView { @@ -156,7 +284,7 @@ public final class IncognitoWebView extends WebView {
} catch (Exception exception) {
exception.printStackTrace();
}
return false;
return super.onFling(e1, e2, velocityX, velocityY);
}
}

3
src/acr/browser/barebones/incognitoclasses/IncognitoChromeClient.java

@ -136,8 +136,9 @@ public class IncognitoChromeClient extends WebChromeClient { @@ -136,8 +136,9 @@ public class IncognitoChromeClient extends WebChromeClient {
if (mCustomView == null && mCustomViewCallback == null) {
return;
}
mCustomView = null;
mCustomView.setKeepScreenOn(false);
mCustomView = null;
IncognitoModeActivity.onHideCustomView(fullScreenContainer, mCustomViewCallback, orientation);
}

2
src/acr/browser/barebones/incognitoclasses/IncognitoLongClickListener.java

@ -8,7 +8,7 @@ public class IncognitoLongClickListener implements OnLongClickListener{ @@ -8,7 +8,7 @@ public class IncognitoLongClickListener implements OnLongClickListener{
@Override
public boolean onLongClick(View v) {
return IncognitoModeActivity.onLongClick(v.getId());
return IncognitoModeActivity.onLongClick();
}
}

1
src/acr/browser/barebones/utilities/FinalVariables.java

@ -15,6 +15,7 @@ public class FinalVariables { @@ -15,6 +15,7 @@ public class FinalVariables {
public static final String GOOGLE_SEARCH = "https://www.google.com/search?client=lightning&q=";
public static final String BING_SEARCH = "http://www.bing.com/search?q=";
public static final String DUCK_SEARCH = "https://duckduckgo.com/?t=lightning&q=";
public static final String DUCK_LITE_SEARCH = "https://duckduckgo.com/lite/?q=";
public static final String STARTPAGE_SEARCH = "https://startpage.com/do/metasearch.pl?language=english&cat=web&query=";
public static final String HOMEPAGE = "https://www.google.com/";
public static final String BAIDU_SEARCH = "http://www.baidu.com/s?wd=";

2
src/acr/browser/barebones/utilities/Utils.java

@ -7,6 +7,7 @@ import java.io.FileNotFoundException; @@ -7,6 +7,7 @@ import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import acr.browser.barebones.databases.DatabaseHandler;
import acr.browser.barebones.databases.HistoryItem;
import android.annotation.SuppressLint;
@ -27,6 +28,7 @@ import android.os.Environment; @@ -27,6 +28,7 @@ import android.os.Environment;
import android.provider.Browser;
import android.util.Log;
import android.webkit.URLUtil;
import android.widget.EditText;
import android.widget.Toast;
public class Utils {

3
src/acr/browser/barebones/webviewclasses/CustomChromeClient.java

@ -136,8 +136,9 @@ public class CustomChromeClient extends WebChromeClient { @@ -136,8 +136,9 @@ public class CustomChromeClient extends WebChromeClient {
if (mCustomView == null && mCustomViewCallback == null) {
return;
}
mCustomView = null;
mCustomView.setKeepScreenOn(false);
mCustomView = null;
BrowserActivity.onHideCustomView(fullScreenContainer, mCustomViewCallback, orientation);
}

2
src/acr/browser/barebones/webviewclasses/WebPageLongClickListener.java

@ -8,7 +8,7 @@ public class WebPageLongClickListener implements OnLongClickListener{ @@ -8,7 +8,7 @@ public class WebPageLongClickListener implements OnLongClickListener{
@Override
public boolean onLongClick(View v) {
return BrowserActivity.onLongClick(v.getId());
return BrowserActivity.onLongClick();
}
}

Loading…
Cancel
Save