Browse Source

2.5.0.4 Release Code

- Fixed a several bugs with UI
- moved strings from menu.xml into strings.xml for easier translation
- updated Incognito code
master
Anthony Restaino 12 years ago
parent
commit
1d49f83aa7
  1. 2
      AndroidManifest.xml
  2. 2
      res/layout/advanced_settings.xml
  3. 11
      res/menu-de/menu.xml
  4. 10
      res/menu-es/menu.xml
  5. 11
      res/menu-fr/menu.xml
  6. 11
      res/menu-it/menu.xml
  7. 12
      res/menu-zh-rCN/menu.xml
  8. 10
      res/menu-zh-rTW/menu.xml
  9. 9
      res/menu/advanced_settings.xml
  10. 6
      res/menu/incognito_menu.xml
  11. 12
      res/menu/menu.xml
  12. 9
      res/menu/new_settings.xml
  13. 9
      res/values-de/strings.xml
  14. 12
      res/values-es/strings.xml
  15. 11
      res/values-fr/strings.xml
  16. 9
      res/values-it/strings.xml
  17. 9
      res/values-zh-rCN/strings.xml
  18. 9
      res/values-zh-rTW/strings.xml
  19. 11
      res/values/strings.xml
  20. 39
      src/acr/browser/barebones/activities/AdvancedSettingsActivity.java
  21. 17
      src/acr/browser/barebones/activities/BarebonesActivity.java
  22. 583
      src/acr/browser/barebones/activities/IncognitoModeActivity.java
  23. 25
      src/acr/browser/barebones/customwebview/IncognitoWebView.java
  24. 2
      src/acr/browser/barebones/utilities/FinalVariables.java
  25. 5
      src/acr/browser/barebones/utilities/Utils.java
  26. 24
      src/acr/browser/barebones/variables/BookmarkPageVariables.java
  27. 26
      src/acr/browser/barebones/variables/FinalVariables.java
  28. 19
      src/acr/browser/barebones/variables/HistoryPageVariables.java
  29. 174
      src/acr/browser/barebones/variables/Utils.java

2
AndroidManifest.xml

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="acr.browser.barebones"
android:versionCode="44"
android:versionCode="45"
android:versionName="2.5.0.4" >
<uses-sdk

2
res/layout/advanced_settings.xml

@ -402,7 +402,7 @@ @@ -402,7 +402,7 @@
android:layout_centerVertical="true"
android:text="@string/importbookmarks"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textAppearance="?android:attr/textAppearance" />
<TextView
android:id="@+id/isImportAvailable"

11
res/menu-de/menu.xml

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/history" android:title="Verlauf" android:titleCondensed="Verlauf" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:title="Zu Lesezeichen hinzufügen" android:titleCondensed="Zu Lesezeichen hinzufügen" android:orderInCategory="2"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="Lesezeichen" android:title="Lesezeichen" android:orderInCategory="3"></item>
<item android:id="@+id/share" android:title="Teilen" android:titleCondensed="Teilen" android:orderInCategory="4"></item>
<item android:id="@+id/settings" android:title="Einstellungen" android:titleCondensed="Einstellungen" android:orderInCategory="6"></item>
<item android:id="@+id/forward" android:title="Vorwärts" android:orderInCategory="5" android:titleCondensed="Vorwärts"></item>
</menu>

10
res/menu-es/menu.xml

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@id/history" android:orderInCategory="1" android:title="History" android:titleCondensed="History" />
<item android:id="@id/bookmark" android:orderInCategory="2" android:title="Anadir a Marcadores" android:titleCondensed="Anadir a Marcadores" />
<item android:id="@id/allBookmarks" android:orderInCategory="3" android:title="Marcadores" android:titleCondensed="Marcadores" />
<item android:id="@id/share" android:orderInCategory="4" android:title="Compartir" android:titleCondensed="Compartir" />
<item android:id="@id/settings" android:orderInCategory="5" android:title="Ajustes" android:titleCondensed="Ajustes" />
<item android:id="@+id/forward" android:title="Adelante" android:orderInCategory="5" android:titleCondensed="Adelante"></item>
</menu>

11
res/menu-fr/menu.xml

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:title="Ajouter aux favoris" android:titleCondensed="Aj. Favoris" android:orderInCategory="2"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="Favoris" android:title="Favoris" android:orderInCategory="3"></item>
<item android:id="@+id/share" android:title="Partager..." android:titleCondensed="Partager" android:orderInCategory="4"></item>
<item android:id="@+id/settings" android:title="Paramètres" android:titleCondensed="Paramètres" android:orderInCategory="6"></item>
<item android:id="@+id/forward" android:title="Suivant" android:orderInCategory="5" android:titleCondensed="Suivant"></item>
</menu>

11
res/menu-it/menu.xml

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:title="Aggiungi ai preferiti" android:titleCondensed="Aggiungi ai preferiti" android:orderInCategory="2"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="Segnalibri" android:title="Segnalibri" android:orderInCategory="3"></item>
<item android:id="@+id/share" android:title="Azione" android:titleCondensed="Azione" android:orderInCategory="4"></item>
<item android:id="@+id/settings" android:title="Impostazioni" android:titleCondensed="Impostazioni" android:orderInCategory="6"></item>
<item android:id="@+id/forward" android:title="Avanti" android:orderInCategory="5" android:titleCondensed="Avanti"></item>
</menu>

12
res/menu-zh-rCN/menu.xml

@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/history" android:titleCondensed="History" android:title="History" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:titleCondensed="添加书签" android:title="添加书签" android:orderInCategory="2"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="书签列表" android:title="书签" android:orderInCategory="3"></item>
<item android:id="@+id/share" android:titleCondensed="分享页面" android:title="分享" android:orderInCategory="4"></item>
<item android:id="@+id/settings" android:titleCondensed="应用设置" android:title="设置" android:orderInCategory="6"></item>
<item android:id="@+id/tabs" android:titleCondensed="显示以及隐藏标签" android:title="显示/隐藏标签" android:orderInCategory="5"></item>
<item android:id="@+id/forward" android:titleCondensed="前进页面" android:title="前进" android:orderInCategory="7"></item>
</menu>

10
res/menu-zh-rTW/menu.xml

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@id/history" android:orderInCategory="1" android:title="History" android:titleCondensed="History" />
<item android:id="@id/bookmark" android:orderInCategory="2" android:title="加入到書簽" android:titleCondensed="加入書簽" />
<item android:id="@id/allBookmarks" android:orderInCategory="3" android:title="我的書簽" android:titleCondensed="我的書簽清單" />
<item android:id="@id/share" android:orderInCategory="4" android:title="分享頁面" android:titleCondensed="分享頁面" />
<item android:id="@id/settings" android:orderInCategory="6" android:title="設定" android:titleCondensed="瀏覽器設定" />
<item android:id="@id/forward" android:orderInCategory="5" android:title="前往下個頁面" android:titleCondensed="前往下個頁面" />
</menu>

9
res/menu/advanced_settings.xml

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>

6
res/menu/incognito_menu.xml

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="1"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="Bookmarks" android:title="Bookmarks" android:orderInCategory="3"></item>
<item android:id="@+id/incognito" android:title="New Tab" android:orderInCategory="5" android:titleCondensed="New Tab"></item>
<item android:id="@+id/history" android:title="@string/menu_history" android:titleCondensed="@string/menu_history" android:orderInCategory="1"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="@string/menu_bookmarks" android:title="@string/menu_bookmarks" android:orderInCategory="3"></item>
<item android:id="@+id/incognito" android:title="@string/menu_new_tab" android:orderInCategory="5" android:titleCondensed="@string/menu_new_tab"></item>
</menu>

12
res/menu/menu.xml

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/history" android:title="History" android:titleCondensed="History" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:title="Add to bookmarks" android:titleCondensed="Add bookmark" android:orderInCategory="2"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="Bookmarks" android:title="Bookmarks" android:orderInCategory="3"></item>
<item android:id="@+id/share" android:title="Share" android:titleCondensed="Share" android:orderInCategory="4"></item>
<item android:id="@+id/settings" android:title="Settings" android:titleCondensed="Settings" android:orderInCategory="6"></item>
<item android:id="@+id/incognito" android:title="Incognito Tab" android:orderInCategory="5" android:titleCondensed="Incognito Tab"></item>
<item android:id="@+id/history" android:title="@string/menu_history" android:titleCondensed="@string/menu_history" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:title="@string/menu_add" android:titleCondensed="@string/menu_add" android:orderInCategory="2"></item>
<item android:id="@+id/allBookmarks" android:titleCondensed="@string/menu_bookmarks" android:title="@string/menu_bookmarks" android:orderInCategory="3"></item>
<item android:id="@+id/share" android:title="@string/menu_share" android:titleCondensed="@string/menu_share" android:orderInCategory="4"></item>
<item android:id="@+id/settings" android:title="@string/menu_settings" android:titleCondensed="@string/menu_settings" android:orderInCategory="6"></item>
<item android:id="@+id/incognito" android:title="@string/menu_incognito" android:orderInCategory="5" android:titleCondensed="@string/menu_incognito"></item>
</menu>

9
res/menu/new_settings.xml

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>
</menu>

9
res/values-de/strings.xml

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<string name="agent">User-Agent</string>
<string name="history">Verlauf beim Beenden leeren</string>
<string name="email">Kontakt</string>
<string name="flash">Adobe Flash aktivieren (falls installiert)</string>
<string name="flash">Adobe Flash aktivieren</string>
<string name="mobile">Mobile Ansicht</string>
<string name="desk">Desktop Ansicht</string>
<string name="custom">Benutzerdefinierte Ansicht</string>
@ -38,5 +38,12 @@ @@ -38,5 +38,12 @@
<string name="search">Suchdienst</string>
<string name="search_hint">Suche</string>
<string name="overViewMode">Seiten in der Übersicht öffnen</string>
<string name="menu_history">Verlauf</string>
<string name="menu_add">Zu Lesezeichen hinzufügen</string>
<string name="menu_bookmarks">Lesezeichen</string>
<string name="menu_share">Teilen</string>
<string name="menu_settings">Einstellungen</string>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

12
res/values-es/strings.xml

@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
<string name="app_name">Lightning</string>
<string name="google">Google</string>
<string name="settings">Ajustes del navegador</string>
<string name="location">Permitir a webs acceder a tu ubicacion</string>
<string name="location">Acceder a tu ubicacion</string>
<string name="password">Guardar contrasenas</string>
<string name="agent">Agente de usuario</string>
<string name="history">Borrar historial al salir</string>
<string name="email">Enviame un Email</string>
<string name="flash">Habilitar Adobe Flash (por demanda)</string>
<string name="flash">Habilitar Adobe Flash</string>
<string name="mobile">Ver como movil</string>
<string name="desk">Ver como ordenador</string>
<string name="custom">Ver con agente de usuario distinto</string>
@ -16,4 +16,12 @@ @@ -16,4 +16,12 @@
<string name="settingshelp">Solo aplicados a nuevas pestanas</string>
<string name="fullscreen">Enable fullscreen mode</string>
<string name="java">Enable JavaScript</string>
<string name="menu_history">History</string>
<string name="menu_add">Anadir a Marcadores</string>
<string name="menu_bookmarks">Marcadores</string>
<string name="menu_share">Compartir</string>
<string name="menu_settings">Ajustes</string>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

11
res/values-fr/strings.xml

@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
<string name="app_name">Lightning</string>
<string name="google">Google</string>
<string name="settings">Paramètres</string>
<string name="location">Autoriser les sites à accéder à ma position</string>
<string name="location">Accéder à ma position</string>
<string name="password">Enregistrer les mots de passe</string>
<string name="agent">User Agent</string>
<string name="history">Effacer l\'historique à la sortie</string>
<string name="email">Contactez moi</string>
<string name="flash">Activer Adobe Flash Player (s\'il est installé)</string>
<string name="flash">Activer Adobe Flash Player</string>
<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>
@ -15,4 +15,11 @@ @@ -15,4 +15,11 @@
<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="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">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

9
res/values-it/strings.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<string name="app_name">Lightning</string>
<string name="google">Google</string>
<string name="settings">Impostazioni del browser</string>
<string name="location">Consenti ai siti di accedere alla tua posizione</string>
<string name="location">Accedere alla tua posizione</string>
<string name="password">Salva le tue password</string>
<string name="agent">User Agent</string>
<string name="history">Clear history on exit</string>
@ -17,5 +17,12 @@ @@ -17,5 +17,12 @@
<string name="settingshelp">Impostazioni valgono solo per le nuove schede</string>
<string name="fullscreen">Enable fullscreen mode</string>
<string name="java">Enable JavaScript</string>
<string name="menu_history">History</string>
<string name="menu_add">Aggiungi ai preferiti</string>
<string name="menu_bookmarks">Segnalibri</string>
<string name="menu_share">Azione</string>
<string name="menu_settings">Impostazioni</string>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

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

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Lightning+</string>
<string name="app_name">Lightning</string>
<string name="google">Google</string>
<string name="settings">浏览器设置</string>
<string name="location">允许站点访问您地理位置</string>
@ -17,5 +17,12 @@ @@ -17,5 +17,12 @@
<string name="settingshelp">设置仅将应用于新标签页</string>
<string name="fullscreen">启用全屏模式</string>
<string name="java">启用 JavaScript</string>
<string name="menu_history">History</string>
<string name="menu_add">添加书签</string>
<string name="menu_bookmarks">书签列表</string>
<string name="menu_share">分享页面</string>
<string name="menu_settings">应用设置</string>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

9
res/values-zh-rTW/strings.xml

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Lightning+</string>
<string name="app_name">Lightning</string>
<string name="google">Google</string>
<string name="settings">瀏覽器設定</string>
<string name="location">允許網頁存取您的位置資訊</string>
@ -16,4 +16,11 @@ @@ -16,4 +16,11 @@
<string name="settingshelp">設定僅套用於新的標簽頁</string>
<string name="fullscreen">啓用全螢幕模式</string>
<string name="java">啓用 JavaScript</string>
<string name="menu_history">History</string>
<string name="menu_add">加入到書簽</string>
<string name="menu_bookmarks">我的書簽</string>
<string name="menu_share">分享頁面</string>
<string name="menu_settings">設定</string>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
</resources>

11
res/values/strings.xml

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
<string name="block">Block Images</string>
<string name="window">Allow sites to open new windows</string>
<string name="cookies">Enable Cookies</string>
<string name="importbookmarks">Import bookmarks from Stock Browser</string>
<string name="importbookmarks">Import bookmarks from Browser</string>
<string name="size">Text size</string>
<string name="title_activity_advanced_settings">AdvancedSettings</string>
<string name="hello_world">Hello world!</string>
@ -44,5 +44,14 @@ @@ -44,5 +44,14 @@
<string name="wideViewPort">Use wide viewport</string>
<string name="overViewMode">Load pages in overview mode</string>
<string name="restore">Restore lost tabs on start</string>
<string name="menu_history">History</string>
<string name="menu_add">Add bookmark</string>
<string name="menu_bookmarks">Bookmarks</string>
<string name="menu_share">Share</string>
<string name="menu_settings">Settings</string>
<string name="menu_incognito">Incognito tab</string>
<string name="menu_new_tab">New tab</string>
<string name="stock_browser_unavailable">(No stock browser detected)</string>
<string name="stock_browser_available">(Supported stock browser detected)</string>
</resources>

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

@ -8,6 +8,8 @@ import acr.browser.barebones.utilities.FinalVariables; @@ -8,6 +8,8 @@ import acr.browser.barebones.utilities.FinalVariables;
import acr.browser.barebones.utilities.Utils;
import acr.browser.barebones.activities.BarebonesActivity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Browser;
import android.app.Activity;
import android.app.AlertDialog;
@ -29,6 +31,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener; @@ -29,6 +31,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
public class AdvancedSettingsActivity extends Activity {
@ -42,6 +45,8 @@ public class AdvancedSettingsActivity extends Activity { @@ -42,6 +45,8 @@ public class AdvancedSettingsActivity extends Activity {
static SharedPreferences.Editor edit;
static RelativeLayout r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13;
static CheckBox cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9, cb10;
static Context CONTEXT;
Handler messageHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -49,7 +54,9 @@ public class AdvancedSettingsActivity extends Activity { @@ -49,7 +54,9 @@ public class AdvancedSettingsActivity extends Activity {
setContentView(R.layout.advanced_settings);
settings = getSharedPreferences(preferences, 0);
edit = settings.edit();
CONTEXT = this;
initialize();
}
void initialize() {
@ -118,13 +125,29 @@ public class AdvancedSettingsActivity extends Activity { @@ -118,13 +125,29 @@ public class AdvancedSettingsActivity extends Activity {
TextView importBookmarks = (TextView)findViewById(R.id.isImportAvailable);
if(BarebonesActivity.noStockBrowser){
importBookmarks.setText("(No Browser Available)");
importBookmarks.setText(getResources().getString(R.string.stock_browser_unavailable));
}
else{
importBookmarks.setText("(Supported Browser Detected)");
importBookmarks.setText(getResources().getString(R.string.stock_browser_available));
}
messageHandler = new MessageHandler();
}
static class MessageHandler extends Handler{
@Override
public void handleMessage(Message msg) {
switch(msg.what){
case 1:
Utils.showToast(CONTEXT, "History Cleared");
break;
}
super.handleMessage(msg);
}
}
void back() {
ImageView back = (ImageView) findViewById(R.id.advanced_back);
back.setBackgroundResource(R.drawable.button);
@ -454,8 +477,11 @@ public class AdvancedSettingsActivity extends Activity { @@ -454,8 +477,11 @@ public class AdvancedSettingsActivity extends Activity {
}
}
trimCache(AdvancedSettingsActivity.this);
messageHandler.sendEmptyMessage(1);
}
void r9(RelativeLayout view) {
view.setOnClickListener(new OnClickListener() {
@ -550,23 +576,24 @@ public class AdvancedSettingsActivity extends Activity { @@ -550,23 +576,24 @@ public class AdvancedSettingsActivity extends Activity {
String title = "";
String url = "";
int number = 0;
if (mCur.moveToFirst() && mCur.getCount() > 0) {
while (mCur.isAfterLast() == false) {
number++;
title = mCur.getString(mCur
.getColumnIndex(Browser.BookmarkColumns.TITLE));
url = mCur.getString(mCur
.getColumnIndex(Browser.BookmarkColumns.URL));
Utils.addBookmark(getBaseContext(),title,url);
Utils.addBookmark(CONTEXT,title,url);
mCur.moveToNext();
}
}
Utils.showToast(CONTEXT, number + " Bookmarks were imported");
} catch (NullPointerException ignored) {
}
}
else{
Utils.createInformativeDialog(getBaseContext(), "Error", "No browser was detected to import bookmarks from.");
Utils.createInformativeDialog(CONTEXT, "Error", "No browser was detected to import bookmarks from.");
}
}

17
src/acr/browser/barebones/activities/BarebonesActivity.java

@ -664,10 +664,12 @@ public class BarebonesActivity extends Activity { @@ -664,10 +664,12 @@ public class BarebonesActivity extends Activity {
}
public void setUrlText(String url) {
if (!url.startsWith("file://")) {
getUrl.setText(url);
} else {
getUrl.setText("");
if (url != null) {
if (!url.startsWith("file://")) {
getUrl.setText(url);
} else {
getUrl.setText("");
}
}
}
@ -2134,13 +2136,12 @@ public class BarebonesActivity extends Activity { @@ -2134,13 +2136,12 @@ public class BarebonesActivity extends Activity {
@Override
public void onBackPressed() {
if (showFullScreen && !uBar.isShown()) {
uBar.startAnimation(slideDown);
}
if (main[pageId] != null && main[pageId].canGoBack()) {
main[pageId].stopLoading();
main[pageId].goBack();
if (showFullScreen && !uBar.isShown()) {
uBar.startAnimation(slideDown);
}
} else {
deleteTab(pageId);
uBar.bringToFront();

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

File diff suppressed because it is too large Load Diff

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

@ -1,7 +1,5 @@ @@ -1,7 +1,5 @@
package acr.browser.barebones.customwebview;
import java.lang.reflect.Method;
import acr.browser.barebones.activities.IncognitoModeActivity;
import acr.browser.barebones.utilities.FinalVariables;
import android.content.Context;
@ -9,7 +7,6 @@ import android.view.MotionEvent; @@ -9,7 +7,6 @@ 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;
@ -19,22 +16,15 @@ public final class IncognitoWebView extends WebView { @@ -19,22 +16,15 @@ public final class IncognitoWebView extends WebView {
final View uBar = IncognitoModeActivity.uBar;
final Animation slideUp = IncognitoModeActivity.slideUp;
final Animation slideDown = IncognitoModeActivity.slideDown;
private ZoomButtonsController zoomControl;
public IncognitoWebView(Context context) {
super(context);
getControls();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (API < 11 && zoomControl != null) {
try {
zoomControl.getZoomControls().setVisibility(View.INVISIBLE);
} catch (IllegalArgumentException ignored) {
}
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: {
first = true;
@ -62,15 +52,4 @@ public final class IncognitoWebView extends WebView { @@ -62,15 +52,4 @@ public final class IncognitoWebView extends WebView {
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();
}
}
}
}

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

@ -6,7 +6,7 @@ import android.os.Environment; @@ -6,7 +6,7 @@ import android.os.Environment;
public class FinalVariables {
public static final int MAX_TABS = 5;
public static final int MAX_BOOKMARKS = 50;
public static final int MAX_BOOKMARKS = 100;
public static final boolean PAID_VERSION = false;
public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/20 Safari/537.17";
public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7";

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

@ -8,6 +8,7 @@ import java.io.FileReader; @@ -8,6 +8,7 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import acr.browser.barebones.activities.AdvancedSettingsActivity;
import acr.browser.barebones.databases.DatabaseHandler;
import acr.browser.barebones.databases.HistoryItem;
import android.annotation.SuppressLint;
@ -177,4 +178,8 @@ public class Utils { @@ -177,4 +178,8 @@ public class Utils {
}
}
public static void showToast(Context context, String message){
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
}

24
src/acr/browser/barebones/variables/BookmarkPageVariables.java

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
package acr.browser.barebones.variables;
public class BookmarkPageVariables {
public static final String Heading = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
+ "<head><meta content=\"en-us\" http-equiv=\"Content-Language\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" />"
+ "<title>Bookmarks</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;}"
+ "body{color: gray;text-size: 10px}"
+ "div {vertical-align: middle;background-color: #ffffff;}"
+ "div.clickable {position:relative;}"
+ "p.font{font-size: 1em;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.space {height: 0.7em;}"
+ "p{padding-top: 0.5em;padding-bottom: 0.5em;padding-right: 0.5em;padding-left: 0.5em;}"
+ "img{padding-left: 0em;padding-right: 0.5em;}"
+ "</style><body bgcolor = #f2f2f2>";
public static final String Part1 = "<div class=\"clickable\">"
+ "<div class=\"shadow\">" + "<p class=\"font\">" + "<a href=\"";
public static final String Part2 = "\"></a>"+
"<img height=\"15px\" width=\"15px\" src='https://www.google.com/s2/favicons?domain=";
public static final String Part3 = "'/>";
public static final String Part4 = "</p></div></div>";
public static final String End = "</body></html>";
}

26
src/acr/browser/barebones/variables/FinalVariables.java

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
package acr.browser.barebones.variables;
import android.os.Environment;
public class FinalVariables {
public static final int MAX_TABS = 5;
public static final int MAX_BOOKMARKS = 50;
public static final boolean PAID_VERSION = false;
public static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/20 Safari/537.17";
public static final String MOBILE_USER_AGENT = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7";
public static final int API = android.os.Build.VERSION.SDK_INT;
public static final String YAHOO_SEARCH = "http://search.yahoo.com/search?p=";
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 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 SETTINGS_INTENT = "android.intent.action.SETTINGS";
public static final String INCOGNITO_INTENT = "android.intent.action.BAREBONESINCOGNITO";
public static final String DOWNLOAD_LOCATION = Environment.getExternalStorageDirectory().toString()+Environment.DIRECTORY_DOWNLOADS;
}

19
src/acr/browser/barebones/variables/HistoryPageVariables.java

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
package acr.browser.barebones.variables;
public class HistoryPageVariables {
public static final String Heading = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">"
+ "<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;}"
+ "body{color: gray;text-size: 10px}div.space {height: 0.7em;} div.extra{text-align: center;}div {vertical-align: middle;}"
+ "div {background-color: #ffffff;}div.clickable {position:relative;}p.black{color: black;font-size: 1em;font-family: \"Lucida Console\"}"
+ "p.font{font-size: 1em;font-family: \"Lucida Console\"}p.black{padding-left: 0.5em;padding-right: 0.5em;padding-top: 0.5em;padding-bottom: 0em;}"
+ "p.font{padding-left: 0.5em;padding-right: 0.5em;padding-top: 0em;padding-bottom: 0.5em;}"
+ "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>";
public static final String Part1 = "<div class=\"clickable\"><div class=\"shadow\"><a href=\"";
public static final String Part2 = "\"></a><p class=\"black\">";
public static final String Part3 = "</p><p class=\"font\">";
public static final String Part4 = "</p></div></div>";
public static final String End = "</body></html>";
}

174
src/acr/browser/barebones/variables/Utils.java

@ -1,174 +0,0 @@ @@ -1,174 +0,0 @@
package acr.browser.barebones.variables;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
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;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.Browser;
import android.util.Log;
import android.webkit.URLUtil;
import android.widget.Toast;
public class Utils {
public static void createInformativeDialog(Context context, String title,
String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setMessage(message)
.setCancelable(true)
.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog alert = builder.create();
alert.show();
}
public static void addBookmark(Context context, String title, String url) {
File book = new File(context.getFilesDir(), "bookmarks");
File bookUrl = new File(context.getFilesDir(), "bookurl");
try {
BufferedReader readUrlRead = new BufferedReader(new FileReader(
bookUrl));
String u;
int n = 0;
while ((u = readUrlRead.readLine()) != null
&& n < FinalVariables.MAX_BOOKMARKS) {
if (u.contentEquals(url)) {
readUrlRead.close();
return;
}
n++;
}
readUrlRead.close();
} catch (FileNotFoundException ignored) {
} catch (IOException ignored) {
} catch (NullPointerException ignored) {
}
try {
BufferedWriter bookWriter = new BufferedWriter(new FileWriter(book,
true));
BufferedWriter urlWriter = new BufferedWriter(new FileWriter(
bookUrl, true));
bookWriter.write(title);
urlWriter.write(url);
bookWriter.newLine();
urlWriter.newLine();
bookWriter.close();
urlWriter.close();
} catch (FileNotFoundException ignored) {
} catch (IOException ignored) {
} catch (NullPointerException ignored) {
}
}
public static void updateHistory(final Context context,
final ContentResolver content, final boolean noStockBrowser,
final String url, final String title) {
Runnable update = new Runnable() {
@Override
public void run() {
if (!noStockBrowser) {
try {
Browser.updateVisitedHistory(content, url, true);
} catch (NullPointerException ignored) {
}
}
try {
StringBuilder sb = new StringBuilder("url" + " = ");
DatabaseUtils.appendEscapedSQLString(sb, url);
DatabaseHandler historyHandler = new DatabaseHandler(
context);
SQLiteDatabase history = historyHandler.getReadableDatabase();
Cursor cursor = history.query("history", new String[] { "id",
"url", "title" }, sb.toString(), null, null, null,
null);
if (!cursor.moveToFirst()) {
historyHandler.addHistoryItem(new HistoryItem(url,
title));
} else {
historyHandler.delete(url);
historyHandler.addHistoryItem(new HistoryItem(url,
title));
}
historyHandler.close();
cursor.close();
history.close();
} catch (IllegalStateException e) {
Log.e("Barebones", "IllegalStateException in updateHistory");
} catch (NullPointerException e) {
Log.e("Barebones", "NullPointerException in updateHistory");
} catch (SQLiteException e) {
Log.e("Barebones", "SQLiteException in updateHistory");
}
}
};
if (url != null) {
if (!url.startsWith("file://")) {
new Thread(update).start();
}
}
}
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
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);
DownloadManager.Request it = new DownloadManager.Request(
nice);
String fileName = URLUtil.guessFileName(url,
contentDisposition, mimetype);
if (FinalVariables.API >= 11) {
it.allowScanningByMediaScanner();
it.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
it.setDestinationInExternalPublicDir(
Environment.DIRECTORY_DOWNLOADS, 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",
Toast.LENGTH_SHORT).show();
} catch (IllegalArgumentException e) {
Log.e("Barebones", "Problem downloading");
Toast.makeText(context, "Error Downloading File",
Toast.LENGTH_SHORT).show();
} catch (SecurityException ignored) {
}
}
}
Loading…
Cancel
Save