帮酷LOGO
  • 显示原文与译文双语对照的内容
文章标签:act  Action  
ActionQueue allows you run action one by one.

  • 源代码名称:android-ActionQueue
  • 源代码网址:http://www.github.com/liaohuqiu/android-ActionQueue
  • android-ActionQueue源代码文档
  • android-ActionQueue源代码下载
  • Git URL:
    git://www.github.com/liaohuqiu/android-ActionQueue.git
  • Git Clone代码到本地:
    git clone http://www.github.com/liaohuqiu/android-ActionQueue
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/liaohuqiu/android-ActionQueue
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
  • Android Gems

    ActionQueue允许你逐个运行操作。

    导入

    仓库:

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

    添加到依赖项:

    compile 'in.srain.cube:action-queue:1.0.1'
    用法
    • 创建操作

      String[] messageList =newString[]{
       "message 1",
       "message 2",
       "message 3",
      };for (int i =0; i < messageList.length; i++) {
       String message = messageList[i];
       PopDialogAction action =newPopDialogAction(message);
       mActionQueue.add(action);
      }
    • 进程操作

      classPopDialogActionextendsActionQueue.Action<String> {
       publicPopDialogAction(Stringbadge) {
       super(badge);
       }
       @OverridepublicvoidonAction() {
       AlertDialog.Builder builder =newAlertDialog.Builder(MainActivity.this);
       Dialog dialog = builder.setMessage(getBadge()).show();
       // notify action is done, and next aciton will be executed dialog.setOnDismissListener(mOnDismissListener);
       }
      }
    • 完成操作时通知

      DialogInterface.OnDismissListener mOnDismissListener =newDialogInterface.OnDismissListener() {
       @OverridepublicvoidonDismiss(DialogInterfacedialog) {
       mActionQueue.notifyActionDoneThenTryToPopNext();
       }
      };
    • 许可证:MIT



    文章标签:act  Action  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语