Java Code Examples for android.support.v4.widget.DrawerLayout#setDrawerLockMode()

The following examples show how to use android.support.v4.widget.DrawerLayout#setDrawerLockMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchFragment.java    From Mover with Apache License 2.0 5 votes vote down vote up
@Override
public void onDetach() {
    super.onDetach();
    DrawerLayout drawer = ButterKnife.findById(getActivity(), R.id.drawer_container);
    drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
    setupToolbar(false);
}
 
Example 2
Source File: NewRecordActivity.java    From SoloPi with Apache License 2.0 4 votes vote down vote up
private void initDrawerLayout() {
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
    mAppListContainer = findViewById(R.id.app_list_container);
}
 
Example 3
Source File: SearchFragment.java    From Mover with Apache License 2.0 4 votes vote down vote up
void setupParent(){
    DrawerLayout drawer = ButterKnife.findById(getActivity(), R.id.drawer_container);
    drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
    drawer.closeDrawer(GravityCompat.START);
}
 
Example 4
Source File: SubredditView.java    From Slide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    overrideSwipeFromAnywhere();
    if (SettingValues.commentPager && SettingValues.single) {
        disableSwipeBackLayout();
    }
    getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    getWindow().getDecorView().setBackgroundDrawable(null);
    super.onCreate(savedInstanceState);
    if (!restarting) {
        overridePendingTransition(R.anim.slideright, 0);
    } else {
        restarting = false;
    }


    subreddit = getIntent().getExtras().getString(EXTRA_SUBREDDIT, "");
    applyColorTheme(subreddit);
    setContentView(R.layout.activity_singlesubreddit);
    setupSubredditAppBar(R.id.toolbar, subreddit, true, subreddit);

    header = findViewById(R.id.header);
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    setResult(3);
    mToolbar.setPopupTheme(new ColorPreferences(this).getFontStyle().getBaseId());
    pager = (ToggleSwipeViewPager) findViewById(R.id.content_view);
    singleMode = SettingValues.single;
    commentPager = false;
    if (singleMode) commentPager = SettingValues.commentPager;
    if (commentPager) {
        adapter = new OverviewPagerAdapterComment(getSupportFragmentManager());
        pager.setSwipeLeftOnly(false);
        pager.setSwipingEnabled(true);
    } else {
        adapter = new OverviewPagerAdapter(getSupportFragmentManager());
    }
    pager.setAdapter(adapter);
    pager.setCurrentItem(1);
    mToolbar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int[] firstVisibleItems;
            int pastVisiblesItems = 0;
            firstVisibleItems =
                    ((CatchStaggeredGridLayoutManager) ((SubmissionsView) (adapter.getCurrentFragment())).rv
                            .getLayoutManager()).findFirstVisibleItemPositions(null);
            if (firstVisibleItems != null && firstVisibleItems.length > 0) {
                for (int firstVisibleItem : firstVisibleItems) {
                    pastVisiblesItems = firstVisibleItem;
                }
            }
            if (pastVisiblesItems > 8) {
                ((SubmissionsView) (adapter.getCurrentFragment())).rv.scrollToPosition(0);
                header.animate()
                        .translationY(header.getHeight())
                        .setInterpolator(new LinearInterpolator())
                        .setDuration(180);
            } else {
                ((SubmissionsView) (adapter.getCurrentFragment())).rv.smoothScrollToPosition(0);
            }
            ((SubmissionsView) (adapter.getCurrentFragment())).resetScroll();
        }
    });
    if (!subreddit.equals("random")
            && !subreddit.equals("all")
            && !subreddit.equals("frontpage")
            && !subreddit.equals("friends")
            && !subreddit.equals("mod")
            && !subreddit.equals("myrandom")
            && !subreddit.equals("randnsfw")
            && !subreddit.equals("popular")
            && !subreddit.contains("+")) {
        executeAsyncSubreddit(subreddit);
    } else {
        drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, GravityCompat.END);
    }
}
 
Example 5
Source File: MainActivity.java    From explorer with Apache License 2.0 3 votes vote down vote up
private void initDrawerLayout() {

        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

        if (drawerLayout == null) return;

        if (name != null || type != null) {

            drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        }
    }