本文整理匯總了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();
}