Search in sources :

Example 91 with Snackbar

use of android.support.design.widget.Snackbar in project smartmodule by carozhu.

the class BaseFragment method showDefaultSnackbar.

public void showDefaultSnackbar(String tips) {
    Snackbar mysnackbar = Snackbar.make(getRootView(), tips, Snackbar.LENGTH_SHORT);
    View view = mysnackbar.getView();
    if (view != null) {
        view.setBackgroundColor(ContextCompat.getColor(context, R.color.md_blue_grey_500));
        ((TextView) view.findViewById(R.id.snackbar_text)).setTextColor(ContextCompat.getColor(context, R.color.white));
    }
    mysnackbar.show();
}
Also used : TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) Snackbar(android.support.design.widget.Snackbar)

Example 92 with Snackbar

use of android.support.design.widget.Snackbar in project smartmodule by carozhu.

the class BaseSimpleAppCompatActivity method showDefaultSnackbar.

public void showDefaultSnackbar(String tips) {
    Snackbar mysnackbar = Snackbar.make(getRootView(), tips, Snackbar.LENGTH_SHORT);
    View view = mysnackbar.getView();
    if (view != null) {
        view.setBackgroundColor(ContextCompat.getColor(context, R.color.md_blue_grey_500));
        ((TextView) view.findViewById(R.id.snackbar_text)).setTextColor(ContextCompat.getColor(context, R.color.white));
    }
    mysnackbar.show();
}
Also used : TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView) Snackbar(android.support.design.widget.Snackbar)

Example 93 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 94 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)

Aggregations

Snackbar (android.support.design.widget.Snackbar)94 View (android.view.View)50 TextView (android.widget.TextView)23 RecyclerView (android.support.v7.widget.RecyclerView)14 Intent (android.content.Intent)13 BaseTransientBottomBar (android.support.design.widget.BaseTransientBottomBar)9 ListView (android.widget.ListView)8 DialogInterface (android.content.DialogInterface)7 ImageView (android.widget.ImageView)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)5 ViewGroup (android.view.ViewGroup)5 AdapterView (android.widget.AdapterView)5 LinearLayout (android.widget.LinearLayout)5 File (java.io.File)5 ArrayList (java.util.ArrayList)5 Bitmap (android.graphics.Bitmap)4 Nullable (android.support.annotation.Nullable)4 LayoutInflater (android.view.LayoutInflater)4 RemindyDAO (ve.com.abicelis.remindy.database.RemindyDAO)4