Search in sources :

Example 96 with Snackbar

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();
}
Also used : Snackbar(android.support.design.widget.Snackbar)

Example 97 with Snackbar

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);
}
Also used : TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout) Snackbar(android.support.design.widget.Snackbar)

Example 98 with Snackbar

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();
    }
}
Also used : View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) Snackbar(android.support.design.widget.Snackbar)

Example 99 with Snackbar

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();
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) View(android.view.View) Snackbar(android.support.design.widget.Snackbar)

Example 100 with Snackbar

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();
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) Snackbar(android.support.design.widget.Snackbar)

Aggregations

Snackbar (android.support.design.widget.Snackbar)102 View (android.view.View)56 TextView (android.widget.TextView)25 Intent (android.content.Intent)13 RecyclerView (android.support.v7.widget.RecyclerView)13 BaseTransientBottomBar (android.support.design.widget.BaseTransientBottomBar)10 ImageView (android.widget.ImageView)10 ViewGroup (android.view.ViewGroup)8 DialogInterface (android.content.DialogInterface)7 LayoutInflater (android.view.LayoutInflater)6 AdapterView (android.widget.AdapterView)6 LinearLayout (android.widget.LinearLayout)6 ListView (android.widget.ListView)6 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)5 AlertDialog (android.app.AlertDialog)4 Context (android.content.Context)4 Nullable (android.support.annotation.Nullable)4 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 File (java.io.File)4 RemindyDAO (ve.com.abicelis.remindy.database.RemindyDAO)4