本文整理汇总了Java中com.justwayward.reader.utils.ToastUtils类的典型用法代码示例。如果您正苦于以下问题:Java ToastUtils类的具体用法?Java ToastUtils怎么用?Java ToastUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ToastUtils类属于com.justwayward.reader.utils包,在下文中一共展示了ToastUtils类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextPage
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
public void nextPage() {
BookStatus status = pagefactory.nextPage();
if (status == BookStatus.NO_NEXT_PAGE) {
ToastUtils.showSingleToast("没有下一页啦");
return;
} else if (status == BookStatus.LOAD_SUCCESS) {
if (isPrepared) {
pagefactory.onDraw(mCurrentPageCanvas);
pagefactory.onDraw(mNextPageCanvas);
postInvalidate();
}
} else {
return;
}
}
示例2: addCollection
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
public void addCollection(BookLists.BookListsBean bean) {
List<BookLists.BookListsBean> list = getCollectionList();
if (list == null) {
list = new ArrayList<>();
}
for (BookLists.BookListsBean data : list) {
if (data != null) {
if (TextUtils.equals(data._id, bean._id)) {
ToastUtils.showToast("已经收藏过啦");
return;
}
}
}
list.add(bean);
ACache.get(ReaderApplication.getsInstance()).put(getCollectionKey(), (Serializable) list);
ToastUtils.showToast("收藏成功");
}
示例3: onClickJoinCollection
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@OnClick(R.id.btnJoinCollection)
public void onClickJoinCollection() {
if (!isJoinedCollections) {
if (recommendBooks != null) {
CollectionsManager.getInstance().add(recommendBooks);
ToastUtils.showToast(String.format(getString(
R.string.book_detail_has_joined_the_book_shelf), recommendBooks.title));
initCollection(false);
}
} else {
CollectionsManager.getInstance().remove(recommendBooks._id);
ToastUtils.showToast(String.format(getString(
R.string.book_detail_has_remove_the_book_shelf), recommendBooks.title));
initCollection(true);
}
}
示例4: dispatchKeyEvent
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN
&& event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
if (System.currentTimeMillis() - currentBackPressedTime > BACK_PRESSED_INTERVAL) {
currentBackPressedTime = System.currentTimeMillis();
ToastUtils.showToast(getString(R.string.exit_tips));
return true;
} else {
finish(); // 退出
}
} else if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) {
return true;
}
return super.dispatchKeyEvent(event);
}
示例5: addBookMark
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
/***************Book Mark*****************/
@OnClick(R.id.tvAddMark)
public void addBookMark() {
int[] readPos = mPageWidget.getReadPos();
BookMark mark = new BookMark();
mark.chapter = readPos[0];
mark.startPos = readPos[1];
mark.endPos = readPos[2];
if (mark.chapter >= 1 && mark.chapter <= mChapterList.size()) {
mark.title = mChapterList.get(mark.chapter - 1).title;
}
mark.desc = mPageWidget.getHeadLine();
if (SettingManager.getInstance().addBookMark(bookId, mark)) {
ToastUtils.showSingleToast("添加书签成功");
updateMark();
} else {
ToastUtils.showSingleToast("书签已存在");
}
}
示例6: uncaughtException
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
/**
* 当UncaughtException发生时会转入该函数来处理
*/
@Override
public void uncaughtException(Thread thread, Throwable ex) {
if (!handleException(ex) && mDefaultHandler != null) {
//如果用户没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
DownloadBookService.cancel(); // 取消任务
LogUtils.i("取消下载任务");
new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
ToastUtils.showSingleToast("哎呀,程序发生异常啦...");
Looper.loop();
}
}).start();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
LogUtils.e("CrashHandler.InterruptedException--->" + e.toString());
}
//退出程序
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
}
示例7: prePage
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
public void prePage() {
BookStatus status = pagefactory.prePage();
if (status == BookStatus.NO_PRE_PAGE) {
ToastUtils.showSingleToast("没有上一页啦");
return;
} else if (status == BookStatus.LOAD_SUCCESS) {
if (isPrepared) {
pagefactory.onDraw(mCurrentPageCanvas);
pagefactory.onDraw(mNextPageCanvas);
postInvalidate();
}
} else {
return;
}
}
示例8: getBookLists
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@Override
public void getBookLists(String duration, String sort, final int start, int limit, String tag, String gender) {
String key = StringUtils.creatAcacheKey("book-lists", duration, sort, start + "", limit + "", tag, gender);
Observable<BookLists> fromNetWork = bookApi.getBookLists(duration, sort, start + "", limit + "", tag, gender)
.compose(RxUtil.<BookLists>rxCacheListHelper(key));
//依次检查disk、network
Subscription rxSubscription = Observable.concat(RxUtil.rxCreateDiskObservable(key, BookLists.class), fromNetWork)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<BookLists>() {
@Override
public void onCompleted() {
mView.complete();
}
@Override
public void onError(Throwable e) {
LogUtils.e("getBookLists:" + e.toString());
mView.showError();
}
@Override
public void onNext(BookLists tags) {
mView.showBookList(tags.bookLists, start == 0 ? true : false);
if (tags.bookLists == null || tags.bookLists.size() <= 0) {
ToastUtils.showSingleToast("暂无相关书单");
}
}
});
addSubscrebe(rxSubscription);
}
示例9: showTagGroup
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
private void showTagGroup() {
if (mTagList.isEmpty()) {
ToastUtils.showToast(getString(R.string.network_error_tips));
return;
}
Animation mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
mShowAction.setDuration(400);
rsvTags.startAnimation(mShowAction);
rsvTags.setVisibility(View.VISIBLE);
}
示例10: netError
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@Override
public void netError(int chapter) {
hideDialog();//防止因为网络问题而出现dialog不消失
if (Math.abs(chapter - currentChapter) <= 1) {
ToastUtils.showToast(R.string.net_error);
}
}
示例11: saveReadBrightness
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
/**
* 保存阅读界面屏幕亮度
*
* @param percent 亮度比例 0~100
*/
public void saveReadBrightness(int percent) {
if(percent > 100){
ToastUtils.showToast("saveReadBrightnessErr CheckRefs");
percent = 100;
}
SharedPreferencesUtil.getInstance().putInt(getLightnessKey(), percent);
}
示例12: loginSuccess
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@Override
public void loginSuccess() {
ToastUtils.showSingleToast("登陆成功");
}
示例13: showError
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@Override
public void showError() {
ToastUtils.showSingleToast("同步异常");
dismissDialog();
}
示例14: readBook
import com.justwayward.reader.utils.ToastUtils; //导入依赖的package包/类
@OnClick(R.id.tvBookReadReading)
public void readBook() {
gone(rlReadAaSet, rlReadMark);
ToastUtils.showToast("正在拼命开发中...");
}