|
|
@ -7,8 +7,11 @@ import java.io.FileNotFoundException; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.FileWriter; |
|
|
|
import java.io.FileWriter; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Random; |
|
|
|
import java.util.Random; |
|
|
@ -33,6 +36,8 @@ import android.content.Context; |
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.Intent; |
|
|
|
import android.content.SharedPreferences; |
|
|
|
import android.content.SharedPreferences; |
|
|
|
|
|
|
|
import android.content.pm.PackageInfo; |
|
|
|
|
|
|
|
import android.content.pm.PackageManager.NameNotFoundException; |
|
|
|
import android.content.res.Configuration; |
|
|
|
import android.content.res.Configuration; |
|
|
|
import android.database.Cursor; |
|
|
|
import android.database.Cursor; |
|
|
|
import android.database.sqlite.SQLiteDatabase; |
|
|
|
import android.database.sqlite.SQLiteDatabase; |
|
|
@ -51,6 +56,7 @@ import android.provider.Browser; |
|
|
|
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.GestureDetector; |
|
|
|
import android.view.Gravity; |
|
|
|
import android.view.Gravity; |
|
|
|
import android.view.KeyEvent; |
|
|
|
import android.view.KeyEvent; |
|
|
|
import android.view.Menu; |
|
|
|
import android.view.Menu; |
|
|
@ -58,6 +64,7 @@ import android.view.MenuInflater; |
|
|
|
import android.view.MenuItem; |
|
|
|
import android.view.MenuItem; |
|
|
|
import android.view.MotionEvent; |
|
|
|
import android.view.MotionEvent; |
|
|
|
import android.view.View; |
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
import android.view.GestureDetector.SimpleOnGestureListener; |
|
|
|
import android.view.View.OnClickListener; |
|
|
|
import android.view.View.OnClickListener; |
|
|
|
import android.view.View.OnKeyListener; |
|
|
|
import android.view.View.OnKeyListener; |
|
|
|
import android.view.View.OnLongClickListener; |
|
|
|
import android.view.View.OnLongClickListener; |
|
|
@ -158,6 +165,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
public static final String HOMEPAGE = FinalVariables.HOMEPAGE; |
|
|
|
public static final String HOMEPAGE = FinalVariables.HOMEPAGE; |
|
|
|
public static final int API = FinalVariables.API; |
|
|
|
public static final int API = FinalVariables.API; |
|
|
|
public static final String SEPARATOR = "\\|\\$\\|SEPARATOR\\|\\$\\|"; |
|
|
|
public static final String SEPARATOR = "\\|\\$\\|SEPARATOR\\|\\$\\|"; |
|
|
|
|
|
|
|
|
|
|
|
public static boolean DEVICE_HAS_GPS = false; |
|
|
|
public static boolean DEVICE_HAS_GPS = false; |
|
|
|
// semi constants
|
|
|
|
// semi constants
|
|
|
|
public static Context CONTEXT; |
|
|
|
public static Context CONTEXT; |
|
|
@ -438,7 +446,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
if (API > 8) { |
|
|
|
if (API > 8) { |
|
|
|
view.setDownloadListener(new CustomDownloadListener(ACTIVITY)); |
|
|
|
view.setDownloadListener(new CustomDownloadListener(ACTIVITY)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
main[pageToView] = view; |
|
|
|
if (display) { |
|
|
|
if (display) { |
|
|
|
if (currentId != -1) { |
|
|
|
if (currentId != -1) { |
|
|
|
background.removeView(currentTab); |
|
|
|
background.removeView(currentTab); |
|
|
@ -455,8 +463,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
} else if (Url.contains("about:blank")) { |
|
|
|
} else if (Url.contains("about:blank")) { |
|
|
|
view.loadUrl(""); |
|
|
|
view.loadUrl(""); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
searchTheWeb(Url, CONTEXT); |
|
|
|
view.loadUrl(Url); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Log.i("Browser", "tab complete"); |
|
|
|
Log.i("Browser", "tab complete"); |
|
|
|
return view; |
|
|
|
return view; |
|
|
@ -475,6 +482,29 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static List<Map<String, String>> getBookmarks() { |
|
|
|
|
|
|
|
List<Map<String, String>> bookmarks = new ArrayList<Map<String, String>>(); |
|
|
|
|
|
|
|
File bookUrl = new File(CONTEXT.getFilesDir(), "bookurl"); |
|
|
|
|
|
|
|
File book = new File(CONTEXT.getFilesDir(), "bookmarks"); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
BufferedReader readUrl = new BufferedReader(new FileReader(bookUrl)); |
|
|
|
|
|
|
|
BufferedReader readBook = new BufferedReader(new FileReader(book)); |
|
|
|
|
|
|
|
String u, t; |
|
|
|
|
|
|
|
while ((u = readUrl.readLine()) != null |
|
|
|
|
|
|
|
&& (t = readBook.readLine()) != null) { |
|
|
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>(); |
|
|
|
|
|
|
|
map.put("title", '\u2605' + " " + t); |
|
|
|
|
|
|
|
map.put("url", u); |
|
|
|
|
|
|
|
bookmarks.add(map); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
readBook.close(); |
|
|
|
|
|
|
|
readUrl.close(); |
|
|
|
|
|
|
|
} catch (FileNotFoundException ignored) { |
|
|
|
|
|
|
|
} catch (IOException ignored) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return bookmarks; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void goBookmarks(Context context, CustomWebView view) { |
|
|
|
static void goBookmarks(Context context, CustomWebView view) { |
|
|
|
File book = new File(context.getFilesDir(), "bookmarks"); |
|
|
|
File book = new File(context.getFilesDir(), "bookmarks"); |
|
|
|
File bookUrl = new File(context.getFilesDir(), "bookurl"); |
|
|
|
File bookUrl = new File(context.getFilesDir(), "bookurl"); |
|
|
@ -583,6 +613,10 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
public static void onHideCustomView(FrameLayout fullScreenContainer, |
|
|
|
public static void onHideCustomView(FrameLayout fullScreenContainer, |
|
|
|
CustomViewCallback mCustomViewCallback, int orientation) { |
|
|
|
CustomViewCallback mCustomViewCallback, int orientation) { |
|
|
|
|
|
|
|
if (!settings.getBoolean("hidestatus", false)) { |
|
|
|
|
|
|
|
ACTIVITY.getWindow().clearFlags( |
|
|
|
|
|
|
|
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
|
|
|
|
|
|
|
} |
|
|
|
FrameLayout screen = (FrameLayout) ACTIVITY.getWindow().getDecorView(); |
|
|
|
FrameLayout screen = (FrameLayout) ACTIVITY.getWindow().getDecorView(); |
|
|
|
screen.removeView(fullScreenContainer); |
|
|
|
screen.removeView(fullScreenContainer); |
|
|
|
fullScreenContainer = null; |
|
|
|
fullScreenContainer = null; |
|
|
@ -593,8 +627,8 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
uBar.bringToFront(); |
|
|
|
uBar.bringToFront(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Message click; |
|
|
|
private static Message click; |
|
|
|
|
|
|
|
|
|
|
|
public static boolean onLongClick() { |
|
|
|
public static boolean onLongClick() { |
|
|
|
int n = currentId; |
|
|
|
int n = currentId; |
|
|
|
if (currentId == -1 || currentTab == null) { |
|
|
|
if (currentId == -1 || currentTab == null) { |
|
|
@ -724,8 +758,8 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
Log.i("Lightning", "Load Time: " + loadTime); |
|
|
|
Log.i("Lightning", "Load Time: " + loadTime); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static int numberPage; |
|
|
|
private static int numberPage; |
|
|
|
|
|
|
|
|
|
|
|
public static void onPageStarted(WebView view, String url, Bitmap favicon) { |
|
|
|
public static void onPageStarted(WebView view, String url, Bitmap favicon) { |
|
|
|
Log.i("Lightning", "Page Started"); |
|
|
|
Log.i("Lightning", "Page Started"); |
|
|
|
loadTime = System.currentTimeMillis(); |
|
|
|
loadTime = System.currentTimeMillis(); |
|
|
@ -779,6 +813,9 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void onShowCustomView() { |
|
|
|
public static void onShowCustomView() { |
|
|
|
|
|
|
|
ACTIVITY.getWindow().setFlags( |
|
|
|
|
|
|
|
WindowManager.LayoutParams.FLAG_FULLSCREEN, |
|
|
|
|
|
|
|
WindowManager.LayoutParams.FLAG_FULLSCREEN); |
|
|
|
background.removeView(currentTab); |
|
|
|
background.removeView(currentTab); |
|
|
|
uBar.setVisibility(View.GONE); |
|
|
|
uBar.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
} |
|
|
@ -831,7 +868,6 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void renameBookmark(String url) { |
|
|
|
public static void renameBookmark(String url) { |
|
|
|
index = 0; |
|
|
|
index = 0; |
|
|
|
for (int n = 0; n < MAX_BOOKMARKS; n++) { |
|
|
|
for (int n = 0; n < MAX_BOOKMARKS; n++) { |
|
|
@ -929,7 +965,12 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
} else if (query.contains("about:history")) { |
|
|
|
} else if (query.contains("about:history")) { |
|
|
|
generateHistory(currentTab, context); |
|
|
|
generateHistory(currentTab, context); |
|
|
|
} else if (isSearch) { |
|
|
|
} else if (isSearch) { |
|
|
|
query.replaceAll(" ", "+"); |
|
|
|
try { |
|
|
|
|
|
|
|
URLEncoder.encode(query, "UTF-8"); |
|
|
|
|
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
currentTab.loadUrl(SEARCH + query); |
|
|
|
currentTab.loadUrl(SEARCH + query); |
|
|
|
} else if (!validURL) { |
|
|
|
} else if (!validURL) { |
|
|
|
currentTab.loadUrl("http://" + query); |
|
|
|
currentTab.loadUrl("http://" + query); |
|
|
@ -1022,6 +1063,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onLongClick(View v) { |
|
|
|
public boolean onLongClick(View v) { |
|
|
|
|
|
|
|
clearCache(); |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -1063,8 +1105,17 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
findNewView(del); |
|
|
|
findNewView(del); |
|
|
|
|
|
|
|
if (main[del] != null) { |
|
|
|
|
|
|
|
if (API > 11) { |
|
|
|
|
|
|
|
main[del].onPause(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (main[del].isShown()) { |
|
|
|
|
|
|
|
background.removeView(main[del]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
main[del].removeAllViews(); |
|
|
|
main[del] = null; |
|
|
|
main[del] = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onAnimationRepeat(Animation animation) { |
|
|
|
public void onAnimationRepeat(Animation animation) { |
|
|
@ -1129,6 +1180,11 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
getUrl.setBackgroundResource(R.drawable.book); |
|
|
|
getUrl.setBackgroundResource(R.drawable.book); |
|
|
|
getUrl.setPadding(tenPad, 0, tenPad, 0); |
|
|
|
getUrl.setPadding(tenPad, 0, tenPad, 0); |
|
|
|
final List<Map<String, String>> list = new ArrayList<Map<String, String>>(); |
|
|
|
final List<Map<String, String>> list = new ArrayList<Map<String, String>>(); |
|
|
|
|
|
|
|
List<Map<String, String>> books = getBookmarks(); |
|
|
|
|
|
|
|
Iterator<Map<String, String>> it = books.iterator(); |
|
|
|
|
|
|
|
while (it.hasNext()) { |
|
|
|
|
|
|
|
list.add(it.next()); |
|
|
|
|
|
|
|
} |
|
|
|
handler = new Handler() { |
|
|
|
handler = new Handler() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1350,24 +1406,54 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
} |
|
|
|
} |
|
|
|
tabList.remove(delete); |
|
|
|
tabList.remove(delete); |
|
|
|
if (!(right || left)) { |
|
|
|
if (!(right || left)) { |
|
|
|
|
|
|
|
if (API > 11) { |
|
|
|
|
|
|
|
currentTab.onPause(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
currentTab.pauseTimers(); |
|
|
|
|
|
|
|
clearCache(); |
|
|
|
|
|
|
|
currentTab = null; |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
uBar.bringToFront(); |
|
|
|
uBar.bringToFront(); |
|
|
|
tabScroll.smoothScrollTo(currentTabTitle.getLeft(), 0); |
|
|
|
tabScroll.smoothScrollTo(currentTabTitle.getLeft(), 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void clearCache() { |
|
|
|
|
|
|
|
if (settings.getBoolean("cache", false) && currentTab != null) { |
|
|
|
|
|
|
|
currentTab.clearCache(true); |
|
|
|
|
|
|
|
Log.i("Lightning", "Cache Cleared"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (int n = 0; n < MAX_TABS; n++) { |
|
|
|
|
|
|
|
if (main[n] != null) { |
|
|
|
|
|
|
|
main[n].removeAllViews(); |
|
|
|
|
|
|
|
main[n] = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void finish() { |
|
|
|
public void finish() { |
|
|
|
background.clearDisappearingChildren(); |
|
|
|
background.clearDisappearingChildren(); |
|
|
|
background.removeView(currentTab); |
|
|
|
background.removeView(currentTab); |
|
|
|
tabScroll.clearDisappearingChildren(); |
|
|
|
tabScroll.clearDisappearingChildren(); |
|
|
|
if (settings.getBoolean("cache", false)) { |
|
|
|
|
|
|
|
currentTab.clearCache(true); |
|
|
|
|
|
|
|
Log.i("Lightning", "Cache Cleared"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
super.finish(); |
|
|
|
super.finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void onDestroy() { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super.onDestroy(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void onStop() { |
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super.onStop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void forward() { |
|
|
|
void forward() { |
|
|
|
ImageView forward = (ImageView) findViewById(R.id.forward); |
|
|
|
ImageView forward = (ImageView) findViewById(R.id.forward); |
|
|
|
forward.setBackgroundResource(R.drawable.button); |
|
|
|
forward.setBackgroundResource(R.drawable.button); |
|
|
@ -1558,12 +1644,12 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
reopenOldTabs(); // restores old tabs or creates a new one
|
|
|
|
// restores old tabs or creates a new one
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
startup.run(); |
|
|
|
startup.run(); |
|
|
|
|
|
|
|
reopenOldTabs(); |
|
|
|
// new tab button
|
|
|
|
// new tab button
|
|
|
|
ImageView newTab = (ImageView) findViewById(R.id.newTab); |
|
|
|
ImageView newTab = (ImageView) findViewById(R.id.newTab); |
|
|
|
newTab.setBackgroundResource(R.drawable.button); |
|
|
|
newTab.setBackgroundResource(R.drawable.button); |
|
|
@ -1717,6 +1803,16 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
isPhone = sizeInInches < 6.5; |
|
|
|
isPhone = sizeInInches < 6.5; |
|
|
|
forward();// forward button
|
|
|
|
forward();// forward button
|
|
|
|
back(); |
|
|
|
back(); |
|
|
|
|
|
|
|
PackageInfo p; |
|
|
|
|
|
|
|
int code = 0; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
p = getPackageManager().getPackageInfo(getPackageName(), 0); |
|
|
|
|
|
|
|
code = p.versionCode; |
|
|
|
|
|
|
|
} catch (NameNotFoundException e) { |
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (settings.getInt("first", 0) == 0) { |
|
|
|
if (settings.getInt("first", 0) == 0) { |
|
|
|
// navigation tips
|
|
|
|
// navigation tips
|
|
|
|
String message = "1. Long-press back button to exit browser\n\n" |
|
|
|
String message = "1. Long-press back button to exit browser\n\n" |
|
|
@ -1727,6 +1823,10 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
Utils.createInformativeDialog(CONTEXT, "Browser Tips", message); |
|
|
|
Utils.createInformativeDialog(CONTEXT, "Browser Tips", message); |
|
|
|
edit.putInt("first", 1); |
|
|
|
edit.putInt("first", 1); |
|
|
|
|
|
|
|
edit.putInt("version", code); |
|
|
|
|
|
|
|
edit.commit(); |
|
|
|
|
|
|
|
} else if (settings.getInt("version", code - 1) != code) { |
|
|
|
|
|
|
|
edit.putInt("version", code); |
|
|
|
edit.commit(); |
|
|
|
edit.commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1769,6 +1869,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
case KeyEvent.KEYCODE_F12: { |
|
|
|
case KeyEvent.KEYCODE_F12: { |
|
|
|
|
|
|
|
clearCache(); |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
case KeyEvent.KEYCODE_F6: { |
|
|
|
case KeyEvent.KEYCODE_F6: { |
|
|
@ -1799,6 +1900,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
urlToLoad[n][0] = null; |
|
|
|
urlToLoad[n][0] = null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
clearCache(); |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} else |
|
|
|
} else |
|
|
@ -1883,13 +1985,17 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void onPause() { |
|
|
|
protected void onPause() { |
|
|
|
|
|
|
|
|
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
if (API >= 11) { |
|
|
|
if (API >= 11) { |
|
|
|
currentTab.onPause(); |
|
|
|
currentTab.onPause(); |
|
|
|
|
|
|
|
for (int n = 0; n < MAX_TABS; n++) { |
|
|
|
|
|
|
|
if (main[n] != null) |
|
|
|
|
|
|
|
main[n].onPause(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
currentTab.pauseTimers(); |
|
|
|
currentTab.pauseTimers(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Thread remember = new Thread(new Runnable() { |
|
|
|
Thread remember = new Thread(new Runnable() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1920,11 +2026,15 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
} |
|
|
|
} |
|
|
|
if (API >= 11) { |
|
|
|
if (API >= 11) { |
|
|
|
currentTab.onResume(); |
|
|
|
currentTab.onResume(); |
|
|
|
|
|
|
|
for (int n = 0; n < MAX_TABS; n++) { |
|
|
|
|
|
|
|
if (main[n] != null) |
|
|
|
|
|
|
|
main[n].onResume(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
gestures = settings.getBoolean("gestures", true); |
|
|
|
gestures = settings.getBoolean("gestures", true); |
|
|
|
reinitializeSettings(); |
|
|
|
|
|
|
|
currentTab.resumeTimers(); |
|
|
|
currentTab.resumeTimers(); |
|
|
|
|
|
|
|
reinitializeSettings(); |
|
|
|
if (settings.getBoolean("fullscreen", false) != fullScreen) { |
|
|
|
if (settings.getBoolean("fullscreen", false) != fullScreen) { |
|
|
|
toggleFullScreen(); |
|
|
|
toggleFullScreen(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1935,11 +2045,21 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
private int y; |
|
|
|
private int y; |
|
|
|
private boolean xPress; |
|
|
|
private boolean xPress; |
|
|
|
private Rect edge; |
|
|
|
private Rect edge; |
|
|
|
|
|
|
|
private final GestureDetector mGestureDetector = new GestureDetector( |
|
|
|
|
|
|
|
CONTEXT, new CustomGestureListener()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class CustomGestureListener extends SimpleOnGestureListener { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onLongPress(MotionEvent e) { |
|
|
|
|
|
|
|
deleteTab(id); |
|
|
|
|
|
|
|
super.onLongPress(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onTouch(View v, MotionEvent event) { |
|
|
|
public boolean onTouch(View v, MotionEvent event) { |
|
|
|
try { |
|
|
|
|
|
|
|
id = v.getId(); |
|
|
|
id = v.getId(); |
|
|
|
|
|
|
|
try { |
|
|
|
background.clearDisappearingChildren(); |
|
|
|
background.clearDisappearingChildren(); |
|
|
|
xPress = false; |
|
|
|
xPress = false; |
|
|
|
x = (int) event.getX(); |
|
|
|
x = (int) event.getX(); |
|
|
@ -1948,13 +2068,8 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
v.getDrawingRect(edge); |
|
|
|
v.getDrawingRect(edge); |
|
|
|
currentTabTitle.setPadding(leftPad, 0, rightPad, 0); |
|
|
|
currentTabTitle.setPadding(leftPad, 0, rightPad, 0); |
|
|
|
if (event.getAction() == MotionEvent.ACTION_DOWN) { |
|
|
|
if (event.getAction() == MotionEvent.ACTION_DOWN) { |
|
|
|
timeTabPressed = System.currentTimeMillis(); |
|
|
|
|
|
|
|
} else if (event.getAction() == MotionEvent.ACTION_UP) { |
|
|
|
} else if (event.getAction() == MotionEvent.ACTION_UP) { |
|
|
|
|
|
|
|
|
|
|
|
if ((System.currentTimeMillis() - timeTabPressed) > 1000) { |
|
|
|
|
|
|
|
xPress = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (x >= (edge.right - bounds.width() - v.getPaddingRight() - 10 * 3 / 2) |
|
|
|
if (x >= (edge.right - bounds.width() - v.getPaddingRight() - 10 * 3 / 2) |
|
|
|
&& x <= (edge.right - v.getPaddingRight() + 10 * 3 / 2) |
|
|
|
&& x <= (edge.right - v.getPaddingRight() + 10 * 3 / 2) |
|
|
|
&& y >= (v.getPaddingTop() - 10 / 2) |
|
|
|
&& y >= (v.getPaddingTop() - 10 / 2) |
|
|
@ -2029,6 +2144,7 @@ public class BrowserActivity extends Activity implements OnTouchListener { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
Log.e("Lightning Error", "Well we dun messed up"); |
|
|
|
Log.e("Lightning Error", "Well we dun messed up"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
mGestureDetector.onTouchEvent(event); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|