android.support.design.widget.BaseTransientBottomBar Java Examples
The following examples show how to use
android.support.design.widget.BaseTransientBottomBar.
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: MockNavigationActivity.java From graphhopper-navigation-android with MIT License | 6 votes |
@Override public void onMapReady(MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap); locationLayerPlugin.setRenderMode(RenderMode.GPS); locationLayerPlugin.setLocationLayerEnabled(false); navigationMapRoute = new NavigationMapRoute(navigation, mapView, mapboxMap); mapboxMap.addOnMapClickListener(this); Snackbar.make(findViewById(R.id.container), "Tap map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show(); locationEngine = new ReplayRouteLocationEngine(); newOrigin(); }
Example #2
Source File: CommonUtils.java From Awesome-WanAndroid with Apache License 2.0 | 6 votes |
/** * Show message * * @param activity Activity * @param msg message */ public static void showSnackMessage(Activity activity, String msg) { LogHelper.e("showSnackMessage :" + msg); //去掉虚拟按键 activity.getWindow().getDecorView().setSystemUiVisibility( //隐藏虚拟按键栏 | 防止点击屏幕时,隐藏虚拟按键栏又弹了出来 View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE ); final Snackbar snackbar = Snackbar.make(activity.getWindow().getDecorView(), msg, Snackbar.LENGTH_SHORT); View view = snackbar.getView(); ((TextView) view.findViewById(R.id.snackbar_text)).setTextColor(ContextCompat.getColor(activity, R.color.white)); snackbar.setAction("知道了", v -> { snackbar.dismiss(); //隐藏SnackBar时记得恢复隐藏虚拟按键栏,不然屏幕底部会多出一块空白布局出来,很难看 activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); }).show(); snackbar.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() { @Override public void onDismissed(Snackbar transientBottomBar, int event) { super.onDismissed(transientBottomBar, event); activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); } }); }
Example #3
Source File: ImagesFragment.java From android-storage-permissions with Apache License 2.0 | 6 votes |
@Override public void showMissingPermissions(boolean showMessage) { if (mPermissionSnackbar == null && !showMessage) { return; } if (mPermissionSnackbar == null) { mPermissionSnackbar = Snackbar.make(mCoordinatorLayout, R.string.missing_permissions, BaseTransientBottomBar.LENGTH_INDEFINITE); mPermissionSnackbar.setAction(R.string.request, new PermissionRequestClickListener()); } if (showMessage) { mPermissionSnackbar.show(); } else { mPermissionSnackbar.dismiss(); } }
Example #4
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
@Override public void onLocationChanged(Location location) { if (lastLocation == null) { // Move the navigationMap camera to the first Location moveCameraTo(location); // Allow navigationMap clicks now that we have the current Location navigationMap.retrieveMap().addOnMapLongClickListener(this); showSnackbar(LONG_PRESS_MAP_MESSAGE, BaseTransientBottomBar.LENGTH_LONG); } // Cache for fetching the route later updateLocation(location); }
Example #5
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
private void initializeLocationEngine() { LocationEngineProvider locationEngineProvider = new LocationEngineProvider(this); locationEngine = locationEngineProvider.obtainBestLocationEngineAvailable(); locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY); locationEngine.addLocationEngineListener(this); locationEngine.setFastestInterval(ONE_SECOND_INTERVAL); locationEngine.activate(); showSnackbar(SEARCHING_FOR_GPS_MESSAGE, BaseTransientBottomBar.LENGTH_SHORT); }
Example #6
Source File: ImageImportActivity.java From android-storage-permissions with Apache License 2.0 | 5 votes |
private void showPermissionError(boolean showMessage) { if (mPermissionSnackbar == null && !showMessage) { return; } if (mPermissionSnackbar == null) { mPermissionSnackbar = Snackbar.make(mCoordinatorLayout, "Missing Permissions", BaseTransientBottomBar.LENGTH_INDEFINITE); mPermissionSnackbar.setAction("Request", new PermissionRequestClickListener()); } if (showMessage) { mPermissionSnackbar.show(); } else { mPermissionSnackbar.dismiss(); } }
Example #7
Source File: MainActivity.java From android with MIT License | 5 votes |
private void showSnackbar(int string, int length) { if (mSnackbar == null) { mSnackbar = Snackbar.make(findViewById(R.id.activity_main), getResources().getString(string), length); mSnackbar.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() { @Override public void onDismissed(Snackbar transientBottomBar, int event) { super.onDismissed(transientBottomBar, event); mSnackbar = null; } }); mSnackbar.show(); } }
Example #8
Source File: FlasherActivity.java From TwrpBuilder with GNU General Public License v3.0 | 5 votes |
@Override protected void onPostExecute(String s) { super.onPostExecute(s); Snackbar.make(getCurrentFocus(), "Flashed", BaseTransientBottomBar.LENGTH_SHORT).show(); editText.setEnabled(true); button.setEnabled(true); flasherPB.setVisibility(View.GONE); flashing = false; }
Example #9
Source File: MainActivity.java From augmentedreality with Apache License 2.0 | 5 votes |
private void showSnackbarMessage(String message, boolean finishOnDismiss) { messageSnackbar = Snackbar.make( this.findViewById(android.R.id.content), message, Snackbar.LENGTH_INDEFINITE); messageSnackbar.getView().setBackgroundColor(0xbf323232); if (finishOnDismiss) { messageSnackbar.setAction( "Dismiss", new View.OnClickListener() { @Override public void onClick(View v) { messageSnackbar.dismiss(); } }); messageSnackbar.addCallback( new BaseTransientBottomBar.BaseCallback<Snackbar>() { @Override public void onDismissed(Snackbar transientBottomBar, int event) { super.onDismissed(transientBottomBar, event); finish(); } }); } messageSnackbar.show(); }
Example #10
Source File: SnackbarHelper.java From poly-sample-android with Apache License 2.0 | 4 votes |
private void show( final Activity activity, final String message, final DismissBehavior dismissBehavior) { activity.runOnUiThread( new Runnable() { @Override public void run() { messageSnackbar = Snackbar.make( activity.findViewById(android.R.id.content), message, Snackbar.LENGTH_INDEFINITE); messageSnackbar.getView().setBackgroundColor(BACKGROUND_COLOR); if (dismissBehavior != DismissBehavior.HIDE) { messageSnackbar.setAction( "Dismiss", new View.OnClickListener() { @Override public void onClick(View v) { messageSnackbar.dismiss(); } }); if (dismissBehavior == DismissBehavior.FINISH) { messageSnackbar.addCallback( new BaseTransientBottomBar.BaseCallback<Snackbar>() { @Override public void onDismissed(Snackbar transientBottomBar, int event) { super.onDismissed(transientBottomBar, event); activity.finish(); } }); } } ((TextView) messageSnackbar .getView() .findViewById(android.support.design.R.id.snackbar_text)) .setMaxLines(maxLines); messageSnackbar.show(); } }); }