Fixed bug where navigation drawers sometimes overlapped
This commit is contained in:
parent
e7dacc9c10
commit
313f9fb105
@ -34,6 +34,7 @@ import android.provider.Browser;
|
|||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
|
import android.support.v4.widget.DrawerLayout.DrawerListener;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
@ -177,6 +178,8 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
|
|||||||
mDrawerListRight.setDivider(null);
|
mDrawerListRight.setDivider(null);
|
||||||
mDrawerListRight.setDividerHeight(0);
|
mDrawerListRight.setDividerHeight(0);
|
||||||
setNavigationDrawerWidth();
|
setNavigationDrawerWidth();
|
||||||
|
mDrawerLayout.setDrawerListener(new DrawerLocker());
|
||||||
|
|
||||||
mWebpageBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_webpage);
|
mWebpageBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_webpage);
|
||||||
mActionBar = getSupportActionBar();
|
mActionBar = getSupportActionBar();
|
||||||
final TypedArray styledAttributes = mContext.getTheme().obtainStyledAttributes(
|
final TypedArray styledAttributes = mContext.getTheme().obtainStyledAttributes(
|
||||||
@ -486,6 +489,36 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DrawerLocker implements DrawerListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerClosed(View v) {
|
||||||
|
if(v == mDrawerRight){
|
||||||
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mDrawerLeft);
|
||||||
|
} else {
|
||||||
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, mDrawerRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerOpened(View v) {
|
||||||
|
if(v == mDrawerRight){
|
||||||
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, mDrawerLeft);
|
||||||
|
} else {
|
||||||
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, mDrawerRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerSlide(View v, float arg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawerStateChanged(int arg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public boolean handleMenuItemClick(MenuItem item) {
|
public boolean handleMenuItemClick(MenuItem item) {
|
||||||
// Handle action buttons
|
// Handle action buttons
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user