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

JavaScript设计模式与开发实践

JavaScript设计模式与开发实践

曾探 / 人民邮电出版社 / 2015-5 / 59.00元

本书在尊重《设计模式》原意的同时,针对JavaScript语言特性全面介绍了更适合JavaScript程序员的了16个常用的设计模式,讲解了JavaScript面向对象和函数式编程方面的基础知识,介绍了面向对象的设计原则及其在设计模式中的体现,还分享了面向对象编程技巧和日常开发中的代码重构。本书将教会你如何把经典的设计模式应用到JavaScript语言中,编写出优美高效、结构化和可维护的代码。一起来看看 《JavaScript设计模式与开发实践》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具