|
|
@ -125,7 +125,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
private synchronized void initialize() { |
|
|
|
private synchronized void initialize() { |
|
|
|
setContentView(R.layout.activity_main); |
|
|
|
setContentView(R.layout.activity_main); |
|
|
|
|
|
|
|
getWindow().setBackgroundDrawable(null); |
|
|
|
mToolbar = (Toolbar) findViewById(R.id.toolbar); |
|
|
|
mToolbar = (Toolbar) findViewById(R.id.toolbar); |
|
|
|
setSupportActionBar(mToolbar); |
|
|
|
setSupportActionBar(mToolbar); |
|
|
|
|
|
|
|
|
|
|
@ -147,7 +147,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
} |
|
|
|
} |
|
|
|
mActivity = this; |
|
|
|
mActivity = this; |
|
|
|
mClickHandler = new ClickHandler(this); |
|
|
|
mClickHandler = new ClickHandler(this); |
|
|
|
getWindow().setBackgroundDrawable(null); |
|
|
|
|
|
|
|
mBrowserFrame = (FrameLayout) findViewById(R.id.content_frame); |
|
|
|
mBrowserFrame = (FrameLayout) findViewById(R.id.content_frame); |
|
|
|
mToolbarLayout = (LinearLayout) findViewById(R.id.toolbar_layout); |
|
|
|
mToolbarLayout = (LinearLayout) findViewById(R.id.toolbar_layout); |
|
|
|
mPageLayout = (LinearLayout) findViewById(R.id.main_layout); |
|
|
|
mPageLayout = (LinearLayout) findViewById(R.id.main_layout); |
|
|
@ -896,7 +895,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
|
|
|
mIsNewIntent = false; |
|
|
|
mIsNewIntent = false; |
|
|
|
selectItem(position); |
|
|
|
showTab(mWebViews.get(position)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1107,18 +1106,10 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
// don't delete the tab because the browser will close and mess stuff up
|
|
|
|
// don't delete the tab because the browser will close and mess stuff up
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void selectItem(final int position) { |
|
|
|
|
|
|
|
// update selected item and title, then close the drawer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showTab(mWebViews.get(position)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onTrimMemory(int level) { |
|
|
|
public void onTrimMemory(int level) { |
|
|
|
if (level > TRIM_MEMORY_RUNNING_MODERATE |
|
|
|
if (level > TRIM_MEMORY_MODERATE && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
|
|
|
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
|
|
|
|
|
|
|
Log.d(Constants.TAG, "Low Memory, Free Memory"); |
|
|
|
Log.d(Constants.TAG, "Low Memory, Free Memory"); |
|
|
|
for (LightningView view : mWebViews) { |
|
|
|
for (LightningView view : mWebViews) { |
|
|
|
view.getWebView().freeMemory(); |
|
|
|
view.getWebView().freeMemory(); |
|
|
@ -1380,7 +1371,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
supportInvalidateOptionsMenu(); |
|
|
|
supportInvalidateOptionsMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1553,8 +1544,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mToolbarLayout.setBackgroundColor(finalColor); |
|
|
|
|
|
|
|
mPageLayout.setBackgroundColor(finalColor); |
|
|
|
|
|
|
|
anim.setDuration(300); |
|
|
|
anim.setDuration(300); |
|
|
|
anim.start(); |
|
|
|
anim.start(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1778,23 +1767,6 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void updateProgress(int n) { |
|
|
|
public void updateProgress(int n) { |
|
|
|
/* |
|
|
|
|
|
|
|
* if (n > mProgressBar.getProgress()) { ObjectAnimator animator = |
|
|
|
|
|
|
|
* ObjectAnimator.ofInt(mProgressBar, "progress", n); |
|
|
|
|
|
|
|
* animator.setDuration(200); animator.setInterpolator(new |
|
|
|
|
|
|
|
* DecelerateInterpolator()); animator.start(); } else if (n < |
|
|
|
|
|
|
|
* mProgressBar.getProgress()) { ObjectAnimator animator = |
|
|
|
|
|
|
|
* ObjectAnimator.ofInt(mProgressBar, "progress", 0, n); |
|
|
|
|
|
|
|
* animator.setDuration(200); animator.setInterpolator(new |
|
|
|
|
|
|
|
* DecelerateInterpolator()); animator.start(); } if (n >= 100) { |
|
|
|
|
|
|
|
* Handler handler = new Handler(); handler.postDelayed(new Runnable() { |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @Override public void run() { |
|
|
|
|
|
|
|
* mProgressBar.setVisibility(View.INVISIBLE); setIsFinishedLoading(); } |
|
|
|
|
|
|
|
* }, 200); |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* } else { mProgressBar.setVisibility(View.VISIBLE); setIsLoading(); } |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
if (n >= 100) { |
|
|
|
if (n >= 100) { |
|
|
|
setIsFinishedLoading(); |
|
|
|
setIsFinishedLoading(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2534,42 +2506,42 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onClick(View v) { |
|
|
|
public void onClick(View v) { |
|
|
|
switch (v.getId()) { |
|
|
|
switch (v.getId()) { |
|
|
|
case R.id.action_back: |
|
|
|
case R.id.action_back: |
|
|
|
if (mCurrentView != null) { |
|
|
|
if (mCurrentView != null) { |
|
|
|
if (mCurrentView.canGoBack()) { |
|
|
|
if (mCurrentView.canGoBack()) { |
|
|
|
mCurrentView.goBack(); |
|
|
|
mCurrentView.goBack(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
deleteTab(mDrawerListLeft.getCheckedItemPosition()); |
|
|
|
deleteTab(mDrawerListLeft.getCheckedItemPosition()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.action_forward: |
|
|
|
case R.id.action_forward: |
|
|
|
if (mCurrentView != null) { |
|
|
|
if (mCurrentView != null) { |
|
|
|
if (mCurrentView.canGoForward()) { |
|
|
|
if (mCurrentView.canGoForward()) { |
|
|
|
mCurrentView.goForward(); |
|
|
|
mCurrentView.goForward(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.arrow_button: |
|
|
|
case R.id.arrow_button: |
|
|
|
if (mSearch != null && mSearch.hasFocus()) { |
|
|
|
if (mSearch != null && mSearch.hasFocus()) { |
|
|
|
mCurrentView.requestFocus(); |
|
|
|
mCurrentView.requestFocus(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mDrawerLayout.openDrawer(mDrawerLeft); |
|
|
|
mDrawerLayout.openDrawer(mDrawerLeft); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.new_tab_button: |
|
|
|
case R.id.new_tab_button: |
|
|
|
newTab(null, true); |
|
|
|
newTab(null, true); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.button_next: |
|
|
|
case R.id.button_next: |
|
|
|
mCurrentView.getWebView().findNext(false); |
|
|
|
mCurrentView.getWebView().findNext(false); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.button_back: |
|
|
|
case R.id.button_back: |
|
|
|
mCurrentView.getWebView().findNext(true); |
|
|
|
mCurrentView.getWebView().findNext(true); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case R.id.button_quit: |
|
|
|
case R.id.button_quit: |
|
|
|
mCurrentView.getWebView().clearMatches(); |
|
|
|
mCurrentView.getWebView().clearMatches(); |
|
|
|
mSearchBar.setVisibility(View.GONE); |
|
|
|
mSearchBar.setVisibility(View.GONE); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|