|
|
@ -187,7 +187,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
LightningDialogBuilder bookmarksDialogBuilder; |
|
|
|
LightningDialogBuilder bookmarksDialogBuilder; |
|
|
|
|
|
|
|
|
|
|
|
@Inject |
|
|
|
@Inject |
|
|
|
TabsManager tabsManager; |
|
|
|
TabsManager mTabsManager; |
|
|
|
|
|
|
|
|
|
|
|
// Preference manager was moved on ThemeableBrowserActivity
|
|
|
|
// Preference manager was moved on ThemeableBrowserActivity
|
|
|
|
|
|
|
|
|
|
|
@ -346,7 +346,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath()); |
|
|
|
WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
tabsManager.restoreTabsAndHandleIntent(this, getIntent(), isIncognito()); |
|
|
|
mTabsManager.restoreTabsAndHandleIntent(this, getIntent(), isIncognito()); |
|
|
|
// At this point we always have at least a tab in the tab manager
|
|
|
|
// At this point we always have at least a tab in the tab manager
|
|
|
|
showTab(0); |
|
|
|
showTab(0); |
|
|
|
|
|
|
|
|
|
|
@ -363,7 +363,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0); |
|
|
|
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0); |
|
|
|
searchTheWeb(mSearch.getText().toString()); |
|
|
|
searchTheWeb(mSearch.getText().toString()); |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
if (currentView != null) { |
|
|
|
if (currentView != null) { |
|
|
|
currentView.requestFocus(); |
|
|
|
currentView.requestFocus(); |
|
|
|
} |
|
|
|
} |
|
|
@ -386,7 +386,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0); |
|
|
|
imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0); |
|
|
|
searchTheWeb(mSearch.getText().toString()); |
|
|
|
searchTheWeb(mSearch.getText().toString()); |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
if (currentView != null) { |
|
|
|
if (currentView != null) { |
|
|
|
currentView.requestFocus(); |
|
|
|
currentView.requestFocus(); |
|
|
|
} |
|
|
|
} |
|
|
@ -397,13 +397,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onFocusChange(View v, final boolean hasFocus) { |
|
|
|
public void onFocusChange(View v, final boolean hasFocus) { |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
if (!hasFocus && currentView != null) { |
|
|
|
if (!hasFocus && currentView != null) { |
|
|
|
setIsLoading(currentView.getProgress() < 100); |
|
|
|
setIsLoading(currentView.getProgress() < 100); |
|
|
|
updateUrl(currentView.getUrl(), true); |
|
|
|
updateUrl(currentView.getUrl(), true); |
|
|
|
} else if (hasFocus && currentView != null) { |
|
|
|
} else if (hasFocus && currentView != null) { |
|
|
|
String url = currentView.getUrl(); |
|
|
|
String url = currentView.getUrl(); |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
if (UrlUtils.isSpecialUrl(url)) { |
|
|
|
mSearch.setText(""); |
|
|
|
mSearch.setText(""); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mSearch.setText(url); |
|
|
|
mSearch.setText(url); |
|
|
@ -553,8 +553,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initializePreferences() { |
|
|
|
private void initializePreferences() { |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
final WebView currentWebView = tabsManager.getCurrentWebView(); |
|
|
|
final WebView currentWebView = mTabsManager.getCurrentWebView(); |
|
|
|
mFullScreen = mPreferences.getFullScreenEnabled(); |
|
|
|
mFullScreen = mPreferences.getFullScreenEnabled(); |
|
|
|
boolean colorMode = mPreferences.getColorModeEnabled(); |
|
|
|
boolean colorMode = mPreferences.getColorModeEnabled(); |
|
|
|
colorMode &= !mDarkTheme; |
|
|
|
colorMode &= !mDarkTheme; |
|
|
@ -665,7 +665,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onOptionsItemSelected(MenuItem item) { |
|
|
|
public boolean onOptionsItemSelected(MenuItem item) { |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
// Handle action buttons
|
|
|
|
// Handle action buttons
|
|
|
|
switch (item.getItemId()) { |
|
|
|
switch (item.getItemId()) { |
|
|
|
case android.R.id.home: |
|
|
|
case android.R.id.home: |
|
|
@ -691,7 +691,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale); |
|
|
|
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case R.id.action_share: |
|
|
|
case R.id.action_share: |
|
|
|
if (currentView != null && !currentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (currentView != null && !UrlUtils.isSpecialUrl(currentView.getUrl())) { |
|
|
|
Intent shareIntent = new Intent(Intent.ACTION_SEND); |
|
|
|
Intent shareIntent = new Intent(Intent.ACTION_SEND); |
|
|
|
shareIntent.setType("text/plain"); |
|
|
|
shareIntent.setType("text/plain"); |
|
|
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, currentView.getTitle()); |
|
|
|
shareIntent.putExtra(Intent.EXTRA_SUBJECT, currentView.getTitle()); |
|
|
@ -703,7 +703,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
openBookmarks(); |
|
|
|
openBookmarks(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case R.id.action_copy: |
|
|
|
case R.id.action_copy: |
|
|
|
if (currentView != null && !currentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (currentView != null && !UrlUtils.isSpecialUrl(currentView.getUrl())) { |
|
|
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); |
|
|
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); |
|
|
|
ClipData clip = ClipData.newPlainText("label", currentView.getUrl()); |
|
|
|
ClipData clip = ClipData.newPlainText("label", currentView.getUrl()); |
|
|
|
clipboard.setPrimaryClip(clip); |
|
|
|
clipboard.setPrimaryClip(clip); |
|
|
@ -717,7 +717,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
openHistory(); |
|
|
|
openHistory(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
case R.id.action_add_bookmark: |
|
|
|
case R.id.action_add_bookmark: |
|
|
|
if (currentView != null && !currentView.getUrl().startsWith(Constants.FILE)) { |
|
|
|
if (currentView != null && !UrlUtils.isSpecialUrl(currentView.getUrl())) { |
|
|
|
mEventBus.post(new BrowserEvents.AddBookmark(currentView.getTitle(), |
|
|
|
mEventBus.post(new BrowserEvents.AddBookmark(currentView.getTitle(), |
|
|
|
currentView.getUrl())); |
|
|
|
currentView.getUrl())); |
|
|
|
} |
|
|
|
} |
|
|
@ -761,7 +761,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void showSearchInterfaceBar(String text) { |
|
|
|
private void showSearchInterfaceBar(String text) { |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
if (currentView != null) { |
|
|
|
if (currentView != null) { |
|
|
|
currentView.find(text); |
|
|
|
currentView.find(text); |
|
|
|
} |
|
|
|
} |
|
|
@ -815,9 +815,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
* @param position the poition of the tab to display |
|
|
|
* @param position the poition of the tab to display |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private synchronized void showTab(final int position) { |
|
|
|
private synchronized void showTab(final int position) { |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = mTabsManager.getCurrentTab(); |
|
|
|
final WebView currentWebView = currentView != null ? currentView.getWebView() : null; |
|
|
|
final WebView currentWebView = currentView != null ? currentView.getWebView() : null; |
|
|
|
final LightningView newView = tabsManager.switchToTab(position); |
|
|
|
final LightningView newView = mTabsManager.switchToTab(position); |
|
|
|
final WebView newWebView = newView != null ? newView.getWebView() : null; |
|
|
|
final WebView newWebView = newView != null ? newView.getWebView() : null; |
|
|
|
if (newView == null || newWebView == null) { |
|
|
|
if (newView == null || newWebView == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -825,7 +825,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
// 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); |
|
|
|
if (newView == currentView && !currentView.isShown()) { |
|
|
|
if (newView == currentView && currentView.isShown()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
mIsNewIntent = false; |
|
|
|
mIsNewIntent = false; |
|
|
@ -845,6 +845,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
updateProgress(0); |
|
|
|
updateProgress(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeViewFromParent(newWebView); |
|
|
|
mBrowserFrame.addView(newWebView, MATCH_PARENT); |
|
|
|
mBrowserFrame.addView(newWebView, MATCH_PARENT); |
|
|
|
newView.requestFocus(); |
|
|
|
newView.requestFocus(); |
|
|
|
newView.onResume(); |
|
|
|
newView.onResume(); |
|
|
@ -891,32 +892,53 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void handleNewIntent(Intent intent) { |
|
|
|
private static void removeViewFromParent(View view) { |
|
|
|
|
|
|
|
ViewGroup parent = ((ViewGroup) view.getParent()); |
|
|
|
|
|
|
|
if (parent != null) { |
|
|
|
|
|
|
|
parent.removeView(view); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String url = null; |
|
|
|
void handleNewIntent(Intent intent) { |
|
|
|
|
|
|
|
final String url; |
|
|
|
if (intent != null) { |
|
|
|
if (intent != null) { |
|
|
|
url = intent.getDataString(); |
|
|
|
url = intent.getDataString(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = null; |
|
|
|
} |
|
|
|
} |
|
|
|
int num = 0; |
|
|
|
int num = 0; |
|
|
|
String source = null; |
|
|
|
final String source; |
|
|
|
if (intent != null && intent.getExtras() != null) { |
|
|
|
if (intent != null && intent.getExtras() != null) { |
|
|
|
num = intent.getExtras().getInt(getPackageName() + ".Origin"); |
|
|
|
num = intent.getExtras().getInt(getPackageName() + ".Origin"); |
|
|
|
source = intent.getExtras().getString("SOURCE"); |
|
|
|
source = intent.getExtras().getString("SOURCE"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
source = null; |
|
|
|
} |
|
|
|
} |
|
|
|
if (num == 1) { |
|
|
|
if (num == 1) { |
|
|
|
loadUrlInCurrentView(url); |
|
|
|
loadUrlInCurrentView(url); |
|
|
|
} else if (url != null) { |
|
|
|
} else if (url != null) { |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
Utils.showSnackbar(this, R.string.message_blocked_local); |
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
|
|
|
url = null; |
|
|
|
builder.setCancelable(true) |
|
|
|
|
|
|
|
.setTitle(R.string.title_warning) |
|
|
|
|
|
|
|
.setMessage(R.string.message_blocked_local) |
|
|
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null) |
|
|
|
|
|
|
|
.setPositiveButton(R.string.action_open, new DialogInterface.OnClickListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
|
|
|
|
newTab(url, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.show(); |
|
|
|
|
|
|
|
} else { |
|
|
|
newTab(url, true); |
|
|
|
newTab(url, true); |
|
|
|
|
|
|
|
} |
|
|
|
mIsNewIntent = (source == null); |
|
|
|
mIsNewIntent = (source == null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void loadUrlInCurrentView(final String url) { |
|
|
|
private void loadUrlInCurrentView(final String url) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab == null) { |
|
|
|
if (currentTab == null) { |
|
|
|
// This is a problem, probably an assert will be better than a return
|
|
|
|
// This is a problem, probably an assert will be better than a return
|
|
|
|
return; |
|
|
|
return; |
|
|
@ -928,7 +950,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void closeEmptyTab() { |
|
|
|
public void closeEmptyTab() { |
|
|
|
final WebView currentWebView = tabsManager.getCurrentWebView(); |
|
|
|
final WebView currentWebView = mTabsManager.getCurrentWebView(); |
|
|
|
if (currentWebView != null && currentWebView.copyBackForwardList().getSize() == 0) { |
|
|
|
if (currentWebView != null && currentWebView.copyBackForwardList().getSize() == 0) { |
|
|
|
closeCurrentTab(); |
|
|
|
closeCurrentTab(); |
|
|
|
} |
|
|
|
} |
|
|
@ -942,25 +964,25 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
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(Constants.TAG, "Low Memory, Free Memory"); |
|
|
|
tabsManager.freeMemory(); |
|
|
|
mTabsManager.freeMemory(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private synchronized boolean newTab(String url, boolean show) { |
|
|
|
private synchronized boolean newTab(String url, boolean show) { |
|
|
|
// Limit number of tabs for limited version of app
|
|
|
|
// Limit number of tabs for limited version of app
|
|
|
|
if (!Constants.FULL_VERSION && tabsManager.size() >= 10) { |
|
|
|
if (!Constants.FULL_VERSION && mTabsManager.size() >= 10) { |
|
|
|
Utils.showSnackbar(this, R.string.max_tabs); |
|
|
|
Utils.showSnackbar(this, R.string.max_tabs); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
mIsNewIntent = false; |
|
|
|
mIsNewIntent = false; |
|
|
|
LightningView startingTab = tabsManager.newTab(this, url, isIncognito()); |
|
|
|
LightningView startingTab = mTabsManager.newTab(this, url, isIncognito()); |
|
|
|
if (mIdGenerator == 0) { |
|
|
|
if (mIdGenerator == 0) { |
|
|
|
startingTab.resumeTimers(); |
|
|
|
startingTab.resumeTimers(); |
|
|
|
} |
|
|
|
} |
|
|
|
mIdGenerator++; |
|
|
|
mIdGenerator++; |
|
|
|
|
|
|
|
|
|
|
|
if (show) { |
|
|
|
if (show) { |
|
|
|
showTab(tabsManager.size() - 1); |
|
|
|
showTab(mTabsManager.size() - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO Check is this is callable directly from LightningView
|
|
|
|
// TODO Check is this is callable directly from LightningView
|
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
@ -969,7 +991,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
// new Handler().postDelayed(new Runnable() {
|
|
|
|
// new Handler().postDelayed(new Runnable() {
|
|
|
|
// @Override
|
|
|
|
// @Override
|
|
|
|
// public void run() {
|
|
|
|
// public void run() {
|
|
|
|
// mDrawerListLeft.smoothScrollToPosition(tabsManager.size() - 1);
|
|
|
|
// mDrawerListLeft.smoothScrollToPosition(mTabsManager.size() - 1);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }, 300);
|
|
|
|
// }, 300);
|
|
|
|
|
|
|
|
|
|
|
@ -977,16 +999,16 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private synchronized void deleteTab(int position) { |
|
|
|
private synchronized void deleteTab(int position) { |
|
|
|
final LightningView tabToDelete = tabsManager.getTabAtPosition(position); |
|
|
|
final LightningView tabToDelete = mTabsManager.getTabAtPosition(position); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
|
|
|
|
if (tabToDelete == null) { |
|
|
|
if (tabToDelete == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int current = tabsManager.positionOf(currentTab); |
|
|
|
int current = mTabsManager.positionOf(currentTab); |
|
|
|
|
|
|
|
|
|
|
|
if (!tabToDelete.getUrl().startsWith(Constants.FILE) && !isIncognito()) { |
|
|
|
if (!UrlUtils.isSpecialUrl(tabToDelete.getUrl()) && !isIncognito()) { |
|
|
|
mPreferences.setSavedUrl(tabToDelete.getUrl()); |
|
|
|
mPreferences.setSavedUrl(tabToDelete.getUrl()); |
|
|
|
} |
|
|
|
} |
|
|
|
final boolean isShown = tabToDelete.isShown(); |
|
|
|
final boolean isShown = tabToDelete.isShown(); |
|
|
@ -995,30 +1017,30 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
} |
|
|
|
} |
|
|
|
if (current > position) { |
|
|
|
if (current > position) { |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
mTabsManager.deleteTab(position); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
} else if (tabsManager.size() > position + 1) { |
|
|
|
} else if (mTabsManager.size() > position + 1) { |
|
|
|
if (current == position) { |
|
|
|
if (current == position) { |
|
|
|
showTab(position + 1); |
|
|
|
showTab(position + 1); |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
mTabsManager.deleteTab(position); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
mTabsManager.deleteTab(position); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (tabsManager.size() > 1) { |
|
|
|
} else if (mTabsManager.size() > 1) { |
|
|
|
if (current == position) { |
|
|
|
if (current == position) { |
|
|
|
showTab(position - 1); |
|
|
|
showTab(position - 1); |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
mTabsManager.deleteTab(position); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
mTabsManager.deleteTab(position); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (currentTab != null && (currentTab.getUrl().startsWith(Constants.FILE) |
|
|
|
if (currentTab != null && (UrlUtils.isSpecialUrl(currentTab.getUrl()) |
|
|
|
|| currentTab.getUrl().equals(mHomepage))) { |
|
|
|
|| currentTab.getUrl().equals(mHomepage))) { |
|
|
|
closeActivity(); |
|
|
|
closeActivity(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
tabsManager.deleteTab(position); |
|
|
|
mTabsManager.deleteTab(position); |
|
|
|
performExitCleanUp(); |
|
|
|
performExitCleanUp(); |
|
|
|
tabToDelete.pauseTimers(); |
|
|
|
tabToDelete.pauseTimers(); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
@ -1036,7 +1058,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void performExitCleanUp() { |
|
|
|
private void performExitCleanUp() { |
|
|
|
final LightningView currentTab = tabsManager.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(Constants.TAG, "Cache Cleared"); |
|
|
@ -1059,9 +1081,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onKeyLongPress(int keyCode, KeyEvent event) { |
|
|
|
public boolean onKeyLongPress(int keyCode, KeyEvent event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) { |
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) { |
|
|
|
showCloseDialog(tabsManager.positionOf(currentTab)); |
|
|
|
showCloseDialog(mTabsManager.positionOf(currentTab)); |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -1069,14 +1091,14 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
private void closeBrowser() { |
|
|
|
private void closeBrowser() { |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
performExitCleanUp(); |
|
|
|
performExitCleanUp(); |
|
|
|
tabsManager.shutdown(); |
|
|
|
mTabsManager.shutdown(); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
mEventBus.post(new BrowserEvents.TabsChanged()); |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public synchronized void onBackPressed() { |
|
|
|
public synchronized void onBackPressed() { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) { |
|
|
|
if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) { |
|
|
|
mDrawerLayout.closeDrawer(mDrawerLeft); |
|
|
|
mDrawerLayout.closeDrawer(mDrawerLeft); |
|
|
|
} else if (mDrawerLayout.isDrawerOpen(mDrawerRight)) { |
|
|
|
} else if (mDrawerLayout.isDrawerOpen(mDrawerRight)) { |
|
|
@ -1096,7 +1118,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
if (mCustomView != null || mCustomViewCallback != null) { |
|
|
|
if (mCustomView != null || mCustomViewCallback != null) { |
|
|
|
onHideCustomView(); |
|
|
|
onHideCustomView(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
deleteTab(tabsManager.positionOf(currentTab)); |
|
|
|
deleteTab(mTabsManager.positionOf(currentTab)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1109,7 +1131,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void onPause() { |
|
|
|
protected void onPause() { |
|
|
|
super.onPause(); |
|
|
|
super.onPause(); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
Log.d(Constants.TAG, "onPause"); |
|
|
|
Log.d(Constants.TAG, "onPause"); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
currentTab.pauseTimers(); |
|
|
|
currentTab.pauseTimers(); |
|
|
@ -1129,7 +1151,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
void saveOpenTabs() { |
|
|
|
void saveOpenTabs() { |
|
|
|
if (mPreferences.getRestoreLostTabsEnabled()) { |
|
|
|
if (mPreferences.getRestoreLostTabsEnabled()) { |
|
|
|
final String s = tabsManager.tabsString(); |
|
|
|
final String s = mTabsManager.tabsString(); |
|
|
|
mPreferences.setMemoryUrl(s); |
|
|
|
mPreferences.setMemoryUrl(s); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1159,7 +1181,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void onResume() { |
|
|
|
protected void onResume() { |
|
|
|
super.onResume(); |
|
|
|
super.onResume(); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
Log.d(Constants.TAG, "onResume"); |
|
|
|
Log.d(Constants.TAG, "onResume"); |
|
|
|
if (mSearchAdapter != null) { |
|
|
|
if (mSearchAdapter != null) { |
|
|
|
mSearchAdapter.refreshPreferences(); |
|
|
|
mSearchAdapter.refreshPreferences(); |
|
|
@ -1170,7 +1192,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
currentTab.onResume(); |
|
|
|
currentTab.onResume(); |
|
|
|
} |
|
|
|
} |
|
|
|
initializePreferences(); |
|
|
|
initializePreferences(); |
|
|
|
tabsManager.resume(this); |
|
|
|
mTabsManager.resume(this); |
|
|
|
|
|
|
|
|
|
|
|
supportInvalidateOptionsMenu(); |
|
|
|
supportInvalidateOptionsMenu(); |
|
|
|
|
|
|
|
|
|
|
@ -1186,7 +1208,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
* checks if it is a search, url, etc. |
|
|
|
* checks if it is a search, url, etc. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void searchTheWeb(@NonNull String query) { |
|
|
|
private void searchTheWeb(@NonNull String query) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (query.isEmpty()) { |
|
|
|
if (query.isEmpty()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1271,9 +1293,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
if (url == null || mSearch == null || mSearch.hasFocus()) { |
|
|
|
if (url == null || mSearch == null || mSearch.hasFocus()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
mEventBus.post(new BrowserEvents.CurrentPageUrl(url)); |
|
|
|
mEventBus.post(new BrowserEvents.CurrentPageUrl(url)); |
|
|
|
if (shortUrl && !url.startsWith(Constants.FILE)) { |
|
|
|
if (shortUrl && !UrlUtils.isSpecialUrl(url)) { |
|
|
|
switch (mPreferences.getUrlBoxContentChoice()) { |
|
|
|
switch (mPreferences.getUrlBoxContentChoice()) { |
|
|
|
case 0: // Default, show only the domain
|
|
|
|
case 0: // Default, show only the domain
|
|
|
|
url = url.replaceFirst(Constants.HTTP, ""); |
|
|
|
url = url.replaceFirst(Constants.HTTP, ""); |
|
|
@ -1292,7 +1314,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (url.startsWith(Constants.FILE)) { |
|
|
|
if (UrlUtils.isSpecialUrl(url)) { |
|
|
|
url = ""; |
|
|
|
url = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
mSearch.setText(url); |
|
|
|
mSearch.setText(url); |
|
|
@ -1320,7 +1342,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
if (!url.startsWith(Constants.FILE)) { |
|
|
|
if (!UrlUtils.isSpecialUrl(url)) { |
|
|
|
new Thread(update).start(); |
|
|
|
new Thread(update).start(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1355,7 +1377,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
searchTheWeb(url); |
|
|
|
searchTheWeb(url); |
|
|
|
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); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
currentTab.requestFocus(); |
|
|
|
currentTab.requestFocus(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1522,7 +1544,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public synchronized void onShowCustomView(final View view, CustomViewCallback callback, int requestedOrientation) { |
|
|
|
public synchronized void onShowCustomView(final View view, CustomViewCallback callback, int requestedOrientation) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (view == null || mCustomView != null) { |
|
|
|
if (view == null || mCustomView != null) { |
|
|
|
if (callback != null) { |
|
|
|
if (callback != null) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -1569,7 +1591,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onHideCustomView() { |
|
|
|
public void onHideCustomView() { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (mCustomView == null || mCustomViewCallback == null || currentTab == null) { |
|
|
|
if (mCustomView == null || mCustomViewCallback == null || currentTab == null) { |
|
|
|
if (mCustomViewCallback != null) { |
|
|
|
if (mCustomViewCallback != null) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -1687,7 +1709,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (newTab("", true)) { |
|
|
|
if (newTab("", true)) { |
|
|
|
LightningView newTab = tabsManager.getTabAtPosition(tabsManager.size() - 1); |
|
|
|
LightningView newTab = mTabsManager.getTabAtPosition(mTabsManager.size() - 1); |
|
|
|
if (newTab != null) { |
|
|
|
if (newTab != null) { |
|
|
|
final WebView webView = newTab.getWebView(); |
|
|
|
final WebView webView = newTab.getWebView(); |
|
|
|
if (webView != null) { |
|
|
|
if (webView != null) { |
|
|
@ -1709,7 +1731,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onCloseWindow(LightningView view) { |
|
|
|
public void onCloseWindow(LightningView view) { |
|
|
|
deleteTab(tabsManager.positionOf(view)); |
|
|
|
deleteTab(mTabsManager.positionOf(view)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1719,7 +1741,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void hideActionBar() { |
|
|
|
public void hideActionBar() { |
|
|
|
final WebView currentWebView = tabsManager.getCurrentWebView(); |
|
|
|
final WebView currentWebView = mTabsManager.getCurrentWebView(); |
|
|
|
if (mFullScreen) { |
|
|
|
if (mFullScreen) { |
|
|
|
if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { |
|
|
|
if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { |
|
|
|
mUiLayout.removeView(mToolbarLayout); |
|
|
|
mUiLayout.removeView(mToolbarLayout); |
|
|
@ -1759,7 +1781,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void showActionBar() { |
|
|
|
public void showActionBar() { |
|
|
|
if (mFullScreen) { |
|
|
|
if (mFullScreen) { |
|
|
|
final WebView view = tabsManager.getCurrentWebView(); |
|
|
|
final WebView view = mTabsManager.getCurrentWebView(); |
|
|
|
|
|
|
|
|
|
|
|
if (mToolbarLayout == null) |
|
|
|
if (mToolbarLayout == null) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -1780,7 +1802,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
view.setTranslationY(height); |
|
|
|
view.setTranslationY(height); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab == null) |
|
|
|
if (currentTab == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
@ -1823,7 +1845,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
* See setIsFinishedLoading and setIsLoading for displaying the correct icon |
|
|
|
* See setIsFinishedLoading and setIsLoading for displaying the correct icon |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void refreshOrStop() { |
|
|
|
private void refreshOrStop() { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab.getProgress() < 100) { |
|
|
|
if (currentTab.getProgress() < 100) { |
|
|
|
currentTab.stopLoading(); |
|
|
|
currentTab.stopLoading(); |
|
|
@ -1842,7 +1864,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab == null) { |
|
|
|
if (currentTab == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1927,7 +1949,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
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(Constants.TAG, "Network Connected: " + String.valueOf(isConnected)); |
|
|
|
tabsManager.notifyConnectionStatus(isConnected); |
|
|
|
mTabsManager.notifyConnectionStatus(isConnected); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -1992,7 +2014,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Subscribe |
|
|
|
@Subscribe |
|
|
|
public void bookmarkCurrentPage(final BookmarkEvents.WantToBookmarkCurrentPage event) { |
|
|
|
public void bookmarkCurrentPage(final BookmarkEvents.WantToBookmarkCurrentPage event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
mEventBus.post(new BrowserEvents.AddBookmark(currentTab.getTitle(), currentTab.getUrl())); |
|
|
|
mEventBus.post(new BrowserEvents.AddBookmark(currentTab.getTitle(), currentTab.getUrl())); |
|
|
|
} |
|
|
|
} |
|
|
@ -2016,9 +2038,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Subscribe |
|
|
|
@Subscribe |
|
|
|
public void bookmarkChanged(final BookmarkEvents.BookmarkChanged event) { |
|
|
|
public void bookmarkChanged(final BookmarkEvents.BookmarkChanged event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null && currentTab.getUrl().startsWith(Constants.FILE) |
|
|
|
if (currentTab != null && currentTab.getUrl().startsWith(Constants.FILE) |
|
|
|
&& currentTab.getUrl().endsWith(Constants.BOOKMARKS_FILENAME)) { |
|
|
|
&& currentTab.getUrl().endsWith(BookmarkPage.FILENAME)) { |
|
|
|
currentTab.loadBookmarkpage(); |
|
|
|
currentTab.loadBookmarkpage(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
@ -2033,9 +2055,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Subscribe |
|
|
|
@Subscribe |
|
|
|
public void bookmarkDeleted(final BookmarkEvents.Deleted event) { |
|
|
|
public void bookmarkDeleted(final BookmarkEvents.Deleted event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null && currentTab.getUrl().startsWith(Constants.FILE) |
|
|
|
if (currentTab != null && currentTab.getUrl().startsWith(Constants.FILE) |
|
|
|
&& currentTab.getUrl().endsWith(Constants.BOOKMARKS_FILENAME)) { |
|
|
|
&& currentTab.getUrl().endsWith(BookmarkPage.FILENAME)) { |
|
|
|
currentTab.loadBookmarkpage(); |
|
|
|
currentTab.loadBookmarkpage(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
@ -2103,12 +2125,12 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Subscribe |
|
|
|
@Subscribe |
|
|
|
public void goBack(final NavigationEvents.GoBack event) { |
|
|
|
public void goBack(final NavigationEvents.GoBack event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab.canGoBack()) { |
|
|
|
if (currentTab.canGoBack()) { |
|
|
|
currentTab.goBack(); |
|
|
|
currentTab.goBack(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
deleteTab(tabsManager.positionOf(currentTab)); |
|
|
|
deleteTab(mTabsManager.positionOf(currentTab)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2120,7 +2142,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Subscribe |
|
|
|
@Subscribe |
|
|
|
public void goForward(final NavigationEvents.GoForward event) { |
|
|
|
public void goForward(final NavigationEvents.GoForward event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab.canGoForward()) { |
|
|
|
if (currentTab.canGoForward()) { |
|
|
|
currentTab.goForward(); |
|
|
|
currentTab.goForward(); |
|
|
@ -2130,7 +2152,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Subscribe |
|
|
|
@Subscribe |
|
|
|
public void goHome(final NavigationEvents.GoHome event) { |
|
|
|
public void goHome(final NavigationEvents.GoHome event) { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
currentTab.loadHomepage(); |
|
|
|
currentTab.loadHomepage(); |
|
|
|
closeDrawers(); |
|
|
|
closeDrawers(); |
|
|
|