Android 开发包 android-ActionQueue

码农软件 · 软件分类 · 手机开发包 · 2019-05-05 13:14:51

软件介绍

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();
        }
    };

本文地址:https://codercto.com/soft/d/5073.html

C++ API设计

C++ API设计

[美] Martin Reddy / 刘晓娜、臧秀涛、林健 / 人民邮电出版社 / 2013-8 / 89.00

现代软件开发中的一大难题就是如何编写优质的API。API负责为某个组件提供逻辑接口并隐藏该模块的内部细节。多数程序员依靠的是经验和冒险,从而很难达到健壮、高效、稳定、可扩展性强的要求。Martin Reddy博士在自己多年经验基础之上,对于不同API风格与模式,总结出了API设计的种种最佳策略,着重针对大规模长期开发项目,辅以翔实的代码范例,从而有助于设计决策的成功实施,以及软件项目的健壮性及稳定......一起来看看 《C++ API设计》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

MD5 加密
MD5 加密

MD5 加密工具