当前位置: 首页>>代码示例>>Java>>正文


Java Snackbar.Callback方法代码示例

本文整理汇总了Java中android.support.design.widget.Snackbar.Callback方法的典型用法代码示例。如果您正苦于以下问题:Java Snackbar.Callback方法的具体用法?Java Snackbar.Callback怎么用?Java Snackbar.Callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.design.widget.Snackbar的用法示例。


在下文中一共展示了Snackbar.Callback方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemDismiss

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onItemDismiss(final int position) {
    final Teacher teacher = getItem(position);
    if (teacher == null) return;
    removeFromAdapter(position);

    int resourStr = R.string.teacher_deleted;

    Snackbar.Callback SCallback = new Snackbar.Callback() {
        @Override
        public void onDismissed(Snackbar transientBottomBar, int event) {
            if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT || event == Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE
                    || event == Snackbar.Callback.DISMISS_EVENT_SWIPE || event == Snackbar.Callback.DISMISS_EVENT_MANUAL) {
                deleteFromDB(teacher);
            } else if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) {
                undoRemoveFromAdapter(position, teacher);
            }
        }
    };
    FunctionHelper.makeLSnackbar(((TeacherListActivity) mContext).getCoordinatorLayout(), resourStr, SCallback, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:26,代码来源:TeacherAdapter.java

示例2: onItemDismiss

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onItemDismiss(final int position) {
    final Location location = getItem(position);
    if (location == null) return;
    removeFromAdapter(position);

    int resourStr = R.string.location_deleted;

    Snackbar.Callback SCallback = new Snackbar.Callback() {
        @Override
        public void onDismissed(Snackbar transientBottomBar, int event) {
            if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT || event == Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE
                    || event == Snackbar.Callback.DISMISS_EVENT_SWIPE || event == Snackbar.Callback.DISMISS_EVENT_MANUAL) {
                deleteFromDB(location);
            } else if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) {
                undoRemoveFromAdapter(position, location);
            }
        }
    };
    FunctionHelper.makeLSnackbar(((LocationListActivity) mContext).getCoordinatorLayout(), resourStr, SCallback, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:26,代码来源:LocationAdapter.java

示例3: onItemDismiss

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onItemDismiss(final int position) {
    final DayLesson dayLesson = getItem(position);
    if (dayLesson == null) return;
    removeFromAdapter(position);

    int resourStr = R.string.day_lesson_deleted;

    Snackbar.Callback SCallback = new Snackbar.Callback() {
        @Override
        public void onDismissed(Snackbar transientBottomBar, int event) {
            if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT || event == Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE
                    || event == Snackbar.Callback.DISMISS_EVENT_SWIPE || event == Snackbar.Callback.DISMISS_EVENT_MANUAL) {
                deleteFromDB(dayLesson);
            } else if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) {
                undoRemoveFromAdapter(position, dayLesson);
            }
        }
    };
    FunctionHelper.makeLSnackbar(((WeekLessonDetailActivity) mContext).getCoordinatorLayout(), resourStr, SCallback, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:26,代码来源:DayLessonAdapter.java

示例4: onItemDismiss

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onItemDismiss(final int position) {
    final DayLesson dayLesson = getItem(position);
    if (dayLesson == null) return;
    removeFromAdapter(position);

    int resourStr = R.string.cancel_deleted;

    Snackbar.Callback SCallback = new Snackbar.Callback() {
        @Override
        public void onDismissed(Snackbar transientBottomBar, int event) {
            if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT || event == Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE
                    || event == Snackbar.Callback.DISMISS_EVENT_SWIPE || event == Snackbar.Callback.DISMISS_EVENT_MANUAL) {
                deleteFromDB(dayLesson);
            } else if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) {
                undoRemoveFromAdapter(position, dayLesson);
            }
        }
    };
    FunctionHelper.makeLSnackbar(((CancelListActivity) mContext).getCoordinatorLayout(), resourStr, SCallback, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:26,代码来源:CancelAdapter.java

示例5: setCallback

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
/**
 * Set a callback to be called when this the visibility of this {@link Snackbar} changes.
 */
@NonNull
public SnackBar setCallback(Snackbar.Callback callback) {
    this.snackbar.setCallback(callback);

    return this;
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:10,代码来源:SnackBar.java

示例6: onItemDismiss

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onItemDismiss(final int position) {
    final Object o = getItem(position);
    if (o == null) return;
    removeFromAdapter(position);

    int resourStr;
    if (o instanceof Subject) {
        resourStr = R.string.subject_deleted;
    } else {
        resourStr = R.string.week_lesson_deleted;
    }
    Snackbar.Callback SCallback = new Snackbar.Callback() {
        @Override
        public void onDismissed(Snackbar transientBottomBar, int event) {
            if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT || event == Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE
                    || event == Snackbar.Callback.DISMISS_EVENT_SWIPE || event == Snackbar.Callback.DISMISS_EVENT_MANUAL) {
                deleteFromDB(o);
            } else if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) {
                undoRemoveFromAdapter(position, o);
            }
        }
    };

    FunctionHelper.makeLSnackbar(((SubjectListActivity) mContext).getCoordinatorLayout(), resourStr, SCallback, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:31,代码来源:SubjectAdapter.java

示例7: onItemDismiss

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
@Override
public void onItemDismiss(final int position) {
    final Object o = getItem(position);
    if (o == null) return;
    removeFromAdapter(position);

    int resourStr;
    if (o instanceof WeekLessonDialogItem) {
        resourStr = R.string.week_lesson_deleted;
    } else {
        resourStr = R.string.day_lesson_deleted;
    }
    Snackbar.Callback SCallback = new Snackbar.Callback() {
        @Override
        public void onDismissed(Snackbar transientBottomBar, int event) {
            if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT || event == Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE
                    || event == Snackbar.Callback.DISMISS_EVENT_SWIPE || event == Snackbar.Callback.DISMISS_EVENT_MANUAL) {
                deleteFromDB(o);
            } else if (event == Snackbar.Callback.DISMISS_EVENT_ACTION) {
                undoRemoveFromAdapter(position, o);
            }
        }
    };
    FunctionHelper.makeLSnackbar(((AddEditDetailSubjectActivity) mContext).getCoordinatorLayout(), resourStr, SCallback, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
        }
    });
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:30,代码来源:WeekLessonDiaLogItemAdapter.java

示例8: showSnackBar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
public Snackbar showSnackBar(View contentView, String string, String action, View.OnClickListener clickListener, Snackbar
        .Callback callback) {
    Snackbar snackbar = Snackbar.make(contentView, string, Snackbar.LENGTH_INDEFINITE)
            .setAction(action, clickListener).setCallback(callback);
    snackbar.show();
    return snackbar;
}
 
开发者ID:chenzj-king,项目名称:RetrofitSample,代码行数:8,代码来源:BaseCompatActivity.java

示例9: makeLSnackbar

import android.support.design.widget.Snackbar; //导入方法依赖的package包/类
public static void makeLSnackbar(View view, int resourStr, Snackbar.Callback callback, View.OnClickListener actionClick) {
    Snackbar.make(view, resourStr, Snackbar.LENGTH_LONG)
            .addCallback(callback)
            .setAction(R.string.undo, actionClick).show();
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:6,代码来源:FunctionHelper.java


注:本文中的android.support.design.widget.Snackbar.Callback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。