本文整理汇总了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) {
}
});
}
示例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) {
}
});
}
示例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) {
}
});
}
示例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) {
}
});
}
示例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;
}
示例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) {
}
});
}
示例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) {
}
});
}
示例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;
}
示例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();
}