use of android.support.design.widget.Snackbar in project Tusky by Vavassor.
the class ComposeActivity method onSendSuccess.
private void onSendSuccess() {
Snackbar bar = Snackbar.make(findViewById(R.id.activity_compose), getString(R.string.confirmation_send), Snackbar.LENGTH_SHORT);
bar.show();
setResult(COMPOSE_SUCCESS);
finish();
}
use of android.support.design.widget.Snackbar in project JustAndroid by chinaltz.
the class AbSnackbarUtil method SnackbarAddView.
/**
* 向Snackbar中添加view
*
* @param snackbar
* @param layoutId
* @param index 新加布局在Snackbar中的位置
*/
public static void SnackbarAddView(Snackbar snackbar, int layoutId, int index) {
View snackbarview = snackbar.getView();
Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbarview;
View add_view = LayoutInflater.from(snackbarview.getContext()).inflate(layoutId, null);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
p.gravity = Gravity.CENTER_VERTICAL;
snackbarLayout.addView(add_view, index, p);
}
use of android.support.design.widget.Snackbar in project BottomNavigation by Ashok-Varma.
the class HomeActivityJava method onClick.
@Override
public void onClick(View v) {
if (v.getId() == R.id.toggle_hide) {
if (bottomNavigationBar != null) {
bottomNavigationBar.toggle();
}
} else if (v.getId() == R.id.toggle_badge) {
if (numberBadgeItem != null) {
numberBadgeItem.toggle();
}
if (shapeBadgeItem != null) {
shapeBadgeItem.toggle();
}
} else if (v.getId() == R.id.fab_home) {
final Snackbar snackbar = Snackbar.make(message, "Fab Clicked", Snackbar.LENGTH_LONG);
snackbar.setAction("dismiss", new View.OnClickListener() {
@Override
public void onClick(View v) {
snackbar.dismiss();
}
});
snackbar.show();
}
}
use of android.support.design.widget.Snackbar in project LiveLessons by douglascraigschmidt.
the class PermissionRequest method showRationale.
/**
* Convenience method that shows an about dialog for this application. It
* has been placed in this ViewUtils class so that it can be easily accessed
* from any activity.
*/
private void showRationale() {
String msg;
// rationales.
if (mRationaleId == R.string.permission_rationale) {
String permissionStrings = "";
for (final String permission : mPermissions) {
permissionStrings += "\n" + permission;
}
msg = mActivity.getString(R.string.permission_rationale) + permissionStrings;
} else {
// App supplied rationale.
msg = mActivity.getString(mRationaleId);
}
if (mLayout != null) {
Snackbar snackbar = Snackbar.make(mLayout, msg, Snackbar.LENGTH_INDEFINITE);
snackbar.setAction(R.string.permissions_ok_button, new View.OnClickListener() {
@Override
public void onClick(View view) {
/// Submit the request.
ActivityCompat.requestPermissions(mActivity, mPermissions, mRequestCode);
}
});
snackbar.show();
} else {
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mActivity);
// Set dialog title.
alertDialogBuilder.setTitle("Permission Request");
// Set dialog message.
alertDialogBuilder.setMessage(msg);
alertDialogBuilder.setCancelable(true);
alertDialogBuilder.setPositiveButton(R.string.permissions_ok_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
/// Submit the request.
ActivityCompat.requestPermissions(mActivity, mPermissions, mRequestCode);
}
});
// Create alert dialog.
final AlertDialog alertDialog = alertDialogBuilder.create();
// Show it.
alertDialog.show();
}
}
use of android.support.design.widget.Snackbar in project zype-android by zype.
the class UiUtils method showPositiveSnackbar.
public static void showPositiveSnackbar(View view, String text) {
if (view == null) {
return;
}
Snackbar snackbar = Snackbar.make(view, text, Snackbar.LENGTH_LONG);
View snackView = snackbar.getView();
snackView.setBackgroundColor(view.getContext().getResources().getColor(R.color.snackbar_positive));
snackbar.show();
}
Aggregations