Search in sources :

Example 1 with ActionClickListener

use of com.nispok.snackbar.listeners.ActionClickListener in project CoCoin by Nightonke.

the class ReportViewFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    IS_EMPTY = RecordManager.getInstance(CoCoinApplication.getAppContext()).RECORDS.isEmpty();
    mScrollView = (ObservableScrollView) view.findViewById(R.id.scrollView);
    MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView, null);
    expenseTV = (TextView) view.findViewById(R.id.expense);
    expenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    expenseTV.setText(CoCoinUtil.GetInMoney(0));
    tagsTV = (TextView) view.findViewById(R.id.tags);
    tagsTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    tagsTV.setText("");
    title = (TextView) view.findViewById(R.id.title);
    title.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    pieLayout = (LinearLayout) view.findViewById(R.id.pie_layout);
    pieLayout.setVisibility(View.GONE);
    pieTitle = (TextView) view.findViewById(R.id.pie_title);
    pieTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    pie = (PieChartView) view.findViewById(R.id.chart_pie);
    pie.setChartRotationEnabled(false);
    pie.setOnValueTouchListener(new PieChartOnValueSelectListener() {

        @Override
        public void onValueSelected(int p, SliceValue sliceValue) {
            // snack bar
            String text;
            tagId = Integer.valueOf(String.valueOf(sliceValue.getLabelAsChars()));
            double percent = sliceValue.getValue() / expense * 100;
            if ("zh".equals(CoCoinUtil.GetLanguage())) {
                text = CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + CoCoinUtil.GetPercentString(percent) + "\n" + "于" + CoCoinUtil.GetTagName(tagId);
            } else {
                text = CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + " (takes " + String.format("%.2f", percent) + "%)\n" + "in " + CoCoinUtil.GetTagName(tagId);
            }
            if ("zh".equals(CoCoinUtil.GetLanguage())) {
                if (selectYear) {
                    dialogTitle = from.get(Calendar.YEAR) + "年" + "\n" + CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + "于" + CoCoinUtil.GetTagName(tagId);
                } else {
                    dialogTitle = from.get(Calendar.YEAR) + "年" + (from.get(Calendar.MONTH) + 1) + "月" + "\n" + CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + "于" + CoCoinUtil.GetTagName(tagId);
                }
            } else {
                if (selectYear) {
                    dialogTitle = CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + " in " + from.get(Calendar.YEAR) + "\n" + "on " + CoCoinUtil.GetTagName(tagId);
                } else {
                    dialogTitle = CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + " in " + CoCoinUtil.GetMonthShort(from.get(Calendar.MONTH) + 1) + " " + from.get(Calendar.YEAR) + "\n" + "on " + CoCoinUtil.GetTagName(tagId);
                }
            }
            Snackbar snackbar = Snackbar.with(mContext).type(SnackbarType.MULTI_LINE).duration(Snackbar.SnackbarDuration.LENGTH_SHORT).position(Snackbar.SnackbarPosition.BOTTOM).margin(15, 15).backgroundDrawable(CoCoinUtil.GetSnackBarBackground(-3)).text(text).textTypeface(CoCoinUtil.GetTypeface()).textColor(Color.WHITE).actionLabelTypeface(CoCoinUtil.GetTypeface()).actionLabel(mContext.getResources().getString(R.string.check)).actionColor(Color.WHITE).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    new GetData(from, to, tagId, dialogTitle).execute();
                }
            });
            SnackbarManager.show(snackbar);
            if (p == lastPieSelectedPosition) {
                return;
            } else {
                lastPieSelectedPosition = p;
            }
        }

        @Override
        public void onValueDeselected() {
        }
    });
    iconRight = (MaterialIconView) view.findViewById(R.id.icon_right);
    iconRight.setOnClickListener(this);
    iconLeft = (MaterialIconView) view.findViewById(R.id.icon_left);
    iconLeft.setOnClickListener(this);
    emptyTip = (TextView) view.findViewById(R.id.empty_tip);
    emptyTip.setTypeface(CoCoinUtil.GetTypeface());
    if (RecordManager.getInstance(CoCoinApplication.getAppContext()).RECORDS.size() != 0) {
        emptyTip.setText(mContext.getResources().getString(R.string.report_view_please_select_data));
    } else {
        emptyTip.setText(mContext.getResources().getString(R.string.report_view_no_data));
        isEmpty = true;
    }
    highestTagLayout = (LinearLayout) view.findViewById(R.id.highest_tag_layout);
    highestTagLayout.setVisibility(View.GONE);
    highestTagTitle = (TextView) view.findViewById(R.id.highest_tag_title);
    highestTagTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestFirst = (LinearLayout) view.findViewById(R.id.highest_first);
    highestFirst.setOnClickListener(this);
    highestTagIcon = (ImageView) view.findViewById(R.id.highest_tag_icon);
    highestTagText = (TextView) view.findViewById(R.id.highest_tag_text);
    highestTagText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestTagExpenseTV = (TextView) view.findViewById(R.id.highest_tag_expense);
    highestTagExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestTagRecord = (TextView) view.findViewById(R.id.highest_tag_sum);
    highestTagRecord.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestTags = (ExpandedListView) view.findViewById(R.id.highest_tags);
    highestTagsLayout = (ExpandableRelativeLayout) view.findViewById(R.id.expand_highest_tag);
    highestTagMore = (LinearLayout) view.findViewById(R.id.highest_tag_more);
    highestTagMore.setOnClickListener(this);
    highestTagMoreText = (TextView) view.findViewById(R.id.highest_tag_more_text);
    highestTagMoreText.setTypeface(CoCoinUtil.getInstance().GetTypeface());
    highestTags.setOnItemClickListener(this);
    lowestTagLayout = (LinearLayout) view.findViewById(R.id.lowest_tag_layout);
    lowestTagLayout.setVisibility(View.GONE);
    lowestTagTitle = (TextView) view.findViewById(R.id.lowest_tag_title);
    lowestTagTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestFirst = (LinearLayout) view.findViewById(R.id.lowest_first);
    lowestFirst.setOnClickListener(this);
    lowestTagIcon = (ImageView) view.findViewById(R.id.lowest_tag_icon);
    lowestTagText = (TextView) view.findViewById(R.id.lowest_tag_text);
    lowestTagText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestTagExpenseTV = (TextView) view.findViewById(R.id.lowest_tag_expense);
    lowestTagExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestTagRecord = (TextView) view.findViewById(R.id.lowest_tag_sum);
    lowestTagRecord.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestTags = (ExpandedListView) view.findViewById(R.id.lowest_tags);
    lowestTagsLayout = (ExpandableRelativeLayout) view.findViewById(R.id.expand_lowest_tag);
    lowestTagMore = (LinearLayout) view.findViewById(R.id.lowest_tag_more);
    lowestTagMore.setOnClickListener(this);
    lowestTagMoreText = (TextView) view.findViewById(R.id.lowest_tag_more_text);
    lowestTagMoreText.setTypeface(CoCoinUtil.getInstance().GetTypeface());
    lowestTags.setOnItemClickListener(this);
    lineLayout = (LinearLayout) view.findViewById(R.id.line_layout);
    lineLayout.setVisibility(View.GONE);
    lineTitle = (TextView) view.findViewById(R.id.line_title);
    lineTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    line = (LineChartView) view.findViewById(R.id.chart_line);
    line.setZoomEnabled(false);
    line.setOnValueTouchListener(new LineChartOnValueSelectListener() {

        @Override
        public void onValueSelected(int lineIndex, int pointIndex, PointValue value) {
            // snack bar
            String text;
            double percent = value.getY() / expense * 100;
            if ("zh".equals(CoCoinUtil.GetLanguage())) {
                if (selectYear) {
                    text = "在" + reportYear + " " + CoCoinUtil.getInstance().GetMonthShort((int) value.getX() + 1) + "\n" + CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent);
                } else {
                    text = "在" + CoCoinUtil.getInstance().GetMonthShort(reportMonth) + " " + ((int) value.getX() + 1) + CoCoinUtil.getInstance().GetWhetherFuck() + "\n" + CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent);
                }
            } else {
                if (selectYear) {
                    text = CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent) + "\n" + "in " + reportYear + " " + CoCoinUtil.getInstance().GetMonthShort((int) value.getX() + 1);
                } else {
                    text = CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent) + "\n" + "on " + CoCoinUtil.getInstance().GetMonthShort(reportMonth) + " " + ((int) value.getX() + 1) + CoCoinUtil.getInstance().GetWhetherFuck();
                }
            }
            if ("zh".equals(CoCoinUtil.GetLanguage())) {
                if (selectYear) {
                    dialogTitle = "在" + reportYear + " " + CoCoinUtil.getInstance().GetMonthShort((int) value.getX() + 1) + "\n" + CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent);
                } else {
                    dialogTitle = "在" + CoCoinUtil.getInstance().GetMonthShort(reportMonth) + " " + ((int) value.getX() + 1) + CoCoinUtil.getInstance().GetWhetherFuck() + "\n" + CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent);
                }
            } else {
                if (selectYear) {
                    dialogTitle = CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent) + "\n" + "in " + reportYear + " " + CoCoinUtil.getInstance().GetMonthShort((int) value.getX() + 1);
                } else {
                    dialogTitle = CoCoinUtil.GetSpendString((int) value.getY()) + CoCoinUtil.GetPercentString(percent) + "\n" + "on " + CoCoinUtil.getInstance().GetMonthShort(reportMonth) + " " + ((int) value.getX() + 1) + CoCoinUtil.getInstance().GetWhetherFuck();
                }
            }
            final Calendar tempFrom = Calendar.getInstance();
            final Calendar tempTo = Calendar.getInstance();
            if (selectYear) {
                tempFrom.set(reportYear, (int) value.getX(), 1, 0, 0, 0);
                tempFrom.add(Calendar.SECOND, 0);
                tempTo.set(reportYear, (int) value.getX(), tempFrom.getActualMaximum(Calendar.DAY_OF_MONTH), 23, 59, 59);
                tempTo.add(Calendar.SECOND, 0);
            } else {
                tempFrom.set(reportYear, reportMonth - 1, (int) value.getX() + 1, 0, 0, 0);
                tempFrom.add(Calendar.SECOND, 0);
                tempTo.set(reportYear, reportMonth - 1, (int) value.getX() + 1, 23, 59, 59);
                tempTo.add(Calendar.SECOND, 0);
            }
            Snackbar snackbar = Snackbar.with(mContext).type(SnackbarType.MULTI_LINE).duration(Snackbar.SnackbarDuration.LENGTH_SHORT).position(Snackbar.SnackbarPosition.BOTTOM).margin(15, 15).backgroundDrawable(CoCoinUtil.GetSnackBarBackground(-3)).text(text).textTypeface(CoCoinUtil.GetTypeface()).textColor(Color.WHITE).actionLabelTypeface(CoCoinUtil.GetTypeface()).actionLabel(mContext.getResources().getString(R.string.check)).actionColor(Color.WHITE).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    new GetData(tempFrom, tempTo, Integer.MIN_VALUE, dialogTitle).execute();
                }
            });
            SnackbarManager.show(snackbar);
            if (pointIndex == lastLineSelectedPosition) {
                return;
            } else {
                lastLineSelectedPosition = pointIndex;
            }
        }

        @Override
        public void onValueDeselected() {
        }
    });
    iconRightLine = (MaterialIconView) view.findViewById(R.id.icon_right_line);
    iconRightLine.setOnClickListener(this);
    iconLeftLine = (MaterialIconView) view.findViewById(R.id.icon_left_line);
    iconLeftLine.setOnClickListener(this);
    highestMonthLayout = (LinearLayout) view.findViewById(R.id.highest_month_layout);
    highestMonthLayout.setVisibility(View.GONE);
    monthTitle = (TextView) view.findViewById(R.id.month_title);
    monthTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestFirstMonth = (LinearLayout) view.findViewById(R.id.highest_first_month);
    highestFirstMonth.setOnClickListener(this);
    highestFirstIcon = (TextView) view.findViewById(R.id.highest_month_icon);
    highestFirstIcon.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestFirstText = (TextView) view.findViewById(R.id.highest_month_text);
    highestFirstText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestFirstExpenseTV = (TextView) view.findViewById(R.id.highest_month_expense);
    highestFirstExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestFirstRecord = (TextView) view.findViewById(R.id.highest_month_sum);
    highestFirstRecord.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestMonths = (ExpandedListView) view.findViewById(R.id.highest_month);
    highestMonths.setOnItemClickListener(this);
    highestMonthsLayout = (ExpandableRelativeLayout) view.findViewById(R.id.expand_highest_month);
    highestLast = (LinearLayout) view.findViewById(R.id.highest_last_month);
    highestLast.setOnClickListener(this);
    highestLastIcon = (TextView) view.findViewById(R.id.lowest_month_icon);
    highestLastIcon.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestLastText = (TextView) view.findViewById(R.id.lowest_month_text);
    highestLastText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestLastExpenseTV = (TextView) view.findViewById(R.id.lowest_month_expense);
    highestLastExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestLastRecord = (TextView) view.findViewById(R.id.lowest_month_sum);
    highestLastRecord.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestMonthMore = (LinearLayout) view.findViewById(R.id.highest_month_more);
    highestMonthMore.setOnClickListener(this);
    highestMonthMoreText = (TextView) view.findViewById(R.id.highest_month_more_text);
    highestMonthMoreText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    averageMonthText = (TextView) view.findViewById(R.id.average_month_text);
    averageMonthText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    averageMonthExpenseTV = (TextView) view.findViewById(R.id.average_month_expense);
    averageMonthExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    averageMonthRecordTV = (TextView) view.findViewById(R.id.average_month_sum);
    averageMonthRecordTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestDayLayout = (LinearLayout) view.findViewById(R.id.highest_day_layout);
    highestDayLayout.setVisibility(View.GONE);
    highestDayTitle = (TextView) view.findViewById(R.id.highest_day_title);
    highestDayTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestFirstDay = (LinearLayout) view.findViewById(R.id.highest_first_day);
    highestFirstDay.setOnClickListener(this);
    highestDayIcon = (TextView) view.findViewById(R.id.highest_day_icon);
    highestDayIcon.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestDayText = (TextView) view.findViewById(R.id.highest_day_text);
    highestDayText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestDayExpenseTV = (TextView) view.findViewById(R.id.highest_day_expense);
    highestDayExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestDayRecord = (TextView) view.findViewById(R.id.highest_day_sum);
    highestDayRecord.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    highestDays = (ExpandedListView) view.findViewById(R.id.highest_days);
    highestDaysLayout = (ExpandableRelativeLayout) view.findViewById(R.id.expand_highest_day);
    highestDayMore = (LinearLayout) view.findViewById(R.id.highest_day_more);
    highestDayMore.setOnClickListener(this);
    highestDayMoreText = (TextView) view.findViewById(R.id.highest_day_more_text);
    highestDayMoreText.setTypeface(CoCoinUtil.getInstance().GetTypeface());
    highestDays.setOnItemClickListener(this);
    lowestDayLayout = (LinearLayout) view.findViewById(R.id.lowest_day_layout);
    lowestDayLayout.setVisibility(View.GONE);
    lowestDayTitle = (TextView) view.findViewById(R.id.lowest_day_title);
    lowestDayTitle.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestFirstDay = (LinearLayout) view.findViewById(R.id.lowest_first_day);
    lowestFirstDay.setOnClickListener(this);
    lowestDayIcon = (TextView) view.findViewById(R.id.lowest_day_icon);
    lowestDayIcon.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestDayText = (TextView) view.findViewById(R.id.lowest_day_text);
    lowestDayText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestDayExpenseTV = (TextView) view.findViewById(R.id.lowest_day_expense);
    lowestDayExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestDayRecord = (TextView) view.findViewById(R.id.lowest_day_sum);
    lowestDayRecord.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    lowestDays = (ExpandedListView) view.findViewById(R.id.lowest_days);
    lowestDaysLayout = (ExpandableRelativeLayout) view.findViewById(R.id.expand_lowest_day);
    lowestDayMore = (LinearLayout) view.findViewById(R.id.lowest_day_more);
    lowestDayMore.setOnClickListener(this);
    lowestDayMoreText = (TextView) view.findViewById(R.id.lowest_day_more_text);
    lowestDayMoreText.setTypeface(CoCoinUtil.getInstance().GetTypeface());
    lowestDays.setOnItemClickListener(this);
    averageDayText = (TextView) view.findViewById(R.id.average_day_text);
    averageDayText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    averageDayExpenseTV = (TextView) view.findViewById(R.id.average_day_expense);
    averageDayExpenseTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    averageDayRecordTV = (TextView) view.findViewById(R.id.average_day_sum);
    averageDayRecordTV.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    foot = (TextView) view.findViewById(R.id.foot);
    foot.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    foot.setVisibility(View.GONE);
    if (IS_EMPTY) {
        emptyTip.setVisibility(View.GONE);
    }
    button = (FloatingActionButton) view.findViewById(R.id.button);
    button.setOnClickListener(this);
    new GetSelectListData(false).execute();
}
Also used : PieChartOnValueSelectListener(lecho.lib.hellocharts.listener.PieChartOnValueSelectListener) PointValue(lecho.lib.hellocharts.model.PointValue) Calendar(java.util.Calendar) SliceValue(lecho.lib.hellocharts.model.SliceValue) ActionClickListener(com.nispok.snackbar.listeners.ActionClickListener) Snackbar(com.nispok.snackbar.Snackbar) LineChartOnValueSelectListener(lecho.lib.hellocharts.listener.LineChartOnValueSelectListener)

Example 2 with ActionClickListener

use of com.nispok.snackbar.listeners.ActionClickListener in project sharelock-android by auth0.

the class ComposeActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    final int entryCount = getSupportFragmentManager().getBackStackEntryCount();
    final ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    if (entryCount == 0 && clipboardManager.hasPrimaryClip() && clipboardManager.getPrimaryClip().getItemCount() > 0) {
        final ClipData primaryClip = clipboardManager.getPrimaryClip();
        final ClipData.Item item = primaryClip.getItemAt(0);
        final String text = item.coerceToText(this).toString();
        if (text.trim().length() > 0) {
            final Snackbar snackbar = Snackbar.with(this).text(getString(R.string.paste_from_clipboard_prompt)).actionLabel(getString(R.string.paste_clipboard_action)).actionColorResource(R.color.sharelock_orange).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    bus.postSticky(new ClipboardSecretEvent(text));
                    clipboardManager.setPrimaryClip(ClipData.newPlainText("", ""));
                }
            }).duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE);
            SnackbarManager.show(snackbar);
        }
    }
}
Also used : ClipboardManager(android.content.ClipboardManager) ClipData(android.content.ClipData) ActionClickListener(com.nispok.snackbar.listeners.ActionClickListener) Snackbar(com.nispok.snackbar.Snackbar) ClipboardSecretEvent(com.auth0.sharelock.event.ClipboardSecretEvent)

Example 3 with ActionClickListener

use of com.nispok.snackbar.listeners.ActionClickListener in project UltimateAndroid by cymcsg.

the class SnackbarSampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.snack_bar_activity_sample);
    Button singleLineButton = (Button) findViewById(R.id.single_line);
    singleLineButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Single-line snackbar"));
        }
    });
    Button singleLineWithActionButton = (Button) findViewById(R.id.single_line_with_action);
    singleLineWithActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Something has been done").actionLabel("Undo").swipeListener(new ActionSwipeListener() {

                @Override
                public void onSwipeToDismiss() {
                    Toast.makeText(SnackbarSampleActivity.this, "swipe to dismiss", Toast.LENGTH_SHORT).show();
                }
            }).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    Toast.makeText(SnackbarSampleActivity.this, "Action undone", Toast.LENGTH_SHORT).show();
                }
            }));
        }
    });
    Button multiLineButton = (Button) findViewById(R.id.multi_line);
    multiLineButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).type(SnackbarType.MULTI_LINE).text("This is a multi-line snackbar. Keep in mind that snackbars" + " are meant for VERY short messages"));
        }
    });
    Button multiLineWithActionButton = (Button) findViewById(R.id.multi_line_with_action);
    multiLineWithActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).type(SnackbarType.MULTI_LINE).text("This is a multi-line snackbar with an action button. Note " + "that multi-line snackbars are 2 lines max").actionLabel("Action").actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    Toast.makeText(SnackbarSampleActivity.this, "Action clicked", Toast.LENGTH_SHORT).show();
                }
            }));
        }
    });
    Button noAnimationButton = (Button) findViewById(R.id.no_animation);
    noAnimationButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("No animation :(").animation(false).duration(2500l));
        }
    });
    Button eventListenerButton = (Button) findViewById(R.id.event_listener);
    eventListenerButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("I'm showing a toast on exit").eventListener(new EventListener() {

                @Override
                public void onShow(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will show. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onShowByReplace(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will show by replace. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onShown(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar shown. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onDismiss(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will dismiss. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onDismissByReplace(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will dismiss by replace. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onDismissed(Snackbar snackbar) {
                    Toast.makeText(SnackbarSampleActivity.this, String.format("Snackbar dismissed. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()), Toast.LENGTH_SHORT).show();
                }
            }));
        }
    });
    Button customColorsButton = (Button) findViewById(R.id.custom_colors);
    customColorsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Different colors!!!").textColor(Color.parseColor("#ff9d9d9c")).color(Color.parseColor("#ff914300")).actionLabel("Action").actionColor(Color.parseColor("#ff5a2900")).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    Log.i(TAG, "Action touched");
                }
            }).duration(Snackbar.SnackbarDuration.LENGTH_SHORT));
        }
    });
    Button unswipeableButton = (Button) findViewById(R.id.unswipeable);
    unswipeableButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Try to swipe me off from the screen").swipeToDismiss(false));
        }
    });
    Button indefiniteButton = (Button) findViewById(R.id.indefinite);
    indefiniteButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).type(SnackbarType.MULTI_LINE).duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE).text("Indefinite duration, ideal for communicating errors"));
        }
    });
    Button listSampleButton = (Button) findViewById(R.id.list_example);
    listSampleButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarListViewSampleActivity.class);
            startActivity(sampleIntent);
        }
    });
    Button recyclerSampleButton = (Button) findViewById(R.id.recycler_example);
    recyclerSampleButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarRecyclerViewSampleActivity.class);
            startActivity(sampleIntent);
        }
    });
    Button customTypefaceButton = (Button) findViewById(R.id.typeface_example);
    customTypefaceButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Roboto-LightItalic.ttf");
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Custom font!").textTypeface(tf).actionLabel("Cool").actionLabelTypeface(tf));
        }
    });
    Button navigationBarTranslucentButton = (Button) findViewById(R.id.navigation_bar_translucent);
    navigationBarTranslucentButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SnackbarNavigationBarTranslucentSampleActivity.isTranslucentSystemBarsCapable()) {
                Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarNavigationBarTranslucentSampleActivity.class);
                startActivity(sampleIntent);
            } else {
                Toast.makeText(SnackbarSampleActivity.this, "Translucent System bars only available for KITKAT or newer", Toast.LENGTH_SHORT).show();
            }
        }
    });
    Button immersiveModeButton = (Button) findViewById(R.id.immersive_mode_example);
    immersiveModeButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SnackbarImmersiveModeSampleActivity.isImmersiveModeCapable()) {
                Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarImmersiveModeSampleActivity.class);
                startActivity(sampleIntent);
            } else {
                Toast.makeText(SnackbarSampleActivity.this, "Immersive mode only available for KITKAT or newer", Toast.LENGTH_SHORT).show();
            }
        }
    });
    Button showInDialogButton = (Button) findViewById(R.id.show_in_dialog_example);
    showInDialogButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarShowInDialogSampleActivity.class);
            startActivity(sampleIntent);
        }
    });
    Button singleLineMarginsButton = (Button) findViewById(R.id.single_line_margins);
    singleLineMarginsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).margin(25).text("Single-line Margins"));
        }
    });
    Button singleLineTopButton = (Button) findViewById(R.id.single_line_top);
    singleLineTopButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).position(Snackbar.SnackbarPosition.TOP).text("Single-line Top"));
        }
    });
    Button singleLineButtonInside = (Button) findViewById(R.id.single_line_inside);
    singleLineButtonInside.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Single-line Inside RelativeLayout"), (android.view.ViewGroup) findViewById(R.id.view_relative_layout));
        }
    });
    Button singleLineTopButtonInside = (Button) findViewById(R.id.single_line_top_inside);
    singleLineTopButtonInside.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).position(Snackbar.SnackbarPosition.TOP).margin(25, 15).text("Single-line TOP Inside LinearLayout"), (android.view.ViewGroup) findViewById(R.id.view_linear_layout));
        }
    });
    Button singleLineButtonCustomShape = (Button) findViewById(R.id.single_line_shape);
    singleLineButtonCustomShape.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).position(Snackbar.SnackbarPosition.TOP).margin(15, 15).backgroundDrawable(R.drawable.snack_bar_custom_shape).text("Single-line Custom Shape"));
        }
    });
}
Also used : Typeface(android.graphics.Typeface) ActionSwipeListener(com.nispok.snackbar.listeners.ActionSwipeListener) Intent(android.content.Intent) View(android.view.View) ActionClickListener(com.nispok.snackbar.listeners.ActionClickListener) Button(android.widget.Button) EventListener(com.nispok.snackbar.listeners.EventListener) Snackbar(com.nispok.snackbar.Snackbar)

Example 4 with ActionClickListener

use of com.nispok.snackbar.listeners.ActionClickListener in project snackbar by nispok.

the class SnackbarSampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);
    Button singleLineButton = (Button) findViewById(R.id.single_line);
    singleLineButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Single-line snackbar"));
        }
    });
    Button singleLineWithActionButton = (Button) findViewById(R.id.single_line_with_action);
    singleLineWithActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Something has been done").actionLabel("Undo").swipeListener(new ActionSwipeListener() {

                @Override
                public void onSwipeToDismiss() {
                    Toast.makeText(SnackbarSampleActivity.this, "swipe to dismiss", Toast.LENGTH_SHORT).show();
                }
            }).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    Toast.makeText(SnackbarSampleActivity.this, "Action undone", Toast.LENGTH_SHORT).show();
                }
            }));
        }
    });
    Button multiLineButton = (Button) findViewById(R.id.multi_line);
    multiLineButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).type(SnackbarType.MULTI_LINE).text("This is a multi-line snackbar. Keep in mind that snackbars" + " are meant for VERY short messages"));
        }
    });
    Button multiLineWithActionButton = (Button) findViewById(R.id.multi_line_with_action);
    multiLineWithActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).type(SnackbarType.MULTI_LINE).text("This is a multi-line snackbar with an action button. Note " + "that multi-line snackbars are 2 lines max").actionLabel("Action").actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    Toast.makeText(SnackbarSampleActivity.this, "Action clicked", Toast.LENGTH_SHORT).show();
                }
            }));
        }
    });
    Button noAnimationButton = (Button) findViewById(R.id.no_animation);
    noAnimationButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("No animation :(").animation(false).duration(2500l));
        }
    });
    Button eventListenerButton = (Button) findViewById(R.id.event_listener);
    eventListenerButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("I'm showing a toast on exit").eventListener(new EventListener() {

                @Override
                public void onShow(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will show. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onShowByReplace(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will show by replace. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onShown(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar shown. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onDismiss(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will dismiss. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onDismissByReplace(Snackbar snackbar) {
                    Log.i(TAG, String.format("Snackbar will dismiss by replace. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()));
                }

                @Override
                public void onDismissed(Snackbar snackbar) {
                    Toast.makeText(SnackbarSampleActivity.this, String.format("Snackbar dismissed. Width: %d Height: %d Offset: %d", snackbar.getWidth(), snackbar.getHeight(), snackbar.getOffset()), Toast.LENGTH_SHORT).show();
                }
            }));
        }
    });
    Button customColorsButton = (Button) findViewById(R.id.custom_colors);
    customColorsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Different colors!!!").textColor(Color.parseColor("#ff9d9d9c")).color(Color.parseColor("#ff914300")).actionLabel("Action").actionColor(Color.parseColor("#ff5a2900")).actionListener(new ActionClickListener() {

                @Override
                public void onActionClicked(Snackbar snackbar) {
                    Log.i(TAG, "Action touched");
                }
            }).duration(Snackbar.SnackbarDuration.LENGTH_SHORT));
        }
    });
    Button unswipeableButton = (Button) findViewById(R.id.unswipeable);
    unswipeableButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Try to swipe me off from the screen").swipeToDismiss(false));
        }
    });
    Button indefiniteButton = (Button) findViewById(R.id.indefinite);
    indefiniteButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).type(SnackbarType.MULTI_LINE).duration(Snackbar.SnackbarDuration.LENGTH_INDEFINITE).text("Indefinite duration, ideal for communicating errors"));
        }
    });
    Button listSampleButton = (Button) findViewById(R.id.list_example);
    listSampleButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarListViewSampleActivity.class);
            startActivity(sampleIntent);
        }
    });
    Button recyclerSampleButton = (Button) findViewById(R.id.recycler_example);
    recyclerSampleButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarRecyclerViewSampleActivity.class);
            startActivity(sampleIntent);
        }
    });
    Button customTypefaceButton = (Button) findViewById(R.id.typeface_example);
    customTypefaceButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Roboto-LightItalic.ttf");
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Custom font!").textTypeface(tf).actionLabel("Cool").actionLabelTypeface(tf));
        }
    });
    Button navigationBarTranslucentButton = (Button) findViewById(R.id.navigation_bar_translucent);
    navigationBarTranslucentButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SnackbarNavigationBarTranslucentSampleActivity.isTranslucentSystemBarsCapable()) {
                Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarNavigationBarTranslucentSampleActivity.class);
                startActivity(sampleIntent);
            } else {
                Toast.makeText(SnackbarSampleActivity.this, "Translucent System bars only available for KITKAT or newer", Toast.LENGTH_SHORT).show();
            }
        }
    });
    Button immersiveModeButton = (Button) findViewById(R.id.immersive_mode_example);
    immersiveModeButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SnackbarImmersiveModeSampleActivity.isImmersiveModeCapable()) {
                Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarImmersiveModeSampleActivity.class);
                startActivity(sampleIntent);
            } else {
                Toast.makeText(SnackbarSampleActivity.this, "Immersive mode only available for KITKAT or newer", Toast.LENGTH_SHORT).show();
            }
        }
    });
    Button showInDialogButton = (Button) findViewById(R.id.show_in_dialog_example);
    showInDialogButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent sampleIntent = new Intent(SnackbarSampleActivity.this, SnackbarShowInDialogSampleActivity.class);
            startActivity(sampleIntent);
        }
    });
    Button singleLineMarginsButton = (Button) findViewById(R.id.single_line_margins);
    singleLineMarginsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).margin(25).text("Single-line Margins"));
        }
    });
    Button singleLineTopButton = (Button) findViewById(R.id.single_line_top);
    singleLineTopButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).position(Snackbar.SnackbarPosition.TOP).text("Single-line Top"));
        }
    });
    Button singleLineButtonInside = (Button) findViewById(R.id.single_line_inside);
    singleLineButtonInside.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).text("Single-line Inside RelativeLayout"), (android.view.ViewGroup) findViewById(R.id.view_relative_layout));
        }
    });
    Button singleLineTopButtonInside = (Button) findViewById(R.id.single_line_top_inside);
    singleLineTopButtonInside.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).position(Snackbar.SnackbarPosition.TOP).margin(25, 15).text("Single-line TOP Inside LinearLayout"), (android.view.ViewGroup) findViewById(R.id.view_linear_layout));
        }
    });
    Button singleLineButtonCustomShape = (Button) findViewById(R.id.single_line_shape);
    singleLineButtonCustomShape.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SnackbarManager.show(Snackbar.with(SnackbarSampleActivity.this).position(Snackbar.SnackbarPosition.TOP).margin(15, 15).backgroundDrawable(R.drawable.custom_shape).text("Single-line Custom Shape"));
        }
    });
}
Also used : Typeface(android.graphics.Typeface) ActionSwipeListener(com.nispok.snackbar.listeners.ActionSwipeListener) Intent(android.content.Intent) View(android.view.View) ActionClickListener(com.nispok.snackbar.listeners.ActionClickListener) Button(android.widget.Button) EventListener(com.nispok.snackbar.listeners.EventListener) Snackbar(com.nispok.snackbar.Snackbar)

Example 5 with ActionClickListener

use of com.nispok.snackbar.listeners.ActionClickListener in project CoCoin by Nightonke.

the class AccountBookListViewActivity method activityOnItemRemoved.

private void activityOnItemRemoved(int position) {
    if (RecordManager.SELECTED_RECORDS.size() == 0) {
        emptyTip.setVisibility(View.VISIBLE);
        verticalRecyclerViewFastScroller.setVisibility(View.INVISIBLE);
    }
    lastPosition = RecordManager.SELECTED_RECORDS.size() - position;
    undid = false;
    Snackbar snackbar = Snackbar.with(mContext).type(SnackbarType.MULTI_LINE).duration(Snackbar.SnackbarDuration.LENGTH_SHORT).position(Snackbar.SnackbarPosition.BOTTOM).margin(15, 15).backgroundDrawable(CoCoinUtil.GetSnackBarBackground(-3)).text(mContext.getResources().getString(R.string.deleting)).textTypeface(CoCoinUtil.GetTypeface()).textColor(Color.WHITE).actionLabelTypeface(CoCoinUtil.GetTypeface()).actionLabel(mContext.getResources().getString(R.string.undo)).actionColor(Color.WHITE).actionListener(new ActionClickListener() {

        @Override
        public void onActionClicked(Snackbar snackbar) {
            RecordManager.SELECTED_RECORDS.add(lastPosition, CoCoinUtil.backupCoCoinRecord);
            RecordManager.SELECTED_SUM += CoCoinUtil.backupCoCoinRecord.getMoney();
            changeTitleSlider();
            CoCoinUtil.backupCoCoinRecord = null;
            LinearLayoutManager linearLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
            int firstVisiblePosition = linearLayoutManager.findFirstCompletelyVisibleItemPosition();
            int lastVisiblePosition = linearLayoutManager.findLastCompletelyVisibleItemPosition();
            final int insertPosition = RecordManager.SELECTED_RECORDS.size() - 1 - lastPosition;
            if (firstVisiblePosition < insertPosition && insertPosition <= lastVisiblePosition) {
            } else {
                recyclerView.scrollToPosition(insertPosition);
            }
            mAdapter.notifyItemInserted(insertPosition);
            mAdapter.notifyDataSetChanged();
            if (RecordManager.SELECTED_RECORDS.size() != 0) {
                emptyTip.setVisibility(View.GONE);
                verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
            }
        }
    }).eventListener(new EventListener() {

        @Override
        public void onShow(Snackbar snackbar) {
        }

        @Override
        public void onShowByReplace(Snackbar snackbar) {
        }

        @Override
        public void onShown(Snackbar snackbar) {
        }

        @Override
        public void onDismiss(Snackbar snackbar) {
            if (CoCoinUtil.backupCoCoinRecord != null) {
                RecordManager.deleteRecord(CoCoinUtil.backupCoCoinRecord, true);
            }
            CoCoinUtil.backupCoCoinRecord = null;
        }

        @Override
        public void onDismissByReplace(Snackbar snackbar) {
            if (CoCoinUtil.backupCoCoinRecord != null) {
                RecordManager.deleteRecord(CoCoinUtil.backupCoCoinRecord, true);
            }
            CoCoinUtil.backupCoCoinRecord = null;
        }

        @Override
        public void onDismissed(Snackbar snackbar) {
            if (CoCoinUtil.backupCoCoinRecord != null) {
                RecordManager.deleteRecord(CoCoinUtil.backupCoCoinRecord, true);
            }
            CoCoinUtil.backupCoCoinRecord = null;
        }
    });
    SnackbarManager.show(snackbar);
}
Also used : EventListener(com.nispok.snackbar.listeners.EventListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ActionClickListener(com.nispok.snackbar.listeners.ActionClickListener) Snackbar(com.nispok.snackbar.Snackbar)

Aggregations

Snackbar (com.nispok.snackbar.Snackbar)5 ActionClickListener (com.nispok.snackbar.listeners.ActionClickListener)5 EventListener (com.nispok.snackbar.listeners.EventListener)3 Intent (android.content.Intent)2 Typeface (android.graphics.Typeface)2 View (android.view.View)2 Button (android.widget.Button)2 ActionSwipeListener (com.nispok.snackbar.listeners.ActionSwipeListener)2 ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 ClipboardSecretEvent (com.auth0.sharelock.event.ClipboardSecretEvent)1 Calendar (java.util.Calendar)1 LineChartOnValueSelectListener (lecho.lib.hellocharts.listener.LineChartOnValueSelectListener)1 PieChartOnValueSelectListener (lecho.lib.hellocharts.listener.PieChartOnValueSelectListener)1 PointValue (lecho.lib.hellocharts.model.PointValue)1 SliceValue (lecho.lib.hellocharts.model.SliceValue)1