android-ActionQueue 使用 Android 开发包

程序名称:android-ActionQueue 使用

授权协议: 未知

操作系统: Android

开发语言: Java

android-ActionQueue 使用 介绍

ActionQueue 允许你一个一个的执行任务。

导入:

allprojects {
    repositories {
        mavenCentral()
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
        jcenter()
    }
}

加依赖:

compile 'in.srain.cube:action-queue:1.0.1'

使用

创建 action:

String[] messageList = new String[]{
        "message 1",
        "message 2",
        "message 3",
};
for (int i = 0; i < messageList.length; i++) {
    String message = messageList[i];
    PopDialogAction action = new PopDialogAction(message);
    mActionQueue.add(action);
}

处理 action:

class PopDialogAction extends ActionQueue.Action<String> {
    public PopDialogAction(String badge) {
        super(badge);
    }
    @Override
    public void onAction() {
        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
        Dialog dialog = builder.setMessage(getBadge()).show();
        // notify action is done, and next aciton will be executed
        dialog.setOnDismissListener(mOnDismissListener);
    }
}

action 执行完之后通知提醒:

   DialogInterface.OnDismissListener mOnDismissListener = new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mActionQueue.notifyActionDoneThenTryToPopNext();
        }
    };

android-ActionQueue 使用 官网

https://github.com/liaohuqiu/android-ActionQueue

相关编程语言

BBGestureBack Full screen return gesture(全屏手...
Framework7 或者叫 F7 是全功能的绑定 iOS 7 应用的...
iOS 调试库,支持 iOS8+,无需添加任何代码,方便 i...
DarkModeKit是在Apple官方的深色模式发布之前设计和...
SimpleNote iOS 版客户端。SimpleNote 是一款在多平...
Kivy iOS,此工具旨在为 iOS 编译必要的库以运行应用...