Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkorossy committed Oct 24, 2017
2 parents 2cd6d3e + ee3bb6c commit f06543f
Show file tree
Hide file tree
Showing 23 changed files with 378 additions and 147 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

**2017-10-24**

New version: 26.1.0.3 (based on v26.1.0)

- The attribute names use the `pref_` prefix in order to avoid name collision with other libraries
- The custom preferences call their change listeners
- Custom preferences extending `DialogPreference` can be added using `PreferenceFragmentCompat.addDialogPreference(...)`

**2017-09-24**

New version: 26.1.0.2 (based on v26.1.0)
Expand Down
60 changes: 14 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Android Support library - preference v7 bugfix

> **BREAKING CHANGE** in attribute and method names (and behavior) for summary handling of `DatePickerPreference` and `TimePickerPreference`. See the changelog for more details.
> **BREAKING CHANGE** in 26.1.0.3: The custom attribute names for extra preference types use `pref_` prefix in order to avoid name collision with other libraries. See the changelog for more details.
This library is meant to fix some of the problems found in the official support preference-v7 library. Also, there are [new preference types](#extra-types) available, such as `RingtonePreference`, `DatePickerPreference`, and `TimePickerPreference`.

Expand All @@ -23,12 +23,12 @@ compile 'com.android.support:preference-v14:26.1.0'
```
And **add** this single line to your gradle file:
```gradle
compile 'com.takisoft.fix:preference-v7:26.1.0.2'
compile 'com.takisoft.fix:preference-v7:26.1.0.3'
```
> Notice the versioning: the first three numbers are *always* the same as the latest official library while the last number is for own updates. I try to keep it up-to-date but if, for whatever reasons, I wouldn't notice the new support library versions, just issue a ticket.
### 2. Use the appropriate class as your fragment's base
You can use either `PreferenceFragmentCompat` or `PreferenceFragmentCompatDividers`. The former is the fixed version of the original fragment while the latter is an extended one where you can set the dividers using the divider flags.
You can use either `PreferenceFragmentCompat` or `PreferenceFragmentCompatDividers`. The former is the fixed version of the original fragment while the latter is an extended one where you can set the dividers using the divider flags. The `PreferenceFragmentCompatDividers` is the recommended approach as it uses the updated Material Design guidelines to create the appropriate divider config.

#### Option 1 - `PreferenceFragmentCompat`
```java
Expand Down Expand Up @@ -92,17 +92,17 @@ Now you can enjoy using the support preferences API without losing all your hair
There are additional preferences not part of the official support library, but decided to add them to some extra libraries. You can add all of them to your project using

```gradle
compile 'com.takisoft.fix:preference-v7-extras:26.1.0.2'
compile 'com.takisoft.fix:preference-v7-extras:26.1.0.3'
```

or one or more groups:

Preference | Dependency | Preview
-|-|-
[`RingtonePreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#ringtonepreference) | `compile 'com.takisoft.fix:preference-v7-ringtone:26.1.0.2'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/ringtone_api26.png)
[`DatePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#datepickerpreference) | `compile 'com.takisoft.fix:preference-v7-datetimepicker:26.1.0.2'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/datepicker_api26.png)
[`TimePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#timepickerpreference) | `compile 'com.takisoft.fix:preference-v7-datetimepicker:26.1.0.2'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/timepicker_api26.png)
[`ColorPickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#colorpickerpreference) | `compile 'com.takisoft.fix:preference-v7-colorpicker:26.1.0.2'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/colorpicker_api26_fixed.png)
[`RingtonePreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#ringtonepreference) | `compile 'com.takisoft.fix:preference-v7-ringtone:26.1.0.3'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/ringtone_api26.png)
[`DatePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#datepickerpreference) | `compile 'com.takisoft.fix:preference-v7-datetimepicker:26.1.0.3'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/datepicker_api26.png)
[`TimePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#timepickerpreference) | `compile 'com.takisoft.fix:preference-v7-datetimepicker:26.1.0.3'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/timepicker_api26.png)
[`ColorPickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#colorpickerpreference) | `compile 'com.takisoft.fix:preference-v7-colorpicker:26.1.0.3'` | ![API 15](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/colorpicker_api26_fixed.png)

---

Expand Down Expand Up @@ -148,7 +148,7 @@ The original implementation uses `?attr/textAppearanceSmall` as the message styl
---

## Version
The current stable version is **26.1.0.2**.
The current stable version is **26.1.0.3**.

## Notes #
This demo / bugfix is set to work on API level 14+.
Expand All @@ -167,45 +167,13 @@ API 15 | API 21 | API 26

### Changelog

**2017-09-24**
**2017-10-24**

New version: 26.1.0.2 (based on v26.1.0)
New version: 26.1.0.3 (based on v26.1.0)

- Quick fix: the app won't crash if the preference XML couldn't be inflated (but it will still display as an empty screen)

**2017-09-24**

New version: 26.1.0.1 (based on v26.1.0)

- Bug fix: crash on API 26 when using dividers and preferences with widgets together
- Bug fix: `ColorPickerPreference`'s column number defaults to auto (0) instead of 3
- `PreferenceCategory`'s title view gets hidden (including its dimensions) when the title is empty (the dividers will be drawn as if the title was not hidden)
- Added 2 new flags to the custom dividers: `DIVIDER_NO_BEFORE_FIRST` and `DIVIDER_NO_AFTER_LAST`

**2017-09-17**

New version: 26.1.0.0 (based on v26.1.0)

- No official support preferences related changes.
- Added new preference type:
- [`ColorPickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#colorpickerpreference)
- [`RingtonePreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#ringtonepreference) has a new attribute: `app:summaryHasRingtone` that can be used to display the name of the selected ringone.

- **BREAKING CHANGE** in attribute and method names (and behavior) for summary handling of `DatePickerPreference` and `TimePickerPreference`.
- The previous `summaryNoXXX` no longer exists. Use the normal `summary` instead for showing summary if no pick is made.
- The new attribute is `summaryHasXXX` which is going to be displayed if the picker has a picked value. If this is not set, the `summary` will be used instead.

**2017-08-31**

New version: 26.0.2.0 (based on v26.0.2)

- No official support preferences related changes.
- Added new preference types:
- [`RingtonePreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#ringtonepreference)
- [`DatePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#datepickerpreference)
- [`TimePickerPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#timepickerpreference)

See the wiki / Preference types page for more details.
- The attribute names use the `pref_` prefix in order to avoid name collision with other libraries
- The custom preferences call their change listeners
- Custom preferences extending `DialogPreference` can be added using `PreferenceFragmentCompat.addDialogPreference(...)`

> For older changelogs, check out the [CHANGELOG](CHANGELOG.md) file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable
try {
return super.onCreateView(inflater, container, savedInstanceState);
} finally {
// Comment this out if you want to revert to the default divider style
setDividerPreferences(DIVIDER_CATEGORY_BEFORE_FIRST | DIVIDER_CATEGORY_BETWEEN | DIVIDER_NO_BEFORE_FIRST);
// Uncomment this if you want to change the divider style
// setDividerPreferences(DIVIDER_OFFICIAL);
}
}

Expand Down
16 changes: 8 additions & 8 deletions app/src/main/res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,30 @@
android:showSilent="true"
android:summary="Select a nice ringtone"
android:title="RingtonePreference"
app:showAdd="true"
app:summaryHasRingtone="The best ringtone: %s" />
app:pref_showAdd="true"
app:pref_summaryHasRingtone="The best ringtone: %s" />
<TimePickerPreference
android:key="pref_time"
android:persistent="false"
android:summary="Select the perfect time"
android:title="TimePickerPreference"
app:hourFormat="auto"
app:pickerTime="19:35"
app:summaryHasTime="Selected time: %s" />
app:pref_hourFormat="auto"
app:pref_pickerTime="19:35"
app:pref_summaryHasTime="Selected time: %s" />
<DatePickerPreference
android:key="pref_date"
android:persistent="false"
android:summary="Select a date"
android:title="DatePickerPreference"
app:minDate="08/31/2017"
app:summaryHasDate="Selected date: %s" />
app:pref_minDate="08/31/2017"
app:pref_summaryHasDate="Selected date: %s" />
<ColorPickerPreference
android:dialogTitle="@string/color_picker_default_title"
android:key="pref_color"
android:persistent="false"
android:summary="Very nice color"
android:title="ColorPickerPreference"
app:size="small" />
app:pref_size="small" />
</PreferenceCategory>
<PreferenceCategory
android:key="pref_empty_categ"
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project.ext.buildToolsVersion = '26.0.1'
project.ext.buildToolsVersion = '26.0.2'
project.ext.minSdkVersion = 14
project.ext.sdkVersion = 26
project.ext.supportLibraryVersion = '26.1.0'
project.ext.supportLibraryVersionPrefix = '26.1.0'
project.ext.supportLibraryVersionSuffix = ''
project.ext.fixLibraryVersion = '2'
project.ext.fixLibraryVersion = '3'

project.ext.extrasLibraryVersionSuffix = ''

Expand All @@ -15,7 +15,7 @@ buildscript {
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
classpath 'com.android.tools.build:gradle:3.0.0-rc2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

Expand Down
2 changes: 1 addition & 1 deletion preference-v7-colorpicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ext {
dependencies {
implementation project(':preference-v7')
implementation "com.android.support:appcompat-v7:${rootProject.supportLibraryVersion}"
api 'com.takisoft.fix:colorpicker:0.9.1'
api 'com.takisoft.fix:colorpicker:1.0.0'
}

//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle'
Expand Down
Loading

0 comments on commit f06543f

Please sign in to comment.