Browse Source

2.3.7

german language
fixed crash when exiting bookmarks
tweaked the bookmark and tab ui a little
master
Anthony Restaino 12 years ago
parent
commit
bba148f92e
  1. 4
      AndroidManifest.xml
  2. BIN
      res/drawable-hdpi/ic_launcher.png
  3. BIN
      res/drawable-mdpi/ic_launcher.png
  4. BIN
      res/drawable-xhdpi/bg_inactive.9.png
  5. BIN
      res/drawable-xhdpi/bg_press.9.png
  6. BIN
      res/drawable-xhdpi/book.9.png
  7. BIN
      res/drawable-xhdpi/book_press.9.png
  8. 6
      res/drawable/bookmark.xml
  9. 7
      res/layout/activity_main.xml
  10. 44
      res/layout/menu.xml
  11. 11
      res/menu-de/menu.xml
  12. 21
      res/values-de/strings.xml
  13. 2
      res/values-it/strings.xml
  14. 2
      res/values-zh-rCN/strings.xml
  15. 2
      res/values-zh-rTW/strings.xml
  16. 4
      res/values/colors.xml
  17. 321
      src/acr/browser/barebones/Barebones.java

4
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="29" android:versionCode="30"
android:versionName="2.3.6" > android:versionName="2.3.7" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

BIN
res/drawable-hdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
res/drawable-mdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 927 B

After

Width:  |  Height:  |  Size: 987 B

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 943 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

6
res/drawable/bookmark.xml

@ -1,5 +1,5 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@color/press"/> <item android:state_focused="true" android:drawable="@drawable/book_press"/>
<item android:state_pressed="true" android:drawable="@color/blue" /> <item android:state_pressed="true" android:drawable="@drawable/book_press" />
<item android:drawable="@drawable/line" /> <item android:drawable="@drawable/book" />
</selector> </selector>

7
res/layout/activity_main.xml

@ -110,17 +110,22 @@
android:paddingTop="10dp" android:paddingTop="10dp"
android:src="@drawable/refresh" /> android:src="@drawable/refresh" />
</RelativeLayout> </RelativeLayout>
<MultiAutoCompleteTextView <MultiAutoCompleteTextView
android:id="@+id/enterUrl" android:id="@+id/enterUrl"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/options" android:layout_toLeftOf="@+id/options"
android:layout_toRightOf="@+id/refreshLayout" android:layout_toRightOf="@+id/refreshLayout"
android:background="@drawable/bookmark"
android:ems="10" android:ems="10"
android:hint="@string/google" android:hint="@string/google"
android:imeOptions="actionGo" android:imeOptions="actionGo"
android:inputType="textUri" android:inputType="textUri"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true" /> android:singleLine="true" />
</RelativeLayout> </RelativeLayout>

44
res/layout/menu.xml

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/bar">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Refresh" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add to Bookmarks" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bookmarks" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Share" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Settings" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forward" />
</LinearLayout>

11
res/menu-de/menu.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/refresh" android:title="Aktualisieren" android:titleCondensed="Aktualisieren" android:orderInCategory="1"></item>
<item android:id="@+id/bookmark" android:title="zu Lesezeichen hinzufugen" android:titleCondensed="Lesezeichen hinzuf𧥮" 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="Vorwarts" android:orderInCategory="5" android:titleCondensed="Vorw峴s"></item>
</menu>

21
res/values-de/strings.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Lightning+</string>
<string name="google">Google</string>
<string name="settings">Browser Einstellungen</string>
<string name="location">Webseiten erlauben auf Standort zu zugreifen</string>
<string name="password">Passworter speichern</string>
<string name="agent">Ansicht</string>
<string name="history">Beim Schlie<EFBFBD>en Verlauf l<EFBFBD>schen</string>
<string name="email">kontaktiere mich</string>
<string name="flash">Adobe Flash aktivieren (fals es installiert ist)</string>
<string name="mobile">Mobile Ansicht</string>
<string name="desk">Computer Ansicht</string>
<string name="custom">personalisierte Nutzeransicht</string>
<string name="home">Startseite</string>
<string name="settingshelp">Einstellungen werden erst g<EFBFBD>ltig wenn ein neuer ab ge<EFBFBD>ffnet wird</string>
<string name="fullscreen">Vollansicht aktivieren</string>
<string name="java">JavaScript aktivieren</string>
</resources>

2
res/values-it/strings.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?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">Impostazioni del browser</string> <string name="settings">Impostazioni del browser</string>
<string name="location">Consenti ai siti di accedere alla tua posizione</string> <string name="location">Consenti ai siti di accedere alla tua posizione</string>

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?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">浏览器设置</string> <string name="settings">浏览器设置</string>
<string name="location">允许站点访问您地理位置</string> <string name="location">允许站点访问您地理位置</string>

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?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">瀏覽器設定</string> <string name="settings">瀏覽器設定</string>
<string name="location">允許網頁存取您的位置資訊</string> <string name="location">允許網頁存取您的位置資訊</string>

4
res/values/colors.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="clear">#00000000</color> <color name="clear">#00000000</color>
<color name="blue">#b40099cc</color> <color name="blue">#b433b5e5</color>
<color name="press">#330099cc</color> <color name="press">#3333b5e5</color>
<color name="black">#ff000000</color> <color name="black">#ff000000</color>
<color name="dark">#ff3f3f3f</color> <color name="dark">#ff3f3f3f</color>

321
src/acr/browser/barebones/Barebones.java

@ -49,6 +49,7 @@ import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.Display;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -93,6 +94,7 @@ import android.widget.LinearLayout;
import android.widget.MultiAutoCompleteTextView.Tokenizer; import android.widget.MultiAutoCompleteTextView.Tokenizer;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener; import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.PopupWindow;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.ScrollView; import android.widget.ScrollView;
@ -133,7 +135,7 @@ public class Barebones extends Activity implements OnLongClickListener,
static int height, width, pixels, leftPad, rightPad, pixelHeight; static int height, width, pixels, leftPad, rightPad, pixelHeight;
static int bookHeight, API; static int bookHeight, API;
static int mShortAnimationDuration; static int mShortAnimationDuration;
static int id; static int id, tenPad;
static int hitTest; static int hitTest;
static int urlColumn, titleColumn; static int urlColumn, titleColumn;
static View mCustomView = null; static View mCustomView = null;
@ -177,7 +179,6 @@ public class Barebones extends Activity implements OnLongClickListener,
static Map<String, String> map; static Map<String, String> map;
static Handler handler; static Handler handler;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -229,11 +230,8 @@ public class Barebones extends Activity implements OnLongClickListener,
public void init() { public void init() {
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics); getWindowManager().getDefaultDisplay().getMetrics(metrics);
if (isPhone) {
showFullScreen = settings.getBoolean("fullscreen", true); showFullScreen = settings.getBoolean("fullscreen", false);
} else {
showFullScreen = settings.getBoolean("fullscreen", false);
}
uBar = (RelativeLayout) findViewById(R.id.urlBar); uBar = (RelativeLayout) findViewById(R.id.urlBar);
bg = (RelativeLayout) findViewById(R.id.background); bg = (RelativeLayout) findViewById(R.id.background);
slideUp = AnimationUtils.loadAnimation(this, R.anim.slide_up); slideUp = AnimationUtils.loadAnimation(this, R.anim.slide_up);
@ -359,9 +357,10 @@ public class Barebones extends Activity implements OnLongClickListener,
pixelHeight = (int) (36 * scale + 0.5f); pixelHeight = (int) (36 * scale + 0.5f);
bookHeight = (int) (48 * scale + 0.5f); bookHeight = (int) (48 * scale + 0.5f);
height56 = (int) (56 * scale + 0.5f); height56 = (int) (56 * scale + 0.5f);
leftPad = (int) (15 * scale + 0.5f); leftPad = (int) (17 * scale + 0.5f);
rightPad = (int) (15 * scale + 0.5f); rightPad = (int) (15 * scale + 0.5f);
height32 = (int) (32 * scale + 0.5f); height32 = (int) (32 * scale + 0.5f);
tenPad = (int) (10 * scale + 0.5f);
statusBar = (int) (25 * scale + 0.5f); statusBar = (int) (25 * scale + 0.5f);
number = 0; number = 0;
loading = getResources().getDrawable(R.drawable.loading); loading = getResources().getDrawable(R.drawable.loading);
@ -416,7 +415,7 @@ public class Barebones extends Activity implements OnLongClickListener,
} }
public static void updateUI(){ public static void updateUI() {
clock = System.currentTimeMillis(); clock = System.currentTimeMillis();
Thread uiUpdate = new Thread(new Runnable() { Thread uiUpdate = new Thread(new Runnable() {
@ -424,7 +423,8 @@ public class Barebones extends Activity implements OnLongClickListener,
public void run() { public void run() {
long clock = System.currentTimeMillis(); long clock = System.currentTimeMillis();
while (true) { while (true) {
while (!(System.currentTimeMillis() - clock > 20 && pageIdIsVisible)); while (!(System.currentTimeMillis() - clock > 20 && pageIdIsVisible))
;
main[pageId].postInvalidate(); main[pageId].postInvalidate();
clock = System.currentTimeMillis(); clock = System.currentTimeMillis();
@ -435,7 +435,7 @@ public class Barebones extends Activity implements OnLongClickListener,
pageIdIsVisible = true; pageIdIsVisible = true;
uiUpdate.setDaemon(true); uiUpdate.setDaemon(true);
uiUpdate.setPriority(Thread.MIN_PRIORITY); uiUpdate.setPriority(Thread.MIN_PRIORITY);
//uiUpdate.start(); // uiUpdate.start();
} }
} }
@ -491,93 +491,92 @@ public class Barebones extends Activity implements OnLongClickListener,
} }
} }
void enterUrl(){ void enterUrl() {
getUrl = (MultiAutoCompleteTextView) findViewById(R.id.enterUrl); getUrl = (MultiAutoCompleteTextView) findViewById(R.id.enterUrl);
getUrl.setPadding(tenPad, 0, tenPad, 0);
getUrl.setTextColor(getResources().getColor(android.R.color.black)); getUrl.setTextColor(getResources().getColor(android.R.color.black));
getUrl.setPadding(tenPad, 0, tenPad, 0);
getUrl.setBackgroundResource(R.drawable.book);
getUrl.setPadding(tenPad, 0, tenPad, 0);
handler = new Handler() { handler = new Handler() {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
switch (msg.what) { switch (msg.what) {
case 1:{ case 1: {
adapter = new SimpleAdapter(Barebones.this, list, adapter = new SimpleAdapter(Barebones.this, list,
R.layout.two_line_autocomplete, R.layout.two_line_autocomplete, new String[] {
new String[] { "title", "url" }, new int[] { R.id.title, "title", "url" }, new int[] { R.id.title,
R.id.url }); R.id.url });
getUrl.setAdapter(adapter); getUrl.setAdapter(adapter);
break; break;
} }
case 2:{ case 2: {
break; break;
} }
} }
} }
}; };
Thread updateAutoComplete = new Thread(new Runnable() { Thread updateAutoComplete = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
bookmarks = Browser.BOOKMARKS_URI; bookmarks = Browser.BOOKMARKS_URI;
columns = new String[] { Browser.BookmarkColumns.URL, columns = new String[] { Browser.BookmarkColumns.URL,
Browser.BookmarkColumns.TITLE }; Browser.BookmarkColumns.TITLE };
try{ try {
managedCursor = null; managedCursor = null;
managedCursor = getContentResolver().query(bookmarks, // URI of managedCursor = getContentResolver().query(bookmarks, // URI
columns, // Which columns to return // of
null, // Which rows to return (all rows) columns, // Which columns to return
null, // Selection arguments (none) null, // Which rows to return (all rows)
null); null, // Selection arguments (none)
Log.i("Lightning: ","SQLite success!!!"); null);
handler.sendEmptyMessage(1); Log.i("Barebones: ", "SQLite success!!!");
Log.i("Lightning: ","SQLite success!!!"); handler.sendEmptyMessage(1);
Log.i("Barebones: ", "SQLite success!!!");
} } catch (SQLiteException e) {
catch(SQLiteException e){
handler.sendEmptyMessage(2); handler.sendEmptyMessage(2);
Log.e("Lightning: ","SQLite Error!!! "+e); Log.e("Barebones: ", "SQLite Error!!! " + e);
} }
list = new ArrayList<Map<String, String>>(); list = new ArrayList<Map<String, String>>();
noStockBrowser = true; noStockBrowser = true;
if(managedCursor!=null){ if (managedCursor != null) {
noStockBrowser = false; noStockBrowser = false;
if (managedCursor.moveToFirst()) { if (managedCursor.moveToFirst()) {
// Variable for holding the retrieved URL // Variable for holding the retrieved URL
urlColumn = managedCursor urlColumn = managedCursor
.getColumnIndex(Browser.BookmarkColumns.URL); .getColumnIndex(Browser.BookmarkColumns.URL);
titleColumn = managedCursor titleColumn = managedCursor
.getColumnIndex(Browser.BookmarkColumns.TITLE); .getColumnIndex(Browser.BookmarkColumns.TITLE);
// Reference to the the column containing the URL // Reference to the the column containing the URL
do { do {
urlA = managedCursor.getString(urlColumn); urlA = managedCursor.getString(urlColumn);
title = managedCursor.getString(titleColumn); title = managedCursor.getString(titleColumn);
map = new HashMap<String, String>(); map = new HashMap<String, String>();
map.put("title", title); map.put("title", title);
map.put("url", urlA); map.put("url", urlA);
list.add(map); list.add(map);
} while (managedCursor.moveToNext()); } while (managedCursor.moveToNext());
} }
} }
} }
}); });
updateAutoComplete.start(); updateAutoComplete.start();
getUrl.setThreshold(2); getUrl.setThreshold(2);
@ -588,9 +587,10 @@ public class Barebones extends Activity implements OnLongClickListener,
@Override @Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) { long arg3) {
try{
txt = (TextView) arg1.findViewById(R.id.url); txt = (TextView) arg1.findViewById(R.id.url);
str = txt.getText().toString(); str = txt.getText().toString();
if(!pageIdIsVisible && isBookmarkShowing){ if (!pageIdIsVisible && isBookmarkShowing) {
scrollBookmarks.startAnimation(fadeOut); scrollBookmarks.startAnimation(fadeOut);
background.removeView(scrollBookmarks); background.removeView(scrollBookmarks);
background.addView(main[pageId]); background.addView(main[pageId]);
@ -599,9 +599,14 @@ public class Barebones extends Activity implements OnLongClickListener,
} }
main[pageId].loadUrl(str); main[pageId].loadUrl(str);
getUrl.setText(str); getUrl.setText(str);
getUrl.setPadding(tenPad, 0, tenPad, 0);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0); imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
}
catch(NullPointerException e){
Log.e("Barebones Error: ","NullPointerException on item click");
}
} }
}); });
@ -647,7 +652,6 @@ public class Barebones extends Activity implements OnLongClickListener,
R.drawable.bg_inactive)); R.drawable.bg_inactive));
} }
urlTitle[pageId].setPadding(leftPad, 0, rightPad, 0); urlTitle[pageId].setPadding(leftPad, 0, rightPad, 0);
background.addView(main[num]); background.addView(main[num]);
background.removeView(main[pageId]); background.removeView(main[pageId]);
@ -696,14 +700,15 @@ public class Barebones extends Activity implements OnLongClickListener,
Drawable[] drawables = title.getCompoundDrawables(); Drawable[] drawables = title.getCompoundDrawables();
bounds[number] = drawables[2].getBounds(); bounds[number] = drawables[2].getBounds();
title.setOnLongClickListener(Barebones.this); title.setOnLongClickListener(Barebones.this);
title.setOnClickListener(new OnClickListener(){ title.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View arg0) { public void onClick(View arg0) {
id = arg0.getId(); id = arg0.getId();
if (API < 16) { if (API < 16) {
urlTitle[pageId].setBackgroundDrawable(getResources() urlTitle[pageId]
.getDrawable(R.drawable.bg_inactive)); .setBackgroundDrawable(getResources()
.getDrawable(R.drawable.bg_inactive));
} else if (API > 15) { } else if (API > 15) {
urlTitle[pageId].setBackground(getResources() urlTitle[pageId].setBackground(getResources()
.getDrawable(R.drawable.bg_inactive)); .getDrawable(R.drawable.bg_inactive));
@ -734,13 +739,12 @@ public class Barebones extends Activity implements OnLongClickListener,
main[id].animate().alpha(1f) main[id].animate().alpha(1f)
.setDuration(mShortAnimationDuration); .setDuration(mShortAnimationDuration);
main[pageId].clearAnimation(); main[pageId].clearAnimation();
// main[pageId].animate().alpha(0f) // main[pageId].animate().alpha(0f)
// .setDuration(mShortAnimationDuration); // .setDuration(mShortAnimationDuration);
// main[pageId].setAlpha(1f); // main[pageId].setAlpha(1f);
background.removeView(main[pageId]); background.removeView(main[pageId]);
uBar.bringToFront(); uBar.bringToFront();
} else { } else {
pageIdIsVisible = false; pageIdIsVisible = false;
@ -752,13 +756,14 @@ public class Barebones extends Activity implements OnLongClickListener,
pageId = id; pageId = id;
pageIdIsVisible = true; pageIdIsVisible = true;
getUrl.setText(urlToLoad[pageId][0]); getUrl.setText(urlToLoad[pageId][0]);
getUrl.setPadding(tenPad, 0, tenPad, 0);
if (API < 16) { if (API < 16) {
urlTitle[pageId].setBackgroundDrawable(getResources() urlTitle[pageId]
.getDrawable(R.drawable.bg_press)); .setBackgroundDrawable(getResources()
.getDrawable(R.drawable.bg_press));
} else if (API > 15) { } else if (API > 15) {
urlTitle[pageId].setBackground(getResources().getDrawable( urlTitle[pageId].setBackground(getResources()
R.drawable.bg_press)); .getDrawable(R.drawable.bg_press));
} }
urlTitle[pageId].setPadding(leftPad, 0, rightPad, 0); urlTitle[pageId].setPadding(leftPad, 0, rightPad, 0);
} }
@ -781,7 +786,6 @@ public class Barebones extends Activity implements OnLongClickListener,
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
@ -933,16 +937,16 @@ public class Barebones extends Activity implements OnLongClickListener,
switch (agentPicker) { switch (agentPicker) {
case 1: case 1:
main[pageToView].getSettings().setUserAgentString(mobile); main[pageToView].getSettings().setUserAgentString(mobile);
Log.i("lightning", mobile); Log.i("barebones", mobile);
break; break;
case 2: case 2:
main[pageToView].getSettings().setUserAgentString(desktop); main[pageToView].getSettings().setUserAgentString(desktop);
Log.i("lightning", desktop); Log.i("barebones", desktop);
break; break;
case 3: case 3:
userAgent = settings.getString("agent", user); userAgent = settings.getString("agent", user);
main[pageToView].getSettings().setUserAgentString(userAgent); main[pageToView].getSettings().setUserAgentString(userAgent);
Log.i("lightning", userAgent); Log.i("barebones", userAgent);
break; break;
} }
background.addView(main[pageToView]); background.addView(main[pageToView]);
@ -953,16 +957,14 @@ public class Barebones extends Activity implements OnLongClickListener,
background.removeView(main[lastVisibleWebView]); background.removeView(main[lastVisibleWebView]);
} }
uBar.bringToFront(); uBar.bringToFront();
if(Url.contains("about:home")&&!showFullScreen){ if (Url.contains("about:home") && !showFullScreen) {
pageIdIsVisible = false; pageIdIsVisible = false;
goBookmarks(); goBookmarks();
} } else if (Url.contains("about:home")) {
else if (Url.contains("about:home")) {
pageIdIsVisible = true; pageIdIsVisible = true;
main[pageToView].loadUrl("about:blank"); main[pageToView].loadUrl("about:blank");
} } else if (Url.contains("about:blank")) {
else if (Url.contains("about:blank")) {
pageIdIsVisible = true; pageIdIsVisible = true;
main[pageToView].loadUrl("about:blank"); main[pageToView].loadUrl("about:blank");
@ -983,15 +985,15 @@ public class Barebones extends Activity implements OnLongClickListener,
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
if(!showFullScreen){ if (!showFullScreen) {
main[pageId].invalidate(); main[pageId].invalidate();
} }
super.onDraw(canvas); super.onDraw(canvas);
} }
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
//final HitTestResult poop; // final HitTestResult poop;
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: {
@ -1006,12 +1008,11 @@ public class Barebones extends Activity implements OnLongClickListener,
move = true; move = true;
} }
case MotionEvent.ACTION_UP: { case MotionEvent.ACTION_UP: {
try{ try {
hitTest = getHitTestResult().getType(); hitTest = getHitTestResult().getType();
} } catch (NullPointerException e) {
catch(NullPointerException e){ }
} if (showFullScreen && hitTest != 9) {
if (showFullScreen&&hitTest!=9) {
if (System.currentTimeMillis() - timeBetweenDownPress < 500 if (System.currentTimeMillis() - timeBetweenDownPress < 500
&& !move) { && !move) {
if (!uBarShows) { if (!uBarShows) {
@ -1050,7 +1051,6 @@ public class Barebones extends Activity implements OnLongClickListener,
public void doUpdateVisitedHistory(WebView view, String url, public void doUpdateVisitedHistory(WebView view, String url,
boolean isReload) { boolean isReload) {
return; return;
} }
@ -1073,7 +1073,7 @@ public class Barebones extends Activity implements OnLongClickListener,
public void onReceivedError(WebView view, int errorCode, public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) { String description, String failingUrl) {
Log.e("Lightning: ","Error: " + description); Log.e("Barebones: ", "Error: " + description);
super.onReceivedError(view, errorCode, description, failingUrl); super.onReceivedError(view, errorCode, description, failingUrl);
} }
@ -1094,12 +1094,13 @@ public class Barebones extends Activity implements OnLongClickListener,
} }
@Override @Override
public void onPageStarted(WebView view,String url, Bitmap favicon) { public void onPageStarted(WebView view, String url, Bitmap favicon) {
int num = view.getId(); int num = view.getId();
pageIsLoading = true; pageIsLoading = true;
refresh.startAnimation(anim); refresh.startAnimation(anim);
getUrl.setText(url); getUrl.setText(url);
getUrl.setPadding(tenPad, 0, tenPad, 0);
urlToLoad[num][0] = url; urlToLoad[num][0] = url;
urlTitle[num].setCompoundDrawables(webpageOther, null, exitTab, urlTitle[num].setCompoundDrawables(webpageOther, null, exitTab,
null); null);
@ -1112,12 +1113,13 @@ public class Barebones extends Activity implements OnLongClickListener,
@Override @Override
public void onPageFinished(WebView view, final String url) { public void onPageFinished(WebView view, final String url) {
if(!noStockBrowser){ if (!noStockBrowser) {
Thread history = new Thread( new Runnable(){ Thread history = new Thread(new Runnable() {
@Override @Override
public void run(){ public void run() {
Browser.updateVisitedHistory(getContentResolver(),url,true); Browser.updateVisitedHistory(getContentResolver(), url,
//Log.i("Lightning",view.getTitle()+" "+url); true);
// Log.i("Barebones",view.getTitle()+" "+url);
} }
}); });
@ -1222,7 +1224,7 @@ public class Barebones extends Activity implements OnLongClickListener,
if (allowLocation == true) { if (allowLocation == true) {
callback.invoke(origin, true, false); callback.invoke(origin, true, false);
} else { } else {
Log.i("Lightning: ", "onGeolocationPermissionsShowPrompt()"); Log.i("Barebones: ", "onGeolocationPermissionsShowPrompt()");
final boolean remember = true; final boolean remember = true;
AlertDialog.Builder builder = new AlertDialog.Builder( AlertDialog.Builder builder = new AlertDialog.Builder(
@ -1263,7 +1265,6 @@ public class Barebones extends Activity implements OnLongClickListener,
super.onReceivedTitle(view, title); super.onReceivedTitle(view, title);
} }
@Override @Override
public void onShowCustomView(View view, public void onShowCustomView(View view,
WebChromeClient.CustomViewCallback callback) { WebChromeClient.CustomViewCallback callback) {
@ -1346,18 +1347,16 @@ public class Barebones extends Activity implements OnLongClickListener,
view.setSaveEnabled(true); view.setSaveEnabled(true);
webViewSettings.setDomStorageEnabled(true); webViewSettings.setDomStorageEnabled(true);
webViewSettings.setAppCacheEnabled(true); webViewSettings.setAppCacheEnabled(true);
webViewSettings.setAppCachePath( webViewSettings.setAppCachePath(getApplicationContext().getFilesDir()
getApplicationContext().getFilesDir().getAbsolutePath() .getAbsolutePath() + "/cache");
+ "/cache");
webViewSettings.setRenderPriority(RenderPriority.HIGH); webViewSettings.setRenderPriority(RenderPriority.HIGH);
webViewSettings.setGeolocationEnabled(true); webViewSettings.setGeolocationEnabled(true);
webViewSettings.setGeolocationDatabasePath( webViewSettings.setGeolocationDatabasePath(getApplicationContext()
getApplicationContext().getFilesDir().getAbsolutePath()); .getFilesDir().getAbsolutePath());
webViewSettings.setDatabaseEnabled(true); webViewSettings.setDatabaseEnabled(true);
webViewSettings.setDatabasePath( webViewSettings.setDatabasePath(getApplicationContext().getFilesDir()
getApplicationContext().getFilesDir().getAbsolutePath() .getAbsolutePath() + "/databases");
+ "/databases");
enableFlash = settings.getInt("enableflash", 0); enableFlash = settings.getInt("enableflash", 0);
switch (enableFlash) { switch (enableFlash) {
case 0: case 0:
@ -1384,8 +1383,8 @@ public class Barebones extends Activity implements OnLongClickListener,
webViewSettings.setSupportZoom(true); webViewSettings.setSupportZoom(true);
webViewSettings.setUseWideViewPort(true); webViewSettings.setUseWideViewPort(true);
webViewSettings.setLoadWithOverviewMode(true); // Seems to be causing webViewSettings.setLoadWithOverviewMode(true); // Seems to be causing
// the performance // the performance
// to drop // to drop
if (API >= 11) { if (API >= 11) {
webViewSettings.setDisplayZoomControls(false); webViewSettings.setDisplayZoomControls(false);
webViewSettings.setAllowContentAccess(true); webViewSettings.setAllowContentAccess(true);
@ -1410,9 +1409,9 @@ public class Barebones extends Activity implements OnLongClickListener,
bookmarkLayout.setOrientation(LinearLayout.VERTICAL); bookmarkLayout.setOrientation(LinearLayout.VERTICAL);
TextView description = new TextView(Barebones.this); TextView description = new TextView(Barebones.this);
description.setHeight(height56); description.setHeight(height56);
description.setBackgroundColor(0xff0099cc); description.setBackgroundColor(0xff33b5e5);
description.setTextColor(0xffffffff); description.setTextColor(0xffffffff);
description.setText("Bookmarks (long-press to remove)"); description.setText("Bookmarks");
description.setGravity(Gravity.CENTER_VERTICAL description.setGravity(Gravity.CENTER_VERTICAL
| Gravity.CENTER_HORIZONTAL); | Gravity.CENTER_HORIZONTAL);
description.setTextSize(bookHeight / 3); description.setTextSize(bookHeight / 3);
@ -1441,13 +1440,14 @@ public class Barebones extends Activity implements OnLongClickListener,
if (uBar.isShown()) { if (uBar.isShown()) {
urlTitle[pageId].setText("Bookmarks"); urlTitle[pageId].setText("Bookmarks");
getUrl.setText("Bookmarks"); getUrl.setText("Bookmarks");
getUrl.setPadding(tenPad, 0, tenPad, 0);
} }
//main[pageId].startAnimation(fadeOut); // main[pageId].startAnimation(fadeOut);
background.removeView(main[pageId]); background.removeView(main[pageId]);
if (showFullScreen) { if (showFullScreen) {
//uBar.startAnimation(fadeOut); // uBar.startAnimation(fadeOut);
background.removeView(uBar); background.removeView(uBar);
} }
scrollBookmarks.addView(bookmarkLayout); scrollBookmarks.addView(bookmarkLayout);
@ -1477,9 +1477,9 @@ public class Barebones extends Activity implements OnLongClickListener,
new FileWriter(book)); new FileWriter(book));
BufferedWriter urlWriter = new BufferedWriter( BufferedWriter urlWriter = new BufferedWriter(
new FileWriter(bookUrl)); new FileWriter(bookUrl));
Log.i("lightning", "makes to here"); Log.i("barebones", "makes to here");
while (bUrl[n] != null && n < (MAX_BOOKMARKS - 1)) { while (bUrl[n] != null && n < (MAX_BOOKMARKS - 1)) {
Log.i("lightning", "makes to here " + n); Log.i("barebones", "makes to here " + n);
if (delete != n) { if (delete != n) {
bookWriter.write(bTitle[n]); bookWriter.write(bTitle[n]);
urlWriter.write(bUrl[n]); urlWriter.write(bUrl[n]);
@ -1487,7 +1487,7 @@ public class Barebones extends Activity implements OnLongClickListener,
urlWriter.newLine(); urlWriter.newLine();
} }
n++; n++;
Log.i("lightning", "makes to here " + n); Log.i("barebones", "makes to here " + n);
} }
bookWriter.close(); bookWriter.close();
urlWriter.close(); urlWriter.close();
@ -1597,6 +1597,8 @@ public class Barebones extends Activity implements OnLongClickListener,
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException e){
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1654,8 +1656,10 @@ public class Barebones extends Activity implements OnLongClickListener,
public void deleteTab(int id) { public void deleteTab(int id) {
int leftId = id; int leftId = id;
pageIdIsVisible = false; pageIdIsVisible = false;
main[id].stopLoading();
main[id].clearView();
boolean right = false, left = false; boolean right = false, left = false;
//background.clearDisappearingChildren(); // background.clearDisappearingChildren();
if (API < 16) { if (API < 16) {
urlTitle[id].setBackgroundDrawable(getResources().getDrawable( urlTitle[id].setBackgroundDrawable(getResources().getDrawable(
R.drawable.bg_press)); R.drawable.bg_press));
@ -1696,6 +1700,7 @@ public class Barebones extends Activity implements OnLongClickListener,
urlTitle[id].setPadding(leftPad, 0, rightPad, 0); urlTitle[id].setPadding(leftPad, 0, rightPad, 0);
pageId = id; pageId = id;
getUrl.setText(urlToLoad[pageId][0]); getUrl.setText(urlToLoad[pageId][0]);
getUrl.setPadding(tenPad, 0, tenPad, 0);
right = true; right = true;
break; break;
} }
@ -1707,7 +1712,7 @@ public class Barebones extends Activity implements OnLongClickListener,
if (urlTitle[leftId].isShown()) { if (urlTitle[leftId].isShown()) {
background.addView(main[leftId]); background.addView(main[leftId]);
main[leftId].setVisibility(View.VISIBLE); main[leftId].setVisibility(View.VISIBLE);
//uBar.bringToFront(); // uBar.bringToFront();
if (API < 16) { if (API < 16) {
urlTitle[leftId] urlTitle[leftId]
.setBackgroundDrawable(getResources() .setBackgroundDrawable(getResources()
@ -1719,6 +1724,7 @@ public class Barebones extends Activity implements OnLongClickListener,
urlTitle[leftId].setPadding(leftPad, 0, rightPad, 0); urlTitle[leftId].setPadding(leftPad, 0, rightPad, 0);
pageId = leftId; pageId = leftId;
getUrl.setText(urlToLoad[pageId][0]); getUrl.setText(urlToLoad[pageId][0]);
getUrl.setPadding(tenPad, 0, tenPad, 0);
left = true; left = true;
break; break;
} }
@ -1727,9 +1733,7 @@ public class Barebones extends Activity implements OnLongClickListener,
} }
} else {
}
else{
right = left = true; right = left = true;
} }
@ -1881,6 +1885,21 @@ public class Barebones extends Activity implements OnLongClickListener,
}); });
menu.show(); menu.show();
} else if (API < 11) { } else if (API < 11) {
/*
LayoutInflater inflater=(LayoutInflater)Barebones.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Display display=getWindowManager().getDefaultDisplay();
int width=display.getWidth()/2;
int height=display.getHeight()/2;
View pop = inflater.inflate(R.layout.menu,null,false);
pop.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
height=pop.getMeasuredHeight();
width=pop.getMeasuredWidth();
PopupWindow pu = new PopupWindow(pop,width,height,true);
pu.showAtLocation(findViewById(v.getId()),Gravity.NO_GRAVITY,v.getRight(),v.getBottom()+80);
*/
openOptionsMenu(); openOptionsMenu();
} }
} }
@ -1944,20 +1963,19 @@ public class Barebones extends Activity implements OnLongClickListener,
String fixedQuery = query.trim(); String fixedQuery = query.trim();
boolean period = fixedQuery.contains("."); boolean period = fixedQuery.contains(".");
if (isBookmarkShowing) { if (isBookmarkShowing) {
Log.i("Lightning", " is executing"); Log.i("Barebones", " is executing");
scrollBookmarks.startAnimation(fadeOut); scrollBookmarks.startAnimation(fadeOut);
background.removeView(scrollBookmarks); background.removeView(scrollBookmarks);
isBookmarkShowing = false;
background.addView(main[pageId]); background.addView(main[pageId]);
main[pageId].startAnimation(fadeIn); main[pageId].startAnimation(fadeIn);
uBar.bringToFront(); uBar.bringToFront();
} }
pageIdIsVisible = true; pageIdIsVisible = true;
if(fixedQuery.contains("about:home")){ if (fixedQuery.contains("about:home")) {
goBookmarks(); goBookmarks();
} } else if (fixedQuery.contains(" ") || period == false) {
else if (fixedQuery.contains(" ") || period == false) {
fixedQuery.replaceAll(" ", "+"); fixedQuery.replaceAll(" ", "+");
main[pageId] main[pageId]
.loadUrl("http://www.google.com/search?q=" + fixedQuery); .loadUrl("http://www.google.com/search?q=" + fixedQuery);
@ -1993,6 +2011,7 @@ public class Barebones extends Activity implements OnLongClickListener,
uBar.bringToFront(); uBar.bringToFront();
urlTitle[pageId].setText(urlToLoad[pageId][1]); urlTitle[pageId].setText(urlToLoad[pageId][1]);
getUrl.setText(urlToLoad[pageId][0]); getUrl.setText(urlToLoad[pageId][0]);
getUrl.setPadding(tenPad, 0, tenPad, 0);
pageIdIsVisible = true; pageIdIsVisible = true;
isBookmarkShowing = false; isBookmarkShowing = false;
} else { } else {
@ -2053,6 +2072,7 @@ public class Barebones extends Activity implements OnLongClickListener,
background.removeView(scrollBookmarks); background.removeView(scrollBookmarks);
urlTitle[pageId].setText(urlToLoad[pageId][1]); urlTitle[pageId].setText(urlToLoad[pageId][1]);
getUrl.setText(urlToLoad[pageId][0]); getUrl.setText(urlToLoad[pageId][0]);
getUrl.setPadding(tenPad, 0, tenPad, 0);
pageIdIsVisible = true; pageIdIsVisible = true;
isBookmarkShowing = false; isBookmarkShowing = false;
uBar.bringToFront(); uBar.bringToFront();
@ -2088,9 +2108,9 @@ public class Barebones extends Activity implements OnLongClickListener,
deleteHistory = settings.getBoolean("history", false); deleteHistory = settings.getBoolean("history", false);
if (deleteHistory == true) { if (deleteHistory == true) {
if(!noStockBrowser){ if (!noStockBrowser) {
Browser.clearHistory(getContentResolver()); Browser.clearHistory(getContentResolver());
} }
} }
// trimCache(this); // trimCache(this);
} catch (Exception e) { } catch (Exception e) {
@ -2126,8 +2146,6 @@ public class Barebones extends Activity implements OnLongClickListener,
return dir.delete(); return dir.delete();
} }
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
pageIdIsVisible = false; pageIdIsVisible = false;
@ -2198,13 +2216,12 @@ public class Barebones extends Activity implements OnLongClickListener,
main[id].animate().alpha(1f) main[id].animate().alpha(1f)
.setDuration(mShortAnimationDuration); .setDuration(mShortAnimationDuration);
main[pageId].clearAnimation(); main[pageId].clearAnimation();
// main[pageId].animate().alpha(0f) // main[pageId].animate().alpha(0f)
// .setDuration(mShortAnimationDuration); // .setDuration(mShortAnimationDuration);
// main[pageId].setAlpha(1f); // main[pageId].setAlpha(1f);
background.removeView(main[pageId]); background.removeView(main[pageId]);
uBar.bringToFront(); uBar.bringToFront();
} else { } else {
pageIdIsVisible = false; pageIdIsVisible = false;
@ -2216,6 +2233,7 @@ public class Barebones extends Activity implements OnLongClickListener,
pageId = id; pageId = id;
pageIdIsVisible = true; pageIdIsVisible = true;
getUrl.setText(urlToLoad[pageId][0]); getUrl.setText(urlToLoad[pageId][0]);
getUrl.setPadding(tenPad, 0, tenPad, 0);
} }
} }
@ -2236,8 +2254,8 @@ public class Barebones extends Activity implements OnLongClickListener,
@Override @Override
protected void onPause() { protected void onPause() {
if(API>=11){ if (API >= 11) {
main[pageId].onPause(); main[pageId].onPause();
} }
main[pageId].pauseTimers(); main[pageId].pauseTimers();
super.onPause(); super.onPause();
@ -2245,13 +2263,12 @@ public class Barebones extends Activity implements OnLongClickListener,
@Override @Override
protected void onResume() { protected void onResume() {
if(API>=11){ if (API >= 11) {
main[pageId].onResume(); main[pageId].onResume();
} }
main[pageId].resumeTimers(); main[pageId].resumeTimers();
super.onResume(); super.onResume();
} }
@Override @Override
@ -2259,12 +2276,10 @@ public class Barebones extends Activity implements OnLongClickListener,
String url = null; String url = null;
url = intent.getDataString(); url = intent.getDataString();
if(url!=null){ if (url != null) {
newTab(number,url); newTab(number, url);
} }
super.onNewIntent(intent); super.onNewIntent(intent);
} }
} }

Loading…
Cancel
Save