{"id":47928178,"url":"https://github.com/vinted/preferx","last_synced_at":"2026-04-04T07:01:03.026Z","repository":{"id":48786457,"uuid":"133521658","full_name":"vinted/preferx","owner":"vinted","description":"A reactive SharedPreferences library for Kotlin","archived":false,"fork":false,"pushed_at":"2023-10-10T07:17:02.000Z","size":169,"stargazers_count":13,"open_issues_count":3,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-10-10T08:28:59.801Z","etag":null,"topics":["android","kotlin","rxjava2","sharedpreferences"],"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/vinted.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-05-15T13:38:25.000Z","updated_at":"2023-10-10T08:29:00.677Z","dependencies_parsed_at":"2022-07-26T00:47:06.952Z","dependency_job_id":null,"html_url":"https://github.com/vinted/preferx","commit_stats":null,"previous_names":[],"tags_count":6,"template":null,"template_full_name":null,"purl":"pkg:github/vinted/preferx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fpreferx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fpreferx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fpreferx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fpreferx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinted","download_url":"https://codeload.github.com/vinted/preferx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinted%2Fpreferx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31390695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["android","kotlin","rxjava2","sharedpreferences"],"created_at":"2026-04-04T07:00:49.187Z","updated_at":"2026-04-04T07:01:02.991Z","avatar_url":"https://github.com/vinted.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/com.vinted/preferx.svg)](https://jitpack.io/#com.vinted/preferx)\n[![Build Status](https://travis-ci.com/vinted/preferx.svg?branch=master)](https://travis-ci.com/vinted/preferx)\n\n# PrefeRx\n\nThis is a reactive SharedPreferences library for Kotlin\n\n - allows to integrate \u0026 manage your preferences with RxJava\n - easily stores primitives, enums and other serializable objects\n\nDownload\n--------\n\n```groovy\ndependencies {\n  implementation 'com.vinted:preferx:\u003cversion\u003e'\n}\n```\n\nSupported types\n--------\nLibrary supports default `SharedPreferences` types with default fallback values when preference was not yet set or was cleared.\n\n\n```kotlin\n\n  sharedPreferences.intPreference(\"counter\", 0)\n\n  sharedPreferences.stringPreference(\"string\", \"\")\n\n  sharedPreferences.booleanPreference(\"seen\", false)\n\n  sharedPreferences.longPreference(\"timestamp\", 0L)\n\n```\n\nIt also allows easy storing of enums and objects.\n\n```kotlin\n\n  sharedPreferences.enumPreference(\"notifications\", Frequency.ALL)\n\n  sharedPreferences.objectPreference(\n    name = \"current_user\"\n    defaultValue = User.ANONYMOUS,\n    serializer = someSerializer,\n    clazz = User::class\n  )\n```\n\nBasic example\n--------\n\n```kotlin\nclass ExampleActivity : Activity {\n\n  private val sharedPreferences by lazy {\n    getSharedPreferences(\"app-pref\", Context.MODE_PRIVATE)\n  }\n\n  private val sessionCounter : IntPreference by lazy {\n    sharedPreferences.intPreference(\"counter\", 0)\n  }\n\n  @Override\n  public fun onCreate(savedInstanceState: Bundle?) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.simple_activity)\n\n    val incrementedCount = sessionCounter.get() + 1\n    sessionCounter.set(incrementedCount)\n\n    counter_view.text = \"Application was started $incrementedCount times\"\n  }\n}\n```\n\nRxJava example\n--------\n\n```kotlin\nclass ExampleActivity : Activity {\n\n  ...\n\n  private var disposable: Disposable? = null\n\n  override fun onCreate(savedInstanceState: Bundle?) {\n    super.onCreate(savedInstanceState)\n\n    Observable.just(stringPreference.get())\n      .concatWith(stringPreference.onChangeObservable)\n      .subscribe {\n          text_view.text = it\n      }\n    }.apply { disposable = this }\n  }\n\n  override fun onDestroy() {\n    disposable?.dispose()\n    super.onDestroy()\n  }\n\n  ...\n}\n```\n\nFor more usage examples see:\n - [preferences with dagger](app/src/main/kotlin/com/vinted/preferx/examples/DaggerActivityExample.kt)\n - [preferences in Rx stream](app/src/main/kotlin/com/vinted/preferx/examples/RxActivityExample.kt)\n\n\nCaveats\n--------\n\n - When `EnumSerializer` fails to resolve enum value for any reason it will fallback to default value\n - When using `EntitySerializer` one must ensure that it returns value. In case of `null` it will fallback to default value.\n\n\nLicense\n--------\n\n```\nMIT License\n\nCopyright (c) 2021 Vinted UAB\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinted%2Fpreferx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinted%2Fpreferx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinted%2Fpreferx/lists"}