use of android.support.v4.widget.DrawerLayout in project JamsMusicPlayer by psaravan.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
//Context and Common object(s).
mContext = getApplicationContext();
mApp = (Common) getApplicationContext();
//Set the theme and inflate the layout.
setTheme();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Init the UI elements.
mDrawerParentLayout = (FrameLayout) findViewById(R.id.main_activity_root);
mDrawerLayout = (DrawerLayout) findViewById(R.id.main_activity_drawer_root);
mNavDrawerLayout = (RelativeLayout) findViewById(R.id.nav_drawer_container);
mCurrentQueueDrawerLayout = (RelativeLayout) findViewById(R.id.current_queue_drawer_container);
//Load the drawer fragments.
loadDrawerFragments();
//KitKat specific translucency.
applyKitKatTranslucency();
//Load the fragment.
loadFragment(savedInstanceState);
/**
* Navigation drawer toggle.
*/
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, 0, 0) {
@Override
public void onDrawerClosed(View view) {
if (mQueueDrawerFragment != null && view == mCurrentQueueDrawerLayout)
mQueueDrawerFragment.setIsDrawerOpen(false);
}
@Override
public void onDrawerOpened(View view) {
if (mQueueDrawerFragment != null && view == mCurrentQueueDrawerLayout)
mQueueDrawerFragment.setIsDrawerOpen(true);
}
};
//Apply the drawer toggle to the DrawerLayout.
mDrawerLayout.setDrawerListener(mDrawerToggle);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowHomeEnabled(true);
//Check if this is the first time the app is being started.
if (mApp.getSharedPreferences().getBoolean(Common.FIRST_RUN, true) == true) {
showAlbumArtScanningDialog();
mApp.getSharedPreferences().edit().putBoolean(Common.FIRST_RUN, false).commit();
}
}
use of android.support.v4.widget.DrawerLayout in project robolectric by robolectric.
the class ShadowDrawerLayoutTest method canGetAndSetDrawerListener.
@Test
public void canGetAndSetDrawerListener() throws Exception {
DrawerLayout drawerLayout = new DrawerLayout(Robolectric.buildActivity(Activity.class).create().get());
DrawerLayout.DrawerListener mockDrawerListener = mock(DrawerLayout.DrawerListener.class);
drawerLayout.setDrawerListener(mockDrawerListener);
assertThat(shadowOf(drawerLayout).getDrawerListener()).isSameAs(mockDrawerListener);
}
use of android.support.v4.widget.DrawerLayout in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getFragmentManager().findFragmentById(R.id.content) == null) {
showLorem();
}
ListView drawer = (ListView) findViewById(R.id.drawer);
drawer.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_row, getResources().getStringArray(R.array.drawer_rows)));
drawer.setOnItemClickListener(this);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
toggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
drawerLayout.setDrawerListener(toggle);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
}
use of android.support.v4.widget.DrawerLayout in project cheesesquare by chrisbanes.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
setupDrawerContent(navigationView);
}
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.v4.widget.DrawerLayout in project AndroidChangeSkin by hongyangAndroid.
the class MainActivity method initView.
private void initView() {
mDrawerLayout = (DrawerLayout) findViewById(R.id.id_drawerLayout);
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.id_left_menu_container);
if (fragment == null) {
fm.beginTransaction().add(R.id.id_left_menu_container, new MenuLeftFragment()).commit();
}
}
Aggregations