{"id":30432913,"url":"https://github.com/gregkorossy/android-support-preference-v7-fix","last_synced_at":"2025-10-09T17:03:39.747Z","repository":{"id":36815616,"uuid":"41122491","full_name":"gregkorossy/Android-Support-Preference-V7-Fix","owner":"gregkorossy","description":"Android androidx.preference support library has some issues, this lib tries to fix them.","archived":false,"fork":false,"pushed_at":"2022-02-21T00:13:19.000Z","size":1885,"stargazers_count":495,"open_issues_count":28,"forks_count":45,"subscribers_count":28,"default_branch":"androidx","last_synced_at":"2025-09-28T20:54:04.334Z","etag":null,"topics":["android","android-library","preference-v7","support-library"],"latest_commit_sha":null,"homepage":"https://discord.gg/87NVsSK","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregkorossy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-20T22:55:09.000Z","updated_at":"2025-07-26T02:31:50.000Z","dependencies_parsed_at":"2022-07-20T10:32:13.745Z","dependency_job_id":null,"html_url":"https://github.com/gregkorossy/Android-Support-Preference-V7-Fix","commit_stats":null,"previous_names":["gregkorossy/android-support-preference-v7-fix","gericop/android-support-preference-v7-fix"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/gregkorossy/Android-Support-Preference-V7-Fix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregkorossy%2FAndroid-Support-Preference-V7-Fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregkorossy%2FAndroid-Support-Preference-V7-Fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregkorossy%2FAndroid-Support-Preference-V7-Fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregkorossy%2FAndroid-Support-Preference-V7-Fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregkorossy","download_url":"https://codeload.github.com/gregkorossy/Android-Support-Preference-V7-Fix/tar.gz/refs/heads/androidx","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregkorossy%2FAndroid-Support-Preference-V7-Fix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001890,"owners_count":26083197,"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-09T02:00:07.460Z","response_time":59,"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":["android","android-library","preference-v7","support-library"],"created_at":"2025-08-22T22:01:05.167Z","updated_at":"2025-10-09T17:03:39.742Z","avatar_url":"https://github.com/gregkorossy.png","language":"Java","funding_links":["https://www.paypal.me/korossyg/0eur"],"categories":[],"sub_categories":[],"readme":"# AndroidX Preference eXtended\n\nThis library is meant to fix some of the problems found in the official AndroidX preference library. Also, there are [new preference types](#extra-types) available, such as `RingtonePreference`, `DatePickerPreference`, and `TimePickerPreference`.\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.takisoft.preferencex/preferencex.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.takisoft.preferencex%22%20AND%20a:%preferencex%22)\n\n### Donation\n\nIf you would like to support me, you may donate some small amount via PayPal.\n\n[ ![Buy me a coffee](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/donate.png)](https://www.paypal.me/korossyg/0eur)\n\n---\n\n## How to use the library?\n### 1. Add gradle dependency\n**Add** this to your gradle file:\n```gradle\nimplementation \"androidx.preference:preference:$androidxVersion\"\nimplementation 'com.takisoft.preferencex:preferencex:1.1.0'\n```\n\n### 2. Use the appropriate class as your fragment's base\n\n```java\nimport com.takisoft.preferencex.PreferenceFragmentCompat;\n\npublic class MyPreferenceFragment extends PreferenceFragmentCompat {\n\n    @Override\n    public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {\n        setPreferencesFromResource(R.xml.settings, rootKey);\n\t\n\t// additional setup\n    }\n}\n```\n\u003e **Warning!** Watch out for the correct package name when importing `PreferenceFragmentCompat`, it should come from `com.takisoft.preferencex`.\n\nNow you can enjoy using preferenceX.\n\n---\n\n## Extra types\n\nThere are additional preferences not part of the official support library, but decided to add them to some extra libraries. You can add them to your project using Gradle.\n\nPreference | Dependency | Preview\n-|-|-\n[`RingtonePreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#ringtonepreference) | `implementation 'com.takisoft.preferencex:preferencex-ringtone:1.1.0'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/ringtone_api26.png)\n[`DatePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#datepickerpreference) | `implementation 'com.takisoft.preferencex:preferencex-datetimepicker:1.1.0'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/datepicker_api26.png)\n[`TimePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#timepickerpreference) | `implementation 'com.takisoft.preferencex:preferencex-datetimepicker:1.1.0'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/timepicker_api26.png)\n[`ColorPickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#colorpickerpreference) | `implementation 'com.takisoft.preferencex:preferencex-colorpicker:1.1.0'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/colorpicker_api26_fixed.png)\n[`SimpleMenuPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#simplemenupreference) | `implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.1.0'` (can be used independent of `preferencex`) | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/simplemenu_api26.png)\n\n---\n\n## Custom solutions\n\n### Hijacked `EditTextPreference`\nThe support implementation of `EditTextPreference` ignores many of the basic yet very important attributes as it doesn't forward them to the underlying `EditText` widget. In my opinion this is a result of some twisted thinking which would require someone to create custom dialog layouts for some simple tasks, like showing a numbers-only dialog. This is the main reason why the `EditTextPreference` gets hijacked by this lib: it replaces certain aspects of the original class in order to forward all the XML attributes set (such as `inputType`) on the `EditTextPreference` to the `EditText`, and also provides a `getEditText()` method so it can be manipulated directly.\n\nThe sample app shows an example of setting (via XML) and querying (programmatically) the input type of the `EditTextPreference`:\n```xml\n\u003cEditTextPreference\n    android:inputType=\"phone\"\n    android:key=\"edit_text_test\" /\u003e\n```\n\n```java\nEditTextPreference etPref = (EditTextPreference) findPreference(\"edit_text_test\");\nif (etPref != null) {\n    int inputType = etPref.getEditText().getInputType();\n    // do something with inputType\n}\n```\n\u003e **Note!** Watch out for the correct package name when importing `EditTextPreference`, it should come from `com.takisoft.preferencex`. If you import from the wrong package (i.e. `androidx.preference`), the `getEditText()` method will not be available, however, the XML attributes will still be forwarded and processed by the `EditText`.\n\n### Others\n\n* Convenience methods in `PreferenceFragmentCompat`;\n* `PreferenceCategory` with different colors;\n* `AutoSummaryEditTextPreference`;\n* `PreferenceActivityResultListener`;\n* `EditTextPreference` correctly calls `notifyChange`. ([#66](https://github.com/Gericop/Android-Support-Preference-V7-Fix/pull/66))\n\n\n---\n\n## Version\nThe current stable version is **1.1.0**.\n\n## Notes #\nThis demo / bugfix is set to work on API level 14+.\n\n---\n\n## Sample\n\n_Material design - everywhere._\n\nAPI 15 | API 21 | API 26\n-|-|-\n![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/base_api15.png) | ![API 21](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/base_api21.png) | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/base_api26.png)\n\n---\n\n### Changelog\n\nSee the separate CHANGELOG.md file.\n\n**2019-11-26**\n\nNew version: 1.1.0 (based on v1.1.0)\n\n- introduced `PreferenceFragmentCompatMasterSwitch` that can be used as a switch's additional screen for settings; see the sample for details\n- Added `pref_disableMessagePaddingFix` attribute to the `EditTextPreference` that can be used to disable the dialog message padding fix.\n- `EditText` does not receive all attributes from `EditTextPreference` from now, only the following: `inputType`, `textAllCaps`, `lines`, `minLines`, `maxLines`, `ems`, `minEms`, `maxEms`\n- `AutoSummaryEditTextPreference` is now deprecated, use an appropriate `SummaryProvider` with the `EditTextPreference`\n\n\u003e For older changelogs, check out the [CHANGELOG](CHANGELOG.md) file.\n\nFeel free to ask / suggest anything on this page by creating a ticket (*issues*)!\n\n# License notes #\nApache v2","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregkorossy%2Fandroid-support-preference-v7-fix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregkorossy%2Fandroid-support-preference-v7-fix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregkorossy%2Fandroid-support-preference-v7-fix/lists"}