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);
drawer = (ListView) findViewById(R.id.drawer);
drawer.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
String[] rows = getResources().getStringArray(R.array.drawer_rows);
drawer.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_row, 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);
getFragmentManager().addOnBackStackChangedListener(this);
if (getFragmentManager().findFragmentById(R.id.content) == null) {
showLorem();
}
}
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 Android-PanesLibrary by cricklet.
the class PhoneDelegate method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
if (findViewById(R.id.content_frame) == null)
setContentView(R.layout.phone_layout);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
drawerToggle = new ActionBarDrawerToggle(getActivity(), drawer, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {
public void onDrawerClosed(View view) {
supportInvalidateOptionsMenu();
// creates call to onPrepareOptionsMenu()
}
public void onDrawerOpened(View drawerView) {
supportInvalidateOptionsMenu();
// creates call to onPrepareOptionsMenu()
}
};
drawer.setDrawerListener(drawerToggle);
FragmentManager fm = getSupportFragmentManager();
fm.addOnBackStackChangedListener(this);
}
use of android.support.v4.widget.DrawerLayout in project AnimeTaste by daimajia.
the class StartActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
mVideoList = (ListView) findViewById(R.id.videoList);
mDrawerList = (ListView) findViewById(R.id.function_list);
mDrawer = (LinearLayout) findViewById(R.id.drawer);
mLayoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mCategoryList = (ListView) findViewById(R.id.category_list);
mFooterView = mLayoutInflater.inflate(R.layout.load_item, null);
mLoadProgress = (ProgressBar) mFooterView.findViewById(R.id.loading);
mLoadText = (TextView) mFooterView.findViewById(R.id.load_text);
mVideoList.addFooterView(mFooterView);
mVideoList.setOnScrollListener(this);
mDrawer.setOnTouchListener(this);
View headerView = mLayoutInflater.inflate(R.layout.gallery_item, null, false);
mVideoList.addHeaderView(headerView);
mRecommendPager = (ViewPager) headerView.findViewById(R.id.pager);
mRecommendPager.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
PointF downP = new PointF();
PointF curP = new PointF();
int act = event.getAction();
if (act == MotionEvent.ACTION_DOWN || act == MotionEvent.ACTION_MOVE || act == MotionEvent.ACTION_UP) {
((ViewGroup) v).requestDisallowInterceptTouchEvent(true);
if (downP.x == curP.x && downP.y == curP.y) {
return false;
}
}
return false;
}
});
mRecommendIndicator = (UnderlinePageIndicator) headerView.findViewById(R.id.indicator);
if (getIntent().hasExtra("Success")) {
init(getIntent());
} else {
Toast.makeText(mContext, R.string.init_failed, Toast.LENGTH_SHORT).show();
finish();
}
mDrawerAapter = new SimpleAdapter(this, getDrawerItems(), R.layout.drawer_item, new String[] { "img", "title" }, new int[] { R.id.item_icon, R.id.item_name });
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_action_navigation_menu, R.string.app_name, R.string.app_name) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
if (mPreviousType != mType || mPreviousCategoryId != mCategoryId) {
mCurrentPage = 1;
mIsEnd = false;
mVideoAdapter.removeAllData();
mFooterView.findViewById(R.id.loading).setVisibility(View.VISIBLE);
mFooterView.findViewById(R.id.load_text).setVisibility(View.INVISIBLE);
triggerApiConnector();
}
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
mPreviousType = mType;
mPreviousCategoryId = mCategoryId;
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerList.setAdapter(mDrawerAapter);
mDrawerList.setOnItemClickListener(this);
ViewUtils.setListViewHeightBasedOnChildren(mDrawerList);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
getSupportActionBar().setLogo(R.drawable.rsz_ab_icon);
rateForUsOrCheckUpdate();
showWhatsNew();
}
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);
}
Aggregations