Skip to content
This repository was archived by the owner on Dec 17, 2020. It is now read-only.

Commit 9dc6fec

Browse files
committed
Dependency updates + Android N update
1 parent 49c04cb commit 9dc6fec

File tree

7 files changed

+70
-24
lines changed

7 files changed

+70
-24
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.1.2'
8+
classpath 'com.android.tools.build:gradle:2.2.0'
99
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
10-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
10+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
1313
}

demo/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
4+
compileSdkVersion 24
55
buildToolsVersion "23.0.3"
66

77
defaultConfig {
88
applicationId "org.neotech.app.retainabletasksdemo"
9-
minSdkVersion 8
10-
targetSdkVersion 23
9+
minSdkVersion 9
10+
targetSdkVersion 24
1111
versionCode 1
1212
versionName "1.0"
1313
}
@@ -23,13 +23,13 @@ dependencies {
2323
compile project(':library')
2424
//compile 'org.neotech.library:android-retainable-tasks:0.1.0'
2525

26-
compile 'com.android.support:appcompat-v7:23.4.0'
27-
compile 'com.android.support:design:23.4.0'
26+
compile 'com.android.support:appcompat-v7:24.2.1'
27+
compile 'com.android.support:design:24.2.1'
2828

2929
//LeakCanary is used to detect memory leaks in debug builds.
30-
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
31-
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
32-
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
30+
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
31+
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
32+
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
3333

3434
//Unit-testing
3535
testCompile 'junit:junit:4.12'

demo/src/main/java/org/neotech/app/retainabletasksdemo/ExtendedHtml.java

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package org.neotech.app.retainabletasksdemo;
22

3+
import android.graphics.Typeface;
4+
import android.os.Build;
5+
import android.os.Parcel;
6+
import android.os.Parcelable;
37
import android.support.annotation.NonNull;
8+
import android.support.design.internal.ParcelableSparseArray;
49
import android.text.Editable;
510
import android.text.Html;
611
import android.text.Spannable;
@@ -16,10 +21,24 @@
1621
*/
1722
public final class ExtendedHtml {
1823

24+
public static final int FROM_HTML_MODE_LEGACY = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_MODE_LEGACY:0;
25+
public static final int FROM_HTML_MODE_COMPACT = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_MODE_COMPACT:0;
26+
public static final int FROM_HTML_OPTION_USE_CSS_COLORS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_OPTION_USE_CSS_COLORS:0;
27+
public static final int FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE:0;
28+
public static final int FROM_HTML_SEPARATOR_LINE_BREAK_DIV = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_SEPARATOR_LINE_BREAK_DIV:0;
29+
public static final int FROM_HTML_SEPARATOR_LINE_BREAK_HEADING = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_SEPARATOR_LINE_BREAK_HEADING:0;
30+
public static final int FROM_HTML_SEPARATOR_LINE_BREAK_LIST = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_SEPARATOR_LINE_BREAK_LIST:0;
31+
public static final int FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM:0;
32+
public static final int FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N?Html.FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH:0;
33+
1934
private static final ExtendedTagHandler TAG_HANDLER = new ExtendedTagHandler();
2035

21-
public static Spanned fromHtml(String source){
22-
return Html.fromHtml(source, null, TAG_HANDLER);
36+
public static Spanned fromHtml(String source, int flags){
37+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
38+
return Html.fromHtml(source, flags, null, TAG_HANDLER);
39+
} else {
40+
return Html.fromHtml(source, null, TAG_HANDLER);
41+
}
2342
}
2443

2544
private static class CodeSpan extends TypefaceSpan {
@@ -31,6 +50,11 @@ public CodeSpan(int backgroundColor){
3150
this.backgroundColor = backgroundColor;
3251
}
3352

53+
protected CodeSpan(Parcel in) {
54+
super(in);
55+
this.backgroundColor = in.readInt();
56+
}
57+
3458
@Override
3559
public void updateDrawState(TextPaint tp) {
3660
super.updateDrawState(tp);
@@ -42,14 +66,37 @@ public void updateMeasureState(TextPaint paint) {
4266
super.updateMeasureState(paint);
4367
paint.bgColor = backgroundColor;
4468
}
69+
70+
public static final Creator<CodeSpan> CREATOR = new Creator<CodeSpan>() {
71+
72+
@Override
73+
public CodeSpan createFromParcel(Parcel in) {
74+
return new CodeSpan(in);
75+
}
76+
77+
@Override
78+
public CodeSpan[] newArray(int size) {
79+
return new CodeSpan[size];
80+
}
81+
};
82+
83+
@Override
84+
public void writeToParcel(Parcel dest, int flags) {
85+
super.writeToParcel(dest, flags);
86+
dest.writeInt(backgroundColor);
87+
}
88+
89+
public int describeContents() {
90+
return 0;
91+
}
4592
}
4693

4794
/**
4895
* Based on: http://stackoverflow.com/questions/4044509/android-how-to-use-the-html-taghandler
4996
*/
5097
private static class ExtendedTagHandler implements Html.TagHandler {
5198

52-
private static final int COLOR = 0xFFCCCCCC;
99+
private static final int COLOR = 0xFFDDDDDD;
53100

54101
@Override
55102
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {

demo/src/main/java/org/neotech/app/retainabletasksdemo/activity/Main.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.support.annotation.NonNull;
99
import android.support.v7.app.AppCompatActivity;
1010
import android.support.v7.widget.Toolbar;
11+
import android.text.Html;
1112
import android.text.Spanned;
1213
import android.view.LayoutInflater;
1314
import android.view.Menu;
@@ -40,7 +41,6 @@ public class Main extends TaskActivityCompat implements Task.Callback {
4041
protected void onCreate(Bundle savedInstanceState) {
4142
super.onCreate(savedInstanceState);
4243
setContentView(R.layout.activity_main);
43-
// setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
4444

4545
vSwitcher = (ViewSwitcher) findViewById(R.id.switcher);
4646
list = (ListView) findViewById(android.R.id.list);
@@ -182,7 +182,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
182182
return convertView;
183183
}
184184

185-
186185
@Override
187186
public void onClick(View v) {
188187
v.getContext().startActivity((Intent) v.getTag());
@@ -198,8 +197,8 @@ private static class Demo {
198197
public Demo(Context context, int titleResId, int descriptionResId, String uri, Intent intent){
199198
this.intentStart = intent;
200199
this.intentView = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/NeoTech-Software/Android-Retainable-Tasks/tree/master/demo/src/main/java/" + uri));
201-
this.title = ExtendedHtml.fromHtml(context.getString(titleResId));
202-
this.description = ExtendedHtml.fromHtml(context.getString(descriptionResId));
200+
this.title = ExtendedHtml.fromHtml(context.getString(titleResId), ExtendedHtml.FROM_HTML_MODE_LEGACY);
201+
this.description = ExtendedHtml.fromHtml(context.getString(descriptionResId), ExtendedHtml.FROM_HTML_MODE_LEGACY);
203202
}
204203
}
205204
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Apr 28 17:08:46 CEST 2016
1+
#Mon Oct 03 15:46:44 CEST 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

library/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ group = publishedGroupId
3636
version = libraryVersion
3737

3838
android {
39-
compileSdkVersion 23
39+
compileSdkVersion 24
4040
buildToolsVersion "23.0.3"
4141

4242
defaultConfig {
4343
minSdkVersion 8
44-
targetSdkVersion 23
44+
targetSdkVersion 24
4545
versionCode 1
4646
versionName = libraryVersion
4747
}
@@ -60,8 +60,8 @@ configurations {
6060
dependencies {
6161
compile fileTree(dir: 'libs', include: ['*.jar'])
6262
testCompile 'junit:junit:4.12'
63-
compile 'com.android.support:appcompat-v7:23.4.0'
64-
javadocCompile 'com.android.support:appcompat-v7:23.4.0'
63+
compile 'com.android.support:appcompat-v7:24.2.1'
64+
javadocCompile 'com.android.support:appcompat-v7: 24.2.1'
6565
}
6666

6767
apply from: 'publish-library.gradle'

library/src/main/java/org/neotech/library/retainabletasks/internal/BaseTaskManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public boolean isResultDelivered(@NonNull String tag) {
160160
@Override
161161
@MainThread
162162
public boolean isRunning(@NonNull String tag) {
163-
if(TaskManager.isStrictDebugModeEnabled()){
163+
if (TaskManager.isStrictDebugModeEnabled()) {
164164
assertMainThread();
165165
}
166166
Task task = tasks.get(tag);

0 commit comments

Comments
 (0)