List of usage examples for android.view Gravity START
int START
To view the source code for android.view Gravity START.
Click Source Link
From source file:com.bradbergeron.splitviewcontrollerdemo.activities.MainActivity.java
@Override public void onDrawerItemSelected(final DrawerFragment.FragmentDrawerItem fragmentDrawerItem) { if (mDrawerLayout.isDrawerOpen(Gravity.START)) { mDrawerLayout.closeDrawer(Gravity.START); }/*from ww w . j av a 2s .c o m*/ final FragmentManager fragmentManager = getFragmentManager(); final String fragmentClassName = fragmentDrawerItem.getFragmentClass().getName(); Fragment newFragment = fragmentManager.findFragmentByTag(fragmentClassName); if (newFragment == null) { newFragment = Fragment.instantiate(this, fragmentClassName); } else if (newFragment.isAdded()) { return; } else if (fragmentDrawerItem.isDefaultItem() && fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack("Drawer", FragmentManager.POP_BACK_STACK_INCLUSIVE); } final FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.content, newFragment, fragmentClassName); if (!fragmentDrawerItem.isDefaultItem()) { transaction.addToBackStack("Drawer"); } transaction.commit(); }
From source file:com.chriscartland.octaviastreethilton.ui.MainActivity.java
private void createDrawer() { // Now retrieve the DrawerLayout so that we can set the status bar color. // This only takes effect on Lollipop, or when using translucentStatusBar // on KitKat. DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_main); drawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.color_primary_dark)); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_main); ArrayAdapter drawerAdapter = ArrayAdapter.createFromResource(this, R.array.navigation_array, R.layout.drawer_list_item);// w w w . j av a 2 s .c o m mDrawerNavigation = (ListView) findViewById(R.id.drawer_navigation); mDrawerNavigation.setAdapter(drawerAdapter); mDrawerNavigation.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { setTitle(parent.getItemAtPosition(position).toString()); mDrawerLayout.closeDrawer(Gravity.START); } }); setTitle(mDrawerNavigation.getItemAtPosition(0).toString()); }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public void openLeft() { layout.openDrawer(Gravity.START); }
From source file:com.michaldabski.filemanager.folders.FolderActivity.java
private void setupDrawers() { this.drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.open_drawer, R.string.close_drawer) { boolean actionBarShown = false; @Override/*w w w .ja va2 s .c o m*/ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); setActionbarVisible(true); invalidateOptionsMenu(); } @Override public void onDrawerClosed(View drawerView) { actionBarShown = false; super.onDrawerClosed(drawerView); invalidateOptionsMenu(); } @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); if (slideOffset > 0 && actionBarShown == false) { actionBarShown = true; setActionbarVisible(true); } else if (slideOffset <= 0) actionBarShown = false; } }; drawerLayout.setDrawerListener(actionBarDrawerToggle); drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); drawerLayout.setFocusableInTouchMode(false); // drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.END); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); setupNavDrawer(); setupClipboardDrawer(); }
From source file:de.azapps.mirakel.new_ui.activities.MirakelActivity.java
@Override public void onListSelected(final ListMirakel list) { setList(list);//from w w w.j ava2s. c o m withOptional(mDrawerLayout, new Procedure<DrawerLayout>() { @Override public void apply(final DrawerLayout input) { input.closeDrawer(Gravity.START); } }); }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public void closeLeft() { layout.closeDrawer(Gravity.START); }
From source file:com.github.shareme.gwsmaterialuikit.library.material.app.Dialog.java
private void init(Context context, int style) { mContentPadding = ThemeUtil.dpToPx(context, 24); mActionMinWidth = ThemeUtil.dpToPx(context, 64); mActionHeight = ThemeUtil.dpToPx(context, 36); mActionOuterHeight = ThemeUtil.dpToPx(context, 48); mActionPadding = ThemeUtil.dpToPx(context, 8); mActionOuterPadding = ThemeUtil.dpToPx(context, 16); mDialogHorizontalPadding = ThemeUtil.dpToPx(context, 40); mDialogVerticalPadding = ThemeUtil.dpToPx(context, 24); mCardView = new DialogCardView(context); mContainer = new ContainerFrameLayout(context); mTitle = new TextView(context); mPositiveAction = new Button(context); mNegativeAction = new Button(context); mNeutralAction = new Button(context); mCardView.setPreventCornerOverlap(false); mCardView.setUseCompatPadding(true); mTitle.setId(TITLE);/* w ww .j a v a 2s .c om*/ mTitle.setGravity(Gravity.START); mTitle.setPadding(mContentPadding, mContentPadding, mContentPadding, mContentPadding - mActionPadding); mPositiveAction.setId(ACTION_POSITIVE); mPositiveAction.setPadding(mActionPadding, 0, mActionPadding, 0); mPositiveAction.setBackgroundResource(0); mNegativeAction.setId(ACTION_NEGATIVE); mNegativeAction.setPadding(mActionPadding, 0, mActionPadding, 0); mNegativeAction.setBackgroundResource(0); mNeutralAction.setId(ACTION_NEUTRAL); mNeutralAction.setPadding(mActionPadding, 0, mActionPadding, 0); mNeutralAction.setBackgroundResource(0); mContainer.addView(mCardView); mCardView.addView(mTitle); mCardView.addView(mPositiveAction); mCardView.addView(mNegativeAction); mCardView.addView(mNeutralAction); backgroundColor(ThemeUtil.windowBackground(context, 0xFFFFFFFF)); elevation(ThemeUtil.dpToPx(context, 4)); cornerRadius(ThemeUtil.dpToPx(context, 2)); dimAmount(0.5f); layoutDirection(ViewCompat.LAYOUT_DIRECTION_LOCALE); titleTextAppearance(R.style.TextAppearance_AppCompat_Title); actionTextAppearance(R.style.TextAppearance_AppCompat_Button); dividerColor(0x1E000000); dividerHeight(ThemeUtil.dpToPx(context, 1)); cancelable(true); canceledOnTouchOutside(true); clearContent(); onCreate(); applyStyle(style); super.setContentView(mContainer); }
From source file:com.esri.arcgisruntime.sample.readgeopackage.MainActivity.java
private void readGeoPackage() { mLayersHashMap = new HashMap<>(); // open and load the GeoPackage GeoPackage geoPackage = new GeoPackage( Environment.getExternalStorageDirectory() + getString(R.string.geopackage_path)); geoPackage.loadAsync();/*from w w w . jav a 2 s . c o m*/ geoPackage.addDoneLoadingListener(() -> { if (geoPackage.getLoadStatus() == LoadStatus.FAILED_TO_LOAD) { String error = "Geopackage failed to load: " + geoPackage.getLoadError(); Log.e(TAG, error); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); return; } // loop through each GeoPackageRaster for (GeoPackageRaster geoPackageRaster : geoPackage.getGeoPackageRasters()) { // create a RasterLayer from the GeoPackageRaster RasterLayer rasterLayer = new RasterLayer(geoPackageRaster); // set the opacity on the RasterLayer to partially visible rasterLayer.setOpacity(0.55f); // load the RasterLayer so we can get to its properties rasterLayer.loadAsync(); rasterLayer.addDoneLoadingListener(() -> { // create a string to hold the name of the RasterLayer for display in the ListView and as the hash map key String rasterLayerName; String path = geoPackageRaster.getPath(); // if getName is not null, use it as the raster's name, else use the end of the path name as the raster's name rasterLayerName = rasterLayer.getName().isEmpty() ? path.substring(path.lastIndexOf('/') + 1) : rasterLayer.getName(); // append the layer type to the name rasterLayerName += "\n(RasterLayer)"; // add the name of the RasterLayer and the RasterLayer itself to the layers HashMap mLayersHashMap.put(rasterLayerName, rasterLayer); // add the name of the RasterLayer to the layers StringAdapter mLayersStringAdaptor.add(rasterLayerName); mLayersStringAdaptor.notifyDataSetChanged(); }); } // get the list of GeoPackageFeatureTables from the GeoPackage List<GeoPackageFeatureTable> geoPackageFeatureTables = geoPackage.getGeoPackageFeatureTables(); // loop through each GeoPackageFeatureTable for (GeoPackageFeatureTable geoPackageFeatureTable : geoPackageFeatureTables) { // create a FeatureLayer from the GeoPackageFeatureLayer FeatureLayer featureLayer = new FeatureLayer(geoPackageFeatureTable); // load the FeatureLayer - that way we can get to it's properties featureLayer.loadAsync(); featureLayer.addDoneLoadingListener(() -> { // create a string to hold the name of the FeatureLayer for display in the ListView and as the hash map key String featureLayerName = featureLayer.getName(); // append the layer type to the name featureLayerName += "\n(FeatureLayer)"; // add the name of the FeatureLayer and the FeatureLayer itself into the hash map mLayersHashMap.put(featureLayerName, featureLayer); // add the name of the FeatureLayer to the layers StringAdapter mLayersStringAdaptor.add(featureLayerName); mLayersStringAdaptor.notifyDataSetChanged(); }); } // open the drawer mDrawerLayout.openDrawer(Gravity.START); }); }
From source file:com.ffmpeger.card.ui.BaseNaviActivity.java
/** * Sets up the navigation drawer as appropriate. Note that the nav drawer will be * different depending on whether the attendee indicated that they are attending the * event on-site vs. attending remotely. *///from w w w . j a v a 2 s. co m private void setupNavDrawer() { // What nav drawer item should be selected? int selfItem = getSelfNavDrawerItem(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (mDrawerLayout == null) { return; } mDrawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.demo_colorPrimaryDark)); if (selfItem == NAVDRAWER_ITEM_INVALID) { // do not show a nav drawer View navDrawer = mDrawerLayout.findViewById(R.id.navdrawer); if (navDrawer != null) { ((ViewGroup) navDrawer.getParent()).removeView(navDrawer); } mDrawerLayout = null; return; } if (mActionBarToolbar != null) { mActionBarToolbar.setNavigationIcon(R.drawable.ic_navigation_drawer); mActionBarToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mDrawerLayout.openDrawer(Gravity.START); } }); } mDrawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() { @Override public void onDrawerClosed(View drawerView) { // run deferred action, if we have one if (mDeferredOnDrawerClosedRunnable != null) { mDeferredOnDrawerClosedRunnable.run(); mDeferredOnDrawerClosedRunnable = null; } //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() //updateStatusBarForNavDrawerSlide(0f); onNavDrawerStateChanged(false, false); } @Override public void onDrawerOpened(View drawerView) { //invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() //updateStatusBarForNavDrawerSlide(1f); onNavDrawerStateChanged(true, false); } @Override public void onDrawerStateChanged(int newState) { //invalidateOptionsMenu(); onNavDrawerStateChanged(isNavDrawerOpen(), newState != DrawerLayout.STATE_IDLE); } @Override public void onDrawerSlide(View drawerView, float slideOffset) { //updateStatusBarForNavDrawerSlide(slideOffset); onNavDrawerSlide(slideOffset); } }); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); //getActionBar().setDisplayHomeAsUpEnabled(true); //getActionBar().setHomeButtonEnabled(true); // populate the nav drawer with the correct items populateNavDrawer(); // When the user runs the app for the first time, we want to land them with the // navigation drawer open. But just the first time. if (!PrefUtils.isWelcomeDone(this)) { // first run of the app starts with the nav drawer open PrefUtils.markWelcomeDone(this); mDrawerLayout.openDrawer(Gravity.START); } }
From source file:ti.modules.titanium.ui.widget.TiUIDrawerLayout.java
public boolean isLeftOpen() { return layout.isDrawerOpen(Gravity.START); }