List of usage examples for android.support.v4.view GravityCompat START
int START
To view the source code for android.support.v4.view GravityCompat START.
Click Source Link
From source file:com.fvd.nimbus.BrowseActivity.java
public void onButtonClick(View v) { drawer.closeDrawer(GravityCompat.START); Intent ip = new Intent(); switch (v.getId()) { case R.id.lbTakePhoto: ip.putExtra("act", "photo"); ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.PaintActivity"); startActivity(ip);//from w ww .j a v a2 s . c o m break; case R.id.lbFromGallery: ip.putExtra("act", "picture"); ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.PaintActivity"); startActivity(ip); break; case R.id.lbPdfAnnotate: ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.ChoosePDFActivity"); startActivity(ip); break; case R.id.libSettings: Intent inten = new Intent(getApplicationContext(), SettingsActivity.class); startActivityForResult(inten, SHOW_SETTINGS); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); return; default: break; } overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); finish(); }
From source file:com.google.blockly.android.AbstractBlocklyActivity.java
/** * Configures the activity to support a navigation menu and drawer provided by * {@link #onCreateAppNavigationDrawer}. */// ww w . ja va 2 s . c o m protected void setupAppNaviagtionDrawer() { DrawerLayout.LayoutParams lp = new DrawerLayout.LayoutParams( getResources().getDimensionPixelSize(R.dimen.navigation_drawer_width), ViewGroup.LayoutParams.MATCH_PARENT, Gravity.START); // Add navigation drawer above the content view, as the first drawer. mDrawerLayout.addView(mNavigationDrawer, 1, lp); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ R.string.navigation_drawer_close /* "close drawer" description for accessibility */ ) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (!mUserLearnedDrawer) { // The user manually opened the drawer; store this flag to prevent auto-showing // the navigation drawer automatically in the future. mUserLearnedDrawer = true; SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(AbstractBlocklyActivity.this); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); } supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } }; // Defer code dependent on restoration of previous instance state. mDrawerLayout.post(new Runnable() { @Override public void run() { mDrawerToggle.syncState(); } }); mDrawerLayout.addDrawerListener(mDrawerToggle); }
From source file:com.example.jonas.materialmockups.activities.ExhibitDetailsActivity.java
@Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_overview) { fab.hide();// ww w .j av a2 s . c o m } else if (id == R.id.nav_routes) { fab.hide(); } else if (id == R.id.nav_exhibit) { fab.show(); } else if (id == R.id.nav_share) { Toast.makeText(getApplicationContext(), "ACTION_SEND Intent with : Checkout HiP @ AppStore ...", Toast.LENGTH_SHORT).show(); } else if (id == R.id.nav_licenses) { startActivity(new Intent(getApplication(), LicensingActivity.class)); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:com.google.blockly.android.ToolboxFragment.java
/** * @return Computed {@link Rotation} constant for {@link #mRotateTabs} and {@link #mTabEdge}. *///from ww w .j a v a 2s . c om @Rotation.Enum private int getLabelRotation() { if (!mRotateTabs) { return Rotation.NONE; } switch (mTabEdge) { case Gravity.LEFT: return Rotation.COUNTER_CLOCKWISE; case Gravity.RIGHT: return Rotation.CLOCKWISE; case Gravity.TOP: return Rotation.NONE; case Gravity.BOTTOM: return Rotation.NONE; case GravityCompat.START: return Rotation.ADAPTIVE_COUNTER_CLOCKWISE; case GravityCompat.END: return Rotation.ADAPTIVE_CLOCKWISE; default: throw new IllegalArgumentException("Invalid tabEdge: " + mTabEdge); } }
From source file:co.scandy.example.scandycoreandroidexample.MainActivity.java
@SuppressWarnings("StatementWithEmptyBody") @Override/*from w ww .j a v a 2 s .co m*/ public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.initialize_button) { // Setup the scan_controls if (mScanControlsView == null) { // Find the controls_container ViewStub stub = (ViewStub) findViewById(R.id.controls_container); // Set the resource to be the scan_controls stub.setLayoutResource(R.layout.scan_controls); // Store the view inflated as the mScanControlsView mScanControlsView = (LinearLayout) stub.inflate(); // Bind the newly created controls to their callbacks bindScanControls(); } else { // Or just make them visible again mScanControlsView.setVisibility(View.VISIBLE); } // Initialize the scanner with the first file we find in the Download directory File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); String rrf_path = ""; // NOTE: you could present your users with a list of files to chose from if you felt like it! for (File file : dir.listFiles()) { if (file.getName().contains(".rrf")) { rrf_path = file.getAbsolutePath(); break; } } // check to see if we have a USB sensor attached if (ScandyCore.hasValidSensor()) { ScandyCore.initializeScanner(); } else if (rrf_path != "") { ScandyCore.initializeScanner(rrf_path); } else { // Show an Alert that we didn't find anything to initialize a scanner with AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("No scanner found"); alertDialog.setMessage("Didn't find a pico flexx or a pre-recorded file."); alertDialog.show(); } } else if (id == R.id.loadmesh_button) { // Make sure to uninitialize the scanner. Scandy Core gracefully handles various states. ScandyCore.uninitializeScanner(); try { // Lets load a test Obj ScandyCore .loadMeshFromURL(new URL("https://s3.amazonaws.com/scandycore-test-assets/scandy-obj.zip")); } catch (MalformedURLException e) { Log.e(TAG, e.getMessage()); } } else if (id == R.id.nav_manage) { } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; }
From source file:com.google.samples.apps.iosched.ui.BaseActivity.java
protected boolean isNavDrawerOpen() { return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START); }
From source file:com.google.samples.apps.iosched.ui.BaseActivity.java
protected void closeNavDrawer() { if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(GravityCompat.START); } }
From source file:com.duy.pascal.ui.editor.EditorActivity.java
@Override public void onBackPressed() { if (mDrawerLayout.isDrawerOpen(GravityCompat.START) || mDrawerLayout.isDrawerOpen(GravityCompat.END)) { mDrawerLayout.closeDrawers();/* w w w . ja v a 2 s.com*/ return; } if (getPreferences().getBoolean(getString(R.string.key_back_undo)) && getEditorFragment() != null) { getEditorFragment().undo(); return; } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.exit).setMessage(R.string.exit_mgs) .setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { EditorActivity.super.onBackPressed(); } }).setPositiveButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).setNeutralButton(R.string.get_more_app, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { StoreUtil.moreApp(EditorActivity.this); } }); showDialog(builder.create()); }
From source file:com.dm.material.dashboard.candybar.activities.CandyBarMainActivity.java
@Override public void onSearchExpanded(boolean expand) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); mIsMenuVisible = !expand;/* w w w. ja va 2s . com*/ if (expand) { toolbar.setNavigationIcon(R.drawable.ic_toolbar_back); toolbar.setNavigationOnClickListener(view -> onBackPressed()); } else { SoftKeyboardHelper.closeKeyboard(this); ColorHelper.setTransparentStatusBar(this, Color.TRANSPARENT); toolbar.setNavigationIcon(R.drawable.ic_toolbar_navigation); toolbar.setNavigationOnClickListener(view -> mDrawerLayout.openDrawer(GravityCompat.START)); } mDrawerLayout .setDrawerLockMode(expand ? DrawerLayout.LOCK_MODE_LOCKED_CLOSED : DrawerLayout.LOCK_MODE_UNLOCKED); supportInvalidateOptionsMenu(); }
From source file:com.duy.pascal.ui.editor.BaseEditorActivity.java
@Override public void onClick(View view) { switch (view.getId()) { case R.id.img_file_menus: mFileMenu.show();/*from w w w. j a v a 2 s .c om*/ break; case R.id.action_new_file: mFileExplorer.createNewFile(); mFabMenu.close(true); break; case R.id.action_new_folder: mFileExplorer.createNewFolder(); mFabMenu.close(true); break; case R.id.img_home_dir: mFileExplorer.show(FileManager.getSrcPath(this)); break; case R.id.row_open_drawer: mDrawerLayout.openDrawer(GravityCompat.END); break; case R.id.row_open_file: mDrawerLayout.openDrawer(GravityCompat.START); break; case R.id.row_open_code_sample: startActivity(new Intent(this, CodeSampleActivity.class)); break; } }