|
|
@ -112,7 +112,7 @@ import acr.browser.lightning.database.HistoryItem; |
|
|
|
import acr.browser.lightning.dialog.LightningDialogBuilder; |
|
|
|
import acr.browser.lightning.dialog.LightningDialogBuilder; |
|
|
|
import acr.browser.lightning.fragment.BookmarksFragment; |
|
|
|
import acr.browser.lightning.fragment.BookmarksFragment; |
|
|
|
import acr.browser.lightning.fragment.TabsFragment; |
|
|
|
import acr.browser.lightning.fragment.TabsFragment; |
|
|
|
import acr.browser.lightning.object.SearchAdapter; |
|
|
|
import acr.browser.lightning.adapter.SearchAdapter; |
|
|
|
import acr.browser.lightning.react.Observable; |
|
|
|
import acr.browser.lightning.react.Observable; |
|
|
|
import acr.browser.lightning.react.Schedulers; |
|
|
|
import acr.browser.lightning.react.Schedulers; |
|
|
|
import acr.browser.lightning.receiver.NetworkReceiver; |
|
|
|
import acr.browser.lightning.receiver.NetworkReceiver; |
|
|
@ -421,7 +421,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void panicClean() { |
|
|
|
void panicClean() { |
|
|
|
Log.d(Constants.TAG, "Closing browser"); |
|
|
|
Log.d(TAG, "Closing browser"); |
|
|
|
mTabsManager.newTab(this, "", false); |
|
|
|
mTabsManager.newTab(this, "", false); |
|
|
|
mTabsManager.switchToTab(0); |
|
|
|
mTabsManager.switchToTab(0); |
|
|
|
mTabsManager.clearSavedState(); |
|
|
|
mTabsManager.clearSavedState(); |
|
|
@ -885,19 +885,19 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void notifyTabViewRemoved(int position) { |
|
|
|
public void notifyTabViewRemoved(int position) { |
|
|
|
Log.d(Constants.TAG, "Notify Tab Removed: " + position); |
|
|
|
Log.d(TAG, "Notify Tab Removed: " + position); |
|
|
|
mTabsView.tabRemoved(position); |
|
|
|
mTabsView.tabRemoved(position); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void notifyTabViewAdded() { |
|
|
|
public void notifyTabViewAdded() { |
|
|
|
Log.d(Constants.TAG, "Notify Tab Added"); |
|
|
|
Log.d(TAG, "Notify Tab Added"); |
|
|
|
mTabsView.tabAdded(); |
|
|
|
mTabsView.tabAdded(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void notifyTabViewChanged(int position) { |
|
|
|
public void notifyTabViewChanged(int position) { |
|
|
|
Log.d(Constants.TAG, "Notify Tab Changed: " + position); |
|
|
|
Log.d(TAG, "Notify Tab Changed: " + position); |
|
|
|
mTabsView.tabChanged(position); |
|
|
|
mTabsView.tabChanged(position); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -909,6 +909,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void removeTabView() { |
|
|
|
public void removeTabView() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log.d(TAG, "Remove the tab view"); |
|
|
|
|
|
|
|
|
|
|
|
// Set the background color so the color mode color doesn't show through
|
|
|
|
// Set the background color so the color mode color doesn't show through
|
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
|
|
|
|
|
|
|
@ -936,6 +938,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log.d(TAG, "Setting the tab view"); |
|
|
|
|
|
|
|
|
|
|
|
// Set the background color so the color mode color doesn't show through
|
|
|
|
// Set the background color so the color mode color doesn't show through
|
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
|
|
|
|
|
|
|
@ -1028,7 +1032,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onTrimMemory(int level) { |
|
|
|
public void onTrimMemory(int level) { |
|
|
|
if (level > TRIM_MEMORY_MODERATE && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
|
|
|
if (level > TRIM_MEMORY_MODERATE && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
|
|
|
Log.d(Constants.TAG, "Low Memory, Free Memory"); |
|
|
|
Log.d(TAG, "Low Memory, Free Memory"); |
|
|
|
mTabsManager.freeMemory(); |
|
|
|
mTabsManager.freeMemory(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1052,19 +1056,19 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (mPreferences.getClearCacheExit() && currentTab != null && !isIncognito()) { |
|
|
|
if (mPreferences.getClearCacheExit() && currentTab != null && !isIncognito()) { |
|
|
|
WebUtils.clearCache(currentTab.getWebView()); |
|
|
|
WebUtils.clearCache(currentTab.getWebView()); |
|
|
|
Log.d(Constants.TAG, "Cache Cleared"); |
|
|
|
Log.d(TAG, "Cache Cleared"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (mPreferences.getClearHistoryExitEnabled() && !isIncognito()) { |
|
|
|
if (mPreferences.getClearHistoryExitEnabled() && !isIncognito()) { |
|
|
|
WebUtils.clearHistory(this, mHistoryDatabase); |
|
|
|
WebUtils.clearHistory(this, mHistoryDatabase); |
|
|
|
Log.d(Constants.TAG, "History Cleared"); |
|
|
|
Log.d(TAG, "History Cleared"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (mPreferences.getClearCookiesExitEnabled() && !isIncognito()) { |
|
|
|
if (mPreferences.getClearCookiesExitEnabled() && !isIncognito()) { |
|
|
|
WebUtils.clearCookies(this); |
|
|
|
WebUtils.clearCookies(this); |
|
|
|
Log.d(Constants.TAG, "Cookies Cleared"); |
|
|
|
Log.d(TAG, "Cookies Cleared"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (mPreferences.getClearWebStorageExitEnabled() && !isIncognito()) { |
|
|
|
if (mPreferences.getClearWebStorageExitEnabled() && !isIncognito()) { |
|
|
|
WebUtils.clearWebStorage(); |
|
|
|
WebUtils.clearWebStorage(); |
|
|
|
Log.d(Constants.TAG, "WebStorage Cleared"); |
|
|
|
Log.d(TAG, "WebStorage Cleared"); |
|
|
|
} else if (isIncognito()) { |
|
|
|
} else if (isIncognito()) { |
|
|
|
WebUtils.clearWebStorage(); // We want to make sure incognito mode is secure
|
|
|
|
WebUtils.clearWebStorage(); // We want to make sure incognito mode is secure
|
|
|
|
} |
|
|
|
} |
|
|
@ -1138,7 +1142,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mEventBus.post(new BrowserEvents.UserPressedBack()); |
|
|
|
mEventBus.post(new BrowserEvents.UserPressedBack()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
Log.d(Constants.TAG, "onBackPressed"); |
|
|
|
Log.d(TAG, "onBackPressed"); |
|
|
|
if (mSearch.hasFocus()) { |
|
|
|
if (mSearch.hasFocus()) { |
|
|
|
currentTab.requestFocus(); |
|
|
|
currentTab.requestFocus(); |
|
|
|
} else if (currentTab.canGoBack()) { |
|
|
|
} else if (currentTab.canGoBack()) { |
|
|
@ -1155,7 +1159,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Log.e(Constants.TAG, "This shouldn't happen ever"); |
|
|
|
Log.e(TAG, "This shouldn't happen ever"); |
|
|
|
super.onBackPressed(); |
|
|
|
super.onBackPressed(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1165,7 +1169,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
protected void onPause() { |
|
|
|
protected void onPause() { |
|
|
|
super.onPause(); |
|
|
|
super.onPause(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
Log.d(Constants.TAG, "onPause"); |
|
|
|
Log.d(TAG, "onPause"); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
currentTab.pauseTimers(); |
|
|
|
currentTab.pauseTimers(); |
|
|
|
currentTab.onPause(); |
|
|
|
currentTab.onPause(); |
|
|
@ -1196,7 +1200,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void onDestroy() { |
|
|
|
protected void onDestroy() { |
|
|
|
Log.d(Constants.TAG, "onDestroy"); |
|
|
|
Log.d(TAG, "onDestroy"); |
|
|
|
|
|
|
|
|
|
|
|
mPresenter.shutdown(); |
|
|
|
mPresenter.shutdown(); |
|
|
|
|
|
|
|
|
|
|
@ -1204,6 +1208,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mHistoryDatabase.close(); |
|
|
|
mHistoryDatabase.close(); |
|
|
|
mHistoryDatabase = null; |
|
|
|
mHistoryDatabase = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
super.onDestroy(); |
|
|
|
super.onDestroy(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1223,7 +1228,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
protected void onResume() { |
|
|
|
protected void onResume() { |
|
|
|
super.onResume(); |
|
|
|
super.onResume(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
Log.d(Constants.TAG, "onResume"); |
|
|
|
Log.d(TAG, "onResume"); |
|
|
|
if (mSearchAdapter != null) { |
|
|
|
if (mSearchAdapter != null) { |
|
|
|
mSearchAdapter.refreshPreferences(); |
|
|
|
mSearchAdapter.refreshPreferences(); |
|
|
|
mSearchAdapter.refreshBookmarks(); |
|
|
|
mSearchAdapter.refreshBookmarks(); |
|
|
@ -1397,11 +1402,11 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
try { |
|
|
|
try { |
|
|
|
mHistoryDatabase.visitHistoryItem(url, title); |
|
|
|
mHistoryDatabase.visitHistoryItem(url, title); |
|
|
|
} catch (IllegalStateException e) { |
|
|
|
} catch (IllegalStateException e) { |
|
|
|
Log.e(Constants.TAG, "IllegalStateException in updateHistory", e); |
|
|
|
Log.e(TAG, "IllegalStateException in updateHistory", e); |
|
|
|
} catch (NullPointerException e) { |
|
|
|
} catch (NullPointerException e) { |
|
|
|
Log.e(Constants.TAG, "NullPointerException in updateHistory", e); |
|
|
|
Log.e(TAG, "NullPointerException in updateHistory", e); |
|
|
|
} catch (SQLiteException e) { |
|
|
|
} catch (SQLiteException e) { |
|
|
|
Log.e(Constants.TAG, "SQLiteException in updateHistory", e); |
|
|
|
Log.e(TAG, "SQLiteException in updateHistory", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1620,7 +1625,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); |
|
|
|
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); |
|
|
|
} catch (IOException ex) { |
|
|
|
} catch (IOException ex) { |
|
|
|
// Error occurred while creating the File
|
|
|
|
// Error occurred while creating the File
|
|
|
|
Log.e(Constants.TAG, "Unable to create Image File", ex); |
|
|
|
Log.e(TAG, "Unable to create Image File", ex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Continue only if the File was successfully created
|
|
|
|
// Continue only if the File was successfully created
|
|
|
@ -1665,7 +1670,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
try { |
|
|
|
try { |
|
|
|
callback.onCustomViewHidden(); |
|
|
|
callback.onCustomViewHidden(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Log.e(Constants.TAG, "Error hiding custom view", e); |
|
|
|
Log.e(TAG, "Error hiding custom view", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1673,7 +1678,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
try { |
|
|
|
try { |
|
|
|
view.setKeepScreenOn(true); |
|
|
|
view.setKeepScreenOn(true); |
|
|
|
} catch (SecurityException e) { |
|
|
|
} catch (SecurityException e) { |
|
|
|
Log.e(Constants.TAG, "WebView is not allowed to keep the screen on"); |
|
|
|
Log.e(TAG, "WebView is not allowed to keep the screen on"); |
|
|
|
} |
|
|
|
} |
|
|
|
mOriginalOrientation = getRequestedOrientation(); |
|
|
|
mOriginalOrientation = getRequestedOrientation(); |
|
|
|
mCustomViewCallback = callback; |
|
|
|
mCustomViewCallback = callback; |
|
|
@ -1712,18 +1717,18 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
try { |
|
|
|
try { |
|
|
|
mCustomViewCallback.onCustomViewHidden(); |
|
|
|
mCustomViewCallback.onCustomViewHidden(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Log.e(Constants.TAG, "Error hiding custom view", e); |
|
|
|
Log.e(TAG, "Error hiding custom view", e); |
|
|
|
} |
|
|
|
} |
|
|
|
mCustomViewCallback = null; |
|
|
|
mCustomViewCallback = null; |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Log.d(Constants.TAG, "onHideCustomView"); |
|
|
|
Log.d(TAG, "onHideCustomView"); |
|
|
|
currentTab.setVisibility(View.VISIBLE); |
|
|
|
currentTab.setVisibility(View.VISIBLE); |
|
|
|
try { |
|
|
|
try { |
|
|
|
mCustomView.setKeepScreenOn(false); |
|
|
|
mCustomView.setKeepScreenOn(false); |
|
|
|
} catch (SecurityException e) { |
|
|
|
} catch (SecurityException e) { |
|
|
|
Log.e(Constants.TAG, "WebView is not allowed to keep the screen on"); |
|
|
|
Log.e(TAG, "WebView is not allowed to keep the screen on"); |
|
|
|
} |
|
|
|
} |
|
|
|
setFullscreen(mPreferences.getHideStatusBarEnabled(), false); |
|
|
|
setFullscreen(mPreferences.getHideStatusBarEnabled(), false); |
|
|
|
if (mFullscreenContainer != null) { |
|
|
|
if (mFullscreenContainer != null) { |
|
|
@ -1737,7 +1742,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mFullscreenContainer = null; |
|
|
|
mFullscreenContainer = null; |
|
|
|
mCustomView = null; |
|
|
|
mCustomView = null; |
|
|
|
if (mVideoView != null) { |
|
|
|
if (mVideoView != null) { |
|
|
|
Log.d(Constants.TAG, "VideoView is being stopped"); |
|
|
|
Log.d(TAG, "VideoView is being stopped"); |
|
|
|
mVideoView.stopPlayback(); |
|
|
|
mVideoView.stopPlayback(); |
|
|
|
mVideoView.setOnErrorListener(null); |
|
|
|
mVideoView.setOnErrorListener(null); |
|
|
|
mVideoView.setOnCompletionListener(null); |
|
|
|
mVideoView.setOnCompletionListener(null); |
|
|
@ -1747,7 +1752,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
try { |
|
|
|
try { |
|
|
|
mCustomViewCallback.onCustomViewHidden(); |
|
|
|
mCustomViewCallback.onCustomViewHidden(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Log.e(Constants.TAG, "Error hiding custom view", e); |
|
|
|
Log.e(TAG, "Error hiding custom view", e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
mCustomViewCallback = null; |
|
|
|
mCustomViewCallback = null; |
|
|
@ -2118,7 +2123,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
public void onReceive(Context context, Intent intent) { |
|
|
|
public void onReceive(Context context, Intent intent) { |
|
|
|
super.onReceive(context, intent); |
|
|
|
super.onReceive(context, intent); |
|
|
|
boolean isConnected = isConnected(context); |
|
|
|
boolean isConnected = isConnected(context); |
|
|
|
Log.d(Constants.TAG, "Network Connected: " + String.valueOf(isConnected)); |
|
|
|
Log.d(TAG, "Network Connected: " + String.valueOf(isConnected)); |
|
|
|
mTabsManager.notifyConnectionStatus(isConnected); |
|
|
|
mTabsManager.notifyConnectionStatus(isConnected); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|