當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。