Browse Source

Sync with Play Store

Sorry for lack of description but it has been a while since I synced and
I cannot quite remember what the changes were. I apologize. I had
trouble syncing from linux.
master
Anthony Restaino 11 years ago
parent
commit
85361507bd
  1. 8
      AndroidManifest.xml
  2. BIN
      Barebones.apk
  3. BIN
      ic_launcher.png
  4. BIN
      ic_launcher_small.png
  5. 3
      res/anim/left.xml
  6. 4
      res/anim/right.xml
  7. BIN
      res/drawable-hdpi/ic_launcher.png
  8. BIN
      res/drawable-xhdpi/ic_launcher.png
  9. BIN
      res/drawable-xxhdpi/ic_launcher.png
  10. 24
      res/layout/advanced_settings.xml
  11. 44
      res/values-fr/strings.xml
  12. 1
      res/values/strings.xml
  13. 34
      src/acr/browser/barebones/activities/AdvancedSettingsActivity.java
  14. 3189
      src/acr/browser/barebones/activities/BrowserActivity.java
  15. 2231
      src/acr/browser/barebones/activities/IncognitoModeActivity.java
  16. 51
      src/acr/browser/barebones/customwebview/CustomWebView.java
  17. 49
      src/acr/browser/barebones/customwebview/IncognitoWebView.java
  18. 8
      src/acr/browser/barebones/databases/DatabaseHandler.java
  19. 4
      src/acr/browser/barebones/incognitoclasses/IncognitoChromeClient.java
  20. 4
      src/acr/browser/barebones/utilities/FinalVariables.java
  21. 55
      src/acr/browser/barebones/utilities/Utils.java
  22. 4
      src/acr/browser/barebones/webviewclasses/CustomChromeClient.java

8
AndroidManifest.xml

@ -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="53" android:versionCode="56"
android:versionName="2.5.0.11" > android:versionName="2.5.1.2" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"
@ -11,9 +11,11 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" /> <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" /> <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" />
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>
<application <application
android:allowBackup="true" android:allowBackup="true"

BIN
Barebones.apk

Binary file not shown.

BIN
ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 131 KiB

BIN
ic_launcher_small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 17 KiB

3
res/anim/left.xml

@ -4,8 +4,7 @@
<translate android:fromXDelta="0%p" <translate android:fromXDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator" android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="9%p" android:duration="150" android:toXDelta="2%p" android:duration="150"
/> />
</set> </set>

4
res/anim/right.xml

@ -3,8 +3,8 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0%p" <translate android:fromXDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator" android:interpolator="@android:anim/anticipate_overshoot_interpolator"
android:toXDelta="-9%p" android:duration="150" android:toXDelta="-2%p" android:duration="150"
/> />
</set> </set>

BIN
res/drawable-hdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
res/drawable-xhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
res/drawable-xxhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 16 KiB

24
res/layout/advanced_settings.xml

@ -394,6 +394,30 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/r16"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@drawable/blueback"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:paddingLeft="10dp"
android:text="@string/gestures"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/cb12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/r8" android:id="@+id/r8"

44
res/values-fr/strings.xml

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Lightning</string> <string name="app_name">Lightning</string>
<string name="google">Google</string> <string name="google">Google</string>
<string name="settings">Paramètres</string> <string name="settings">Paramètres</string>
@ -13,47 +11,15 @@
<string name="mobile">Voir la version mobile</string> <string name="mobile">Voir la version mobile</string>
<string name="desk">Voir la version ordinateur</string> <string name="desk">Voir la version ordinateur</string>
<string name="custom">Utiliser un User Agent personnalisé</string> <string name="custom">Utiliser un User Agent personnalisé</string>
<string name="home">Page d\'accueil</string> <string name="home">Au démarrage</string>
<string name="settingshelp">Les paramètres ne s\'appliqueront qu\'aux nouveaux onglets</string> <string name="settingshelp">Les paramètres ne s\'appliqueront qu\'aux nouveaux onglets</string>
<string name="fullscreen">Activer le mode plein écran</string> <string name="fullscreen">Activer le mode plein écran</string>
<string name="java">Activer JavaScript</string> <string name="java">Activer JavaScript</string>
<string name="saveTab">Restaurer les onglets si ils sont perdus</string> <string name="menu_history">History</string>
<string name="settings_title">Paramètres</string> <string name="menu_add">Aj. Favoris</string>
<string name="download">Dossier de téléchargement</string>
<string name="advanced">Paramètres avancés</string>
<string name="source">Code source</string>
<string name="license">Licence</string>
<string name="github">github.com/anthonycr/Lightning-Browser</string>
<string name="apache">Apache License 2.0</string>
<string name="title_activity_new_settings">NewSettings</string>
<string name="action_settings">Paramètres</string>
<string name="version">Version de l\'application</string>
<string name="cache">Effacer le cache en quittant</string>
<string name="reflow">Activer la redistribution du texte</string>
<string name="block">Bloquer les images</string>
<string name="window">Permettre aux sites d\'ouvrir dans de nouvelles fenêtres</string>
<string name="cookies">Activer les témoins</string>
<string name="importbookmarks">Importer les favoris du Navigateur Internet</string>
<string name="size">Taille du texte</string>
<string name="title_activity_advanced_settings">AdvancedSettings</string>
<string name="hello_world">Hello world!</string>
<string name="recommended">(Recommandé)</string>
<string name="weird_look">(Les sites peuvent paraître étranges)</string>
<string name="search">Moteur de recherche</string>
<string name="search_hint">Rechercher</string>
<string name="wideViewPort">Modifer l\'échelle de l\'écran</string>
<string name="overViewMode">Charger les pages dans une vue d\'ensemble</string>
<string name="restore">Restorer les onglets perdus au démarrage</string>
<string name="menu_history">Historique</string>
<string name="menu_add">Ajouter favoris</string>
<string name="menu_bookmarks">Favoris</string> <string name="menu_bookmarks">Favoris</string>
<string name="menu_share">Partager</string> <string name="menu_share">Partager</string>
<string name="menu_settings">Paramètres</string> <string name="menu_settings">Paramètres</string>
<string name="menu_incognito">Onglet privé</string> <string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">Nouvel onglet</string> <string name="menu_new_tab">New tab</string>
<string name="stock_browser_unavailable">(Navigateur d\'origine introuvable)</string>
<string name="stock_browser_available">(Navigateur d\'origine trouvé)</string>
<string name="fullScreenOption">Cacher la barre de status en naviguant</string>
<string name="clear_cookies">Effacer lex témoins</string>
</resources> </resources>

1
res/values/strings.xml

@ -55,5 +55,6 @@
<string name="stock_browser_available">(Supported stock browser detected)</string> <string name="stock_browser_available">(Supported stock browser detected)</string>
<string name="fullScreenOption">Hide status bar while browsing</string> <string name="fullScreenOption">Hide status bar while browsing</string>
<string name="clear_cookies">Clear browser cookies</string> <string name="clear_cookies">Clear browser cookies</string>
<string name="gestures">Enable back and foward gestures</string>
</resources> </resources>

34
src/acr/browser/barebones/activities/AdvancedSettingsActivity.java

@ -39,8 +39,8 @@ public class AdvancedSettingsActivity extends Activity {
static final String preferences = "settings"; static final String preferences = "settings";
static SharedPreferences settings; static SharedPreferences settings;
static SharedPreferences.Editor edit; static SharedPreferences.Editor edit;
static RelativeLayout r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; static RelativeLayout r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16;
static CheckBox cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10, cb11; static CheckBox cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10, cb11, cb12;
static Context CONTEXT; static Context CONTEXT;
Handler messageHandler; Handler messageHandler;
@ -76,6 +76,8 @@ public class AdvancedSettingsActivity extends Activity {
r13 = (RelativeLayout) findViewById(R.id.r13); r13 = (RelativeLayout) findViewById(R.id.r13);
r14 = (RelativeLayout) findViewById(R.id.r14); r14 = (RelativeLayout) findViewById(R.id.r14);
r15 = (RelativeLayout) findViewById(R.id.r15); r15 = (RelativeLayout) findViewById(R.id.r15);
r16 = (RelativeLayout) findViewById(R.id.r16);
cb1 = (CheckBox) findViewById(R.id.cb1); cb1 = (CheckBox) findViewById(R.id.cb1);
cb2 = (CheckBox) findViewById(R.id.cb2); cb2 = (CheckBox) findViewById(R.id.cb2);
@ -88,6 +90,7 @@ public class AdvancedSettingsActivity extends Activity {
cb9 = (CheckBox) findViewById(R.id.cb9); cb9 = (CheckBox) findViewById(R.id.cb9);
cb10 = (CheckBox) findViewById(R.id.cb10); cb10 = (CheckBox) findViewById(R.id.cb10);
cb11 = (CheckBox) findViewById(R.id.cb11); cb11 = (CheckBox) findViewById(R.id.cb11);
cb12 = (CheckBox) findViewById(R.id.cb12);
cb1.setChecked(settings.getBoolean("passwords", true)); cb1.setChecked(settings.getBoolean("passwords", true));
cb2.setChecked(settings.getBoolean("cache", false)); cb2.setChecked(settings.getBoolean("cache", false));
@ -100,6 +103,7 @@ public class AdvancedSettingsActivity extends Activity {
cb9.setChecked(settings.getBoolean("overviewmode", true)); cb9.setChecked(settings.getBoolean("overviewmode", true));
cb10.setChecked(settings.getBoolean("restoreclosed", true)); cb10.setChecked(settings.getBoolean("restoreclosed", true));
cb11.setChecked(settings.getBoolean("hidestatus", false)); cb11.setChecked(settings.getBoolean("hidestatus", false));
cb12.setChecked(settings.getBoolean("gestures", true));
r1(r1); r1(r1);
r2(r2); r2(r2);
@ -116,6 +120,7 @@ public class AdvancedSettingsActivity extends Activity {
r13(r13); r13(r13);
r14(r14); r14(r14);
r15(r15); r15(r15);
r16(r16);
cb1(cb1); cb1(cb1);
cb2(cb2); cb2(cb2);
cb3(cb3); cb3(cb3);
@ -127,6 +132,7 @@ public class AdvancedSettingsActivity extends Activity {
cb9(cb9); cb9(cb9);
cb10(cb10); cb10(cb10);
cb11(cb11); cb11(cb11);
cb12(cb12);
back(); back();
TextView importBookmarks = (TextView)findViewById(R.id.isImportAvailable); TextView importBookmarks = (TextView)findViewById(R.id.isImportAvailable);
@ -312,6 +318,19 @@ public class AdvancedSettingsActivity extends Activity {
}); });
} }
void cb12(CheckBox view) {
view.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
edit.putBoolean("gestures", isChecked);
edit.commit();
}
});
}
void r1(RelativeLayout view) { void r1(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() { view.setOnClickListener(new OnClickListener() {
@ -531,6 +550,17 @@ public class AdvancedSettingsActivity extends Activity {
}); });
} }
void r16(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
cb12.setChecked(!cb12.isChecked());
}
});
}
public void clearHistory() { public void clearHistory() {
CookieManager c = CookieManager.getInstance(); CookieManager c = CookieManager.getInstance();
CookieSyncManager.createInstance(this); CookieSyncManager.createInstance(this);

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

@ -21,12 +21,12 @@ import android.webkit.WebSettings.PluginState;
import android.webkit.WebSettings.RenderPriority; import android.webkit.WebSettings.RenderPriority;
public final class CustomWebView extends WebView { public final class CustomWebView extends WebView {
private boolean first = false;
static final int API = FinalVariables.API; static final int API = FinalVariables.API;
public static boolean showFullScreen;; public static boolean showFullScreen;;
final View uBar = BrowserActivity.uBar; final View uBar = BrowserActivity.uBar;
final Animation slideUp = BrowserActivity.slideUp; final Animation slideUp = BrowserActivity.slideUp;
final Animation slideDown = BrowserActivity.slideDown; final Animation slideDown = BrowserActivity.slideDown;
final boolean DEVICE_HAS_GPS = BrowserActivity.DEVICE_HAS_GPS;
static Context CONTEXT; static Context CONTEXT;
static String defaultUser; static String defaultUser;
public WebSettings settings; public WebSettings settings;
@ -157,10 +157,14 @@ public final class CustomWebView extends WebView {
} }
} }
settings.setGeolocationEnabled(preferences if (DEVICE_HAS_GPS) {
.getBoolean("location", false)); settings.setGeolocationEnabled(preferences.getBoolean("location",
settings.setGeolocationDatabasePath(context.getFilesDir() false));
.getAbsolutePath()); settings.setGeolocationDatabasePath(context.getFilesDir()
.getAbsolutePath());
} else {
settings.setGeolocationEnabled(false);
}
settings.setUseWideViewPort(preferences settings.setUseWideViewPort(preferences
.getBoolean("wideviewport", true)); .getBoolean("wideviewport", true));
settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode", settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode",
@ -181,12 +185,10 @@ public final class CustomWebView extends WebView {
getSettings().setUserAgentString(defaultUser); getSettings().setUserAgentString(defaultUser);
break; break;
case 2: case 2:
getSettings().setUserAgentString( getSettings().setUserAgentString(FinalVariables.DESKTOP_USER_AGENT);
FinalVariables.DESKTOP_USER_AGENT);
break; break;
case 3: case 3:
getSettings().setUserAgentString( getSettings().setUserAgentString(FinalVariables.MOBILE_USER_AGENT);
FinalVariables.MOBILE_USER_AGENT);
break; break;
case 4: case 4:
getSettings().setUserAgentString( getSettings().setUserAgentString(
@ -215,6 +217,14 @@ public final class CustomWebView extends WebView {
private class CustomGestureListener extends SimpleOnGestureListener { private class CustomGestureListener extends SimpleOnGestureListener {
final int SWIPE_THRESHOLD = 100; final int SWIPE_THRESHOLD = 100;
final int SWIPE_VELOCITY_THRESHOLD = 100; final int SWIPE_VELOCITY_THRESHOLD = 100;
DisplayMetrics metrics;
WindowManager wm;
Display display;
Point size;
int width;
float diffY;
float diffX;
boolean first = false;
@Override @Override
public boolean onDown(MotionEvent e) { public boolean onDown(MotionEvent e) {
@ -225,7 +235,11 @@ public final class CustomWebView extends WebView {
@Override @Override
public void onLongPress(MotionEvent e) { public void onLongPress(MotionEvent e) {
if (BrowserActivity.currentId != -1) { if (BrowserActivity.currentId != -1) {
BrowserActivity.onLongClick(); try {
BrowserActivity.onLongClick();
} catch (NullPointerException ignored) {
ignored.printStackTrace();
}
} }
super.onLongPress(e); super.onLongPress(e);
} }
@ -251,24 +265,23 @@ public final class CustomWebView extends WebView {
float velocityY) { float velocityY) {
try { try {
int width;
if (API < 13) { if (API < 13) {
DisplayMetrics metrics = CONTEXT.getResources() metrics = CONTEXT.getResources()
.getDisplayMetrics(); .getDisplayMetrics();
width = metrics.widthPixels; width = metrics.widthPixels;
} else { } else {
WindowManager wm = (WindowManager) CONTEXT wm = (WindowManager) CONTEXT
.getSystemService(Context.WINDOW_SERVICE); .getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay(); display = wm.getDefaultDisplay();
Point size = new Point(); size = new Point();
display.getSize(size); display.getSize(size);
width = size.x; width = size.x;
} }
if ((width - e1.getX() < width / 12) if ((width - e1.getX() <= width / 15)
|| (e1.getX() < width / 12)) { || (e1.getX() <= width / 15)) {
float diffY = e2.getY() - e1.getY(); diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX(); diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) { if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD if (Math.abs(diffX) > SWIPE_THRESHOLD
&& Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {

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

@ -21,7 +21,6 @@ import android.webkit.WebSettings.PluginState;
import android.webkit.WebSettings.RenderPriority; import android.webkit.WebSettings.RenderPriority;
public final class IncognitoWebView extends WebView { public final class IncognitoWebView extends WebView {
private boolean first = false;
static final int API = FinalVariables.API; static final int API = FinalVariables.API;
public static boolean showFullScreen;; public static boolean showFullScreen;;
final View uBar = IncognitoModeActivity.uBar; final View uBar = IncognitoModeActivity.uBar;
@ -157,10 +156,7 @@ public final class IncognitoWebView extends WebView {
} }
} }
settings.setGeolocationEnabled(preferences settings.setGeolocationEnabled(false);
.getBoolean("location", false));
settings.setGeolocationDatabasePath(context.getFilesDir()
.getAbsolutePath());
settings.setUseWideViewPort(preferences settings.setUseWideViewPort(preferences
.getBoolean("wideviewport", true)); .getBoolean("wideviewport", true));
settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode", settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode",
@ -181,12 +177,10 @@ public final class IncognitoWebView extends WebView {
getSettings().setUserAgentString(defaultUser); getSettings().setUserAgentString(defaultUser);
break; break;
case 2: case 2:
getSettings().setUserAgentString( getSettings().setUserAgentString(FinalVariables.DESKTOP_USER_AGENT);
FinalVariables.DESKTOP_USER_AGENT);
break; break;
case 3: case 3:
getSettings().setUserAgentString( getSettings().setUserAgentString(FinalVariables.MOBILE_USER_AGENT);
FinalVariables.MOBILE_USER_AGENT);
break; break;
case 4: case 4:
getSettings().setUserAgentString( getSettings().setUserAgentString(
@ -215,6 +209,14 @@ public final class IncognitoWebView extends WebView {
private class CustomGestureListener extends SimpleOnGestureListener { private class CustomGestureListener extends SimpleOnGestureListener {
final int SWIPE_THRESHOLD = 100; final int SWIPE_THRESHOLD = 100;
final int SWIPE_VELOCITY_THRESHOLD = 100; final int SWIPE_VELOCITY_THRESHOLD = 100;
DisplayMetrics metrics;
WindowManager wm;
Display display;
Point size;
int width;
float diffY;
float diffX;
boolean first = false;
@Override @Override
public boolean onDown(MotionEvent e) { public boolean onDown(MotionEvent e) {
@ -225,7 +227,11 @@ public final class IncognitoWebView extends WebView {
@Override @Override
public void onLongPress(MotionEvent e) { public void onLongPress(MotionEvent e) {
if (IncognitoModeActivity.currentId != -1) { if (IncognitoModeActivity.currentId != -1) {
IncognitoModeActivity.onLongClick(); try {
IncognitoModeActivity.onLongClick();
} catch (NullPointerException ig) {
ig.printStackTrace();
}
} }
super.onLongPress(e); super.onLongPress(e);
} }
@ -251,31 +257,32 @@ public final class IncognitoWebView extends WebView {
float velocityY) { float velocityY) {
try { try {
int width;
if (API < 13) { if (API < 13) {
DisplayMetrics metrics = CONTEXT.getResources() metrics = CONTEXT.getResources()
.getDisplayMetrics(); .getDisplayMetrics();
width = metrics.widthPixels; width = metrics.widthPixels;
} else { } else {
WindowManager wm = (WindowManager) CONTEXT wm = (WindowManager) CONTEXT
.getSystemService(Context.WINDOW_SERVICE); .getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay(); display = wm.getDefaultDisplay();
Point size = new Point(); size = new Point();
display.getSize(size); display.getSize(size);
width = size.x; width = size.x;
} }
if ((width - e1.getX() < width / 12) if ((width - e1.getX() <= width / 15)
|| (e1.getX() < width / 12)) { || (e1.getX() <= width / 15)) {
float diffY = e2.getY() - e1.getY(); diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX(); diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) { if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD if (Math.abs(diffX) > SWIPE_THRESHOLD
&& Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) { if (diffX > 0) {
IncognitoModeActivity.goBack(IncognitoWebView.this); IncognitoModeActivity
.goBack(IncognitoWebView.this);
} else { } else {
IncognitoModeActivity.goForward(IncognitoWebView.this); IncognitoModeActivity
.goForward(IncognitoWebView.this);
} }
} }
} }

8
src/acr/browser/barebones/databases/DatabaseHandler.java

@ -81,6 +81,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
cursor.moveToFirst(); cursor.moveToFirst();
String m = cursor.getString(0); String m = cursor.getString(0);
cursor.close(); cursor.close();
db.close();
// return item // return item
return m; return m;
} }
@ -117,10 +118,11 @@ public class DatabaseHandler extends SQLiteOpenHelper {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put(KEY_URL, item.getUrl()); values.put(KEY_URL, item.getUrl());
values.put(KEY_TITLE, item.getTitle()); values.put(KEY_TITLE, item.getTitle());
int n = db.update(TABLE_HISTORY, values, KEY_ID + " = ?",
// updating row
return db.update(TABLE_HISTORY, values, KEY_ID + " = ?",
new String[] { String.valueOf(item.getID()) }); new String[] { String.valueOf(item.getID()) });
// updating row
db.close();
return n;
} }
// Deleting single item // Deleting single item

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

@ -140,6 +140,7 @@ public class IncognitoChromeClient extends WebChromeClient {
mCustomView.setKeepScreenOn(false); mCustomView.setKeepScreenOn(false);
mCustomView = null; mCustomView = null;
IncognitoModeActivity.onHideCustomView(fullScreenContainer, mCustomViewCallback, orientation); IncognitoModeActivity.onHideCustomView(fullScreenContainer, mCustomViewCallback, orientation);
super.onHideCustomView();
} }
@Override @Override
@ -174,7 +175,7 @@ public class IncognitoChromeClient extends WebChromeClient {
mCustomView = view; mCustomView = view;
mCustomViewCallback = callback; mCustomViewCallback = callback;
browserActivity.setRequestedOrientation(requestedOrientation); browserActivity.setRequestedOrientation(requestedOrientation);
super.onShowCustomView(view, requestedOrientation, callback);
} }
@Override @Override
@ -198,6 +199,7 @@ public class IncognitoChromeClient extends WebChromeClient {
mCustomView = view; mCustomView = view;
mCustomViewCallback = callback; mCustomViewCallback = callback;
browserActivity.setRequestedOrientation(browserActivity.getRequestedOrientation()); browserActivity.setRequestedOrientation(browserActivity.getRequestedOrientation());
super.onShowCustomView(view, callback);
} }
public void openFileChooser(ValueCallback<Uri> uploadMsg) { public void openFileChooser(ValueCallback<Uri> uploadMsg) {

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

@ -15,9 +15,9 @@ public class FinalVariables {
public static final String GOOGLE_SEARCH = "https://www.google.com/search?client=lightning&q="; 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 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_SEARCH = "https://duckduckgo.com/?t=lightning&q=";
public static final String DUCK_LITE_SEARCH = "https://duckduckgo.com/lite/?q="; public static final String DUCK_LITE_SEARCH = "https://duckduckgo.com/lite/?t=lightning&q=";
public static final String STARTPAGE_SEARCH = "https://startpage.com/do/metasearch.pl?language=english&cat=web&query="; 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 HOMEPAGE = "https://duckduckgo.com";
public static final String BAIDU_SEARCH = "http://www.baidu.com/s?wd="; public static final String BAIDU_SEARCH = "http://www.baidu.com/s?wd=";
public static final String YANDEX_SEARCH = "http://yandex.ru/yandsearch?lr=21411&text="; public static final String YANDEX_SEARCH = "http://yandex.ru/yandsearch?lr=21411&text=";
public static final String ADVANCED_SETTINGS_INTENT = "android.intent.action.ADVANCED_SETTINGS"; public static final String ADVANCED_SETTINGS_INTENT = "android.intent.action.ADVANCED_SETTINGS";

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

@ -10,7 +10,6 @@ import java.io.IOException;
import acr.browser.barebones.databases.DatabaseHandler; import acr.browser.barebones.databases.DatabaseHandler;
import acr.browser.barebones.databases.HistoryItem; import acr.browser.barebones.databases.HistoryItem;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.DownloadManager; import android.app.DownloadManager;
@ -28,13 +27,15 @@ import android.os.Environment;
import android.provider.Browser; import android.provider.Browser;
import android.util.Log; import android.util.Log;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
public class Utils { public class Utils {
public static DatabaseHandler historyHandler; public static DatabaseHandler historyHandler;
public static SQLiteDatabase history; public static SQLiteDatabase history;
public static Cursor cursor;
public static StringBuilder sb;
public static Runnable update;
public static void createInformativeDialog(Context context, String title, public static void createInformativeDialog(Context context, String title,
String message) { String message) {
@ -92,7 +93,7 @@ public class Utils {
public static void updateHistory(final Context context, public static void updateHistory(final Context context,
final ContentResolver content, final boolean noStockBrowser, final ContentResolver content, final boolean noStockBrowser,
final String url, final String title) { final String url, final String title) {
Runnable update = new Runnable() { update = new Runnable() {
@Override @Override
public void run() { public void run() {
if (!noStockBrowser) { if (!noStockBrowser) {
@ -102,11 +103,11 @@ public class Utils {
} }
} }
try { try {
StringBuilder sb = new StringBuilder("url" + " = "); sb = new StringBuilder("url" + " = ");
DatabaseUtils.appendEscapedSQLString(sb, url); DatabaseUtils.appendEscapedSQLString(sb, url);
historyHandler = new DatabaseHandler(context); historyHandler = new DatabaseHandler(context);
history = historyHandler.getReadableDatabase(); history = historyHandler.getReadableDatabase();
Cursor cursor = history.query("history", new String[] { cursor = history.query("history", new String[] {
"id", "url", "title" }, sb.toString(), null, null, "id", "url", "title" }, sb.toString(), null, null,
null, null); null, null);
if (!cursor.moveToFirst()) { if (!cursor.moveToFirst()) {
@ -140,30 +141,26 @@ public class Utils {
public static void downloadFile(final Context context, final String url, public static void downloadFile(final Context context, final String url,
final String contentDisposition, final String mimetype) { final String contentDisposition, final String mimetype) {
try { try {
Thread downloader = new Thread(new Runnable() { DownloadManager download = (DownloadManager) context
@SuppressLint("InlinedApi") .getSystemService(Context.DOWNLOAD_SERVICE);
@Override Uri nice = Uri.parse(url);
public void run() { DownloadManager.Request it = new DownloadManager.Request(
DownloadManager download = (DownloadManager) context nice);
.getSystemService(Context.DOWNLOAD_SERVICE); String fileName = URLUtil.guessFileName(url,
Uri nice = Uri.parse(url); contentDisposition, mimetype);
DownloadManager.Request it = new DownloadManager.Request( it.setTitle(fileName);
nice); it.setDescription(url);
String fileName = URLUtil.guessFileName(url, if (FinalVariables.API >= 11) {
contentDisposition, mimetype); it.allowScanningByMediaScanner();
if (FinalVariables.API >= 11) { it.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
it.allowScanningByMediaScanner(); }
it.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); String location = context.getSharedPreferences("settings",
} 0).getString("download",
String location = context.getSharedPreferences("settings", Environment.DIRECTORY_DOWNLOADS);
0).getString("download", it.setDestinationInExternalPublicDir(location, fileName);
Environment.DIRECTORY_DOWNLOADS); Log.i("Barebones", "Downloading" + fileName);
it.setDestinationInExternalPublicDir(location, fileName); download.enqueue(it);
Log.i("Barebones", "Downloading" + fileName);
download.enqueue(it);
}
});
downloader.run();
} catch (NullPointerException e) { } catch (NullPointerException e) {
Log.e("Barebones", "Problem downloading"); Log.e("Barebones", "Problem downloading");
Toast.makeText(context, "Error Downloading File", Toast.makeText(context, "Error Downloading File",

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

@ -140,6 +140,7 @@ public class CustomChromeClient extends WebChromeClient {
mCustomView.setKeepScreenOn(false); mCustomView.setKeepScreenOn(false);
mCustomView = null; mCustomView = null;
BrowserActivity.onHideCustomView(fullScreenContainer, mCustomViewCallback, orientation); BrowserActivity.onHideCustomView(fullScreenContainer, mCustomViewCallback, orientation);
super.onHideCustomView();
} }
@Override @Override
@ -174,7 +175,7 @@ public class CustomChromeClient extends WebChromeClient {
mCustomView = view; mCustomView = view;
mCustomViewCallback = callback; mCustomViewCallback = callback;
browserActivity.setRequestedOrientation(requestedOrientation); browserActivity.setRequestedOrientation(requestedOrientation);
super.onShowCustomView(view, requestedOrientation, callback);
} }
@Override @Override
@ -198,6 +199,7 @@ public class CustomChromeClient extends WebChromeClient {
mCustomView = view; mCustomView = view;
mCustomViewCallback = callback; mCustomViewCallback = callback;
browserActivity.setRequestedOrientation(browserActivity.getRequestedOrientation()); browserActivity.setRequestedOrientation(browserActivity.getRequestedOrientation());
super.onShowCustomView(view, callback);
} }
public void openFileChooser(ValueCallback<Uri> uploadMsg) { public void openFileChooser(ValueCallback<Uri> uploadMsg) {

Loading…
Cancel
Save