{"id":20929673,"url":"https://github.com/swiftech/andex","last_synced_at":"2026-07-03T01:03:11.350Z","repository":{"id":6391112,"uuid":"7628933","full_name":"swiftech/andex","owner":"swiftech","description":"extension for Android SDK","archived":false,"fork":false,"pushed_at":"2024-01-28T16:08:20.000Z","size":3181,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T18:47:31.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swiftech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-01-15T16:52:35.000Z","updated_at":"2024-04-09T08:37:18.000Z","dependencies_parsed_at":"2025-01-19T18:45:09.395Z","dependency_job_id":"46498153-c8d1-41f6-a442-44dccb04f4c4","html_url":"https://github.com/swiftech/andex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftech%2Fandex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftech%2Fandex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftech%2Fandex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swiftech%2Fandex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swiftech","download_url":"https://codeload.github.com/swiftech/andex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243324267,"owners_count":20273099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T21:22:44.910Z","updated_at":"2025-10-27T11:17:48.154Z","avatar_url":"https://github.com/swiftech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"andex\n=====\n\n\n对于 Android 开发来说，交互流程处理，状态处理等问题是比较繁琐的问题，即重要又容易出错，andex 的目的就是为了解决此类问题。\n\n\n### 版本\nv 2.0.3\n* 捕获自定义的 Action 抛出的异常并终止执行\n* 增加状态检查\n* 增加强制执行 Action 的方法\n\n### 使用方法\n\n* 在你自己的工程中添加对 andex 的引用。\n\n\n### 功能概述\n\n##### Activity 和 Fragment 流程管理\n\n* Activity 控制\n跳转到另一个 Activity\n\n```java\nnew ActivityBuilder(this, NextActivity.class)\n    .withId(1001)\n    .with(\"title\", \"Next Activity\")\n    .start();\n```\n\n\n* Fragment 控制\n跳转到另一个 Fragment：\n\n```java\nSecondFragment secondFragment = new SecondFragment();\nnew FragmentBuilder(this, secondFragment).replace(R.id.fl_content)\n        .withId(1001)\n        .with(\"title\", \"Second Fragment\")\n        .with(\"content\", \"This is the second fragment\")\n        .start();\n```\n\n\n##### 状态管理器\n\n用户和 App 的交互本质上是 UI 对于处于不同状态下所作出的变化，而程序对于 UI 交互的处理是异步化的，这使得处理交互的代码分散在各处，不便于阅读和维护。\nStatusBus 是 andex 提供的状态管理器，它能很好的管理 UI 交互的状态，大量简化代码量。\n\n一个基本的例子，处理一个页面的视图状态和编辑状态之间的切换：\n```java\nStatusBus statusBus = StatusBus.newInstance(StatusDemoActivity.class, StatusDemoActivity.this, getWindow().getDecorView());\nstatusBus.status(\"VIEW\")\n        .in(ActionBuilder.create()\n                .text(R.id.tv_edit, \"Edit\")\n                .text(R.id.btn1, \"Save\")\n                .disable(R.id.btn1, R.id.et1, R.id.et2)\n                .bgColorInt(R.id.btn1, Color.argb(255, 0, 255, 0))\n        )\n        .status(\"EDIT\")\n        .in(ActionBuilder.create()\n                .text(R.id.tv_edit, \"Cancel\")\n                .text(R.id.btn1, \"Save\")\n                .enable(R.id.btn1, R.id.et1, R.id.et2)\n                .bgColorInt(R.id.btn1, Color.argb(255, 255, 0, 0))\n        );\n\ntvEdit = findViewById(R.id.tv_edit);\ntvEdit.setOnClickListener(v -\u003e {\n    if (statusBus.isStatus(\"VIEW\")) {\n        statusBus.post(\"EDIT\");\n    } else if (statusBus.isStatus(\"EDIT\")) {\n        statusBus.post(\"VIEW\");\n    }\n});\n\nbtnOk = findViewById(R.id.btn1);\nbtnOk.setOnClickListener(v -\u003e {\n    statusBus.post(\"VIEW\");\n});\n\nstatusBus.post(\"VIEW\");\n```\n\n正如您所见，所有改变 UI 的代码全部都集中到了一起，容易阅读和管理，上面的示例代码定义了两种状态\"视图\"和\"编辑\"，`in()` 方法表示其包含的 `ActionBuilder` 所创建的代码在进入此状态时执行。\n而所有发生状态改变的地方只需要调用 post() 方法改变状态即可，相应 UI 属性根据状态进入和退出而发生相应的改变。\n `ActionBuilder` 提供快速修改常见的 UI 属性的配置方法，简化了这些繁冗的代码。\n\n`ActionBuilder` 只实现了常见的 UI 属性配置方法，对于没有覆盖到的 UI 属性的修改，可以用定制化的方法：\n\n```java\nstatusBus.status(\"VIEW\")\n        .in(ActionBuilder.create()\n                .text(R.id.tv_edit, \"Edit\")\n        )\n        .in(() -\u003e {\n            ((TextView)findViewById(R.id.tv_edit)).setLines(4);\n        })  \n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftech%2Fandex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftech%2Fandex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftech%2Fandex/lists"}