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);
}
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();
}
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();
}
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);
}
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();
}
Aggregations