{"id":19336820,"url":"https://github.com/blackbbc/luna","last_synced_at":"2025-10-05T17:09:47.237Z","repository":{"id":84995119,"uuid":"77286523","full_name":"blackbbc/Luna","owner":"blackbbc","description":"Android saved instance state helper","archived":false,"fork":false,"pushed_at":"2017-04-06T10:04:23.000Z","size":111,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T08:13:39.846Z","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/blackbbc.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":"2016-12-24T14:23:41.000Z","updated_at":"2016-12-24T14:24:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"088f250d-04ac-418f-b542-74866eb8a4a5","html_url":"https://github.com/blackbbc/Luna","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/blackbbc/Luna","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackbbc%2FLuna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackbbc%2FLuna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackbbc%2FLuna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackbbc%2FLuna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackbbc","download_url":"https://codeload.github.com/blackbbc/Luna/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackbbc%2FLuna/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278486308,"owners_count":25994945,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10T03:12:32.576Z","updated_at":"2025-10-05T17:09:47.193Z","avatar_url":"https://github.com/blackbbc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/blackbbc/Luna.svg)](https://jitpack.io/#blackbbc/Luna)\n[![Build Status](https://travis-ci.org/blackbbc/Luna.svg?branch=master)](https://travis-ci.org/blackbbc/Luna)\n[![Dependency Status](https://www.versioneye.com/user/projects/585ea6602e129e0047a7fc8e/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/585ea6602e129e0047a7fc8e)\n\n# Luna\nAndroid instance state helper. It uses apt to generate codes.\n\n## Download\nAdd in your root build.gradle:\n```\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\nAdd in your app/build.gradle\n```\ndependencies {\n    annotationProcessor 'com.github.blackbbc.Luna:luna-processor:1.0.1'\n    compile 'com.github.blackbbc.Luna:luna-annotation:1.0.1'\n}\n```\n\n## Usage\n\nUse `@State` annotation to annotate variables that need to save.\n``` Java\npublic class MainActivity extends AppCompatActivity {\n    @State int testInt;\n    @State Integer testInteger;\n    @State boolean testBoolean;\n    @State float testFloat;\n    @State String testString;\n    @State ArrayList\u003cInteger\u003e integers;\n    @State List\u003cString\u003e strings;\n    @State List\u003cProduct\u003e products;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n    }\n\n    @Override\n    protected void onSaveInstanceState(Bundle outState) {\n        super.onSaveInstanceState(outState);\n    }\n}\n```\n\nRun \"Build\" to generate necessary helper codes. The helper codes is named by prefix `Luna` + `ClassName`. For example, the above `MainActivity` will generate `LunaMainActivity` class. Then add the following codes to use them!.\n\n```Java\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.activity_main);\n    LunaMainActivity.onRestoreInstanceState(this, savedInstanceState);\n}\n\n@Override\nprotected void onSaveInstanceState(Bundle outState) {\n    super.onSaveInstanceState(outState);\n    LunaMainActivity.onSaveInstanceState(this, outState);\n}\n```\n\nThat's all!\n\n## Support types:\n1. Boxed and unboxed primitive type.\n  - `boolean`, `byte`, `short`, `int`, `long`, `char`, `float`, `double`\n  - `Boolean`, `Byte`, `Short`, `Int`, `Long`, `Char`, `Float`, `Double`\n2. `String`\n3. `Parcelable`\n4. `List\u003cInteger\u003e`, `List\u003cString\u003e`, `List\u003cParcelable\u003e`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackbbc%2Fluna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackbbc%2Fluna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackbbc%2Fluna/lists"}