|
|
@ -136,10 +136,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
private ViewGroup mDrawerLeft, mDrawerRight, mUiLayout, mToolbarLayout; |
|
|
|
private ViewGroup mDrawerLeft, mDrawerRight, mUiLayout, mToolbarLayout; |
|
|
|
private RelativeLayout mSearchBar; |
|
|
|
private RelativeLayout mSearchBar; |
|
|
|
|
|
|
|
|
|
|
|
// List
|
|
|
|
|
|
|
|
// private LightningView mCurrentView;
|
|
|
|
|
|
|
|
private WebView mWebView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Views
|
|
|
|
// Views
|
|
|
|
private AnimatedProgressBar mProgressBar; |
|
|
|
private AnimatedProgressBar mProgressBar; |
|
|
|
private AutoCompleteTextView mSearch; |
|
|
|
private AutoCompleteTextView mSearch; |
|
|
@ -620,6 +616,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
private void initializePreferences() { |
|
|
|
private void initializePreferences() { |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentView = tabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
final WebView currentWebView = currentView.getWebView(); |
|
|
|
if (mPreferences == null) { |
|
|
|
if (mPreferences == null) { |
|
|
|
mPreferences = PreferenceManager.getInstance(); |
|
|
|
mPreferences = PreferenceManager.getInstance(); |
|
|
|
} |
|
|
|
} |
|
|
@ -640,8 +637,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mToolbarLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); |
|
|
|
mToolbarLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); |
|
|
|
height = mToolbarLayout.getMeasuredHeight(); |
|
|
|
height = mToolbarLayout.getMeasuredHeight(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (mWebView != null) |
|
|
|
if (currentWebView != null) |
|
|
|
mWebView.setTranslationY(height); |
|
|
|
currentWebView.setTranslationY(height); |
|
|
|
mBrowserFrame.setLayoutTransition(null); |
|
|
|
mBrowserFrame.setLayoutTransition(null); |
|
|
|
if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { |
|
|
|
if (mBrowserFrame.findViewById(R.id.toolbar_layout) == null) { |
|
|
|
mUiLayout.removeView(mToolbarLayout); |
|
|
|
mUiLayout.removeView(mToolbarLayout); |
|
|
@ -655,8 +652,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mUiLayout.addView(mToolbarLayout, 0); |
|
|
|
mUiLayout.addView(mToolbarLayout, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
mBrowserFrame.setLayoutTransition(new LayoutTransition()); |
|
|
|
mBrowserFrame.setLayoutTransition(new LayoutTransition()); |
|
|
|
if (mWebView != null) |
|
|
|
if (currentWebView != null) |
|
|
|
mWebView.setTranslationY(0); |
|
|
|
currentWebView.setTranslationY(0); |
|
|
|
} |
|
|
|
} |
|
|
|
setFullscreen(mPreferences.getHideStatusBarEnabled(), false); |
|
|
|
setFullscreen(mPreferences.getHideStatusBarEnabled(), false); |
|
|
|
|
|
|
|
|
|
|
@ -925,9 +922,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
currentView.onPause(); |
|
|
|
currentView.onPause(); |
|
|
|
} |
|
|
|
} |
|
|
|
tabsManager.setCurrentTab(newView); |
|
|
|
tabsManager.setCurrentTab(newView); |
|
|
|
mWebView = newView.getWebView(); |
|
|
|
final WebView currentWebView = currentView.getWebView(); |
|
|
|
newView.setForegroundTab(true); |
|
|
|
newView.setForegroundTab(true); |
|
|
|
if (mWebView != null) { |
|
|
|
if (currentWebView != null) { |
|
|
|
updateUrl(newView.getUrl(), true); |
|
|
|
updateUrl(newView.getUrl(), true); |
|
|
|
updateProgress(newView.getProgress()); |
|
|
|
updateProgress(newView.getProgress()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -935,7 +932,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
updateProgress(0); |
|
|
|
updateProgress(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mBrowserFrame.addView(mWebView, MATCH_PARENT); |
|
|
|
mBrowserFrame.addView(currentWebView, MATCH_PARENT); |
|
|
|
newView.requestFocus(); |
|
|
|
newView.requestFocus(); |
|
|
|
newView.onResume(); |
|
|
|
newView.onResume(); |
|
|
|
|
|
|
|
|
|
|
@ -949,10 +946,10 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mToolbarLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); |
|
|
|
mToolbarLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); |
|
|
|
height = mToolbarLayout.getMeasuredHeight(); |
|
|
|
height = mToolbarLayout.getMeasuredHeight(); |
|
|
|
} |
|
|
|
} |
|
|
|
mWebView.setTranslationY(translation + height); |
|
|
|
currentWebView.setTranslationY(translation + height); |
|
|
|
mToolbarLayout.setTranslationY(translation); |
|
|
|
mToolbarLayout.setTranslationY(translation); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mWebView.setTranslationY(0); |
|
|
|
currentWebView.setTranslationY(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
showActionBar(); |
|
|
|
showActionBar(); |
|
|
@ -1018,7 +1015,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void closeEmptyTab() { |
|
|
|
public void closeEmptyTab() { |
|
|
|
if (mWebView != null && mWebView.copyBackForwardList().getSize() == 0) { |
|
|
|
final WebView currentWebView = tabsManager.getCurrentWebView(); |
|
|
|
|
|
|
|
if (currentWebView != null && currentWebView.copyBackForwardList().getSize() == 0) { |
|
|
|
closeCurrentTab(); |
|
|
|
closeCurrentTab(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1117,7 +1115,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
performExitCleanUp(); |
|
|
|
performExitCleanUp(); |
|
|
|
tabToDelete.pauseTimers(); |
|
|
|
tabToDelete.pauseTimers(); |
|
|
|
tabToDelete.onDestroy(); |
|
|
|
tabToDelete.onDestroy(); |
|
|
|
mWebView = null; |
|
|
|
|
|
|
|
mTabAdapter.notifyDataSetChanged(); |
|
|
|
mTabAdapter.notifyDataSetChanged(); |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1169,7 +1166,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
private void closeBrowser() { |
|
|
|
private void closeBrowser() { |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
mBrowserFrame.setBackgroundColor(mBackgroundColor); |
|
|
|
performExitCleanUp(); |
|
|
|
performExitCleanUp(); |
|
|
|
mWebView = null; |
|
|
|
|
|
|
|
tabsManager.shutdown(); |
|
|
|
tabsManager.shutdown(); |
|
|
|
mTabAdapter.notifyDataSetChanged(); |
|
|
|
mTabAdapter.notifyDataSetChanged(); |
|
|
|
finish(); |
|
|
|
finish(); |
|
|
@ -1808,7 +1804,10 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
Message click = mClickHandler.obtainMessage(); |
|
|
|
Message click = mClickHandler.obtainMessage(); |
|
|
|
if (click != null) { |
|
|
|
if (click != null) { |
|
|
|
click.setTarget(mClickHandler); |
|
|
|
click.setTarget(mClickHandler); |
|
|
|
mWebView.requestFocusNodeHref(click); |
|
|
|
final WebView currentWebView = tabsManager.getCurrentWebView(); |
|
|
|
|
|
|
|
if (currentWebView != null) { |
|
|
|
|
|
|
|
currentWebView.requestFocusNodeHref(click); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1972,8 +1971,10 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (newTab("", true)) { |
|
|
|
if (newTab("", true)) { |
|
|
|
|
|
|
|
// TODO Review this
|
|
|
|
|
|
|
|
final WebView webView = tabsManager.getTabAtPosition(tabsManager.size() - 1).getWebView(); |
|
|
|
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; |
|
|
|
WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; |
|
|
|
transport.setWebView(mWebView); |
|
|
|
transport.setWebView(webView); |
|
|
|
resultMsg.sendToTarget(); |
|
|
|
resultMsg.sendToTarget(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2003,6 +2004,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void hideActionBar() { |
|
|
|
public void hideActionBar() { |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
final WebView currentWebView = currentTab.getWebView(); |
|
|
|
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); |
|
|
@ -2010,13 +2012,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mToolbarLayout.bringToFront(); |
|
|
|
mToolbarLayout.bringToFront(); |
|
|
|
Log.d(Constants.TAG, "Move view to browser frame"); |
|
|
|
Log.d(Constants.TAG, "Move view to browser frame"); |
|
|
|
mToolbarLayout.setTranslationY(0); |
|
|
|
mToolbarLayout.setTranslationY(0); |
|
|
|
mWebView.setTranslationY(mToolbarLayout.getHeight()); |
|
|
|
currentWebView.setTranslationY(mToolbarLayout.getHeight()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (mToolbarLayout == null || currentTab == null) |
|
|
|
if (mToolbarLayout == null || currentTab == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
final int height = mToolbarLayout.getHeight(); |
|
|
|
final int height = mToolbarLayout.getHeight(); |
|
|
|
final WebView view = mWebView; |
|
|
|
final WebView view = currentWebView; |
|
|
|
if (mToolbarLayout.getTranslationY() > -0.01f) { |
|
|
|
if (mToolbarLayout.getTranslationY() > -0.01f) { |
|
|
|
Animation show = new Animation() { |
|
|
|
Animation show = new Animation() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -2030,7 +2032,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
show.setDuration(250); |
|
|
|
show.setDuration(250); |
|
|
|
show.setInterpolator(new DecelerateInterpolator()); |
|
|
|
show.setInterpolator(new DecelerateInterpolator()); |
|
|
|
// show.setFillAfter(true);
|
|
|
|
// show.setFillAfter(true);
|
|
|
|
mWebView.startAnimation(show); |
|
|
|
currentWebView.startAnimation(show); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2041,6 +2043,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(); |
|
|
|
|
|
|
|
|
|
|
|
if (mToolbarLayout == null) |
|
|
|
if (mToolbarLayout == null) |
|
|
|
return; |
|
|
|
return; |
|
|
@ -2057,13 +2060,14 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mToolbarLayout.bringToFront(); |
|
|
|
mToolbarLayout.bringToFront(); |
|
|
|
Log.d(Constants.TAG, "Move view to browser frame"); |
|
|
|
Log.d(Constants.TAG, "Move view to browser frame"); |
|
|
|
mToolbarLayout.setTranslationY(0); |
|
|
|
mToolbarLayout.setTranslationY(0); |
|
|
|
mWebView.setTranslationY(height); |
|
|
|
if (view != null) { |
|
|
|
|
|
|
|
view.setTranslationY(height); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
final LightningView currentTab = tabsManager.getCurrentTab(); |
|
|
|
if (currentTab == null) |
|
|
|
if (currentTab == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
final WebView view = mWebView; |
|
|
|
|
|
|
|
final int totalHeight = height; |
|
|
|
final int totalHeight = height; |
|
|
|
if (mToolbarLayout.getTranslationY() < -(height - 0.01f)) { |
|
|
|
if (mToolbarLayout.getTranslationY() < -(height - 0.01f)) { |
|
|
|
Animation show = new Animation() { |
|
|
|
Animation show = new Animation() { |
|
|
@ -2079,7 +2083,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
show.setDuration(250); |
|
|
|
show.setDuration(250); |
|
|
|
show.setInterpolator(new DecelerateInterpolator()); |
|
|
|
show.setInterpolator(new DecelerateInterpolator()); |
|
|
|
// show.setFillAfter(true);
|
|
|
|
// show.setFillAfter(true);
|
|
|
|
mWebView.startAnimation(show); |
|
|
|
if (view != null) { |
|
|
|
|
|
|
|
view.startAnimation(show); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2093,9 +2099,10 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
public void longClickPage(final String url) { |
|
|
|
public void longClickPage(final String url) { |
|
|
|
HitTestResult result = null; |
|
|
|
HitTestResult result = null; |
|
|
|
String currentUrl = null; |
|
|
|
String currentUrl = null; |
|
|
|
if (mWebView != null) { |
|
|
|
final WebView currentWebView = tabsManager.getCurrentWebView(); |
|
|
|
result = mWebView.getHitTestResult(); |
|
|
|
if (currentWebView != null) { |
|
|
|
currentUrl = mWebView.getUrl(); |
|
|
|
result = currentWebView.getHitTestResult(); |
|
|
|
|
|
|
|
currentUrl = currentWebView.getUrl(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (currentUrl != null && currentUrl.startsWith(Constants.FILE)) { |
|
|
|
if (currentUrl != null && currentUrl.startsWith(Constants.FILE)) { |
|
|
|
if (currentUrl.endsWith(HistoryPage.FILENAME)) { |
|
|
|
if (currentUrl.endsWith(HistoryPage.FILENAME)) { |
|
|
@ -2279,6 +2286,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 = tabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
final WebView currentWebView = currentTab.getWebView(); |
|
|
|
switch (v.getId()) { |
|
|
|
switch (v.getId()) { |
|
|
|
case R.id.action_back: |
|
|
|
case R.id.action_back: |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
@ -2309,13 +2317,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
newTab(null, true); |
|
|
|
newTab(null, true); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.button_next: |
|
|
|
case R.id.button_next: |
|
|
|
mWebView.findNext(false); |
|
|
|
currentWebView.findNext(false); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.button_back: |
|
|
|
case R.id.button_back: |
|
|
|
mWebView.findNext(true); |
|
|
|
currentWebView.findNext(true); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.button_quit: |
|
|
|
case R.id.button_quit: |
|
|
|
mWebView.clearMatches(); |
|
|
|
currentWebView.clearMatches(); |
|
|
|
mSearchBar.setVisibility(View.GONE); |
|
|
|
mSearchBar.setVisibility(View.GONE); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.action_reading: |
|
|
|
case R.id.action_reading: |
|
|
@ -2435,9 +2443,10 @@ 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 = tabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
final WebView currentWebView = currentTab.getWebView(); |
|
|
|
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(Constants.BOOKMARKS_FILENAME)) { |
|
|
|
openBookmarkPage(mWebView); |
|
|
|
openBookmarkPage(currentWebView); |
|
|
|
} |
|
|
|
} |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
eventBus.post(new BrowserEvents.CurrentPageUrl(currentTab.getUrl())); |
|
|
|
eventBus.post(new BrowserEvents.CurrentPageUrl(currentTab.getUrl())); |
|
|
@ -2452,9 +2461,10 @@ 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 = tabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
final WebView currentWebView = currentTab.getWebView(); |
|
|
|
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(Constants.BOOKMARKS_FILENAME)) { |
|
|
|
openBookmarkPage(mWebView); |
|
|
|
openBookmarkPage(currentWebView); |
|
|
|
} |
|
|
|
} |
|
|
|
if (currentTab != null) { |
|
|
|
if (currentTab != null) { |
|
|
|
eventBus.post(new BrowserEvents.CurrentPageUrl(currentTab.getUrl())); |
|
|
|
eventBus.post(new BrowserEvents.CurrentPageUrl(currentTab.getUrl())); |
|
|
|