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. 6
      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. 1999
      src/acr/browser/barebones/activities/BrowserActivity.java
  15. 2005
      src/acr/browser/barebones/activities/IncognitoModeActivity.java
  16. 45
      src/acr/browser/barebones/customwebview/CustomWebView.java
  17. 47
      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. 21
      src/acr/browser/barebones/utilities/Utils.java
  22. 4
      src/acr/browser/barebones/webviewclasses/CustomChromeClient.java

6
AndroidManifest.xml

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.barebones"
android:versionCode="53"
android:versionName="2.5.0.11" >
android:versionCode="56"
android:versionName="2.5.1.2" >
<uses-sdk
android:minSdkVersion="8"
@ -14,6 +14,8 @@ @@ -14,6 +14,8 @@
<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.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
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 @@ @@ -4,8 +4,7 @@
<translate android:fromXDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="9%p" android:duration="150"
android:toXDelta="2%p" android:duration="150"
/>
</set>

4
res/anim/right.xml

@ -3,8 +3,8 @@ @@ -3,8 +3,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"
android:interpolator="@android:anim/anticipate_overshoot_interpolator"
android:toXDelta="-2%p" android:duration="150"
/>
</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 @@ @@ -394,6 +394,30 @@
android:layout_alignParentRight="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
android:id="@+id/r8"

44
res/values-fr/strings.xml

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Lightning</string>
<string name="google">Google</string>
<string name="settings">Paramètres</string>
@ -13,47 +11,15 @@ @@ -13,47 +11,15 @@
<string name="mobile">Voir la version mobile</string>
<string name="desk">Voir la version ordinateur</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="fullscreen">Activer le mode plein écran</string>
<string name="java">Activer JavaScript</string>
<string name="saveTab">Restaurer les onglets si ils sont perdus</string>
<string name="settings_title">Paramètres</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_history">History</string>
<string name="menu_add">Aj. Favoris</string>
<string name="menu_bookmarks">Favoris</string>
<string name="menu_share">Partager</string>
<string name="menu_settings">Paramètres</string>
<string name="menu_incognito">Onglet privé</string>
<string name="menu_new_tab">Nouvel onglet</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>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

1
res/values/strings.xml

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

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

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

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

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

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

@ -21,7 +21,6 @@ import android.webkit.WebSettings.PluginState; @@ -21,7 +21,6 @@ import android.webkit.WebSettings.PluginState;
import android.webkit.WebSettings.RenderPriority;
public final class IncognitoWebView extends WebView {
private boolean first = false;
static final int API = FinalVariables.API;
public static boolean showFullScreen;;
final View uBar = IncognitoModeActivity.uBar;
@ -157,10 +156,7 @@ public final class IncognitoWebView extends WebView { @@ -157,10 +156,7 @@ public final class IncognitoWebView extends WebView {
}
}
settings.setGeolocationEnabled(preferences
.getBoolean("location", false));
settings.setGeolocationDatabasePath(context.getFilesDir()
.getAbsolutePath());
settings.setGeolocationEnabled(false);
settings.setUseWideViewPort(preferences
.getBoolean("wideviewport", true));
settings.setLoadWithOverviewMode(preferences.getBoolean("overviewmode",
@ -181,12 +177,10 @@ public final class IncognitoWebView extends WebView { @@ -181,12 +177,10 @@ public final class IncognitoWebView extends WebView {
getSettings().setUserAgentString(defaultUser);
break;
case 2:
getSettings().setUserAgentString(
FinalVariables.DESKTOP_USER_AGENT);
getSettings().setUserAgentString(FinalVariables.DESKTOP_USER_AGENT);
break;
case 3:
getSettings().setUserAgentString(
FinalVariables.MOBILE_USER_AGENT);
getSettings().setUserAgentString(FinalVariables.MOBILE_USER_AGENT);
break;
case 4:
getSettings().setUserAgentString(
@ -215,6 +209,14 @@ public final class IncognitoWebView extends WebView { @@ -215,6 +209,14 @@ public final class IncognitoWebView extends WebView {
private class CustomGestureListener extends SimpleOnGestureListener {
final int SWIPE_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
public boolean onDown(MotionEvent e) {
@ -225,7 +227,11 @@ public final class IncognitoWebView extends WebView { @@ -225,7 +227,11 @@ public final class IncognitoWebView extends WebView {
@Override
public void onLongPress(MotionEvent e) {
if (IncognitoModeActivity.currentId != -1) {
try {
IncognitoModeActivity.onLongClick();
} catch (NullPointerException ig) {
ig.printStackTrace();
}
}
super.onLongPress(e);
}
@ -251,31 +257,32 @@ public final class IncognitoWebView extends WebView { @@ -251,31 +257,32 @@ public final class IncognitoWebView extends WebView {
float velocityY) {
try {
int width;
if (API < 13) {
DisplayMetrics metrics = CONTEXT.getResources()
metrics = CONTEXT.getResources()
.getDisplayMetrics();
width = metrics.widthPixels;
} else {
WindowManager wm = (WindowManager) CONTEXT
wm = (WindowManager) CONTEXT
.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display = wm.getDefaultDisplay();
size = new Point();
display.getSize(size);
width = size.x;
}
if ((width - e1.getX() < width / 12)
|| (e1.getX() < width / 12)) {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if ((width - e1.getX() <= width / 15)
|| (e1.getX() <= width / 15)) {
diffY = e2.getY() - e1.getY();
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(IncognitoWebView.this);
IncognitoModeActivity
.goBack(IncognitoWebView.this);
} 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 { @@ -81,6 +81,7 @@ public class DatabaseHandler extends SQLiteOpenHelper {
cursor.moveToFirst();
String m = cursor.getString(0);
cursor.close();
db.close();
// return item
return m;
}
@ -117,10 +118,11 @@ public class DatabaseHandler extends SQLiteOpenHelper { @@ -117,10 +118,11 @@ public class DatabaseHandler extends SQLiteOpenHelper {
ContentValues values = new ContentValues();
values.put(KEY_URL, item.getUrl());
values.put(KEY_TITLE, item.getTitle());
// updating row
return db.update(TABLE_HISTORY, values, KEY_ID + " = ?",
int n = db.update(TABLE_HISTORY, values, KEY_ID + " = ?",
new String[] { String.valueOf(item.getID()) });
// updating row
db.close();
return n;
}
// Deleting single item

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

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

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

@ -15,9 +15,9 @@ public class FinalVariables { @@ -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 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 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 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 YANDEX_SEARCH = "http://yandex.ru/yandsearch?lr=21411&text=";
public static final String ADVANCED_SETTINGS_INTENT = "android.intent.action.ADVANCED_SETTINGS";

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

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

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

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

Loading…
Cancel
Save