Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkorossy committed Jul 18, 2018
2 parents b227f64 + 5f28c22 commit a72d390
Show file tree
Hide file tree
Showing 30 changed files with 553 additions and 151 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

**2018-07-18**

New version: 28.0.0.0-alpha3 (based on v28.0.0-alpha3)

- No support preferences related changes in the support library.
- `PreferenceFragmentCompatDividers` is now deprecated. Use `PreferenceFragmentCompat` instead.
- Added `preference-v7-material` module which provides `Theme.MaterialComponents` related themes.
- Bug fixes #166, #169, #173

**2018-07-04**

New version: 27.1.1.2 (based on v27.1.1)
Expand Down
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
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`.

Support Library (28.0.0-alpha3):
[ ![Download](https://api.bintray.com/packages/gericop/maven/com.takisoft.fix%3Apreference-v7/images/download.svg) ](https://bintray.com/gericop/maven/com.takisoft.fix%3Apreference-v7/_latestVersion)

AndroidX (1.0.0-beta01):
[ ![Download](https://api.bintray.com/packages/takisoft/android/com.takisoft.preferencex%3Apreferencex/images/download.svg) ](https://bintray.com/takisoft/android/com.takisoft.preferencex%3Apreferencex/_latestVersion)
> Check out the other available AndroidX artifacts at https://bintray.com/takisoft/android)
### Donation

If you would like to support me, you may donate some small amount via PayPal.
Expand All @@ -18,12 +23,12 @@ If you would like to support me, you may donate some small amount via PayPal.
### 1. Add gradle dependency
First, **remove** the unnecessary lines of preference-v7 and preference-v14 from your gradle file as the bugfix contains both of them:
```gradle
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:preference-v14:27.1.1'
implementation 'com.android.support:preference-v7:28.0.0-alpha3'
implementation 'com.android.support:preference-v14:28.0.0-alpha3'
```
And **add** this single line to your gradle file:
```gradle
implementation 'com.takisoft.fix:preference-v7:27.1.1.2'
implementation 'com.takisoft.fix:preference-v7:28.0.0.0-alpha3'
```
> 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.
Expand All @@ -47,6 +52,7 @@ public class MyPreferenceFragment extends PreferenceFragmentCompat {
> **Warning!** Watch out for the correct package name when importing `PreferenceFragmentCompat`, it should come from `com.takisoft.fix.support.v7.preference`.
---
#### Option 2 - `PreferenceFragmentCompatDividers`
> **Warning!** `PreferenceFragmentCompatDividers` is deprecated and will be removed from the AndroidX version of the lib. You should use `PreferenceFragmentCompat` instead.
```java
import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers;

Expand Down Expand Up @@ -82,6 +88,14 @@ For example, the sample app uses `PreferenceFixTheme.Light.NoActionBar` as the p
</style>
```

**Theme.MaterialComponents**
There's a NEW module called `preference-v7-material` that provides the new `Theme.MaterialComponents` related themes. You can add it to your project like this:
```gradle
implementation 'com.takisoft.fix:preference-v7-material:28.0.0.0-alpha3'
```

> Note that you may need to use multidexing after this because it uses the support design library which is a huge codebase.
### 4. That's it!
Now you can enjoy using the support preferences API without losing all your hair.

Expand All @@ -92,18 +106,18 @@ 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
implementation 'com.takisoft.fix:preference-v7-extras:27.1.1.2'
implementation 'com.takisoft.fix:preference-v7-extras:28.0.0.0-alpha3'
```

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:27.1.1.2'` | ![API 26](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:27.1.1.2'` | ![API 26](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:27.1.1.2'` | ![API 26](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:27.1.1.2'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/colorpicker_api26_fixed.png)
[`SimpleMenuPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#simplemenupreference) | `compile 'com.takisoft.fix:preference-v7-simplemenu:27.1.1.2'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/simplemenu_api26.png)
[`RingtonePreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#ringtonepreference) | `compile 'com.takisoft.fix:preference-v7-ringtone:28.0.0.0-alpha3'` | ![API 26](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:28.0.0.0-alpha3'` | ![API 26](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:28.0.0.0-alpha3'` | ![API 26](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:28.0.0.0-alpha3'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/colorpicker_api26_fixed.png)
[`SimpleMenuPreference`](https://github.com/Gericop/Android-Support-Preference-V7-Fix/wiki/Preference-types#simplemenupreference) | `compile 'com.takisoft.fix:preference-v7-simplemenu:28.0.0.0-alpha3'` | ![API 26](https://raw.githubusercontent.com/Gericop/Android-Support-Preference-V7-Fix/master/images/simplemenu_api26.png)

---

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

## Version
The current stable version is **27.1.1.2**.
The current stable version is **28.0.0.0-alpha3**.

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

### Changelog

**2018-07-18**

New version: 28.0.0.0-alpha3 (based on v28.0.0-alpha3)

- No support preferences related changes in the support library.
- `PreferenceFragmentCompatDividers` is now deprecated. Use `PreferenceFragmentCompat` instead.
- Added `preference-v7-material` module which provides `Theme.MaterialComponents` related themes.
- Bug fixes #166, #169, #173

**2018-07-04**

New version: 27.1.1.2 (based on v27.1.1)

- No support preferences related changes in the support library.
- RingtonePreference bug fixes(#164, #165, #167).

**2018-05-11**

New version: 27.1.1.1 (based on v27.1.1)

- No support preferences related changes in the support library.
- Bug fixes (#153, #149, #155, #152).

**2018-04-10**

New version: 27.1.1.0 (based on v27.1.1)

- No support preferences related changes in the support library.
- Some bug fixes (see #147 for more info).

> For older changelogs, check out the [CHANGELOG](CHANGELOG.md) file.
Feel free to ask / suggest anything on this page by creating a ticket (*issues*)!
Expand Down
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android {
targetSdkVersion rootProject.sdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
Expand All @@ -20,7 +21,8 @@ android {
}

dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:appcompat-v7:${rootProject.supportLibraryVersion}"
implementation project(':preference-v7')
implementation project(':preference-v7-material')
implementation project(':preference-v7-extras')
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.takisoft.preferencefix;

import android.support.multidex.MultiDexApplication;

public class MyApplication extends MultiDexApplication {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
import android.support.annotation.Nullable;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.takisoft.fix.support.v7.preference.EditTextPreference;
import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompatDividers;
import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat;

/**
* A placeholder fragment containing a simple view.
*/
public class MyPreferenceFragment extends PreferenceFragmentCompatDividers {
public class MyPreferenceFragment extends PreferenceFragmentCompat {

@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
Expand All @@ -30,7 +27,7 @@ public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String r

Preference prefEmptyCheck = findPreference("pref_empty_check");

if(prefEmptyCheck != null) {
if (prefEmptyCheck != null) {
prefEmptyCheck.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Expand All @@ -46,16 +43,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable Bundle savedInstanceState) {
try {
return super.onCreateView(inflater, container, savedInstanceState);
} finally {
// Uncomment this if you want to change the divider style
// setDividerPreferences(DIVIDER_OFFICIAL);
}
}

private void testDynamicPrefs() {
final Context ctx = getPreferenceManager().getContext(); // this is the material styled context

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<!-- Base application theme. -->
<style name="Theme.MyTheme" parent="@style/PreferenceFixTheme.Light.NoActionBar">
<style name="Theme.MyTheme" parent="@style/PreferenceFixTheme.MaterialComponents.Light.NoActionBar">
<item name="colorAccent">@color/accent</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
Expand Down
14 changes: 7 additions & 7 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 = '27.0.3'
project.ext.buildToolsVersion = '28.0.0'
project.ext.minSdkVersion = 14
project.ext.sdkVersion = 27
project.ext.supportLibraryVersion = '27.1.1'
project.ext.supportLibraryVersionPrefix = '27.1.1'
project.ext.supportLibraryVersionSuffix = ''
project.ext.fixLibraryVersion = '2'
project.ext.sdkVersion = 28
project.ext.supportLibraryVersion = '28.0.0-alpha3'
project.ext.supportLibraryVersionPrefix = '28.0.0'
project.ext.supportLibraryVersionSuffix = '-alpha3'
project.ext.fixLibraryVersion = '0'

project.ext.extrasLibraryVersionSuffix = ''

Expand All @@ -16,7 +16,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta02'
classpath 'com.android.tools.build:gradle:3.2.0-beta03'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
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:1.0.4'
api 'com.takisoft.fix:colorpicker:1.0.5-alpha3'
}

//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle'
Expand Down
2 changes: 1 addition & 1 deletion preference-v7-datetimepicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ext {

dependencies {
implementation project(':preference-v7')
api 'com.takisoft.fix:datetimepicker:1.0.6'
api 'com.takisoft.fix:datetimepicker:1.0.7-alpha3'
}

//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle'
Expand Down
2 changes: 0 additions & 2 deletions preference-v7-extras/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ ext {
}

dependencies {
implementation project(':preference-v7')

api project(':preference-v7-datetimepicker')
api project(':preference-v7-ringtone')
api project(':preference-v7-colorpicker')
Expand Down
1 change: 1 addition & 0 deletions preference-v7-material/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
57 changes: 57 additions & 0 deletions preference-v7-material/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion rootProject.sdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.sdkVersion
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
consumerProguardFiles 'proguard-rules.pro'
}
}
}

ext {
bintrayRepo = 'maven'
bintrayName = 'com.takisoft.fix:preference-v7-material'

publishedGroupId = 'com.takisoft.fix'
libraryName = 'Preference v7 - Fix with Material Components'
artifact = 'preference-v7-material'

libraryDescription = 'Android Support Library Preference v7 is full of bugs. This library tries to overcome some of the basic problems. The original Support Library files are under Apache 2.0, the fixes are unlicensed.'

siteUrl = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix'
gitUrl = 'https://github.com/Gericop/Android-Support-Preference-V7-Fix.git'

libraryVersion = "${rootProject.supportLibraryVersionPrefix}.${fixLibraryVersion}${rootProject.supportLibraryVersionSuffix}"

developerId = 'gericop'
developerName = 'Gergely Kőrössy'
developerEmail = 'korossyg@takisoft.com'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0", "Unlicense"]
}

dependencies {
api project(':preference-v7')
api "com.android.support:design:${rootProject.supportLibraryVersion}"
}

//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/installv.gradle'
//apply from: 'https://raw.githubusercontent.com/numetriclabz/jcenter/master/bintrayv.gradle'
apply from: '../installv.gradle'
apply from: '../bintrayv.gradle'

javadoc.doFirst {
failOnError false
}
21 changes: 21 additions & 0 deletions preference-v7-material/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.takisoft.preferencefix.material;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.takisoft.preferencefix.material.test", appContext.getPackageName());
}
}
2 changes: 2 additions & 0 deletions preference-v7-material/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.takisoft.preferencefix.material" />
Loading

0 comments on commit a72d390

Please sign in to comment.