├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── takisoft │ │ └── preferencex │ │ └── demo │ │ ├── ActivityResultTestPreference.java │ │ ├── MainActivity.java │ │ ├── MyApplication.java │ │ ├── MyMasterSwitchFragment.java │ │ └── MyPreferenceFragment.java │ └── res │ ├── drawable │ ├── ic_info_outline_24dp.xml │ └── ic_lock_outline_24dp.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values │ ├── colors_indigo_pink.xml │ ├── strings.xml │ ├── styles.xml │ └── test_list_entries.xml │ └── xml │ ├── settings.xml │ └── settings_master.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images ├── base_api15.png ├── base_api21.png ├── base_api26.png ├── colorpicker_api26_fixed.png ├── datepicker_api15.png ├── datepicker_api26.png ├── donate.png ├── ringtone_api15.png ├── ringtone_api26.png ├── simplemenu_api26.png ├── timepicker_api15.png └── timepicker_api26.png ├── preferencex-colorpicker ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── takisoft │ │ └── preferencex │ │ ├── ColorPickerPreference.java │ │ └── ColorPickerPreferenceDialogFragmentCompat.java │ └── res │ ├── drawable │ └── colorpickerpreference_pref_swatch.xml │ ├── layout │ └── preference_widget_color_swatch.xml │ └── values │ ├── attrs.xml │ └── dimens.xml ├── preferencex-datetimepicker ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── takisoft │ │ └── preferencex │ │ ├── DatePickerPreference.java │ │ ├── DatePickerPreferenceDialogFragmentCompat.java │ │ ├── TimePickerPreference.java │ │ └── TimePickerPreferenceDialogFragmentCompat.java │ └── res │ └── values │ └── attrs.xml ├── preferencex-ringtone ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── takisoft │ │ └── preferencex │ │ ├── RingtonePreference.java │ │ └── RingtonePreferenceDialogFragmentCompat.java │ └── res │ ├── drawable │ └── ringtone_ic_add.xml │ ├── layout │ └── add_ringtone_item.xml │ ├── values-af │ └── strings.xml │ ├── values-am │ └── strings.xml │ ├── values-ar │ └── strings.xml │ ├── values-az │ └── strings.xml │ ├── values-b+sr+Latn │ └── strings.xml │ ├── values-be │ └── strings.xml │ ├── values-bg │ └── strings.xml │ ├── values-bn │ └── strings.xml │ ├── values-bs │ └── strings.xml │ ├── values-ca │ └── strings.xml │ ├── values-cs │ └── strings.xml │ ├── values-da │ └── strings.xml │ ├── values-de │ └── strings.xml │ ├── values-el │ └── strings.xml │ ├── values-en-rAU │ └── strings.xml │ ├── values-en-rGB │ └── strings.xml │ ├── values-en-rIN │ └── strings.xml │ ├── values-es-rUS │ └── strings.xml │ ├── values-es │ └── strings.xml │ ├── values-et │ └── strings.xml │ ├── values-eu │ └── strings.xml │ ├── values-fa │ └── strings.xml │ ├── values-fi │ └── strings.xml │ ├── values-fr-rCA │ └── strings.xml │ ├── values-fr │ └── strings.xml │ ├── values-gl │ └── strings.xml │ ├── values-gu │ └── strings.xml │ ├── values-hi │ └── strings.xml │ ├── values-hr │ └── strings.xml │ ├── values-hu │ └── strings.xml │ ├── values-hy │ └── strings.xml │ ├── values-in │ └── strings.xml │ ├── values-is │ └── strings.xml │ ├── values-it │ └── strings.xml │ ├── values-iw │ └── strings.xml │ ├── values-ja │ └── strings.xml │ ├── values-ka │ └── strings.xml │ ├── values-kk │ └── strings.xml │ ├── values-km │ └── strings.xml │ ├── values-kn │ └── strings.xml │ ├── values-ko │ └── strings.xml │ ├── values-ky │ └── strings.xml │ ├── values-lo │ └── strings.xml │ ├── values-lt │ └── strings.xml │ ├── values-lv │ └── strings.xml │ ├── values-mk │ └── strings.xml │ ├── values-ml │ └── strings.xml │ ├── values-mn │ └── strings.xml │ ├── values-mr │ └── strings.xml │ ├── values-ms │ └── strings.xml │ ├── values-my │ └── strings.xml │ ├── values-nb │ └── strings.xml │ ├── values-ne │ └── strings.xml │ ├── values-nl │ └── strings.xml │ ├── values-pa │ └── strings.xml │ ├── values-pl │ └── strings.xml │ ├── values-pt-rBR │ └── strings.xml │ ├── values-pt-rPT │ └── strings.xml │ ├── values-pt │ └── strings.xml │ ├── values-ro │ └── strings.xml │ ├── values-ru │ └── strings.xml │ ├── values-si │ └── strings.xml │ ├── values-sk │ └── strings.xml │ ├── values-sl │ └── strings.xml │ ├── values-sq │ └── strings.xml │ ├── values-sr │ └── strings.xml │ ├── values-sv │ └── strings.xml │ ├── values-sw │ └── strings.xml │ ├── values-ta │ └── strings.xml │ ├── values-te │ └── strings.xml │ ├── values-th │ └── strings.xml │ ├── values-tl │ └── strings.xml │ ├── values-tr │ └── strings.xml │ ├── values-uk │ └── strings.xml │ ├── values-ur │ └── strings.xml │ ├── values-uz │ └── strings.xml │ ├── values-vi │ └── strings.xml │ ├── values-zh-rCN │ └── strings.xml │ ├── values-zh-rHK │ └── strings.xml │ ├── values-zh-rTW │ └── strings.xml │ ├── values-zu │ └── strings.xml │ └── values │ ├── attrs.xml │ └── strings.xml ├── preferencex-simplemenu ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── takisoft │ │ └── preferencex │ │ ├── SimpleMenuPreference.java │ │ ├── animation │ │ ├── PropertyHolder.java │ │ ├── RectEvaluator.java │ │ ├── SimpleMenuAnimation.java │ │ └── SimpleMenuBoundsProperty.java │ │ ├── drawable │ │ └── FixedBoundsDrawable.java │ │ └── widget │ │ ├── SimpleMenuListAdapter.java │ │ ├── SimpleMenuListItemHolder.java │ │ └── SimpleMenuPopupWindow.java │ └── res │ ├── anim │ └── abc_shrink_fade_out_center.xml │ ├── drawable │ ├── simple_menu_background.xml │ └── simple_menu_item_background.xml │ ├── layout-v21 │ └── preference_simplemenu.xml │ ├── layout │ ├── preference_simplemenu.xml │ ├── simple_menu_item.xml │ └── simple_menu_list.xml │ ├── values-night │ └── colors.xml │ ├── values-sw600dp │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ └── styles.xml ├── preferencex ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ ├── androidx │ │ └── preference │ │ │ └── PreferenceManagerFix.java │ └── com │ │ └── takisoft │ │ └── preferencex │ │ ├── AutoSummaryEditTextPreference.java │ │ ├── EditTextPreference.java │ │ ├── PreferenceActivityResultListener.java │ │ ├── PreferenceCategory.java │ │ ├── PreferenceFragmentCompat.java │ │ ├── PreferenceFragmentCompatMasterSwitch.java │ │ └── SwitchPreferenceCompat.java │ └── res │ ├── layout │ ├── preference_list_master_switch.xml │ └── preference_material_ext.xml │ └── values │ ├── attrs.xml │ ├── ids.xml │ └── styles.xml ├── scripts ├── publish-module.gradle └── publish-root.gradle └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | /*/build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | .gradle 30 | /local.properties 31 | /.idea/workspace.xml 32 | /.idea/libraries 33 | .DS_Store 34 | /build 35 | /captures 36 | .idea/ 37 | *.iml 38 | *.iws 39 | *.ipr 40 | *~ 41 | *.swp 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidX Preference eXtended 2 | 3 | This 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`. 4 | 5 | [![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) 6 | 7 | ### Donation 8 | 9 | If you would like to support me, you may donate some small amount via PayPal. 10 | 11 | [ ![Buy me a coffee](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/donate.png)](https://www.paypal.me/korossyg/0eur) 12 | 13 | --- 14 | 15 | ## How to use the library? 16 | ### 1. Add gradle dependency 17 | **Add** this to your gradle file: 18 | ```gradle 19 | implementation "androidx.preference:preference:$androidxVersion" 20 | implementation 'com.takisoft.preferencex:preferencex:1.1.0' 21 | ``` 22 | 23 | ### 2. Use the appropriate class as your fragment's base 24 | 25 | ```java 26 | import com.takisoft.preferencex.PreferenceFragmentCompat; 27 | 28 | public class MyPreferenceFragment extends PreferenceFragmentCompat { 29 | 30 | @Override 31 | public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) { 32 | setPreferencesFromResource(R.xml.settings, rootKey); 33 | 34 | // additional setup 35 | } 36 | } 37 | ``` 38 | > **Warning!** Watch out for the correct package name when importing `PreferenceFragmentCompat`, it should come from `com.takisoft.preferencex`. 39 | 40 | Now you can enjoy using preferenceX. 41 | 42 | --- 43 | 44 | ## Extra types 45 | 46 | There 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. 47 | 48 | Preference | Dependency | Preview 49 | -|-|- 50 | [`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) 51 | [`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) 52 | [`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) 53 | [`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) 54 | [`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) 55 | 56 | --- 57 | 58 | ## Custom solutions 59 | 60 | ### Hijacked `EditTextPreference` 61 | The 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. 62 | 63 | The sample app shows an example of setting (via XML) and querying (programmatically) the input type of the `EditTextPreference`: 64 | ```xml 65 | 68 | ``` 69 | 70 | ```java 71 | EditTextPreference etPref = (EditTextPreference) findPreference("edit_text_test"); 72 | if (etPref != null) { 73 | int inputType = etPref.getEditText().getInputType(); 74 | // do something with inputType 75 | } 76 | ``` 77 | > **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`. 78 | 79 | ### Others 80 | 81 | * Convenience methods in `PreferenceFragmentCompat`; 82 | * `PreferenceCategory` with different colors; 83 | * `AutoSummaryEditTextPreference`; 84 | * `PreferenceActivityResultListener`; 85 | * `EditTextPreference` correctly calls `notifyChange`. ([#66](https://github.com/Gericop/Android-Support-Preference-V7-Fix/pull/66)) 86 | 87 | 88 | --- 89 | 90 | ## Version 91 | The current stable version is **1.1.0**. 92 | 93 | ## Notes # 94 | This demo / bugfix is set to work on API level 14+. 95 | 96 | --- 97 | 98 | ## Sample 99 | 100 | _Material design - everywhere._ 101 | 102 | API 15 | API 21 | API 26 103 | -|-|- 104 | ![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) 105 | 106 | --- 107 | 108 | ### Changelog 109 | 110 | See the separate CHANGELOG.md file. 111 | 112 | **2019-11-26** 113 | 114 | New version: 1.1.0 (based on v1.1.0) 115 | 116 | - introduced `PreferenceFragmentCompatMasterSwitch` that can be used as a switch's additional screen for settings; see the sample for details 117 | - Added `pref_disableMessagePaddingFix` attribute to the `EditTextPreference` that can be used to disable the dialog message padding fix. 118 | - `EditText` does not receive all attributes from `EditTextPreference` from now, only the following: `inputType`, `textAllCaps`, `lines`, `minLines`, `maxLines`, `ems`, `minEms`, `maxEms` 119 | - `AutoSummaryEditTextPreference` is now deprecated, use an appropriate `SummaryProvider` with the `EditTextPreference` 120 | 121 | > For older changelogs, check out the [CHANGELOG](CHANGELOG.md) file. 122 | 123 | Feel free to ask / suggest anything on this page by creating a ticket (*issues*)! 124 | 125 | # License notes # 126 | Apache v2 127 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion rootProject.sdkVersion 5 | 6 | defaultConfig { 7 | applicationId "com.takisoft.preferencex.demo" 8 | minSdkVersion rootProject.minSdkVersion 9 | targetSdkVersion rootProject.sdkVersion 10 | versionCode 1 11 | versionName "1.0" 12 | multiDexEnabled true 13 | vectorDrawables.useSupportLibrary = true 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation 'androidx.multidex:multidex:2.0.1' 25 | implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion" 26 | implementation "com.google.android.material:material:$materialVersion" 27 | implementation project(':preferencex') 28 | implementation project(':preferencex-colorpicker') 29 | implementation project(':preferencex-datetimepicker') 30 | implementation project(':preferencex-ringtone') 31 | implementation project(':preferencex-simplemenu') 32 | } 33 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/takisoft/preferencex/demo/ActivityResultTestPreference.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.demo; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import androidx.annotation.NonNull; 7 | import androidx.annotation.Nullable; 8 | import androidx.preference.Preference; 9 | import android.util.AttributeSet; 10 | import android.widget.Toast; 11 | 12 | import com.takisoft.preferencex.PreferenceActivityResultListener; 13 | import com.takisoft.preferencex.PreferenceFragmentCompat; 14 | 15 | public class ActivityResultTestPreference extends Preference implements PreferenceActivityResultListener { 16 | public static final int RC_GET_CONTENT = 3462; 17 | 18 | public ActivityResultTestPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 19 | super(context, attrs, defStyleAttr, defStyleRes); 20 | } 21 | 22 | public ActivityResultTestPreference(Context context, AttributeSet attrs, int defStyleAttr) { 23 | super(context, attrs, defStyleAttr); 24 | } 25 | 26 | public ActivityResultTestPreference(Context context, AttributeSet attrs) { 27 | super(context, attrs); 28 | } 29 | 30 | public ActivityResultTestPreference(Context context) { 31 | super(context); 32 | } 33 | 34 | @Override 35 | public void onPreferenceClick(@NonNull PreferenceFragmentCompat fragment, @NonNull Preference preference) { 36 | Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 37 | intent.setType("*/*"); 38 | intent.addCategory(Intent.CATEGORY_OPENABLE); 39 | 40 | fragment.startActivityForResult(intent, RC_GET_CONTENT); 41 | } 42 | 43 | @Override 44 | public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { 45 | if (requestCode == RC_GET_CONTENT && resultCode == Activity.RESULT_OK && data != null) { 46 | Toast.makeText(getContext(), data.getDataString(), Toast.LENGTH_LONG).show(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/takisoft/preferencex/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.demo; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | 6 | import androidx.annotation.Nullable; 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import androidx.appcompat.widget.Toolbar; 9 | import androidx.fragment.app.FragmentTransaction; 10 | import androidx.preference.PreferenceFragmentCompat; 11 | import androidx.preference.PreferenceScreen; 12 | 13 | public class MainActivity extends AppCompatActivity implements PreferenceFragmentCompat.OnPreferenceStartScreenCallback { 14 | 15 | @Override 16 | protected void onCreate(@Nullable Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_main); 19 | 20 | Toolbar toolbar = findViewById(R.id.toolbar); 21 | setSupportActionBar(toolbar); 22 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 23 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View v) { 26 | onBackPressed(); 27 | } 28 | }); 29 | 30 | if (savedInstanceState == null) { 31 | MyPreferenceFragment fragment = new MyPreferenceFragment(); 32 | 33 | FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); 34 | ft.replace(R.id.fragment, fragment); 35 | ft.commitAllowingStateLoss(); 36 | } 37 | } 38 | 39 | @Override 40 | public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { 41 | MyPreferenceFragment fragment = new MyPreferenceFragment(); 42 | Bundle args = new Bundle(); 43 | args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, preferenceScreen.getKey()); 44 | fragment.setArguments(args); 45 | 46 | FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); 47 | ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); 48 | ft.replace(R.id.fragment, fragment, preferenceScreen.getKey()); 49 | ft.addToBackStack(preferenceScreen.getKey()); 50 | ft.commitAllowingStateLoss(); 51 | 52 | return true; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/takisoft/preferencex/demo/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.demo; 2 | 3 | import androidx.multidex.MultiDexApplication; 4 | 5 | public class MyApplication extends MultiDexApplication { 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/takisoft/preferencex/demo/MyMasterSwitchFragment.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.demo; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.annotation.Nullable; 6 | 7 | import com.takisoft.preferencex.PreferenceFragmentCompatMasterSwitch; 8 | 9 | public class MyMasterSwitchFragment extends PreferenceFragmentCompatMasterSwitch { 10 | @Override 11 | public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) { 12 | setPreferencesFromResource(R.xml.settings_master, rootKey); 13 | 14 | getMasterSwitch().setOnPreferenceChangeListener(new OnMasterSwitchChangeListener() { 15 | @Override 16 | public boolean onMasterSwitchChange(boolean newValue) { 17 | updatePreferences(newValue); 18 | return true; 19 | } 20 | }); 21 | 22 | updatePreferences(getMasterSwitch().isChecked()); 23 | } 24 | 25 | private void updatePreferences(boolean enabled) { 26 | findPreference("cat_enabled").setVisible(enabled); 27 | findPreference("cat_disabled").setVisible(!enabled); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/takisoft/preferencex/demo/MyPreferenceFragment.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.demo; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | 6 | import com.takisoft.preferencex.PreferenceFragmentCompat; 7 | 8 | import androidx.annotation.Nullable; 9 | import androidx.preference.Preference; 10 | import androidx.preference.PreferenceCategory; 11 | 12 | /** 13 | * A placeholder fragment containing a simple view. 14 | */ 15 | public class MyPreferenceFragment extends PreferenceFragmentCompat { 16 | 17 | @Override 18 | public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) { 19 | setPreferencesFromResource(R.xml.settings, rootKey); 20 | 21 | testDynamicPrefs(); 22 | 23 | Preference prefEmptyCheck = findPreference("pref_empty_check"); 24 | 25 | if (prefEmptyCheck != null) { 26 | prefEmptyCheck.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { 27 | @Override 28 | public boolean onPreferenceChange(Preference preference, Object newValue) { 29 | if (!(Boolean) newValue) { 30 | findPreference("pref_empty_categ").setTitle(null); 31 | } else { 32 | findPreference("pref_empty_categ").setTitle("Now you see me"); 33 | } 34 | 35 | return true; 36 | } 37 | }); 38 | } 39 | } 40 | 41 | private void testDynamicPrefs() { 42 | final Context ctx = getPreferenceManager().getContext(); // this is the material styled context 43 | 44 | final PreferenceCategory dynamicCategory = (PreferenceCategory) findPreference("pref_categ"); 45 | 46 | Preference prefAdd = findPreference("pref_add"); 47 | if (prefAdd != null) { 48 | prefAdd.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 49 | private int n = 0; 50 | 51 | @Override 52 | public boolean onPreferenceClick(Preference preference) { 53 | Preference newPreference = new Preference(ctx); 54 | 55 | newPreference.setTitle("New preference " + n++); 56 | newPreference.setSummary(Long.toString(System.currentTimeMillis())); 57 | 58 | if (dynamicCategory != null) { 59 | dynamicCategory.addPreference(newPreference); 60 | } 61 | return true; 62 | } 63 | }); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_info_outline_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lock_outline_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 21 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors_indigo_pink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #C5CAE9 6 | #FF4081 7 | #212121 8 | #727272 9 | #FFFFFF 10 | #B6B6B6 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SupportPreferenceFix 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 16 | 17 | 21 | 22 | 30 | 31 | 34 | 35 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/test_list_entries.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Alpha 5 | Bravo 6 | Charlie 7 | 8 | 9 | A 10 | B 11 | C 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/xml/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 14 | 19 | 24 | 28 | 32 | 38 | 42 | 45 | 46 | 49 | 54 | 55 | 58 | 61 | 62 | 63 | 70 | 78 | 86 | 93 | 97 | 100 | 104 | 105 | 106 | 109 | 120 | 128 | 135 | 143 | 151 | 152 | 155 | 161 | 162 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/xml/settings_master.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 23 | 24 | 25 | 28 | 32 | 33 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext { 4 | minSdkVersion = 14 5 | sdkVersion = 29 6 | materialVersion = '1.2.0-alpha02' 7 | androidxAppcompatVersion = '1.1.0' 8 | androidxPreferenceVersion = '1.1.0' 9 | 10 | libVersion = '1.1.0' 11 | } 12 | repositories { 13 | google() 14 | mavenCentral() 15 | maven { 16 | url "https://plugins.gradle.org/m2/" 17 | } 18 | } 19 | dependencies { 20 | classpath 'com.android.tools.build:gradle:7.3.0-alpha03' 21 | // NOTE: Do not place your application dependencies here; they belong 22 | // in the individual module build.gradle files 23 | } 24 | } 25 | 26 | plugins { 27 | id "io.github.gradle-nexus.publish-plugin" version "1.1.0" 28 | } 29 | 30 | allprojects { 31 | repositories { 32 | google() 33 | mavenCentral() 34 | } 35 | } 36 | 37 | task clean(type: Delete) { 38 | delete rootProject.buildDir 39 | } 40 | 41 | apply from: "${rootDir}/scripts/publish-root.gradle" -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | android.enableJetifier=true 20 | android.useAndroidX=true 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Oct 25 11:19:10 CEST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn ( ) { 37 | echo "$*" 38 | } 39 | 40 | die ( ) { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | for s in "${@}" ; do 159 | s=\"$s\" 160 | APP_ARGS=$APP_ARGS" "$s 161 | done 162 | 163 | # Collect all arguments for the java command, following the shell quoting and substitution rules 164 | eval set -- "$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$GRADLE_OPTS" "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 165 | 166 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 167 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 168 | cd "$(dirname "$0")" 169 | fi 170 | 171 | exec "$JAVACMD" "$@" 172 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /images/base_api15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/base_api15.png -------------------------------------------------------------------------------- /images/base_api21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/base_api21.png -------------------------------------------------------------------------------- /images/base_api26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/base_api26.png -------------------------------------------------------------------------------- /images/colorpicker_api26_fixed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/colorpicker_api26_fixed.png -------------------------------------------------------------------------------- /images/datepicker_api15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/datepicker_api15.png -------------------------------------------------------------------------------- /images/datepicker_api26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/datepicker_api26.png -------------------------------------------------------------------------------- /images/donate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/donate.png -------------------------------------------------------------------------------- /images/ringtone_api15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/ringtone_api15.png -------------------------------------------------------------------------------- /images/ringtone_api26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/ringtone_api26.png -------------------------------------------------------------------------------- /images/simplemenu_api26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/simplemenu_api26.png -------------------------------------------------------------------------------- /images/timepicker_api15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/timepicker_api15.png -------------------------------------------------------------------------------- /images/timepicker_api26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/images/timepicker_api26.png -------------------------------------------------------------------------------- /preferencex-colorpicker/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /preferencex-colorpicker/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.sdkVersion 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.minSdkVersion 8 | targetSdkVersion rootProject.sdkVersion 9 | 10 | vectorDrawables.useSupportLibrary = true 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | consumerProguardFiles 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | lintOptions { 20 | abortOnError false 21 | } 22 | } 23 | 24 | ext { 25 | PUBLISH_GROUP_ID = 'com.takisoft.preferencex' 26 | PUBLISH_VERSION = rootProject.libVersion 27 | PUBLISH_ARTIFACT_ID = 'preferencex-colorpicker' 28 | PUBLISH_DESCRIPTION = 'AndroidX Preference - ColorPickerPreference' 29 | PUBLISH_URL = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix' 30 | PUBLISH_LICENSE_NAME = 'The Apache Software License, Version 2.0' 31 | PUBLISH_LICENSE_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 32 | PUBLISH_DEVELOPER_ID = 'gericop' 33 | PUBLISH_DEVELOPER_NAME = 'Gergely Kőrössy' 34 | PUBLISH_DEVELOPER_EMAIL = 'korossyg@takisoft.com' 35 | PUBLISH_SCM_CONNECTION = 36 | 'scm:git:github.com/Gericop/Android-Support-Preference-V7-Fix.git' 37 | PUBLISH_SCM_DEVELOPER_CONNECTION = 38 | 'scm:git:ssh://github.com/Gericop/Android-Support-Preference-V7-Fix.git' 39 | PUBLISH_SCM_URL = 40 | 'https://github.com/Gericop/Android-Support-Preference-V7-Fix/tree/master' 41 | } 42 | 43 | apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" 44 | 45 | dependencies { 46 | implementation project(':preferencex') 47 | implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion" 48 | api 'com.takisoft.colorpicker:colorpicker:1.0.0' 49 | } -------------------------------------------------------------------------------- /preferencex-colorpicker/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /preferencex-colorpicker/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /preferencex-colorpicker/src/main/java/com/takisoft/preferencex/ColorPickerPreferenceDialogFragmentCompat.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.app.Dialog; 4 | import android.content.DialogInterface; 5 | import android.os.Bundle; 6 | import androidx.annotation.NonNull; 7 | import androidx.preference.PreferenceDialogFragmentCompat; 8 | 9 | import com.takisoft.colorpicker.ColorPickerDialog; 10 | import com.takisoft.colorpicker.OnColorSelectedListener; 11 | 12 | public class ColorPickerPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat implements OnColorSelectedListener { 13 | 14 | private int pickedColor; 15 | 16 | @NonNull 17 | @Override 18 | public Dialog onCreateDialog(Bundle savedInstanceState) { 19 | ColorPickerPreference pref = getColorPickerPreference(); 20 | 21 | ColorPickerDialog.Params params = new ColorPickerDialog.Params.Builder(getContext()) 22 | .setSelectedColor(pref.getColor()) 23 | .setColors(pref.getColors()) 24 | .setColorContentDescriptions(pref.getColorDescriptions()) 25 | .setSize(pref.getSize()) 26 | .setSortColors(pref.isSortColors()) 27 | .setColumns(pref.getColumns()) 28 | .build(); 29 | 30 | ColorPickerDialog dialog = new ColorPickerDialog(getActivity(), this, params); 31 | dialog.setTitle(pref.getDialogTitle()); 32 | 33 | return dialog; 34 | } 35 | 36 | /*@Override 37 | public void onClick(DialogInterface dialog, int which) { 38 | super.onClick(dialog, which); 39 | 40 | if (which == DialogInterface.BUTTON_POSITIVE) { 41 | //((DatePickerDialog) getDialog()).onClick(dialog, which); 42 | } 43 | }*/ 44 | 45 | @Override 46 | public void onDialogClosed(boolean positiveResult) { 47 | ColorPickerPreference preference = getColorPickerPreference(); 48 | 49 | if (positiveResult && preference.callChangeListener(pickedColor)) { 50 | preference.setColor(pickedColor); 51 | } 52 | } 53 | 54 | @Override 55 | public void onColorSelected(int color) { 56 | this.pickedColor = color; 57 | 58 | super.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); 59 | } 60 | 61 | ColorPickerPreference getColorPickerPreference() { 62 | return (ColorPickerPreference) getPreference(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /preferencex-colorpicker/src/main/res/drawable/colorpickerpreference_pref_swatch.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /preferencex-colorpicker/src/main/res/layout/preference_widget_color_swatch.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /preferencex-colorpicker/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /preferencex-colorpicker/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 24dp 4 | -------------------------------------------------------------------------------- /preferencex-datetimepicker/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /preferencex-datetimepicker/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.sdkVersion 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.minSdkVersion 8 | targetSdkVersion rootProject.sdkVersion 9 | } 10 | buildTypes { 11 | release { 12 | minifyEnabled false 13 | consumerProguardFiles 'proguard-rules.pro' 14 | } 15 | } 16 | 17 | lintOptions { 18 | abortOnError false 19 | } 20 | } 21 | 22 | ext { 23 | PUBLISH_GROUP_ID = 'com.takisoft.preferencex' 24 | PUBLISH_VERSION = rootProject.libVersion 25 | PUBLISH_ARTIFACT_ID = 'preferencex-datetimepicker' 26 | PUBLISH_DESCRIPTION = 'AndroidX Preference - DatePickerPreference and TimePickerPreference' 27 | PUBLISH_URL = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix' 28 | PUBLISH_LICENSE_NAME = 'The Apache Software License, Version 2.0' 29 | PUBLISH_LICENSE_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 30 | PUBLISH_DEVELOPER_ID = 'gericop' 31 | PUBLISH_DEVELOPER_NAME = 'Gergely Kőrössy' 32 | PUBLISH_DEVELOPER_EMAIL = 'korossyg@takisoft.com' 33 | PUBLISH_SCM_CONNECTION = 34 | 'scm:git:github.com/Gericop/Android-Support-Preference-V7-Fix.git' 35 | PUBLISH_SCM_DEVELOPER_CONNECTION = 36 | 'scm:git:ssh://github.com/Gericop/Android-Support-Preference-V7-Fix.git' 37 | PUBLISH_SCM_URL = 38 | 'https://github.com/Gericop/Android-Support-Preference-V7-Fix/tree/master' 39 | } 40 | 41 | apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" 42 | 43 | dependencies { 44 | implementation project(':preferencex') 45 | api 'com.takisoft.datetimepicker:datetimepicker:1.0.2' 46 | } -------------------------------------------------------------------------------- /preferencex-datetimepicker/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /preferencex-datetimepicker/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /preferencex-datetimepicker/src/main/java/com/takisoft/preferencex/DatePickerPreferenceDialogFragmentCompat.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.app.Dialog; 4 | import android.content.DialogInterface; 5 | import android.os.Bundle; 6 | import androidx.annotation.NonNull; 7 | import androidx.preference.PreferenceDialogFragmentCompat; 8 | 9 | import com.takisoft.datetimepicker.DatePickerDialog; 10 | import com.takisoft.datetimepicker.widget.DatePicker; 11 | 12 | import java.util.Calendar; 13 | import java.util.Date; 14 | 15 | public class DatePickerPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat implements DatePickerDialog.OnDateSetListener { 16 | 17 | private int pickedYear; 18 | private int pickedMonth; 19 | private int pickedDay; 20 | 21 | private DatePickerPreference getDatePickerPreference() { 22 | return (DatePickerPreference) getPreference(); 23 | } 24 | 25 | @NonNull 26 | @Override 27 | public Dialog onCreateDialog(Bundle savedInstanceState) { 28 | DatePickerPreference preference = getDatePickerPreference(); 29 | 30 | Calendar cal = Calendar.getInstance(); 31 | 32 | Date date = preference.getDate(); 33 | Date pickerDate = preference.getPickerDate(); 34 | Date minDate = preference.getMinDate(); 35 | Date maxDate = preference.getMaxDate(); 36 | 37 | if (date != null) { 38 | cal.setTime(date); 39 | } else if (pickerDate != null) { 40 | cal.setTime(pickerDate); 41 | } 42 | 43 | DatePickerDialog dialog = new DatePickerDialog(getActivity(), this, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); 44 | 45 | DatePicker picker = dialog.getDatePicker(); 46 | 47 | if (minDate != null) { 48 | cal.setTime(minDate); 49 | picker.setMinDate(cal.getTimeInMillis()); 50 | } 51 | 52 | if (maxDate != null) { 53 | cal.setTime(maxDate); 54 | picker.setMaxDate(cal.getTimeInMillis()); 55 | } 56 | 57 | //dialog.setTitle(preference.getDialogTitle()); // this does not work in landscape 58 | //dialog.setIcon(preference.getDialogIcon()); 59 | dialog.setButton(DialogInterface.BUTTON_POSITIVE, preference.getPositiveButtonText(), this); 60 | dialog.setButton(DialogInterface.BUTTON_NEGATIVE, preference.getNegativeButtonText(), this); 61 | 62 | return dialog; 63 | } 64 | 65 | @Override 66 | public void onClick(DialogInterface dialog, int which) { 67 | super.onClick(dialog, which); 68 | 69 | if (which == DialogInterface.BUTTON_POSITIVE) { 70 | ((DatePickerDialog) getDialog()).onClick(dialog, which); 71 | } 72 | } 73 | 74 | @Override 75 | public void onDialogClosed(boolean positiveResult) { 76 | DatePickerPreference preference = getDatePickerPreference(); 77 | 78 | if (positiveResult && preference.callChangeListener(new DatePickerPreference.DateWrapper(pickedYear, pickedMonth, pickedDay))) { 79 | preference.setDate(pickedYear, pickedMonth, pickedDay); 80 | } 81 | } 82 | 83 | @Override 84 | public void onDateSet(DatePicker datePicker, int year, int month, int day) { 85 | pickedYear = year; 86 | pickedMonth = month; 87 | pickedDay = day; 88 | 89 | super.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /preferencex-datetimepicker/src/main/java/com/takisoft/preferencex/TimePickerPreferenceDialogFragmentCompat.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.app.Dialog; 4 | import android.content.DialogInterface; 5 | import android.os.Bundle; 6 | import androidx.annotation.NonNull; 7 | import androidx.preference.PreferenceDialogFragmentCompat; 8 | 9 | import com.takisoft.datetimepicker.TimePickerDialog; 10 | import com.takisoft.datetimepicker.widget.TimePicker; 11 | 12 | import java.util.Calendar; 13 | import java.util.Date; 14 | 15 | public class TimePickerPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat implements TimePickerDialog.OnTimeSetListener { 16 | 17 | private int pickedHour; 18 | private int pickedMinute; 19 | 20 | private TimePickerPreference getTimePickerPreference() { 21 | return (TimePickerPreference) getPreference(); 22 | } 23 | 24 | @NonNull 25 | @Override 26 | public Dialog onCreateDialog(Bundle savedInstanceState) { 27 | TimePickerPreference preference = getTimePickerPreference(); 28 | 29 | Calendar cal = Calendar.getInstance(); 30 | 31 | Date time = preference.getTime(); 32 | Date pickerTime = preference.getPickerTime(); 33 | 34 | if (time != null) { 35 | cal.setTime(time); 36 | } else if (pickerTime != null) { 37 | cal.setTime(pickerTime); 38 | } 39 | 40 | TimePickerDialog dialog = new TimePickerDialog(getActivity(), this, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), preference.is24HourView()); 41 | dialog.setButton(DialogInterface.BUTTON_POSITIVE, preference.getPositiveButtonText(), this); 42 | dialog.setButton(DialogInterface.BUTTON_NEGATIVE, preference.getNegativeButtonText(), this); 43 | 44 | return dialog; 45 | } 46 | 47 | @Override 48 | public void onClick(DialogInterface dialog, int which) { 49 | super.onClick(dialog, which); 50 | 51 | if (which == DialogInterface.BUTTON_POSITIVE) { 52 | ((TimePickerDialog) getDialog()).onClick(dialog, which); 53 | } 54 | } 55 | 56 | @Override 57 | public void onDialogClosed(boolean positiveResult) { 58 | TimePickerPreference preference = getTimePickerPreference(); 59 | 60 | if (positiveResult && preference.callChangeListener(new TimePickerPreference.TimeWrapper(pickedHour, pickedMinute))) { 61 | preference.setTime(pickedHour, pickedMinute); 62 | } 63 | } 64 | 65 | @Override 66 | public void onTimeSet(TimePicker timePicker, int hourOfDay, int minute) { 67 | pickedHour = hourOfDay; 68 | pickedMinute = minute; 69 | 70 | //onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); 71 | super.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /preferencex-datetimepicker/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /preferencex-ringtone/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /preferencex-ringtone/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.sdkVersion 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.minSdkVersion 8 | targetSdkVersion rootProject.sdkVersion 9 | 10 | vectorDrawables.useSupportLibrary = true 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | consumerProguardFiles 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | lintOptions { 20 | abortOnError false 21 | } 22 | } 23 | 24 | ext { 25 | PUBLISH_GROUP_ID = 'com.takisoft.preferencex' 26 | PUBLISH_VERSION = rootProject.libVersion 27 | PUBLISH_ARTIFACT_ID = 'preferencex-ringtone' 28 | PUBLISH_DESCRIPTION = 'AndroidX Preference - RingtonePreference' 29 | PUBLISH_URL = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix' 30 | PUBLISH_LICENSE_NAME = 'The Apache Software License, Version 2.0' 31 | PUBLISH_LICENSE_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 32 | PUBLISH_DEVELOPER_ID = 'gericop' 33 | PUBLISH_DEVELOPER_NAME = 'Gergely Kőrössy' 34 | PUBLISH_DEVELOPER_EMAIL = 'korossyg@takisoft.com' 35 | PUBLISH_SCM_CONNECTION = 36 | 'scm:git:github.com/Gericop/Android-Support-Preference-V7-Fix.git' 37 | PUBLISH_SCM_DEVELOPER_CONNECTION = 38 | 'scm:git:ssh://github.com/Gericop/Android-Support-Preference-V7-Fix.git' 39 | PUBLISH_SCM_URL = 40 | 'https://github.com/Gericop/Android-Support-Preference-V7-Fix/tree/master' 41 | } 42 | 43 | apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" 44 | 45 | dependencies { 46 | implementation project(':preferencex') 47 | implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion" 48 | } -------------------------------------------------------------------------------- /preferencex-ringtone/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/drawable/ringtone_ic_add.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/layout/add_ringtone_item.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 23 | 24 | 33 | 34 | 48 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-af/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Verstekluitoon 3 | Geen 4 | Luitone 5 | Verstekkennisgewing-klank 6 | Verstekwekkerklank 7 | Voeg luitoon by 8 | Kan nie gepasmaakte luitoon byvoeg nie 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-am/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ነባሪ የስልክ ላይ ጥሪ 3 | ምንም 4 | ጥሪ ድምፆች 5 | ነባሪ የማሳወቂያ ድምጽ 6 | ነባሪ የማንቂያ ድምፅ 7 | የጥሪ ቅላጼ አክል 8 | ብጁ የጥሪ ቅላጼን ማከል አልተቻለም 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ar/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | نغمة الرنين الافتراضية 3 | لا شيء 4 | نغمات الرنين 5 | صوت الإشعار التلقائي 6 | صوت التنبيه الافتراضي 7 | إضافة نغمة رنين 8 | يتعذر إضافة نغمة رنين مخصصة 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-az/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Defolt rinqton 3 | Heç biri 4 | Zəng səsləri 5 | Varsayılan bildiriş səsi 6 | Defolt siqnal səsi 7 | Zəng səsi daxil edin 8 | Fərdi zəng səsi əlavə etmək mümkün deyil 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-b+sr+Latn/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Podrazumevani zvuk zvona 3 | Bez zvuka 4 | Zvukovi zvona 5 | Podrazumevani zvuk obaveštenja 6 | Podrazumevani zvuk alarma 7 | Dodaj melodiju zvona 8 | Dodavanje prilagođene melodije zvona nije uspelo 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-be/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Стандартны рынгтон 3 | Няма 4 | Рынгтоны 5 | Стандартны сігнал апавяшчэння 6 | Стандартны сігнал будзільніка 7 | Дадаць рынгтон 8 | Немагчыма дадаць карыстальніцкі рынгтон 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-bg/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Стандартна мелодия 3 | Без 4 | Мелодии 5 | Стандартен звук за известяване 6 | Стандартен звук за будилника 7 | Добавяне на мелодия 8 | Персонализираната мелодия не може да се добави 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-bn/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ডিফল্ট রিংটোন 3 | কোনো কিছুই নয় 4 | রিংটোনগুলি 5 | ডিফল্ট বিজ্ঞপ্তি শব্দ 6 | ডিফল্ট অ্যালার্মের শব্দ 7 | রিংটোন যোগ করুন 8 | কাস্টম রিংটোন যোগ করা গেল না 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-bs/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Zadana melodija zvona 3 | Bez zvuka 4 | Melodije zvona 5 | Zadani zvuk obavještenja 6 | Zadani zvuk alarma 7 | Dodaj melodiju zvona 8 | Nije moguće dodati prilagođenu melodiju zvona 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ca/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | So predeterminat 3 | Cap 4 | Sons 5 | So de notificació predeterminat 6 | So d\'alarma predeterminat 7 | Afegeix un so de trucada 8 | No es pot afegir el so de trucada personalitzat 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-cs/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Výchozí vyzváněcí tón 3 | Žádný 4 | Vyzváněcí tóny 5 | Výchozí zvuk oznámení 6 | Výchozí zvuk budíku 7 | Přidat vyzváněcí tón 8 | Vlastní vyzváněcí tón se nepodařilo přidat 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-da/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Standardringetone 3 | Ingen 4 | Ringetoner 5 | Standardlyd for underretninger 6 | Standardlyd for alarmer 7 | Tilføj ringetone 8 | Den tilpassede ringetone kunne ikke tilføjes 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Standard-Klingelton 3 | Ohne 4 | Klingeltöne 5 | Standard-Benachrichtigungston 6 | Standard-Weckton 7 | Klingelton hinzufügen 8 | Benutzerdefinierter Klingelton konnte nicht hinzugefügt werden 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-el/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Προεπιλεγμένος ήχος κλήσης 3 | Κανένας 4 | Ήχοι κλήσης 5 | Προεπιλεγμένος ήχος ειδοποίησης 6 | Προεπιλεγμένος ήχος ειδοποίησης 7 | Προσθήκη ήχου κλήσης 8 | Δεν είναι δυνατή η προσθήκη προσαρμοσμένου ήχου κλήσης 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-en-rAU/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Default ringtone 3 | None 4 | Ringtones 5 | Default notification sound 6 | Default alarm sound 7 | Add ringtone 8 | Unable to add customised ringtone 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-en-rGB/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Default ringtone 3 | None 4 | Ringtones 5 | Default notification sound 6 | Default alarm sound 7 | Add ringtone 8 | Unable to add customised ringtone 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-en-rIN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Default ringtone 3 | None 4 | Ringtones 5 | Default notification sound 6 | Default alarm sound 7 | Add ringtone 8 | Unable to add customised ringtone 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-es-rUS/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Tono predeterminado 3 | Ninguno 4 | Tonos de llamada 5 | Sonido de notificación predeterminado 6 | Sonido de alarma predeterminado 7 | Agregar tono 8 | No se puede agregar el tono personalizado 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Tono por defecto 3 | Ninguno 4 | Tonos 5 | Sonido de notificación predeterminado 6 | Sonido de alarma predeterminado 7 | Añadir tono de llamada 8 | No se ha podido añadir un tono de llamada personalizado 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-et/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Vaikehelin 3 | Puudub 4 | Helinad 5 | Märguande vaikeheli 6 | Äratuse vaikeheli 7 | Lisa helin 8 | Kohandatud helinat ei õnnestu lisada 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-eu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Tonu lehenetsia 3 | Bat ere ez 4 | Tonuak 5 | Jakinarazpenen soinu lehenetsia 6 | Alarmaren soinu lehenetsia 7 | Gehitu tonua 8 | Ezin da gehitu tonu pertsonalizatua 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-fa/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | آهنگ زنگ پیش‌فرض 3 | هیچ‌کدام 4 | آهنگ‌های زنگ 5 | صدای اعلان پیش‌فرض 6 | صدای زنگ پیش‌فرض 7 | افزودن آهنگ زنگ 8 | افزودن آهنگ زنگ سفارشی ممکن نیست 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-fi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Oletussoittoääni 3 | Ei mitään 4 | Soittoäänet 5 | Ilmoituksen oletusääni 6 | Herätyksen oletusääni 7 | Lisää soittoääni 8 | Muokatun soittoäänen lisääminen epäonnistui. 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-fr-rCA/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Sonnerie par défaut 3 | Aucun 4 | Sonneries 5 | Son de notification par défaut 6 | Son par défaut pour l\'alarme 7 | Ajouter une sonnerie 8 | Impossible d\'ajouter une sonnerie personnalisée 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Sonnerie par défaut 3 | Aucun(e) 4 | Sonneries 5 | Son de notification par défaut 6 | Son de l\'alarme par défaut 7 | Ajouter une sonnerie 8 | Impossible d\'ajouter une sonnerie personnalisée 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-gl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Ton de chamada predeterminado 3 | Ningún 4 | Tons de chamada 5 | Son de notificación predeterminado 6 | Son de alarma predeterminado 7 | Engadir ton de chamada 8 | Non se pode engadir un ton de chamada personalizado 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-gu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ડિફોલ્ટ રિંગટોન 3 | કોઈ નહીં 4 | રિંગટોન્સ 5 | ડિફોલ્ટ સૂચના માટે ધ્વનિ 6 | ડિફોલ્ટ એલાર્મ ધ્વનિ 7 | રિંગટોન ઉમેરો 8 | કસ્ટમ રિંગટોન ઉમેરવામાં અસમર્થ 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-hi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | डिफ़ॉल्‍ट रिंगटोन 3 | कोई नहीं 4 | रिंगटोन 5 | डिफ़ॉल्ट नोटिफ़िकेशन ध्वनि 6 | डिफ़ॉल्ट अलार्म ध्वनि 7 | रिंगटोन जोड़ेंं 8 | कस्टम रिंगटोन जोड़ने में असमर्थ 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-hr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Zadana melodija zvona 3 | Ništa 4 | Melodije zvona 5 | Zadani zvuk obavijesti 6 | Zadani zvuk alarma 7 | Dodaj melodiju zvona 8 | Dodavanje prilagođene melodije zvona nije moguće 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-hu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Alapértelmezett csengőhang 3 | Egyik sem 4 | Csengőhangok 5 | Alapértelmezett értesítési hang 6 | Alapértelmezett ébresztési hang 7 | Csengőhang hozzáadása 8 | Nem sikerült hozzáadni az egyéni csengőhangot 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-hy/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Կանխադրված զանգերանգ 3 | Ոչ մեկը 4 | Զանգերանգներ 5 | Ծանուցման կանխադրված ձայնը 6 | Զարթուցիչի կանխադրված ձայնը 7 | Ավելացնել զանգերանգ 8 | Հնարավոր չէ հատուկ զանգերանգ ավելացնել 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-in/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Nada dering default 3 | Tidak Ada 4 | Nada dering 5 | Suara notifikasi default 6 | Suara alarm default 7 | Tambahkan nada dering 8 | Tidak dapat menambahkan nada dering khusus 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-is/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Sjálfgefinn hringitónn 3 | Ekkert 4 | Hringitónar 5 | Sjálfgefið hljóð tilkynninga 6 | Sjálfgefið hljóð í vekjara 7 | Bæta hringitóni við 8 | Get ekki bætt sérsniðnum hringitóni við 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-it/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Suoneria predefinita 3 | Nessuna 4 | Suonerie 5 | Suono di notifica predefinito 6 | Suono sveglia predefinito 7 | Aggiungi suoneria 8 | Impossibile aggiungere suoneria personalizzata 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-iw/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | רינגטון ברירת מחדל 3 | ללא 4 | רינגטונים 5 | צליל ברירת המחדל לתזכורת 6 | צליל ברירת המחדל להתראה 7 | רינגטון חדש 8 | לא ניתן להוסיף רינגטון מותאם אישית 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | プリセット着信音 3 | なし 4 | 着信音 5 | デフォルトの通知音 6 | デフォルトの警告音 7 | 着信音を追加 8 | カスタム着信音を追加できません 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ka/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ნაგულისხმევი ზარი 3 | არც ერთი 4 | ზარები 5 | შეტყობინებების ნაგულისხმევი ხმა 6 | მაღვიძარას ნაგულისხმევი ხმა 7 | ზარის დამატება 8 | მორგებული ზარის დამატება შეუძლებელია 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-kk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Әдепкі рингтон 3 | Ешқандай 4 | Қоңырау әуендері 5 | Әдепкі хабарландыру дыбысы 6 | Әдепкі дабыл дыбысы 7 | Рингтон енгізу 8 | Арнаулы рингтонды енгізу мүмкін емес 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-km/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | សំឡេង​រោទ៍​លំនាំដើម 3 | គ្មាន 4 | សំឡេង​រោទ៍ 5 | សំឡេង​ជូន​ដំណឹង​លំនាំដើម 6 | សំឡេងម៉ោងរោទិ៍លំនាំដើម 7 | បន្ថែម​សំឡេង​រោទ៍ 8 | មិន​អាច​បន្ថែម​សំឡេង​រោទ៍​ផ្ទាល់ខ្លួន​បាន 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-kn/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ಡಿಫಾಲ್ಟ್ ರಿಂಗ್‌ಟೋನ್ 3 | ಯಾವುದೂ ಇಲ್ಲ 4 | ರಿಂಗ್‌ಟೋನ್‌ಗಳು 5 | ಡಿಫಾಲ್ಟ್ ಅಧಿಸೂಚನೆ ಧ್ವನಿ 6 | ಡಿಫಾಲ್ಟ್ ಅಲಾರಮ್ ಧ್ವನಿ 7 | ರಿಂಗ್‌ಟೋನ್ ಸೇರಿಸಿ 8 | ಕಸ್ಟಮ್ ರಿಂಗ್‌ಟೋನ್ ಸೇರಿಸಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ko/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 기본 벨소리 3 | 없음 4 | 벨소리 5 | 기본 알림 소리 6 | 기본 알람 소리 7 | 벨소리 추가 8 | 맞춤 벨소리를 추가할 수 없습니다. 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ky/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Демейки шыңгыр 3 | Эч бир 4 | Шыңгырлар 5 | Демейки эскертме үнү 6 | Ойготкучтун демейки үнү 7 | Шыңгыр кошуу 8 | Жеке рингтон кошулбай жатат 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-lo/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ຣິງໂທນເລີ່ມຕົ້ນ 3 | ບໍ່ມີ 4 | ຣິງໂທນ 5 | ສຽງແຈ້ງເຕືອນເລີ່ມຕົ້ນ 6 | ສຽງໂມງປຸກຕາມຄ່າເລີ່ມຕົ້ນ 7 | ເພີ່ມຣິງໂທນ 8 | Unable to add custom ringtone 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-lt/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Numatytasis skambėjimo tonas 3 | Nėra 4 | Skambėjimo tonai 5 | Numatytasis pranešimo garsas 6 | Numatytasis signalo garsas 7 | Pridėti skambėjimo toną 8 | Nepavyksta pridėti tinkinto skambėjimo tono 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-lv/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Noklusējuma zvana signāls 3 | Nav 4 | Zvana signāli 5 | Paziņojuma noklusējuma skaņa 6 | Signāla noklusējuma skaņa 7 | Pievienot zvana signālu 8 | Nevar pievienot pielāgotu zvana signālu 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-mk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Стандардна мелодија 3 | Ниедна 4 | Мелодии 5 | Стандарден звук за известување 6 | Стандарден звук за аларм 7 | Додај мелодија 8 | Не може да се додаде приспособена мелодија 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ml/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ഡിഫോൾട്ട് റിംഗ്‌ടോൺ 3 | ഒന്നും വേണ്ട 4 | റിംഗ്ടോണുകൾ 5 | ഡിഫോൾട്ട് അറിയിപ്പ് ശബ്‌ദം 6 | ഡിഫോൾട്ട് അലാറം ശബ്ദം 7 | റിംഗ്‌ടോൺ ചേർക്കുക 8 | ഇഷ്ടാനുസൃത റിംഗ്‌ടോൺ ചേർക്കാനാവില്ല 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-mn/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Үндсэн хонхны ая 3 | Алийг нь ч биш 4 | Хонхны ая 5 | Мэдэгдлийн үндсэн ая 6 | Сэрүүлгийн өгөгдмөл дуу 7 | Хонхны ая нэмэх 8 | Захиалгат хонхны ая нэмэх боломжгүй 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-mr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | डीफॉल्ट रिंगटोन 3 | काहीही नाही 4 | रिंगटोन 5 | डीफॉल्ट सूचना ध्वनी 6 | डीफॉल्ट अलार्म ध्वनी 7 | रिंगटोन जोडा 8 | सानुकूल रिंगटोन जोडण्यात अक्षम 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ms/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Nada dering lalai 3 | Tiada 4 | Nada dering 5 | Bunyi pemberitahuan lalai 6 | Bunyi penggera lalai 7 | Tambah nada dering 8 | Tidak dapat menambah nada dering tersuai 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-my/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | မူရင်းမြည်သံ 3 | တစ်ခုမှမဟုတ် 4 | မြည်သံများ 5 | မူရင်းအကြောင်းကြားသံ 6 | မူရင်းနှိုးစက်သံ 7 | ဖုန်းမြည်သံကို ထည့်ရန် 8 | စိတ်ကြိုက်ဖုန်းမြည်သံကို ထည့်သွင်း၍မရပါ 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-nb/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Standard ringetone 3 | Ingen 4 | Ringelyder 5 | Standard varsellyd 6 | Standard alarmlyd 7 | Legg til ringelyd 8 | Kan ikke legge til egendefinert ringelyd 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ne/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | पूर्वनिर्धारित रिङटोन 3 | कुनै पनि होइन 4 | रिङटोनहरू 5 | सूचनाका लागि पूर्वनिर्धारित ध्वनि 6 | अलार्मका लागि पूर्वनिर्धारित ध्वनि 7 | रिङटोन थप्नुहोस् 8 | आफू अनुकूल रिङटोन थप्न सकिएन 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Standaardbeltoon 3 | Geen 4 | Beltonen 5 | Standaard meldingsgeluid 6 | Standaard alarmgeluid 7 | Beltoon toevoegen 8 | Toevoegen van aangepaste beltoon is mislukt 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-pa/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ਪੂਰਵ-ਨਿਰਧਾਰਤ ਰਿੰਗਟੋਨ 3 | ਕੋਈ ਨਹੀਂ 4 | ਰਿੰਗਟੋਨਾਂ 5 | ਪੂਰਵ-ਨਿਰਧਾਰਤ ਸੂਚਨਾ ਧੁਨੀ 6 | ਪੂਰਵ-ਨਿਰਧਾਰਤ ਅਲਾਰਮ ਧੁਨੀ 7 | ਰਿੰਗਟੋਨ ਸ਼ਾਮਲ ਕਰੋ 8 | ਵਿਸ਼ੇਸ਼-ਵਿਉਂਤੀ ਰਿੰਗਟੋਨ ਨੂੰ ਸ਼ਾਮਲ ਕਰਨ ਦੇ ਅਯੋਗ 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-pl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Dzwonek domyślny 3 | Brak 4 | Dzwonki 5 | Domyślny dźwięk powiadomienia 6 | Domyślny dźwięk alarmu 7 | Dodaj dzwonek 8 | Nie można dodać dzwonka niestandardowego 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-pt-rBR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Toque padrão 3 | Nenhum 4 | Toques 5 | Som de notificação padrão 6 | Som de alarme padrão 7 | Adicionar toque 8 | Não foi possível adicionar o toque personalizado 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-pt-rPT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Toque predefinido 3 | Nada 4 | Toques 5 | Som de notificação predefinido 6 | Som de alarme predefinido 7 | Adicionar toque 8 | Não foi possível adicionar o toque personalizado 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-pt/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Toque padrão 3 | Nenhum 4 | Toques 5 | Som de notificação padrão 6 | Som de alarme padrão 7 | Adicionar toque 8 | Não foi possível adicionar o toque personalizado 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ro/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Ton de apel prestabilit 3 | Niciunul 4 | Tonuri de apel 5 | Sunet de notificare prestabilit 6 | Sunet de alarmă prestabilit 7 | Adăugați un ton de sonerie 8 | Nu se poate adăuga tonul de sonerie personalizat 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ru/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Мелодия по умолчанию 3 | Без звука 4 | Мелодии 5 | Звук уведомления по умолчанию 6 | Звук будильника по умолчанию 7 | Добавить рингтон 8 | Не удалось добавить рингтон 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-si/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | සුපුරුදු රින්ටෝනය සකසන්න 3 | කිසිවක් නැත 4 | රිගින්ටෝන 5 | පෙරනිමි දැනුම්දීම් හඬ 6 | පෙරනිමි එලාම හඬ 7 | නාද රිද්මය එක් කරන්න 8 | අභිරුචි නාද රිද්මය එක් කළ නොහැකිය 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-sk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Predvolený tón zvonenia 3 | Žiadny 4 | Tóny zvonenia 5 | Predvolený zvuk upozornenia 6 | Predvolený zvuk budíka 7 | Pridať tón zvonenia 8 | Nepodarilo sa pridať vlastný tón zvonenia 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-sl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Privzeta melodija zvonjenja 3 | Brez 4 | Melodije zvonjenja 5 | Privzeti zvok obvestila 6 | Privzeti zvok alarma 7 | Dodaj ton zvonjenja 8 | Tona zvonjenja po meri ni mogoče dodati 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-sq/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Zile e paracaktuar. 3 | Asnjë 4 | Zilet 5 | Tingulli i parazgjedhur i njoftimit 6 | Tingulli i parazgjedhur i alarmit 7 | Shto zile 8 | Nuk mund të shtojë ton zileje të personalizuar 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-sr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Подразумевани звук звона 3 | Без звука 4 | Звукови звона 5 | Подразумевани звук обавештења 6 | Подразумевани звук аларма 7 | Додај мелодију звона 8 | Додавање прилагођене мелодије звона није успело 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-sv/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Standardringsignal 3 | Ingen 4 | Ringsignaler 5 | Standardljud för aviseringar 6 | Standardljud för alarm 7 | Lägg till ringsignal 8 | Det gick inte att lägga till en egen ringsignal 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-sw/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Mlio chaguo-msingi 3 | Hamna 4 | Toni za mlio 5 | Sauti chaguo-msingi ya arifa 6 | Sauti chaguo-msingi ya kengele 7 | Ongeza mlio wa simu 8 | Imeshindwa kuongeza mlio maalum wa simu 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ta/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | இயல்புநிலை ரிங்டோன் 3 | ஏதுமில்லை 4 | ரிங்டோன்கள் 5 | இயல்பு அறிவிப்பு ஒலி 6 | இயல்பு அலார ஒலி 7 | ரிங்டோனைச் சேர் 8 | தனிப்பயன் ரிங்டோனைச் சேர்க்க முடியவில்லை 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-te/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | డిఫాల్ట్ రింగ్‌టోన్ 3 | ఏదీ వద్దు 4 | రింగ్‌టోన్‌లు 5 | డిఫాల్ట్ నోటిఫికేషన్ ధ్వని 6 | డిఫాల్ట్ అలారం ధ్వని 7 | రింగ్‌టోన్‌ను జోడించు 8 | అనుకూల రింగ్‌టోన్‌ను జోడించలేకపోయింది 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-th/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | เสียงเรียกเข้าเริ่มต้น 3 | ไม่มี 4 | เสียงเรียกเข้า 5 | เสียงแจ้งเตือนเริ่มต้น 6 | เสียงปลุกเริ่มต้น 7 | เพิ่มเสียงเรียกเข้า 8 | ไม่สามารถเพิ่มเสียงเรียกเข้าที่กำหนดเอง 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-tl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Default na ringtone 3 | Wala 4 | Mga Ringtone 5 | Default na tunog ng notification 6 | Default na tunog ng alarm 7 | Magdagdag ng ringtone 8 | Hindi maidagdag ang custom na ringtone 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-tr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Varsayılan zil sesi 3 | Yok 4 | Zil sesleri 5 | Varsayılan bildirim sesi 6 | Varsayılan alarm sesi 7 | Zil sesi ekle 8 | Özel zil sesi eklenemiyor 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-uk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Мелодія за умовчанням 3 | Немає 4 | Мелодії 5 | Сигнал сповіщень за умовчанням 6 | Сигнал будильника за умовчанням 7 | Додати сигнал дзвінка 8 | Не вдалося додати користувацький сигнал дзвінка 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-ur/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ڈیفالٹ رنگ ٹون 3 | کوئی نہیں 4 | رنگ ٹونز 5 | اطلاع کی ڈیفالٹ آواز 6 | الارم کی ڈیفالٹ آواز 7 | رنگ ٹون شامل کریں 8 | حسب ضرورت رنگ ٹون شامل کرنے سے قاصر ہے 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-uz/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Standart rington 3 | Yo‘q 4 | Ringtonlar 5 | Standart bildirishnoma signali 6 | Standart signal 7 | Rington qo‘shish 8 | Maxsus rington qo‘shib bo‘lmadi 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-vi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Nhạc chuông mặc định 3 | Không 4 | Nhạc chuông 5 | Âm thanh thông báo mặc định 6 | Âm thanh báo thức mặc định 7 | Thêm nhạc chuông 8 | Không thể thêm nhạc chuông tùy chỉnh 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 默认铃声 3 | 4 | 铃声 5 | 默认通知提示音 6 | 默认闹钟铃声 7 | 添加铃声 8 | 无法添加自定义铃声 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-zh-rHK/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 預設鈴聲 3 | 4 | 鈴聲 5 | 預設通知音效 6 | 預設鬧鐘音效 7 | 加入鈴聲 8 | 無法加入自訂鈴聲 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-zh-rTW/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 預設鈴聲 3 | 4 | 鈴聲 5 | 預設通知音效 6 | 預設鬧鐘音效 7 | 新增鈴聲 8 | 無法新增自訂鈴聲 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values-zu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Iringithoni emisiwe 3 | Akunalutho 4 | Amaringithoni 5 | Umsindo wesaziso ozenzakalelayo 6 | Umsindo we-alamu ozenzakalelayo 7 | Engeza ithoni yokukhala 8 | Ayikwazi ukwengeza ithoni yokukhala yangokwezifiso 9 | 10 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /preferencex-ringtone/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Default ringtone 3 | None 4 | Ringtones 5 | Default notification sound 6 | Default alarm sound 7 | 8 | 9 | Add ringtone 10 | 11 | 12 | Unable to add custom ringtone 13 | 14 | -------------------------------------------------------------------------------- /preferencex-simplemenu/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /preferencex-simplemenu/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.sdkVersion 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.minSdkVersion 8 | targetSdkVersion rootProject.sdkVersion 9 | 10 | vectorDrawables.useSupportLibrary = true 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | consumerProguardFiles 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | lintOptions { 20 | abortOnError false 21 | } 22 | } 23 | 24 | ext { 25 | PUBLISH_GROUP_ID = 'com.takisoft.preferencex' 26 | PUBLISH_VERSION = rootProject.libVersion 27 | PUBLISH_ARTIFACT_ID = 'preferencex-simplemenu' 28 | PUBLISH_DESCRIPTION = 'AndroidX Preference - SimpleMenuPreference. Displays a simple menu on API 21+ and a ListPreference on pre-Lollipop devices.' 29 | PUBLISH_URL = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix' 30 | PUBLISH_LICENSE_NAME = 'The Apache Software License, Version 2.0' 31 | PUBLISH_LICENSE_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 32 | PUBLISH_DEVELOPER_ID = 'Mygod' 33 | PUBLISH_DEVELOPER_NAME = 'Mygod' 34 | PUBLISH_DEVELOPER_EMAIL = 'contact-preference@mygod.be' 35 | PUBLISH_SCM_CONNECTION = 36 | 'scm:git:github.com/Gericop/Android-Support-Preference-V7-Fix.git' 37 | PUBLISH_SCM_DEVELOPER_CONNECTION = 38 | 'scm:git:ssh://github.com/Gericop/Android-Support-Preference-V7-Fix.git' 39 | PUBLISH_SCM_URL = 40 | 'https://github.com/Gericop/Android-Support-Preference-V7-Fix/tree/master' 41 | } 42 | 43 | apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" 44 | 45 | dependencies { 46 | api "androidx.preference:preference:$androidxPreferenceVersion" 47 | } -------------------------------------------------------------------------------- /preferencex-simplemenu/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/SimpleMenuPreference.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.os.Build; 6 | import androidx.annotation.NonNull; 7 | import androidx.annotation.RequiresApi; 8 | import androidx.preference.ListPreference; 9 | import androidx.preference.PreferenceViewHolder; 10 | import android.util.AttributeSet; 11 | import android.view.View; 12 | 13 | import com.takisoft.preferencex.simplemenu.R; 14 | import com.takisoft.preferencex.widget.SimpleMenuPopupWindow; 15 | 16 | /** 17 | * A version of {@link ListPreference} that use 18 | * Simple Menus 19 | * in Material Design as drop down. 20 | * 21 | * On pre-Lollipop, it will fallback {@link ListPreference}. 22 | */ 23 | 24 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 25 | public class SimpleMenuPreference extends ListPreference { 26 | 27 | private View mAnchor; 28 | private View mItemView; 29 | private SimpleMenuPopupWindow mPopupWindow; 30 | 31 | public SimpleMenuPreference(Context context) { 32 | this(context, null); 33 | } 34 | 35 | public SimpleMenuPreference(Context context, AttributeSet attrs) { 36 | this(context, attrs, Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? R.attr.dialogPreferenceStyle : R.attr.simpleMenuPreferenceStyle); 37 | } 38 | 39 | public SimpleMenuPreference(Context context, AttributeSet attrs, int defStyle) { 40 | this(context, attrs, defStyle, R.style.Preference_SimpleMenuPreference); 41 | } 42 | 43 | public SimpleMenuPreference(Context context, AttributeSet attrs, int defStyleAttr, 44 | int defStyleRes) { 45 | super(context, attrs, defStyleAttr, defStyleRes); 46 | 47 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 48 | return; 49 | } 50 | 51 | TypedArray a = context.obtainStyledAttributes( 52 | attrs, R.styleable.SimpleMenuPreference, defStyleAttr, defStyleRes); 53 | 54 | int popupStyle = a.getResourceId(R.styleable.SimpleMenuPreference_pref_popupStyle, R.style.Preference_SimpleMenuPreference_Popup); 55 | 56 | mPopupWindow = new SimpleMenuPopupWindow(context, attrs, R.styleable.SimpleMenuPreference_pref_popupStyle, popupStyle); 57 | mPopupWindow.setOnItemClickListener(new SimpleMenuPopupWindow.OnItemClickListener() { 58 | @Override 59 | public void onClick(int i) { 60 | String value = getEntryValues()[i].toString(); 61 | if (callChangeListener(value)) { 62 | setValue(value); 63 | } 64 | } 65 | }); 66 | 67 | a.recycle(); 68 | } 69 | 70 | @Override 71 | protected void onClick() { 72 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 73 | super.onClick(); 74 | return; 75 | } 76 | 77 | if (getEntries() == null || getEntries().length == 0) { 78 | return; 79 | } 80 | 81 | if (mPopupWindow == null) { 82 | return; 83 | } 84 | 85 | mPopupWindow.setEntries(getEntries()); 86 | mPopupWindow.setSelectedIndex(findIndexOfValue(getValue())); 87 | 88 | View container = (View) mItemView // itemView 89 | .getParent(); // -> list (RecyclerView) 90 | mPopupWindow.show(mItemView, container, (int) mAnchor.getX()); 91 | } 92 | 93 | @Override 94 | public void setEntries(@NonNull CharSequence[] entries) { 95 | super.setEntries(entries); 96 | 97 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 98 | return; 99 | } 100 | 101 | mPopupWindow.requestMeasure(); 102 | } 103 | 104 | @Override 105 | public void onBindViewHolder(PreferenceViewHolder view) { 106 | super.onBindViewHolder(view); 107 | 108 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 109 | return; 110 | } 111 | 112 | mItemView = view.itemView; 113 | mAnchor = view.itemView.findViewById(android.R.id.empty); 114 | 115 | if (mAnchor == null) { 116 | throw new IllegalStateException("SimpleMenuPreference item layout must contain" + 117 | "a view id is android.R.id.empty to support iconSpaceReserved"); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/animation/PropertyHolder.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.animation; 2 | 3 | import android.view.View; 4 | 5 | import com.takisoft.preferencex.drawable.FixedBoundsDrawable; 6 | 7 | /** 8 | * Holder class holds background drawable and content view. 9 | */ 10 | 11 | public class PropertyHolder { 12 | 13 | private final FixedBoundsDrawable mBackground; 14 | private final View mContentView; 15 | 16 | public PropertyHolder(FixedBoundsDrawable background, View contentView) { 17 | mBackground = background; 18 | mContentView = contentView; 19 | } 20 | 21 | public FixedBoundsDrawable getBackground() { 22 | return mBackground; 23 | } 24 | 25 | public View getContentView() { 26 | return mContentView; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/animation/RectEvaluator.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.animation; 2 | 3 | import android.animation.TypeEvaluator; 4 | import android.annotation.SuppressLint; 5 | import android.graphics.Rect; 6 | 7 | /** 8 | * This evaluator can be used to perform type interpolation between {@link Rect}. 9 | */ 10 | 11 | public class RectEvaluator implements TypeEvaluator { 12 | 13 | private final Rect mMax; 14 | private final Rect mTemp = new Rect(); 15 | 16 | public RectEvaluator(Rect max) { 17 | mMax = max; 18 | } 19 | 20 | @SuppressLint("CheckResult") 21 | @Override 22 | public Rect evaluate(float fraction, Rect startValue, Rect endValue) { 23 | mTemp.left = startValue.left + (int) ((endValue.left - startValue.left) * fraction); 24 | mTemp.top = startValue.top + (int) ((endValue.top - startValue.top) * fraction); 25 | mTemp.right = startValue.right + (int) ((endValue.right - startValue.right) * fraction); 26 | mTemp.bottom = startValue.bottom + (int) ((endValue.bottom - startValue.bottom) * fraction); 27 | mTemp.setIntersect(mMax, mTemp); 28 | return mTemp; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/animation/SimpleMenuAnimation.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.animation; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorSet; 5 | import android.animation.FloatEvaluator; 6 | import android.animation.ObjectAnimator; 7 | import android.animation.TypeEvaluator; 8 | import android.annotation.TargetApi; 9 | import android.graphics.Rect; 10 | import android.os.Build; 11 | import androidx.interpolator.view.animation.FastOutSlowInInterpolator; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.view.animation.AccelerateInterpolator; 15 | import android.view.animation.DecelerateInterpolator; 16 | 17 | import com.takisoft.preferencex.drawable.FixedBoundsDrawable; 18 | import com.takisoft.preferencex.widget.SimpleMenuPopupWindow; 19 | 20 | /** 21 | * Helper class to create and start animation of Simple Menu. 22 | * 23 | * TODO let params styleable 24 | */ 25 | 26 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 27 | public class SimpleMenuAnimation { 28 | 29 | public static void postStartEnterAnimation(final SimpleMenuPopupWindow popupWindow, final FixedBoundsDrawable background, 30 | final int width, final int height, 31 | final int startX, final int startY, final Rect start, 32 | final int itemHeight, final int elevation, final int selectedIndex) { 33 | popupWindow.getBackground().setFixedBounds(new Rect()); 34 | popupWindow.getContentView().setClipBounds(new Rect()); 35 | 36 | popupWindow.getContentView().post(new Runnable() { 37 | @Override 38 | public void run() { 39 | // return if already dismissed 40 | if (popupWindow.getContentView().getParent() == null) { 41 | return; 42 | } 43 | startEnterAnimation(popupWindow.getContentView(), background, width, height, startX, startY, start, itemHeight, elevation, selectedIndex); 44 | } 45 | }); 46 | } 47 | 48 | public static void startEnterAnimation(final View view, final FixedBoundsDrawable background, 49 | int width, int height, 50 | int centerX, int centerY, Rect start, 51 | int itemHeight, int elevation, int selectedIndex) { 52 | PropertyHolder holder = new PropertyHolder(background, view); 53 | Animator backgroundAnimator = createBoundsAnimator( 54 | holder, width, height, centerX, centerY, start); 55 | 56 | AnimatorSet animatorSet = new AnimatorSet(); 57 | animatorSet.playTogether( 58 | backgroundAnimator, 59 | createElevationAnimator((View) view.getParent(), elevation)); 60 | animatorSet.setDuration(backgroundAnimator.getDuration()); 61 | animatorSet.start(); 62 | 63 | long delay = 0; 64 | 65 | if (view instanceof ViewGroup) { 66 | for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { 67 | int offset = selectedIndex - i; 68 | startChild(((ViewGroup) view).getChildAt(i), delay + 30 * Math.abs(offset), 69 | offset == 0 ? 0 : (int) (itemHeight * 0.2) * (offset < 0 ? -1 : 1)); 70 | } 71 | } 72 | } 73 | 74 | private static void startChild(View child, long delay, int translationY) { 75 | child.setAlpha(0); 76 | 77 | Animator alphaAnimator = ObjectAnimator.ofFloat(child, "alpha", 0.0f, 1.0f); 78 | alphaAnimator.setDuration(200); 79 | alphaAnimator.setInterpolator(new AccelerateInterpolator()); 80 | 81 | Animator translationAnimator = ObjectAnimator.ofFloat(child, "translationY", translationY, 0); 82 | translationAnimator.setDuration(275); 83 | translationAnimator.setInterpolator(new DecelerateInterpolator()); 84 | 85 | AnimatorSet animatorSet = new AnimatorSet(); 86 | animatorSet.playTogether(alphaAnimator, translationAnimator); 87 | animatorSet.setStartDelay(delay); 88 | animatorSet.start(); 89 | } 90 | 91 | private static Rect[] getBounds( 92 | int width, int height, int centerX, int centerY) { 93 | int endWidth = Math.max(centerX, width - centerX); 94 | int endHeight = Math.max(centerY, height - centerY); 95 | 96 | int endLeft = centerX - endWidth; 97 | int endRight = centerX + endWidth; 98 | int endTop = centerY - endHeight; 99 | int endBottom = centerY + endHeight; 100 | 101 | Rect end = new Rect(endLeft, endTop, endRight, endBottom); 102 | Rect max = new Rect(0, 0, width, height); 103 | 104 | return new Rect[]{end, max}; 105 | } 106 | 107 | private static Animator createBoundsAnimator(PropertyHolder holder, 108 | int width, int height, int centerX, int centerY, Rect start) { 109 | int speed = 4096; 110 | 111 | int endWidth = Math.max(centerX, width - centerX); 112 | int endHeight = Math.max(centerY, height - centerY); 113 | 114 | Rect[] rect = getBounds(width, height, centerX, centerY); 115 | Rect end = rect[0]; 116 | Rect max = rect[1]; 117 | 118 | long duration = (long) ((float) Math.max(endWidth, endHeight) / speed * 1000); 119 | duration = Math.max(duration, 150); 120 | duration = Math.min(duration, 300); 121 | 122 | Animator animator = ObjectAnimator 123 | .ofObject(holder, SimpleMenuBoundsProperty.BOUNDS, new RectEvaluator(max), start, end); 124 | animator.setInterpolator(new DecelerateInterpolator()); 125 | animator.setDuration(duration); 126 | return animator; 127 | } 128 | 129 | @SuppressWarnings("unchecked") 130 | private static Animator createElevationAnimator(View view, float elevation) { 131 | Animator animator = ObjectAnimator.ofObject(view, View.TRANSLATION_Z, (TypeEvaluator) new FloatEvaluator(), -elevation, 0f); 132 | animator.setInterpolator(new FastOutSlowInInterpolator()); 133 | return animator; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/animation/SimpleMenuBoundsProperty.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.animation; 2 | 3 | import android.annotation.TargetApi; 4 | import android.graphics.Rect; 5 | import android.os.Build; 6 | import android.util.Property; 7 | 8 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 9 | public class SimpleMenuBoundsProperty extends Property { 10 | 11 | public static final Property BOUNDS; 12 | 13 | static { 14 | BOUNDS = new SimpleMenuBoundsProperty("bounds"); 15 | } 16 | 17 | @Override 18 | public Rect get(PropertyHolder holder) { 19 | return holder.getBackground().getFixedBounds(); 20 | } 21 | 22 | @Override 23 | public void set(PropertyHolder holder, Rect value) { 24 | holder.getBackground().setFixedBounds(value); 25 | holder.getContentView().setClipBounds(value); 26 | } 27 | 28 | public SimpleMenuBoundsProperty(String name) { 29 | super(Rect.class, name); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/drawable/FixedBoundsDrawable.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.drawable; 2 | 3 | import android.annotation.TargetApi; 4 | import android.graphics.Canvas; 5 | import android.graphics.ColorFilter; 6 | import android.graphics.Outline; 7 | import android.graphics.Rect; 8 | import android.graphics.drawable.Drawable; 9 | import android.os.Build; 10 | import androidx.annotation.NonNull; 11 | import androidx.annotation.Nullable; 12 | 13 | /** 14 | * A wrapped {@link Drawable} that force use its own bounds to draw. 15 | * 16 | * It maybe a little dirty. But if we don't do that, during the expanding animation, there will be 17 | * one or two frame using wrong bounds because of parent view sets bounds. 18 | */ 19 | 20 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 21 | public class FixedBoundsDrawable extends Drawable implements Drawable.Callback { 22 | 23 | private final Drawable mDrawable; 24 | private final Rect mFixedBounds = new Rect(); 25 | 26 | public FixedBoundsDrawable(Drawable wrappedDrawable) { 27 | mDrawable = wrappedDrawable; 28 | } 29 | 30 | public Rect getFixedBounds() { 31 | return mFixedBounds; 32 | } 33 | 34 | public void setFixedBounds(@NonNull Rect bounds) { 35 | setFixedBounds(bounds.left, bounds.top, bounds.right, bounds.bottom); 36 | } 37 | 38 | public void setFixedBounds(int left, int top, int right, int bottom) { 39 | mFixedBounds.set(left, top, right, bottom); 40 | setBounds(left, top, right, bottom); 41 | } 42 | 43 | @Override 44 | public void getOutline(@NonNull Outline outline) { 45 | mDrawable.getOutline(outline); 46 | } 47 | 48 | @Override 49 | public void draw(@NonNull Canvas canvas) { 50 | mDrawable.setBounds(mFixedBounds); 51 | mDrawable.draw(canvas); 52 | } 53 | 54 | @Override 55 | public void setAlpha(int alpha) { 56 | mDrawable.setAlpha(alpha); 57 | } 58 | 59 | @Override 60 | public void setColorFilter(@Nullable ColorFilter colorFilter) { 61 | mDrawable.setColorFilter(colorFilter); 62 | } 63 | 64 | @Override 65 | public int getOpacity() { 66 | return mDrawable.getOpacity(); 67 | } 68 | 69 | @Override 70 | public void invalidateDrawable(@NonNull Drawable who) { 71 | final Callback callback = getCallback(); 72 | if (callback != null) { 73 | callback.invalidateDrawable(this); 74 | } 75 | } 76 | 77 | @Override 78 | public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) { 79 | final Callback callback = getCallback(); 80 | if (callback != null) { 81 | callback.scheduleDrawable(this, what, when); 82 | } 83 | } 84 | 85 | @Override 86 | public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) { 87 | final Callback callback = getCallback(); 88 | if (callback != null) { 89 | callback.unscheduleDrawable(this, what); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/widget/SimpleMenuListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.widget; 2 | 3 | import android.os.Build; 4 | import androidx.annotation.RequiresApi; 5 | import androidx.recyclerview.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.ViewGroup; 8 | 9 | import com.takisoft.preferencex.simplemenu.R; 10 | 11 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 12 | public class SimpleMenuListAdapter extends RecyclerView.Adapter { 13 | 14 | private SimpleMenuPopupWindow mWindow; 15 | 16 | public SimpleMenuListAdapter(SimpleMenuPopupWindow window) { 17 | super(); 18 | 19 | mWindow = window; 20 | } 21 | 22 | @Override 23 | public SimpleMenuListItemHolder onCreateViewHolder(ViewGroup parent, int viewType) { 24 | return new SimpleMenuListItemHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_menu_item, parent, false)); 25 | } 26 | 27 | @Override 28 | public void onBindViewHolder(final SimpleMenuListItemHolder holder, int position) { 29 | holder.bind(mWindow, position); 30 | } 31 | 32 | @Override 33 | public int getItemCount() { 34 | return mWindow.getEntries() == null ? 0 : mWindow.getEntries().length; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/java/com/takisoft/preferencex/widget/SimpleMenuListItemHolder.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex.widget; 2 | 3 | import android.os.Build; 4 | import androidx.annotation.RequiresApi; 5 | import androidx.recyclerview.widget.RecyclerView; 6 | import android.view.View; 7 | import android.widget.CheckedTextView; 8 | 9 | import static com.takisoft.preferencex.widget.SimpleMenuPopupWindow.DIALOG; 10 | import static com.takisoft.preferencex.widget.SimpleMenuPopupWindow.HORIZONTAL; 11 | 12 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 13 | public class SimpleMenuListItemHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 14 | 15 | public CheckedTextView mCheckedTextView; 16 | 17 | private SimpleMenuPopupWindow mWindow; 18 | 19 | public SimpleMenuListItemHolder(View itemView) { 20 | super(itemView); 21 | 22 | mCheckedTextView = itemView.findViewById(android.R.id.text1); 23 | itemView.setOnClickListener(this); 24 | } 25 | 26 | public void bind(SimpleMenuPopupWindow window, int position) { 27 | mWindow = window; 28 | mCheckedTextView.setText(mWindow.getEntries()[position]); 29 | mCheckedTextView.setChecked(position == mWindow.getSelectedIndex()); 30 | mCheckedTextView.setMaxLines(mWindow.getMode() == DIALOG ? Integer.MAX_VALUE : 1); 31 | 32 | int padding = mWindow.listPadding[mWindow.getMode()][HORIZONTAL]; 33 | int paddingVertical = mCheckedTextView.getPaddingTop(); 34 | mCheckedTextView.setPadding(padding, paddingVertical, padding, paddingVertical); 35 | } 36 | 37 | @Override 38 | public void onClick(View view) { 39 | if (mWindow.getOnItemClickListener() != null) { 40 | mWindow.getOnItemClickListener().onClick(getAdapterPosition()); 41 | } 42 | 43 | if (mWindow.isShowing()) { 44 | mWindow.dismiss(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/anim/abc_shrink_fade_out_center.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 27 | 32 | 35 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/drawable/simple_menu_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/drawable/simple_menu_item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/layout-v21/preference_simplemenu.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 30 | 31 | 36 | 37 | 47 | 48 | 54 | 55 | 56 | 62 | 63 | 69 | 70 | 77 | 78 | 88 | 89 | 90 | 91 | 92 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/layout/preference_simplemenu.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 31 | 32 | 37 | 38 | 49 | 50 | 56 | 57 | 58 | 64 | 65 | 71 | 72 | 79 | 80 | 89 | 90 | 91 | 92 | 93 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/layout/simple_menu_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/layout/simple_menu_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #303030 4 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 4 | 23dp 5 | 6 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 35 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FAFAFA 4 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 56dp 4 | 15dp 5 | 600dp 6 | 7 | 5 8 | -------------------------------------------------------------------------------- /preferencex-simplemenu/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 25 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /preferencex/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /preferencex/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.sdkVersion 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.minSdkVersion 8 | targetSdkVersion rootProject.sdkVersion 9 | } 10 | 11 | buildTypes { 12 | release { 13 | minifyEnabled false 14 | consumerProguardFiles 'proguard-rules.pro' 15 | } 16 | } 17 | 18 | lintOptions { 19 | abortOnError false 20 | } 21 | } 22 | 23 | ext { 24 | PUBLISH_GROUP_ID = 'com.takisoft.preferencex' 25 | PUBLISH_VERSION = rootProject.libVersion 26 | PUBLISH_ARTIFACT_ID = 'preferencex' 27 | PUBLISH_DESCRIPTION = 'AndroidX Preference library eXtended' 28 | PUBLISH_URL = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix' 29 | PUBLISH_LICENSE_NAME = 'The Apache Software License, Version 2.0' 30 | PUBLISH_LICENSE_URL = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 31 | PUBLISH_DEVELOPER_ID = 'gericop' 32 | PUBLISH_DEVELOPER_NAME = 'Gergely Kőrössy' 33 | PUBLISH_DEVELOPER_EMAIL = 'korossyg@takisoft.com' 34 | PUBLISH_SCM_CONNECTION = 35 | 'scm:git:github.com/Gericop/Android-Support-Preference-V7-Fix.git' 36 | PUBLISH_SCM_DEVELOPER_CONNECTION = 37 | 'scm:git:ssh://github.com/Gericop/Android-Support-Preference-V7-Fix.git' 38 | PUBLISH_SCM_URL = 39 | 'https://github.com/Gericop/Android-Support-Preference-V7-Fix/tree/master' 40 | } 41 | 42 | apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" 43 | 44 | dependencies { 45 | api "androidx.preference:preference:$androidxPreferenceVersion" 46 | } -------------------------------------------------------------------------------- /preferencex/proguard-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/takisoft/preferencex-android/2fb10a369a44191e544179e3ca97e339b540d996/preferencex/proguard-rules.pro -------------------------------------------------------------------------------- /preferencex/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /preferencex/src/main/java/com/takisoft/preferencex/EditTextPreference.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.text.InputType; 6 | import android.text.TextUtils; 7 | import android.util.AttributeSet; 8 | import android.util.TypedValue; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.view.ViewParent; 12 | import android.widget.EditText; 13 | 14 | import androidx.annotation.NonNull; 15 | import androidx.annotation.Nullable; 16 | import androidx.collection.SparseArrayCompat; 17 | 18 | public class EditTextPreference extends androidx.preference.EditTextPreference { 19 | @Nullable 20 | private OnBindEditTextListener onBindEditTextListener; 21 | 22 | private SparseArrayCompat editTextAttributes = new SparseArrayCompat<>(); 23 | 24 | private boolean disableMessagePaddingFix; 25 | 26 | @SuppressWarnings("unused") 27 | public EditTextPreference(Context context) { 28 | this(context, null); 29 | } 30 | 31 | @SuppressWarnings("WeakerAccess") 32 | public EditTextPreference(Context context, AttributeSet attrs) { 33 | this(context, attrs, R.attr.editTextPreferenceStyle); 34 | } 35 | 36 | @SuppressWarnings("WeakerAccess") 37 | public EditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) { 38 | this(context, attrs, defStyleAttr, 0); 39 | } 40 | 41 | @SuppressWarnings("WeakerAccess") 42 | public EditTextPreference(Context context, final AttributeSet attrs, int defStyleAttr, int defStyleRes) { 43 | super(context, attrs, defStyleAttr, defStyleRes); 44 | 45 | TypedArray a = getContext().obtainStyledAttributes( 46 | attrs, R.styleable.EditTextPreference, defStyleAttr, defStyleRes); 47 | disableMessagePaddingFix = a.getBoolean(R.styleable.EditTextPreference_pref_disableMessagePaddingFix, false); 48 | a.recycle(); 49 | 50 | processAttrs(attrs); 51 | 52 | super.setOnBindEditTextListener(new OnBindEditTextListener() { 53 | @Override 54 | public void onBindEditText(@NonNull EditText editText) { 55 | if (!disableMessagePaddingFix) { 56 | fixMessagePadding(editText); 57 | } 58 | 59 | int n = editTextAttributes.size(); 60 | for (int i = 0; i < n; i++) { 61 | int attr = editTextAttributes.keyAt(i); 62 | TypedValue value = editTextAttributes.valueAt(i); 63 | 64 | int data = value.data; 65 | // TODO resolve resources? 66 | 67 | switch (attr) { 68 | case android.R.attr.inputType: 69 | editText.setInputType(data); 70 | break; 71 | case android.R.attr.textAllCaps: 72 | editText.setAllCaps(data == 1); 73 | break; 74 | case android.R.attr.lines: 75 | editText.setLines(data); 76 | break; 77 | case android.R.attr.minLines: 78 | editText.setMinLines(data); 79 | break; 80 | case android.R.attr.maxLines: 81 | editText.setMaxLines(data); 82 | break; 83 | case android.R.attr.ems: 84 | editText.setEms(data); 85 | break; 86 | case android.R.attr.minEms: 87 | editText.setMinEms(data); 88 | break; 89 | case android.R.attr.maxEms: 90 | editText.setMaxEms(data); 91 | break; 92 | } 93 | } 94 | 95 | if (onBindEditTextListener != null) { 96 | onBindEditTextListener.onBindEditText(editText); 97 | } 98 | } 99 | }); 100 | } 101 | 102 | private void fixMessagePadding(@NonNull View view) { 103 | ViewParent parent = view.getParent(); 104 | if (parent instanceof ViewGroup) { 105 | View msgView = ((ViewGroup) parent).findViewById(android.R.id.message); 106 | 107 | if (msgView != null) { 108 | ViewGroup.LayoutParams layoutParams = msgView.getLayoutParams(); 109 | 110 | if (layoutParams instanceof ViewGroup.MarginLayoutParams) { 111 | ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams; 112 | marginLayoutParams.bottomMargin = 0; 113 | msgView.setLayoutParams(marginLayoutParams); 114 | } 115 | } 116 | } 117 | } 118 | 119 | private void processAttrs(AttributeSet attributeSet) { 120 | if (attributeSet == null) { 121 | return; 122 | } 123 | 124 | int n = attributeSet.getAttributeCount(); 125 | 126 | for (int i = 0; i < n; i++) { 127 | int nameRes = attributeSet.getAttributeNameResource(i); 128 | int resId = attributeSet.getAttributeResourceValue(i, 0); 129 | 130 | TypedValue value = null; 131 | 132 | switch (nameRes) { 133 | case android.R.attr.inputType: 134 | value = new TypedValue(); 135 | value.resourceId = resId; 136 | value.data = attributeSet.getAttributeIntValue(i, InputType.TYPE_CLASS_TEXT); 137 | value.type = TypedValue.TYPE_INT_HEX; 138 | break; 139 | case android.R.attr.minEms: 140 | case android.R.attr.maxEms: 141 | case android.R.attr.ems: 142 | case android.R.attr.minLines: 143 | case android.R.attr.maxLines: 144 | case android.R.attr.lines: 145 | value = new TypedValue(); 146 | value.resourceId = resId; 147 | value.data = attributeSet.getAttributeIntValue(i, -1); 148 | value.type = TypedValue.TYPE_INT_DEC; 149 | break; 150 | case android.R.attr.textAllCaps: 151 | value = new TypedValue(); 152 | value.resourceId = resId; 153 | value.data = attributeSet.getAttributeBooleanValue(i, false) ? 1 : 0; 154 | value.type = TypedValue.TYPE_INT_BOOLEAN; 155 | break; 156 | } 157 | 158 | if (value != null) { 159 | editTextAttributes.put(nameRes, value); 160 | } 161 | } 162 | } 163 | 164 | /** 165 | * Returns the {@link OnBindEditTextListener} used to configure the {@link EditText} 166 | * displayed in the corresponding dialog view for this preference. 167 | *

168 | * NOTE that this will return the internal {@link OnBindEditTextListener} instead of the one set 169 | * via {@link #setOnBindEditTextListener(OnBindEditTextListener)}. 170 | * 171 | * @return The {@link OnBindEditTextListener} set for this preference, or {@code null} if 172 | * there is no OnBindEditTextListener set 173 | * @see OnBindEditTextListener 174 | */ 175 | @Nullable 176 | //@Override 177 | public OnBindEditTextListener getOnBindEditTextListener() { 178 | return this.onBindEditTextListener; 179 | //return super.getOnBindEditTextListener(); 180 | } 181 | 182 | @Override 183 | public void setOnBindEditTextListener(@Nullable OnBindEditTextListener onBindEditTextListener) { 184 | this.onBindEditTextListener = onBindEditTextListener; 185 | } 186 | 187 | @Deprecated 188 | public EditText getEditText() { 189 | throw new UnsupportedOperationException("Use OnBindEditTextListener to modify the EditText"); 190 | } 191 | 192 | @Override 193 | public void setText(String text) { 194 | String oldText = getText(); 195 | super.setText(text); 196 | if (!TextUtils.equals(text, oldText)) { 197 | notifyChanged(); 198 | } 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /preferencex/src/main/java/com/takisoft/preferencex/PreferenceActivityResultListener.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import androidx.annotation.NonNull; 6 | import androidx.annotation.Nullable; 7 | import androidx.fragment.app.Fragment; 8 | import androidx.preference.Preference; 9 | 10 | /** 11 | * An interface for custom preferences that want to handle click events by either starting an 12 | * {@link Activity} for results calling {@link Fragment#startActivityForResult(Intent, int)} or 13 | * using the supplied {@link PreferenceFragmentCompat} fragment manually (e.g. adding a fragment to 14 | * it). 15 | */ 16 | public interface PreferenceActivityResultListener { 17 | /** 18 | * Called when the user clicks on the preference. 19 | * 20 | * @param fragment The preference fragment that shows the preference screen. 21 | * @param preference The preference instance. 22 | */ 23 | void onPreferenceClick(@NonNull PreferenceFragmentCompat fragment, @NonNull Preference preference); 24 | 25 | /** 26 | * Called when an activity you launched exits, giving you the requestCode 27 | * you started it with, the resultCode it returned, and any additional 28 | * data from it. The resultCode will be 29 | * {@link Activity#RESULT_CANCELED} if the activity explicitly returned that, 30 | * didn't return any result, or crashed during its operation. 31 | * 32 | * @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from. 33 | * @param resultCode The integer result code returned by the child activity through its setResult(). 34 | * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). 35 | */ 36 | void onActivityResult(int requestCode, int resultCode, @Nullable Intent data); 37 | } 38 | -------------------------------------------------------------------------------- /preferencex/src/main/java/com/takisoft/preferencex/PreferenceCategory.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.os.Build; 6 | import android.text.TextUtils; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.TextView; 11 | 12 | import androidx.annotation.ColorInt; 13 | import androidx.annotation.ColorRes; 14 | import androidx.core.content.res.TypedArrayUtils; 15 | import androidx.preference.PreferenceViewHolder; 16 | import androidx.recyclerview.widget.RecyclerView; 17 | 18 | /** 19 | * An extended {@link androidx.preference.PreferenceCategory} that allows the user to set the color 20 | * and the visibility of the title. 21 | */ 22 | public class PreferenceCategory extends androidx.preference.PreferenceCategory { 23 | private static final int[] CATEGORY_ATTRS = new int[]{R.attr.colorAccent}; 24 | 25 | protected int color; 26 | protected View itemView; 27 | 28 | public PreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 29 | super(context, attrs, defStyleAttr, defStyleRes); 30 | 31 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PreferenceCategory, defStyleAttr, 0); 32 | color = a.getColor(R.styleable.PreferenceCategory_pref_categoryColor, 0); 33 | a.recycle(); 34 | } 35 | 36 | public PreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr) { 37 | this(context, attrs, defStyleAttr, 0); 38 | } 39 | 40 | public PreferenceCategory(Context context, AttributeSet attrs) { 41 | this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.preferenceCategoryStyle, android.R.attr.preferenceCategoryStyle)); 42 | } 43 | 44 | public PreferenceCategory(Context context) { 45 | this(context, null); 46 | } 47 | 48 | private void setTitleVisibility(View itemView, boolean isVisible) { 49 | if (itemView == null) { 50 | return; 51 | } 52 | 53 | final RecyclerView.LayoutParams currentParams = (RecyclerView.LayoutParams) itemView.getLayoutParams(); 54 | final RecyclerView.LayoutParams param; 55 | 56 | final boolean wasHidden = itemView.getTag() != null && currentParams.width == 0; 57 | 58 | if (itemView.getTag() == null) { 59 | param = new RecyclerView.LayoutParams((ViewGroup.MarginLayoutParams) currentParams); 60 | itemView.setTag(param); 61 | } else { 62 | param = (RecyclerView.LayoutParams) itemView.getTag(); 63 | } 64 | 65 | if (isVisible) { 66 | if (itemView.getVisibility() == View.GONE || wasHidden) { 67 | currentParams.width = param.width; 68 | currentParams.height = param.height; 69 | currentParams.leftMargin = param.leftMargin; 70 | currentParams.rightMargin = param.rightMargin; 71 | currentParams.topMargin = param.topMargin; 72 | currentParams.bottomMargin = param.bottomMargin; 73 | itemView.setVisibility(View.VISIBLE); 74 | } 75 | } else { 76 | if (itemView.getVisibility() == View.VISIBLE || !wasHidden) { 77 | currentParams.width = 0; 78 | currentParams.height = 0; 79 | currentParams.leftMargin = 0; 80 | currentParams.rightMargin = 0; 81 | currentParams.topMargin = 0; 82 | currentParams.bottomMargin = 0; 83 | itemView.setVisibility(View.GONE); 84 | } 85 | } 86 | } 87 | 88 | @Override 89 | public void setTitle(CharSequence title) { 90 | super.setTitle(title); 91 | 92 | setTitleVisibility(itemView, !TextUtils.isEmpty(getTitle())); 93 | } 94 | 95 | public void setColor(@ColorInt int color) { 96 | this.color = color; 97 | } 98 | 99 | public void setColorResource(@ColorRes int resId) { 100 | int color; 101 | 102 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { 103 | color = getContext().getResources().getColor(resId); 104 | } else { 105 | color = getContext().getColor(resId); 106 | } 107 | 108 | setColor(color); 109 | } 110 | 111 | @Override 112 | public void onBindViewHolder(PreferenceViewHolder holder) { 113 | super.onBindViewHolder(holder); 114 | 115 | itemView = holder.itemView; 116 | 117 | TextView titleView = (TextView) holder.findViewById(android.R.id.title); 118 | 119 | if (titleView != null) { 120 | final TypedArray typedArray = getContext().obtainStyledAttributes(CATEGORY_ATTRS); 121 | 122 | if (typedArray.length() > 0 && typedArray.getIndexCount() > 0) { 123 | final int accentColor = typedArray.getColor(typedArray.getIndex(0), 0xff4081); // defaults to pink 124 | titleView.setTextColor(color == 0 ? accentColor : color); 125 | } 126 | 127 | typedArray.recycle(); 128 | } 129 | 130 | boolean isVisible = !TextUtils.isEmpty(getTitle()); 131 | setTitleVisibility(holder.itemView, isVisible); 132 | /*if (!isVisible) { 133 | return; 134 | }*/ 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /preferencex/src/main/java/com/takisoft/preferencex/SwitchPreferenceCompat.java: -------------------------------------------------------------------------------- 1 | package com.takisoft.preferencex; 2 | 3 | 4 | import android.annotation.SuppressLint; 5 | import android.content.Context; 6 | import android.content.res.ColorStateList; 7 | import android.content.res.TypedArray; 8 | import android.graphics.drawable.Drawable; 9 | import android.util.AttributeSet; 10 | import android.view.View; 11 | 12 | import androidx.appcompat.content.res.AppCompatResources; 13 | import androidx.preference.PreferenceViewHolder; 14 | 15 | public class SwitchPreferenceCompat extends androidx.preference.SwitchPreferenceCompat { 16 | private static final int[] ATTRS = new int[]{androidx.appcompat.R.attr.controlBackground, R.attr.colorControlNormal}; 17 | 18 | private final View.OnClickListener contentClickListener = new View.OnClickListener() { 19 | @SuppressLint("RestrictedApi") 20 | @Override 21 | public void onClick(View v) { 22 | performClick((View) v.getParent()); 23 | } 24 | }; 25 | 26 | private final View.OnClickListener widgetClickListener = new View.OnClickListener() { 27 | @Override 28 | public void onClick(View v) { 29 | final boolean newValue = !isChecked(); 30 | 31 | if (callChangeListener(newValue)) { 32 | setChecked(newValue); 33 | } 34 | } 35 | }; 36 | 37 | private boolean withSeparator = false; 38 | 39 | { 40 | refreshWithSeparator(false); 41 | } 42 | 43 | public SwitchPreferenceCompat(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 44 | super(context, attrs, defStyleAttr, defStyleRes); 45 | } 46 | 47 | public SwitchPreferenceCompat(Context context, AttributeSet attrs, int defStyleAttr) { 48 | super(context, attrs, defStyleAttr); 49 | } 50 | 51 | public SwitchPreferenceCompat(Context context, AttributeSet attrs) { 52 | super(context, attrs); 53 | } 54 | 55 | public SwitchPreferenceCompat(Context context) { 56 | super(context); 57 | } 58 | 59 | void refresh() { 60 | if (!withSeparator) { 61 | return; 62 | } 63 | 64 | boolean value = getPersistedBoolean(false); 65 | boolean oldPersistent = isPersistent(); 66 | 67 | setPersistent(false); 68 | setChecked(value); 69 | setPersistent(oldPersistent); 70 | /*boolean old = mChecked; 71 | mChecked = getPersistedBoolean(false); 72 | 73 | if (old != mChecked) { 74 | notifyDependencyChange(shouldDisableDependents()); 75 | notifyChanged(); 76 | }*/ 77 | } 78 | 79 | @Override 80 | protected void onClick() { 81 | if (!withSeparator) { 82 | super.onClick(); 83 | } 84 | } 85 | 86 | private void refreshWithSeparator(boolean changeLayout) { 87 | if (setWithSeparator(getFragment() != null) && changeLayout) { 88 | notifyHierarchyChanged(); 89 | } 90 | } 91 | 92 | private boolean setWithSeparator(boolean withSeparator) { 93 | if (this.withSeparator == withSeparator) { 94 | return false; 95 | } 96 | 97 | this.withSeparator = withSeparator; 98 | if (withSeparator) { 99 | setLayoutResource(R.layout.preference_material_ext); 100 | } else { 101 | setLayoutResource(androidx.preference.R.layout.preference_material); 102 | } 103 | 104 | return true; 105 | } 106 | 107 | @Override 108 | public void setFragment(String fragment) { 109 | super.setFragment(fragment); 110 | refreshWithSeparator(true); 111 | } 112 | 113 | @Override 114 | public void onBindViewHolder(PreferenceViewHolder holder) { 115 | super.onBindViewHolder(holder); 116 | 117 | if (withSeparator) { 118 | holder.findViewById(android.R.id.widget_frame).setOnClickListener(widgetClickListener); 119 | holder.findViewById(R.id.pref_content_frame).setOnClickListener(contentClickListener); 120 | //?attr/controlBackground 121 | //androidx.appcompat.R.attr.controlBackground 122 | 123 | final TypedArray typedArray = getContext().obtainStyledAttributes(ATTRS); 124 | 125 | if (typedArray.length() > 0 && typedArray.getIndexCount() > 0) { 126 | int id = typedArray.getResourceId(0, 0); 127 | if (id != 0) { 128 | Drawable bgDrawable = AppCompatResources.getDrawable(getContext(), id); 129 | holder.findViewById(androidx.preference.R.id.switchWidget).setBackgroundDrawable(bgDrawable); 130 | } 131 | 132 | ColorStateList separatorColor = typedArray.getColorStateList(1); 133 | if (separatorColor != null) { 134 | int[] stateSet = isEnabled() ? new int[]{android.R.attr.state_enabled} : new int[]{-android.R.attr.state_enabled}; 135 | int dividerColor = separatorColor.getColorForState(stateSet, separatorColor.getDefaultColor()); 136 | holder.findViewById(R.id.pref_separator).setBackgroundColor(dividerColor); 137 | } 138 | } 139 | 140 | typedArray.recycle(); 141 | } 142 | 143 | holder.itemView.setClickable(!withSeparator); 144 | holder.itemView.setFocusable(!withSeparator); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /preferencex/src/main/res/layout/preference_list_master_switch.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 37 | 38 | 39 | 40 | 46 | 47 | 54 | 55 | 56 | 57 | 58 | 66 | 67 | 68 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /preferencex/src/main/res/layout/preference_material_ext.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 37 | 38 | 39 | 40 | 46 | 47 | 54 | 55 | 66 | 67 | 68 | 69 | 70 | 77 | 78 | 89 | 90 | -------------------------------------------------------------------------------- /preferencex/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /preferencex/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /preferencex/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 22 | 23 | 27 | 28 | 32 | 33 | -------------------------------------------------------------------------------- /scripts/publish-module.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'signing' 3 | 4 | task androidSourcesJar(type: Jar) { 5 | archiveClassifier.set('sources') 6 | if (project.plugins.findPlugin("com.android.library")) { 7 | from android.sourceSets.main.java.srcDirs 8 | } else { 9 | from sourceSets.main.java.srcDirs 10 | } 11 | } 12 | 13 | artifacts { 14 | archives androidSourcesJar 15 | } 16 | 17 | group = PUBLISH_GROUP_ID 18 | version = PUBLISH_VERSION 19 | 20 | afterEvaluate { 21 | publishing { 22 | publications { 23 | release(MavenPublication) { 24 | // The coordinates of the library, being set from variables that 25 | // we'll set up later 26 | groupId PUBLISH_GROUP_ID 27 | artifactId PUBLISH_ARTIFACT_ID 28 | version PUBLISH_VERSION 29 | 30 | // Two artifacts, the `aar` (or `jar`) and the sources 31 | if (project.plugins.findPlugin("com.android.library")) { 32 | from components.release 33 | } else { 34 | artifact("$buildDir/libs/${project.getName()}-${version}.jar") 35 | } 36 | 37 | artifact androidSourcesJar 38 | 39 | // Mostly self-explanatory metadata 40 | pom { 41 | name = PUBLISH_ARTIFACT_ID 42 | description = PUBLISH_DESCRIPTION 43 | url = PUBLISH_URL 44 | licenses { 45 | license { 46 | name = PUBLISH_LICENSE_NAME 47 | url = PUBLISH_LICENSE_URL 48 | } 49 | } 50 | developers { 51 | developer { 52 | id = PUBLISH_DEVELOPER_ID 53 | name = PUBLISH_DEVELOPER_NAME 54 | email = PUBLISH_DEVELOPER_EMAIL 55 | } 56 | } 57 | 58 | // Version control info - if you're using GitHub, follow the 59 | // format as seen here 60 | scm { 61 | connection = PUBLISH_SCM_CONNECTION 62 | developerConnection = PUBLISH_SCM_DEVELOPER_CONNECTION 63 | url = PUBLISH_SCM_URL 64 | } 65 | } 66 | } 67 | } 68 | } 69 | } 70 | 71 | ext["signing.keyId"] = rootProject.ext["signing.keyId"] 72 | ext["signing.password"] = rootProject.ext["signing.password"] 73 | ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] 74 | 75 | signing { 76 | sign publishing.publications 77 | } 78 | -------------------------------------------------------------------------------- /scripts/publish-root.gradle: -------------------------------------------------------------------------------- 1 | // Create variables with empty default values 2 | ext["signing.keyId"] = '' 3 | ext["signing.password"] = '' 4 | ext["signing.secretKeyRingFile"] = '' 5 | ext["ossrhUsername"] = '' 6 | ext["ossrhPassword"] = '' 7 | ext["sonatypeStagingProfileId"] = '' 8 | 9 | File secretPropsFile = project.rootProject.file('local.properties') 10 | if (secretPropsFile.exists()) { 11 | // Read local.properties file first if it exists 12 | Properties p = new Properties() 13 | new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } 14 | p.each { name, value -> ext[name] = value } 15 | } else { 16 | // Use system environment variables 17 | ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') 18 | ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') 19 | ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') 20 | ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') 21 | ext["signing.password"] = System.getenv('SIGNING_PASSWORD') 22 | ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') 23 | } 24 | 25 | // Set up Sonatype repository 26 | nexusPublishing { 27 | repositories { 28 | sonatype { 29 | stagingProfileId = sonatypeStagingProfileId 30 | username = ossrhUsername 31 | password = ossrhPassword 32 | nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) 33 | snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':preferencex', ':preferencex-datetimepicker', ':preferencex-ringtone', ':preferencex-colorpicker', ':preferencex-simplemenu' 2 | --------------------------------------------------------------------------------