Search in sources :

Example 16 with Snackbar

use of android.support.design.widget.Snackbar in project android-advancedrecyclerview by h6ah4i.

the class SwipeableExampleActivity method onItemRemoved.

/**
     * This method will be called when a list item is removed
     *
     * @param position The position of the item within data set
     */
public void onItemRemoved(int position) {
    Snackbar snackbar = Snackbar.make(findViewById(R.id.container), R.string.snack_bar_text_item_removed, Snackbar.LENGTH_LONG);
    snackbar.setAction(R.string.snack_bar_action_undo, new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onItemUndoActionClicked();
        }
    });
    snackbar.setActionTextColor(ContextCompat.getColor(this, R.color.snackbar_action_color_done));
    snackbar.show();
}
Also used : View(android.view.View) Snackbar(android.support.design.widget.Snackbar)

Example 17 with Snackbar

use of android.support.design.widget.Snackbar in project iosched by google.

the class PermissionsUtils method displayPermissionDeniedAppInfoResolutionSnackbar.

private static Snackbar displayPermissionDeniedAppInfoResolutionSnackbar(@NonNull final Activity activity, final int messageResId, final boolean isPersistent) {
    View view = UIUtils.getRootView(activity);
    final int length = isPersistent ? Snackbar.LENGTH_INDEFINITE : Snackbar.LENGTH_LONG;
    Snackbar snackbar = Snackbar.make(view, messageResId, length).setAction(R.string.ok, new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            LOGI(TAG, "Invoking App Info screen");
            final Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            Uri uri = Uri.fromParts("package", BuildConfig.APPLICATION_ID, null);
            intent.setData(uri);
            activity.startActivity(intent);
        }
    });
    snackbar.show();
    return snackbar;
}
Also used : Intent(android.content.Intent) View(android.view.View) Uri(android.net.Uri) Snackbar(android.support.design.widget.Snackbar)

Example 18 with Snackbar

use of android.support.design.widget.Snackbar in project WordPress-Android by wordpress-mobile.

the class WPSwipeSnackbar method show.

private static Snackbar show(@NonNull ViewPager viewPager, @NonNull SwipeArrows arrows) {
    Context context = viewPager.getContext();
    String swipeText = context.getResources().getString(R.string.swipe_for_more);
    String arrowLeft = context.getResources().getString(R.string.previous_button);
    String arrowRight = context.getResources().getString(R.string.next_button);
    String text;
    switch(arrows) {
        case LEFT:
            text = arrowLeft + "  " + swipeText;
            break;
        case RIGHT:
            text = swipeText + "  " + arrowRight;
            break;
        case BOTH:
            text = arrowLeft + "  " + swipeText + "  " + arrowRight;
            break;
        default:
            text = swipeText;
            break;
    }
    Snackbar snackbar = Snackbar.make(viewPager, text, Snackbar.LENGTH_LONG);
    centerSnackbarText(snackbar);
    snackbar.show();
    return snackbar;
}
Also used : Context(android.content.Context) Snackbar(android.support.design.widget.Snackbar)

Example 19 with Snackbar

use of android.support.design.widget.Snackbar in project AgentWeb by Justson.

the class AgentWebUtils method show.

public static void show(View parent, CharSequence text, int duration, @ColorInt int textColor, @ColorInt int bgColor, CharSequence actionText, @ColorInt int actionTextColor, View.OnClickListener listener) {
    SpannableString spannableString = new SpannableString(text);
    ForegroundColorSpan colorSpan = new ForegroundColorSpan(textColor);
    spannableString.setSpan(colorSpan, 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    snackbarWeakReference = new WeakReference<>(Snackbar.make(parent, spannableString, duration));
    Snackbar snackbar = snackbarWeakReference.get();
    View view = snackbar.getView();
    view.setBackgroundColor(bgColor);
    if (actionText != null && actionText.length() > 0 && listener != null) {
        snackbar.setActionTextColor(actionTextColor);
        snackbar.setAction(actionText, listener);
    }
    snackbar.show();
}
Also used : SpannableString(android.text.SpannableString) ForegroundColorSpan(android.text.style.ForegroundColorSpan) View(android.view.View) WebView(android.webkit.WebView) Snackbar(android.support.design.widget.Snackbar)

Example 20 with Snackbar

use of android.support.design.widget.Snackbar in project YourAppIdea by Michenux.

the class SnackbarHelper method showInfoLongMessage.

public static void showInfoLongMessage(View view, @StringRes int message) {
    Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
    View sbView = snackbar.getView();
    TextView textView = (TextView) sbView.findViewById(org.michenux.drodrolib.R.id.snackbar_text);
    textView.setTextColor(Color.YELLOW);
    snackbar.show();
}
Also used : TextView(android.widget.TextView) TextView(android.widget.TextView) 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