Update to latest support libs, get rid of pointless hardware layers

This commit is contained in:
Anthony Restaino 2016-02-24 19:33:09 -05:00
parent 8132b34bbf
commit a6edd3ca29
3 changed files with 29 additions and 9 deletions

View File

@ -57,10 +57,10 @@ dexcount {
dependencies { dependencies {
// support libraries // support libraries
compile 'com.android.support:palette-v7:23.1.1' compile 'com.android.support:palette-v7:23.2.0'
compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.1.1' compile 'com.android.support:design:23.2.0'
compile 'com.android.support:recyclerview-v7:23.1.1' compile 'com.android.support:recyclerview-v7:23.2.0'
// html parsing fo reading mode // html parsing fo reading mode
compile 'org.jsoup:jsoup:1.8.3' compile 'org.jsoup:jsoup:1.8.3'

View File

@ -276,8 +276,30 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mBackground.setColor(((ColorDrawable) mToolbarLayout.getBackground()).getColor()); mBackground.setColor(((ColorDrawable) mToolbarLayout.getBackground()).getColor());
// Drawer stutters otherwise // Drawer stutters otherwise
mDrawerLeft.setLayerType(View.LAYER_TYPE_HARDWARE, null); mDrawerLeft.setLayerType(View.LAYER_TYPE_NONE, null);
mDrawerRight.setLayerType(View.LAYER_TYPE_HARDWARE, null); mDrawerRight.setLayerType(View.LAYER_TYPE_NONE, null);
mDrawerLayout.addDrawerListener(new DrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {}
@Override
public void onDrawerOpened(View drawerView) {}
@Override
public void onDrawerClosed(View drawerView) {}
@Override
public void onDrawerStateChanged(int newState) {
if (newState == DrawerLayout.STATE_DRAGGING) {
mDrawerLeft.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mDrawerRight.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else if (newState == DrawerLayout.STATE_IDLE) {
mDrawerLeft.setLayerType(View.LAYER_TYPE_NONE, null);
mDrawerRight.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !mShowTabsInDrawer) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !mShowTabsInDrawer) {
getWindow().setStatusBarColor(Color.BLACK); getWindow().setStatusBarColor(Color.BLACK);
@ -329,8 +351,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mArrowImage = (ImageView) customView.findViewById(R.id.arrow); mArrowImage = (ImageView) customView.findViewById(R.id.arrow);
FrameLayout arrowButton = (FrameLayout) customView.findViewById(R.id.arrow_button); FrameLayout arrowButton = (FrameLayout) customView.findViewById(R.id.arrow_button);
if (mShowTabsInDrawer) { if (mShowTabsInDrawer) {
// Use hardware acceleration for the animation
mArrowImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
if (mArrowImage.getWidth() <= 0) { if (mArrowImage.getWidth() <= 0) {
mArrowImage.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); mArrowImage.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
} }

View File

@ -138,7 +138,7 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
animator.setChangeDuration(0); animator.setChangeDuration(0);
animator.setRemoveDuration(200); animator.setRemoveDuration(200);
animator.setMoveDuration(200); animator.setMoveDuration(200);
mRecyclerView.setLayerType(View.LAYER_TYPE_HARDWARE, null); mRecyclerView.setLayerType(View.LAYER_TYPE_NONE, null);
mRecyclerView.setItemAnimator(animator); mRecyclerView.setItemAnimator(animator);
mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setLayoutManager(layoutManager);
mTabsAdapter = new LightningViewAdapter(mShowInNavigationDrawer); mTabsAdapter = new LightningViewAdapter(mShowInNavigationDrawer);