{"id":13610405,"url":"https://github.com/kishandonga/EasyPrefs","last_synced_at":"2025-04-12T22:33:45.743Z","repository":{"id":115563407,"uuid":"277233141","full_name":"kishandonga/EasyPrefs","owner":"kishandonga","description":"EasyPrefs is a wrapper on the android shared preferences, also it will need only one-time initialization and used in the whole project without context, it supports encryption and decryption with extended APIs. ","archived":false,"fork":false,"pushed_at":"2023-09-30T17:07:20.000Z","size":273,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-01T19:54:57.336Z","etag":null,"topics":["android","android-library","androidlibrary","easy-to-use","encrypted-preferences","encryptedpreferences","encryptedsharedpreferences","preferences","preferences-api","sharedpreferences","sharedpreferences-editor","tested"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kishandonga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-07-05T04:50:28.000Z","updated_at":"2023-06-08T10:34:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"f834d0dc-aba2-4a52-a4c4-f57f4baf699b","html_url":"https://github.com/kishandonga/EasyPrefs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishandonga%2FEasyPrefs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishandonga%2FEasyPrefs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishandonga%2FEasyPrefs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kishandonga%2FEasyPrefs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kishandonga","download_url":"https://codeload.github.com/kishandonga/EasyPrefs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223549237,"owners_count":17163620,"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":["android","android-library","androidlibrary","easy-to-use","encrypted-preferences","encryptedpreferences","encryptedsharedpreferences","preferences","preferences-api","sharedpreferences","sharedpreferences-editor","tested"],"created_at":"2024-08-01T19:01:44.384Z","updated_at":"2024-11-07T16:31:12.830Z","avatar_url":"https://github.com/kishandonga.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Android EasyPrefs\n\n[![](https://jitpack.io/v/kishandonga/EasyPrefs.svg)](https://jitpack.io/#kishandonga/EasyPrefs)\u0026nbsp;\u0026nbsp;![](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)\u0026nbsp;\u0026nbsp;[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-EasyPrefs-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8171)\n\nEasyPrefs is a library for the android SharedPreferences or we can say it wrapper on it. It provides easy access to the SharedPreferences API, also it will need only one-time initialization, and is used in the whole project without context also has a facility to provide context if necessary with support encryption and decryption.\n\nIt supports all Primitive Data Types including Set.\n\nFor, the secure operation use AES encryption \u003c= 20 API Level, and for 21 \u003e= use Android-provided encrypted shared preferences in both cases you get the same output your key and value are stored securely.\n\nThis library is developed in Kotlin and supports both the language `Kotlin` as well as `Java` with the same practices.\n\nThe default file name is **`prefs_\u003cpackage_name\u003e`** and custom file name like **`prefs_\u003cgiven_filename\u003e`** there is no need to give a file extension. it is automatically appended at the end of the name.\n\n## Installation\nGradle:\n\n```groovy\nallprojects {\n    repositories {\n        maven { url 'https://jitpack.io' }\n    }\n}\n\ndependencies {\n    implementation 'com.github.kishandonga:EasyPrefs:1.2'\n}\n```\n\n## Examples\n\nRefer, to the Sample Test Suite in the suite package\nFor, more information refer to this test case code [here](app/src/androidTest/java/com/sample/easyprefs/kotlin)\n\n#### Initialize App\n\n`Prefs.initializeApp(context)` this line of code adds into the main Application Class, as like this.\n\n```kotlin\nclass MainApp : Application() {\n    override fun onCreate() {\n        super.onCreate()\n        Prefs.initializeApp(this)\n    }\n}\n```\n\n#### Write Operation\n\n```kotlin\nPrefs.write().content(\"KEY\", \"VALUE\")\n\t     .content(\"KEY\", \"VALUE\")\n\t     .commit() or .apply()\n```\n\n```kotlin\nPrefs.write(fileName)\n       \t     .content(\"KEY\", \"VALUE\")\n\t     .content(\"KEY\", \"VALUE\")\n\t     .commit() or .apply()\n```\n\n```kotlin\nPrefs.write(context)\n       \t     .content(\"KEY\", \"VALUE\")\n       \t     .content(\"KEY\", \"VALUE\")\n       \t     .commit() or .apply()\n```\n\n```kotlin\nPrefs.write(context, fileName)\n       \t     .content(\"KEY\", \"VALUE\")\n       \t     .content(\"KEY\", \"VALUE\")\n       \t     .commit() or .apply()\n```\n\n#### Read Operation\n\n```kotlin\nPrefs.read().content(\"KEY\", \"\")\nPrefs.read(fileName).content(\"KEY\", \"\")\nPrefs.read(context).content(\"KEY\", \"\")\nPrefs.read(context, fileName).content(\"KEY\", \"\")\n```\n\n#### Secure Operation\n\n```kotlin\nPrefs.securely().write()\n       \t     .content(\"KEY\", \"VALUE\")\n       \t     .content(\"KEY\", \"VALUE\")\n       \t     .commit() or .apply()\n\nPrefs.securely().read().content(\"KEY\",  \"\")\n```\n\n#### Has Operation\n\n```kotlin\nPrefs.has().key(\"KEY\");\nPrefs.has(fileName).key(\"KEY\");\nPrefs.has(context).key(\"KEY\");\nPrefs.has(context, fileName).key(\"KEY\");\n\nPrefs.has().empty();\n```\n- Give boolean value if key exists then true else false.\n\n#### Remove Operation\n\n```kotlin\nPrefs.remove().key(\"KEY\").\nPrefs.remove(fileName).key(\"KEY\").\nPrefs.remove(context).key(\"KEY\").\nPrefs.remove(context, fileName).key(\"KEY\").\n\ncommit() or .apply()\n```\n-\tAfter the remove operation commit and apply call mandatory.\n\n#### Clear Operation\n\n```kotlin\nPrefs.clear().all()\nPrefs.clear(fileName).all()\nPrefs.clear(context).all()\nPrefs.clear(context, fileName).all()\n\n.commit() or .apply()\n\nNote: for, securely operation use the same Prefs.clear() operation.\n```\n-\tAfter the clear operation commit and apply call mandatory.\n\nFor, all the read, write, clear, has, remove support context and fileName manually, so you can use your preferences with multiple files with the same API use just need to change the fileName when you call.\n\nIf you pass context manually then no need to initialize lib on the application class, For, more information refer [here](app/src/androidTest/java/com/sample/easyprefs)\n\nThis library tested on the API levels 20, 26, 29, and 30 if you found any bug or issue raise an issue or submit a PR\n\n## Future Scope\n- add sorting on the Set so get direct sorted data.\n- callback extend as we already have in the preferences.\n- provide suggestions to make this lib more helpful.\n\n---\n\n### Contributing\n\nContributions are welcome! If you find a bug please report it and if you want to add a new feature then please suggest it to me. If you want to contribute code please file an issue or create a branch of the current dev branch and post a pull request.\n\n### About me\n\nI'm Kishan Donga and you can connect with me via the below links, I am a developer and I love to create innovations.\n\nLinkedIn [@ikd96](https://www.linkedin.com/in/ikd96/) \nEmail [kishandonga.92@gmail.com](mailto:kishandonga.92@gmail.com)\nTwitter [@ikishan96](https://twitter.com/ikishan96) \nInstagram [@ikishan96](https://www.instagram.com/ikishan96/)\n\n### License\n\n[EasyPrefs](https://github.com/kishandonga/EasyPrefs)  is released under the [MIT License](https://github.com/kishandonga/EasyPrefs/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkishandonga%2FEasyPrefs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkishandonga%2FEasyPrefs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkishandonga%2FEasyPrefs/lists"}