Search in sources :

Example 51 with Snackbar

use of android.support.design.widget.Snackbar in project CreditCardView by Movile.

the class CreditCardFragment method showEditCardLayout.

private void showEditCardLayout(final boolean editFlagCard) {
    backFinish.set(false);
    Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.trans_rigth_out);
    anim.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            layoutPayment.setVisibility(View.GONE);
            if (editFlagCard) {
                switchSaveCard.setVisibility(View.VISIBLE);
                btEdit.setVisibility(View.INVISIBLE);
            }
            pageChanged();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    if (editFlagCard) {
        pager.setCurrentItem(pages.indexOf(Step.FLAG));
        clearFields();
        Snackbar snackbar = Snackbar.make(viewHolder, R.string.option_pay_using_other_card_chosen, Snackbar.LENGTH_LONG).setActionTextColor(getActivity().getResources().getColor(R.color.white)).setAction(R.string.undo, new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                restoreSavedCard(getCurrentCcv());
            }
        });
        View view = snackbar.getView();
        TextView textView = (TextView) view.findViewById(R.id.snackbar_text);
        textView.setTextColor(Color.WHITE);
        snackbar.show();
    }
    layoutPayment.startAnimation(anim);
    Animation anim2 = AnimationUtils.loadAnimation(getActivity(), R.anim.trans_rigth_in);
    layoutData.startAnimation(anim2);
    layoutData.setVisibility(View.VISIBLE);
}
Also used : Animation(android.view.animation.Animation) TextView(android.widget.TextView) ImageView(android.widget.ImageView) CreditCardView(movile.com.creditcardguide.view.CreditCardView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) Snackbar(android.support.design.widget.Snackbar)

Example 52 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 53 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 54 with Snackbar

use of android.support.design.widget.Snackbar in project PhotoPicker by donglua.

the class PhotoPagerActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        onBackPressed();
        return true;
    }
    if (item.getItemId() == R.id.delete) {
        final int index = pagerFragment.getCurrentItem();
        final String deletedPath = pagerFragment.getPaths().get(index);
        Snackbar snackbar = Snackbar.make(pagerFragment.getView(), R.string.__picker_deleted_a_photo, Snackbar.LENGTH_LONG);
        if (pagerFragment.getPaths().size() <= 1) {
            // show confirm dialog
            new AlertDialog.Builder(this).setTitle(R.string.__picker_confirm_to_delete).setPositiveButton(R.string.__picker_yes, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.dismiss();
                    pagerFragment.getPaths().remove(index);
                    pagerFragment.getViewPager().getAdapter().notifyDataSetChanged();
                    onBackPressed();
                }
            }).setNegativeButton(R.string.__picker_cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.dismiss();
                }
            }).show();
        } else {
            snackbar.show();
            pagerFragment.getPaths().remove(index);
            pagerFragment.getViewPager().getAdapter().notifyDataSetChanged();
        }
        snackbar.setAction(R.string.__picker_undo, new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                if (pagerFragment.getPaths().size() > 0) {
                    pagerFragment.getPaths().add(index, deletedPath);
                } else {
                    pagerFragment.getPaths().add(deletedPath);
                }
                pagerFragment.getViewPager().getAdapter().notifyDataSetChanged();
                pagerFragment.getViewPager().setCurrentItem(index, true);
            }
        });
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : DialogInterface(android.content.DialogInterface) View(android.view.View) Snackbar(android.support.design.widget.Snackbar)

Example 55 with Snackbar

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

the class ExpandableDraggableSwipeableExampleActivity method onChildItemRemoved.

/**
     * This method will be called when a child item is removed
     *
     * @param groupPosition The group position of the child item within data set
     * @param childPosition The position of the child item within the group
     */
public void onChildItemRemoved(int groupPosition, int childPosition) {
    Snackbar snackbar = Snackbar.make(findViewById(R.id.container), R.string.snack_bar_text_child_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 : RecyclerView(android.support.v7.widget.RecyclerView) 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