{"id":13628957,"url":"https://github.com/frankiesardo/icepick","last_synced_at":"2025-05-13T23:04:47.499Z","repository":{"id":9498495,"uuid":"11390894","full_name":"frankiesardo/icepick","owner":"frankiesardo","description":"Android Instance State made easy","archived":false,"fork":false,"pushed_at":"2021-05-26T07:01:41.000Z","size":945,"stargazers_count":3745,"open_issues_count":26,"forks_count":208,"subscribers_count":90,"default_branch":"master","last_synced_at":"2025-05-12T10:48:16.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frankiesardo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-13T16:43:09.000Z","updated_at":"2025-05-02T16:50:05.000Z","dependencies_parsed_at":"2022-08-07T05:01:05.641Z","dependency_job_id":null,"html_url":"https://github.com/frankiesardo/icepick","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankiesardo%2Ficepick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankiesardo%2Ficepick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankiesardo%2Ficepick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankiesardo%2Ficepick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frankiesardo","download_url":"https://codeload.github.com/frankiesardo/icepick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254040569,"owners_count":22004568,"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-08-01T22:01:00.207Z","updated_at":"2025-05-13T23:04:42.492Z","avatar_url":"https://github.com/frankiesardo.png","language":"Clojure","funding_links":[],"categories":["Clojure","Parcelables","Annotation","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"Icepick\n============\n\nIcepick is an Android library that eliminates the boilerplate of saving and restoring instance state.\nIt uses annotation processing to generate code that does bundle manipulation and key generation, so that you don't have to write it yourself.\n\n```java\nclass ExampleActivity extends Activity {\n  @State String username; // This will be automatically saved and restored\n\n  @Override public void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    Icepick.restoreInstanceState(this, savedInstanceState);\n  }\n\n  @Override public void onSaveInstanceState(Bundle outState) {\n    super.onSaveInstanceState(outState);\n    Icepick.saveInstanceState(this, outState);\n  }\n\n  // You can put the calls to Icepick into a BaseActivity\n  // All Activities extending BaseActivity automatically have state saved/restored\n}\n```\n\nIt works for `Activities`, `Fragments` or any object that needs to serialize its state on a `Bundle` (e.g. mortar's [ViewPresenters](https://github.com/square/mortar/blob/master/mortar/src/main/java/mortar/ViewPresenter.java))\n\nIcepick can also generate the instance state code for custom Views:\n\n```java\nclass CustomView extends View {\n  @State int selectedPosition; // This will be automatically saved and restored\n\n  @Override public Parcelable onSaveInstanceState() {\n    return Icepick.saveInstanceState(this, super.onSaveInstanceState());\n  }\n\n  @Override public void onRestoreInstanceState(Parcelable state) {\n    super.onRestoreInstanceState(Icepick.restoreInstanceState(this, state));\n  }\n\n  // You can put the calls to Icepick into a BaseCustomView and inherit from it\n  // All Views extending this CustomView automatically have state saved/restored\n}\n```\n\nCustom Bundler\n--------\n\nFrom version `3.2.0` you can supply a class parameter to the `State` annotation.\nThis class should implement the `Bundler` interface and you can use it to provide custom serialisation and deserialisation for your types.\n\n```java\nclass MyFragment {\n  @State(MyCustomBundler.class) MyCustomType myCustomType;\n}\n\nclass MyCustomBundler implements Bundler\u003cMyCustomType\u003e {\n  void put(String key, MyCustomType value, Bundle bundle) {\n    ...\n  }\n\n  MyCustomType get(String key, Bundle bundle) {\n    ...\n  }\n}\n```\n\nThis is useful if you want to use `icepick` in conjunction with `Parceler`.\n\nProguard\n--------\n\nIf Proguard is enabled make sure you add these rules to your configuration:\n\n```\n-dontwarn icepick.**\n-keep class icepick.** { *; }\n-keep class **$$Icepick { *; }\n-keepclasseswithmembernames class * {\n    @icepick.* \u003cfields\u003e;\n}\n-keepnames class * { @icepick.State *;}\n```\n\nDownload\n--------\n\nIcepick needs two libraries: `icepick` and `icepick-processor`.\n\n[![Clojars Project](http://clojars.org/frankiesardo/icepick/latest-version.svg)](http://clojars.org/frankiesardo/icepick)\n\n[![Clojars Project](http://clojars.org/frankiesardo/icepick-processor/latest-version.svg)](http://clojars.org/frankiesardo/icepick-processor)\n\nGradle:\n\n```groovy\nrepositories {\n  maven {url \"https://clojars.org/repo/\"}\n}\ndependencies {\n  compile 'frankiesardo:icepick:{{latest-version}}'\n  provided 'frankiesardo:icepick-processor:{{latest-version}}'\n}\n```\n\nMaven:\n\n```xml\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003eclojars\u003c/id\u003e\n    \u003curl\u003ehttps://clojars.org/repo/\u003c/url\u003e\n    \u003csnapshots\u003e\n      \u003cenabled\u003etrue\u003c/enabled\u003e\n    \u003c/snapshots\u003e\n    \u003creleases\u003e\n      \u003cenabled\u003etrue\u003c/enabled\u003e\n    \u003c/releases\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003efrankiesardo\u003c/groupId\u003e\n    \u003cartifactId\u003eicepick\u003c/artifactId\u003e\n    \u003cversion\u003e{{latest-version}}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003efrankiesardo\u003c/groupId\u003e\n    \u003cartifactId\u003eicepick-processor\u003c/artifactId\u003e\n    \u003cversion\u003e{{latest-version}}\u003c/version\u003e\n    \u003coptional\u003etrue\u003c/optional\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankiesardo%2Ficepick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrankiesardo%2Ficepick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankiesardo%2Ficepick/lists"}