From 8b4126674bc82c44d30f691e002885a29c06d3aa Mon Sep 17 00:00:00 2001 From: chenxinlei Date: Wed, 10 Aug 2022 11:42:02 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BAAndroidX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- app/build.gradle | 21 +++++----- app/src/main/AndroidManifest.xml | 4 +- .../main/java/zhou/demo/DebugActivity.java | 2 +- app/src/main/java/zhou/demo/GifActivity.java | 4 +- .../main/java/zhou/demo/ListViewActivity.java | 30 +++++++------- app/src/main/java/zhou/demo/MainActivity.java | 4 +- .../java/zhou/demo/RecyclerViewActivity.java | 10 ++--- app/src/main/java/zhou/demo/TestActivity.java | 4 +- app/src/main/res/layout/activity_recycler.xml | 2 +- app/src/main/res/raw/hello.md | 2 +- app/src/main/res/raw/tt.md | 2 +- .../main/res/xml/network_security_config.xml | 7 ++++ build.gradle | 40 +++++++++++-------- glideimagegetter/build.gradle | 17 ++++---- .../glideimagegetter/GlideImageGetter.java | 2 +- .../glideimagegetter/ImageTarget.java | 2 +- .../glideimagegetter/ImageTargetGif.java | 2 +- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 6 +-- okhttpimagedownloader/build.gradle | 39 +++++------------- richtext/build.gradle | 37 ++++------------- .../com/zzhoujay/richtext/ImageHolder.java | 4 +- .../com/zzhoujay/richtext/LinkHolder.java | 2 +- .../java/com/zzhoujay/richtext/RichText.java | 2 +- .../com/zzhoujay/richtext/RichTextConfig.java | 4 +- .../com/zzhoujay/richtext/RichTextPool.java | 2 +- .../zzhoujay/richtext/cache/BitmapPool.java | 2 +- .../drawable/DrawableBorderHolder.java | 2 +- .../richtext/drawable/DrawableWrapper.java | 2 +- .../richtext/drawable/GifDrawable.java | 2 +- 31 files changed, 121 insertions(+), 146 deletions(-) create mode 100644 app/src/main/res/xml/network_security_config.xml diff --git a/README.md b/README.md index 3b37c50..3f4b19e 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ ### gradle中引用的方法 ``` -compile 'com.zzhoujay.richtext:richtext:latest-version' +implementation 'com.zzhoujay.richtext:richtext:latest-version' ``` ### 使用新的Html解析器 只需加入此依赖即可,无须其他操作,新Html解析器对原生Html解析器的功能做了补充 ``` -compile 'com.zzhoujay:html:latest-version' +implementation 'com.zzhoujay:html:latest-version' ``` 新Html解析器增加了对代码块的支持,代码块可以触发点击事件,通过`urlClick`设置, diff --git a/app/build.gradle b/app/build.gradle index a2b7b58..01ee5be 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 - buildToolsVersion "25.0.2" + compileSdkVersion 33 defaultConfig { applicationId "zhou.demo" minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 33 versionCode 1 versionName "1.0" } @@ -27,13 +26,13 @@ android { } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - testCompile 'junit:junit:4.12' - compile 'com.android.support:appcompat-v7:26.1.0' - compile 'com.android.support:recyclerview-v7:26.1.0' - compile project(':richtext') -// compile project(':okhttpimagedownloader') -// compile 'com.zzhoujay.richtext:richtext:3.0.7' - compile 'com.zzhoujay:html:1.0.1' + implementation fileTree(include: ['*.jar'], dir: 'libs') + testImplementation 'junit:junit:4.13.2' + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'androidx.recyclerview:recyclerview:1.2.1' + implementation project(':richtext') +// implementation project(':okhttpimagedownloader') +// implementation 'com.zzhoujay.richtext:richtext:3.0.7' + implementation 'com.zzhoujay:html:1.0.1' // compile 'com.zzhoujay.okhttpimagedownloader:OkHttpImageDownloader:1.0.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9e1bacb..c3f062c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,8 +10,10 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" + android:networkSecurityConfig="@xml/network_security_config" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/zhou/demo/DebugActivity.java b/app/src/main/java/zhou/demo/DebugActivity.java index c4008f3..0d94aa9 100644 --- a/app/src/main/java/zhou/demo/DebugActivity.java +++ b/app/src/main/java/zhou/demo/DebugActivity.java @@ -2,7 +2,7 @@ import android.app.Activity; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.Log; import android.widget.ImageView; import android.widget.TextView; diff --git a/app/src/main/java/zhou/demo/GifActivity.java b/app/src/main/java/zhou/demo/GifActivity.java index 36c8050..6b423ef 100644 --- a/app/src/main/java/zhou/demo/GifActivity.java +++ b/app/src/main/java/zhou/demo/GifActivity.java @@ -1,8 +1,8 @@ package zhou.demo; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; diff --git a/app/src/main/java/zhou/demo/ListViewActivity.java b/app/src/main/java/zhou/demo/ListViewActivity.java index f296a34..cb6c401 100644 --- a/app/src/main/java/zhou/demo/ListViewActivity.java +++ b/app/src/main/java/zhou/demo/ListViewActivity.java @@ -1,8 +1,8 @@ package zhou.demo; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -21,7 +21,7 @@ public class ListViewActivity extends AppCompatActivity { // private static final String[] testString = new String[]{ -// "

Test1

", +// "

Test1

", // "

Test2

", // "

Test3

", // "

Test4

", @@ -35,20 +35,20 @@ public class ListViewActivity extends AppCompatActivity { private static final String gifTest = "

Gif Test

"; private static final String[] testString = { - "

Test1

", - "

Test2

", - "

Test3

", - "

Test4

", - "

Test5

", - "

Test6

", - "

Test7

", - "

Test8

", - "

Test9

" + "

Test1

", + "

Test2

", + "

Test3

", + "

Test4

", + "

Test5

", + "

Test6

", + "

Test7

", + "

Test8

", + "

Test9

" }; private static final String[] testString__ = { - "

Test1

", - "

Test2

", - "

Test9

", + "

Test1

", + "

Test2

", + "

Test9

", "

Test3

", "

Test4

", "

Test5

", diff --git a/app/src/main/java/zhou/demo/MainActivity.java b/app/src/main/java/zhou/demo/MainActivity.java index 57eece3..96c92f0 100644 --- a/app/src/main/java/zhou/demo/MainActivity.java +++ b/app/src/main/java/zhou/demo/MainActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; @@ -78,7 +78,7 @@ public class MainActivity extends AppCompatActivity { "

效果

\n" + "

\"演示\"

\n" + "

gradle中引用的方法

\n" + - "
compile 'com.zzhoujay.richtext:richtext:3.0.5'\n" +
+            "
implementation 'com.zzhoujay.richtext:richtext:3.0.5'\n" +
             "
\n" + "

关于issue

\n" + "

最近一段时间会比较忙,issue不能及时处理,一般会定时抽空集中解决issue,但时间有限解决速度上不敢保证。

\n" + diff --git a/app/src/main/java/zhou/demo/RecyclerViewActivity.java b/app/src/main/java/zhou/demo/RecyclerViewActivity.java index dede0d9..6832c4d 100644 --- a/app/src/main/java/zhou/demo/RecyclerViewActivity.java +++ b/app/src/main/java/zhou/demo/RecyclerViewActivity.java @@ -1,10 +1,10 @@ package zhou.demo; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -18,7 +18,7 @@ public class RecyclerViewActivity extends AppCompatActivity { private static final String[] testString1 = new String[]{ - "

Test1

", + "

Test1

", "

Test2

", "

Test3

", "

Test4

", diff --git a/app/src/main/java/zhou/demo/TestActivity.java b/app/src/main/java/zhou/demo/TestActivity.java index f71548b..805e930 100644 --- a/app/src/main/java/zhou/demo/TestActivity.java +++ b/app/src/main/java/zhou/demo/TestActivity.java @@ -1,8 +1,8 @@ package zhou.demo; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; import android.widget.TextView; import android.widget.Toast; diff --git a/app/src/main/res/layout/activity_recycler.xml b/app/src/main/res/layout/activity_recycler.xml index f0e9565..8812a52 100644 --- a/app/src/main/res/layout/activity_recycler.xml +++ b/app/src/main/res/layout/activity_recycler.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - diff --git a/app/src/main/res/raw/hello.md b/app/src/main/res/raw/hello.md index bd293d1..41fd0bf 100644 --- a/app/src/main/res/raw/hello.md +++ b/app/src/main/res/raw/hello.md @@ -20,7 +20,7 @@ ### gradle中引用的方法 ``` -compile 'com.zzhoujay.richtext:richtext:1.1.5' +implementation 'com.zzhoujay.richtext:richtext:1.1.5' ``` --- diff --git a/app/src/main/res/raw/tt.md b/app/src/main/res/raw/tt.md index e3b2d1a..741665c 100644 --- a/app/src/main/res/raw/tt.md +++ b/app/src/main/res/raw/tt.md @@ -39,7 +39,7 @@ RichText.fromMarkdown(markdown).into(textView); ### Use in Gradle -`compile 'com.zzhoujay.markdown:markdown:0.0.4'` +`implementation 'com.zzhoujay.markdown:markdown:0.0.4'` ### 已知问题 diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..2cc2c36 --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,7 @@ + + + + ww4.sinaimg.cn + baidu.com + + diff --git a/build.gradle b/build.gradle index 3a6183c..186aae0 100644 --- a/build.gradle +++ b/build.gradle @@ -2,16 +2,23 @@ buildscript { repositories { - jcenter() maven { - url 'https://maven.google.com/' - name 'Google' + url 'http://192.168.31.21:8090/repository/maven-aliyun/' + allowInsecureProtocol = true } + maven { + url 'http://192.168.31.21:8090/repository/maven-central/' + allowInsecureProtocol = true + } + maven { + url 'http://192.168.31.21:8090/repository/maven-public/' + allowInsecureProtocol = true + } + mavenCentral() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' - classpath 'com.novoda:bintray-release:0.7.0' - + classpath 'com.android.tools.build:gradle:7.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -19,19 +26,20 @@ buildscript { allprojects { repositories { - jcenter() maven { - url 'https://maven.google.com/' - name 'Google' + url 'http://192.168.31.21:8090/repository/maven-aliyun/' + allowInsecureProtocol = true } - } - - tasks.withType(Javadoc) { - options { - encoding "UTF-8" - charSet 'UTF-8' - links "http://docs.oracle.com/javase/7/docs/api" + maven { + url 'http://192.168.31.21:8090/repository/maven-central/' + allowInsecureProtocol = true + } + maven { + url 'http://192.168.31.21:8090/repository/maven-public/' + allowInsecureProtocol = true } + mavenCentral() + google() } } diff --git a/glideimagegetter/build.gradle b/glideimagegetter/build.gradle index b105dd7..5a0808e 100644 --- a/glideimagegetter/build.gradle +++ b/glideimagegetter/build.gradle @@ -5,12 +5,11 @@ def version_code = 6 def version_name = "1.0.5" android { - compileSdkVersion 24 - buildToolsVersion "25.0.0" + compileSdkVersion 33 defaultConfig { - minSdkVersion 7 - targetSdkVersion 24 + minSdkVersion 15 + targetSdkVersion 33 versionCode version_code versionName version_name @@ -32,11 +31,11 @@ android { } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - testCompile 'junit:junit:4.12' - compile 'com.github.bumptech.glide:glide:3.7.0' - compile 'com.zzhoujay.richtext:richtext:2.5.+' -// compile project(':richtext') + implementation fileTree(include: ['*.jar'], dir: 'libs') + testImplementation 'junit:junit:4.12' + implementation 'com.github.bumptech.glide:glide:3.7.0' + implementation 'com.zzhoujay.richtext:richtext:2.5.+' +// implementation project(':richtext') } publish { diff --git a/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/GlideImageGetter.java b/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/GlideImageGetter.java index 84b0653..40bb6bd 100644 --- a/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/GlideImageGetter.java +++ b/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/GlideImageGetter.java @@ -2,7 +2,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.v4.util.LruCache; +import androidx.collection.LruCache; import android.widget.TextView; import com.bumptech.glide.BitmapTypeRequest; diff --git a/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTarget.java b/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTarget.java index 93c1929..bcdcbc6 100644 --- a/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTarget.java +++ b/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTarget.java @@ -5,7 +5,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.v7.widget.TintContextWrapper; +import androidx.appcompat.widget.TintContextWrapper; import android.widget.TextView; import com.bumptech.glide.request.target.BaseTarget; diff --git a/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTargetGif.java b/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTargetGif.java index fc27aab..b523974 100644 --- a/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTargetGif.java +++ b/glideimagegetter/src/main/java/com/zzhoujay/glideimagegetter/ImageTargetGif.java @@ -3,7 +3,7 @@ import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.widget.TextView; import com.bumptech.glide.Glide; diff --git a/gradle.properties b/gradle.properties index 1d3591c..915f0e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index beb3abc..d6e1dd9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Nov 15 23:17:18 CST 2017 +#Mon Jul 18 17:25:42 CST 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/okhttpimagedownloader/build.gradle b/okhttpimagedownloader/build.gradle index b7e4256..2fef1b6 100644 --- a/okhttpimagedownloader/build.gradle +++ b/okhttpimagedownloader/build.gradle @@ -1,20 +1,15 @@ apply plugin: 'com.android.library' -apply plugin: 'com.novoda.bintray-release' - -def version_code = 3 -def version_name = "1.0.2" android { - compileSdkVersion 26 - buildToolsVersion "25.0.2" + compileSdkVersion 33 defaultConfig { - minSdkVersion 14 - targetSdkVersion 26 - versionCode version_code - versionName version_name + minSdkVersion 15 + targetSdkVersion 33 + versionCode 3 + versionName "1.0.2" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { @@ -29,23 +24,7 @@ android { } dependencies { - compile 'com.squareup.okhttp3:okhttp:3.7.0' -// compile project(':richtext') - compile 'com.zzhoujay.richtext:richtext:3.0.1' -} - -publish { - - Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - userOrg = properties.getProperty("bintray.user") - groupId = "com.zzhoujay.okhttpimagedownloader" - artifactId = 'OkHttpImageDownloader' - publishVersion = version_name - desc = '使用okhttp实现的图片下载器' - website = 'https://github.com/zzhoujay/RichTex' - - bintrayUser=properties.getProperty("bintray.user") - bintrayKey=properties.getProperty("bintray.key") - + implementation 'com.squareup.okhttp3:okhttp:3.7.0' +// implementation project(':richtext') + implementation 'com.zzhoujay.richtext:richtext:3.0.1' } diff --git a/richtext/build.gradle b/richtext/build.gradle index f605853..ad7292e 100644 --- a/richtext/build.gradle +++ b/richtext/build.gradle @@ -1,20 +1,15 @@ apply plugin: 'com.android.library' -apply plugin: 'com.novoda.bintray-release' -def version_code = 65 -def version_name = "3.0.8" android { - compileSdkVersion 26 - buildToolsVersion "25.0.2" + compileSdkVersion 33 - resourcePrefix "zhou_" defaultConfig { - minSdkVersion 14 - targetSdkVersion 26 - versionCode version_code - versionName version_name + minSdkVersion 15 + targetSdkVersion 33 + versionCode 65 + versionName "3.0.8" } buildTypes { release { @@ -31,23 +26,7 @@ android { } dependencies { - compile 'com.zzhoujay.markdown:markdown:1.0.5' - compile 'com.jakewharton:disklrucache:2.0.2' - compile 'com.android.support:support-v4:26.1.0' -} - -publish { - - Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - userOrg = properties.getProperty("bintray.user") - bintrayUser=properties.getProperty("bintray.user") - bintrayKey=properties.getProperty("bintray.key") - - groupId = "com.zzhoujay.richtext" - artifactId = 'richtext' - publishVersion = version_name - desc = 'Android端的富文本解析器' - website = 'https://github.com/zzhoujay/RichTex' - + implementation 'com.zzhoujay.markdown:markdown:1.0.5' + implementation 'com.jakewharton:disklrucache:2.0.2' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' } \ No newline at end of file diff --git a/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java b/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java index 0cb9e74..ef07018 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java @@ -1,8 +1,8 @@ package com.zzhoujay.richtext; import android.graphics.drawable.Drawable; -import android.support.annotation.ColorInt; -import android.support.annotation.IntDef; +import androidx.annotation.ColorInt; +import androidx.annotation.IntDef; import android.widget.TextView; import com.zzhoujay.richtext.drawable.DrawableBorderHolder; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/LinkHolder.java b/richtext/src/main/java/com/zzhoujay/richtext/LinkHolder.java index 067b612..dca287a 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/LinkHolder.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/LinkHolder.java @@ -1,7 +1,7 @@ package com.zzhoujay.richtext; import android.graphics.Color; -import android.support.annotation.ColorInt; +import androidx.annotation.ColorInt; /** * Created by zhou on 2016/11/17. diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichText.java b/richtext/src/main/java/com/zzhoujay/richtext/RichText.java index 04a6b46..ff3dc9b 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichText.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichText.java @@ -3,7 +3,7 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java b/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java index 109ce4c..4243267 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java @@ -6,8 +6,8 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.support.annotation.ColorInt; -import android.support.v4.util.Pair; +import androidx.annotation.ColorInt; +import androidx.core.util.Pair; import android.widget.TextView; import com.zzhoujay.richtext.callback.Callback; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java b/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java index 3d41e19..96ac3ac 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java @@ -1,6 +1,6 @@ package com.zzhoujay.richtext; -import android.support.v4.util.LruCache; +import androidx.collection.LruCache; import android.text.SpannableStringBuilder; import android.text.Spanned; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java b/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java index a46039b..d26323d 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java @@ -1,7 +1,7 @@ package com.zzhoujay.richtext.cache; import android.graphics.Bitmap; -import android.support.v4.util.LruCache; +import androidx.collection.LruCache; import com.jakewharton.disklrucache.DiskLruCache; import com.zzhoujay.richtext.drawable.DrawableSizeHolder; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableBorderHolder.java b/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableBorderHolder.java index 1317396..5d6ec62 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableBorderHolder.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableBorderHolder.java @@ -1,7 +1,7 @@ package com.zzhoujay.richtext.drawable; import android.graphics.Color; -import android.support.annotation.ColorInt; +import androidx.annotation.ColorInt; /** * Created by zhou on 2017/10/4. diff --git a/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableWrapper.java b/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableWrapper.java index 3b032ec..a097f99 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableWrapper.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/drawable/DrawableWrapper.java @@ -9,7 +9,7 @@ import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.zzhoujay.richtext.ImageHolder; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/drawable/GifDrawable.java b/richtext/src/main/java/com/zzhoujay/richtext/drawable/GifDrawable.java index a533a8c..5f2f699 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/drawable/GifDrawable.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/drawable/GifDrawable.java @@ -10,7 +10,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.widget.TextView; /** From ef0e2dd2b5b78041713447e484ab1ce2726061e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= <31652110+L-X-J@users.noreply.github.com> Date: Fri, 17 Mar 2023 14:48:30 +0800 Subject: [PATCH 2/9] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f4b19e..ba42ef5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# RichText [ ![Download](https://api.bintray.com/packages/zzhoujay/maven/richtext/images/download.svg) ](https://bintray.com/zzhoujay/maven/richtext/_latestVersion) +# RichText-AndroidX -### 注意:此项目已不再维护 +### 注意:原项目作者意见不维护了,不支持AndroidX,此项目使用原作则代码改造为支持Androidx > Android平台下的富文本解析器 From e5cc120c234e04fd7edbdd20864c1f70f58448f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= <31652110+L-X-J@users.noreply.github.com> Date: Fri, 17 Mar 2023 14:49:09 +0800 Subject: [PATCH 3/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba42ef5..29fbc32 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RichText-AndroidX -### 注意:原项目作者意见不维护了,不支持AndroidX,此项目使用原作则代码改造为支持Androidx +### 注意:原项目作者意见不维护了,不支持AndroidX,此项目使用原作者代码改造为支持Androidx > Android平台下的富文本解析器 From e7350f258d5857d0eea4a5ce5fac8383f975794d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= <31652110+L-X-J@users.noreply.github.com> Date: Fri, 17 Mar 2023 14:49:25 +0800 Subject: [PATCH 4/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 29fbc32..ea63bde 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RichText-AndroidX -### 注意:原项目作者意见不维护了,不支持AndroidX,此项目使用原作者代码改造为支持Androidx +### 注意:原项目作者已经不维护了,不支持AndroidX,此项目使用原作者代码改造为支持Androidx > Android平台下的富文本解析器 From f545e738ac2178a4ea366d6a9050a48207a52b9f Mon Sep 17 00:00:00 2001 From: Kay <31652110+L-X-J@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:43:28 +0800 Subject: [PATCH 5/9] Update README.md --- README.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ea63bde..dcfea19 100644 --- a/README.md +++ b/README.md @@ -24,18 +24,10 @@ ![演示](image/image.jpg "演示") -### gradle中引用的方法 +### 引入方法 + +clone 该项目然后跑起来,打出 aar包然后引入自己的项目 -``` -implementation 'com.zzhoujay.richtext:richtext:latest-version' -``` - -### 使用新的Html解析器 - -只需加入此依赖即可,无须其他操作,新Html解析器对原生Html解析器的功能做了补充 -``` -implementation 'com.zzhoujay:html:latest-version' -``` 新Html解析器增加了对代码块的支持,代码块可以触发点击事件,通过`urlClick`设置, 代码块回调的参数由`code://`开头 From 43dd161df168504f9df56b733d56e6f0ba4d2d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= Date: Fri, 23 Aug 2024 16:35:08 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B1=E4=BA=8E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B8=AD=E7=9A=84=E6=9C=AC=E5=9C=B0=20gradle?= =?UTF-8?q?=20=E9=95=9C=E5=83=8F=E5=AF=BC=E8=87=B4=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index 186aae0..f8cbee2 100644 --- a/build.gradle +++ b/build.gradle @@ -2,42 +2,19 @@ buildscript { repositories { - maven { - url 'http://192.168.31.21:8090/repository/maven-aliyun/' - allowInsecureProtocol = true - } - maven { - url 'http://192.168.31.21:8090/repository/maven-central/' - allowInsecureProtocol = true - } - maven { - url 'http://192.168.31.21:8090/repository/maven-public/' - allowInsecureProtocol = true - } mavenCentral() google() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'com.android.tools.build:gradle:7.2.2' } } allprojects { repositories { - maven { - url 'http://192.168.31.21:8090/repository/maven-aliyun/' - allowInsecureProtocol = true - } - maven { - url 'http://192.168.31.21:8090/repository/maven-central/' - allowInsecureProtocol = true - } - maven { - url 'http://192.168.31.21:8090/repository/maven-public/' - allowInsecureProtocol = true - } + maven { url 'https://maven.aliyun.com/repository/public' } + maven { url 'https://maven.aliyun.com/repository/central' } + maven { url 'https://maven.aliyun.com/repository/jcenter' } mavenCentral() google() } From 902233537ea6a6fb0c0a7836de90b31186a53913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= Date: Fri, 23 Aug 2024 16:37:29 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20gradle=20=E7=9A=84?= =?UTF-8?q?=E6=9F=90=E4=BA=9B=E8=BF=87=E6=9C=9F=20api=20=E7=9A=84=E8=AD=A6?= =?UTF-8?q?=E5=91=8A=EF=BC=8C=E9=87=87=E7=94=A8=E6=96=B0=E7=9A=84=20api?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=20compileSdkVersion=20=E6=94=B9=E4=B8=BA=20c?= =?UTF-8?q?ompileSdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- richtext/build.gradle | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/richtext/build.gradle b/richtext/build.gradle index ad7292e..cd34ed3 100644 --- a/richtext/build.gradle +++ b/richtext/build.gradle @@ -2,11 +2,9 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 33 - - + compileSdk 33 defaultConfig { - minSdkVersion 15 + minSdkVersion 21 targetSdkVersion 33 versionCode 65 versionName "3.0.8" From 7b0394d86562b73b6a6530fa403508b61b5b6c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= Date: Fri, 23 Aug 2024 16:39:59 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20legacy-support-v4=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=EF=BC=8C2024=E5=B9=B4=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E8=AF=A5=20only=20androidx=20=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 14 +++++++------- glideimagegetter/build.gradle | 4 ++-- okhttpimagedownloader/build.gradle | 2 +- richtext/build.gradle | 3 ++- .../java/com/zzhoujay/richtext/ImageHolder.java | 3 ++- .../java/com/zzhoujay/richtext/RichTextConfig.java | 3 ++- .../java/com/zzhoujay/richtext/RichTextPool.java | 2 +- .../com/zzhoujay/richtext/cache/BitmapPool.java | 2 +- 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 01ee5be..b31307b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,10 +1,10 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 33 + compileSdk 33 defaultConfig { applicationId "zhou.demo" - minSdkVersion 15 + minSdkVersion 21 targetSdkVersion 33 versionCode 1 versionName "1.0" @@ -28,11 +28,11 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.13.2' - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'androidx.recyclerview:recyclerview:1.2.1' + // appcompat 1.7.0 会强制 compile = 34 这里先用 1.6.1 + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation project(':richtext') // implementation project(':okhttpimagedownloader') -// implementation 'com.zzhoujay.richtext:richtext:3.0.7' - implementation 'com.zzhoujay:html:1.0.1' - // compile 'com.zzhoujay.okhttpimagedownloader:OkHttpImageDownloader:1.0.0' +// implementation 'com.zzhoujay.richtext:richtext:3.0.8' + implementation 'com.zzhoujay:html:1.0.2' } diff --git a/glideimagegetter/build.gradle b/glideimagegetter/build.gradle index 5a0808e..f8e852c 100644 --- a/glideimagegetter/build.gradle +++ b/glideimagegetter/build.gradle @@ -32,9 +32,9 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.2' implementation 'com.github.bumptech.glide:glide:3.7.0' - implementation 'com.zzhoujay.richtext:richtext:2.5.+' + implementation 'com.zzhoujay.richtext:richtext:3.0.8' // implementation project(':richtext') } diff --git a/okhttpimagedownloader/build.gradle b/okhttpimagedownloader/build.gradle index 2fef1b6..ae8daaf 100644 --- a/okhttpimagedownloader/build.gradle +++ b/okhttpimagedownloader/build.gradle @@ -26,5 +26,5 @@ android { dependencies { implementation 'com.squareup.okhttp3:okhttp:3.7.0' // implementation project(':richtext') - implementation 'com.zzhoujay.richtext:richtext:3.0.1' + implementation 'com.zzhoujay.richtext:richtext:3.0.8' } diff --git a/richtext/build.gradle b/richtext/build.gradle index cd34ed3..385c405 100644 --- a/richtext/build.gradle +++ b/richtext/build.gradle @@ -26,5 +26,6 @@ android { dependencies { implementation 'com.zzhoujay.markdown:markdown:1.0.5' implementation 'com.jakewharton:disklrucache:2.0.2' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.annotation:annotation:1.8.2' +// implementation 'androidx.legacy:legacy-support-v4:1.0.0' } \ No newline at end of file diff --git a/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java b/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java index ef07018..0dbf49e 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java @@ -1,9 +1,10 @@ package com.zzhoujay.richtext; import android.graphics.drawable.Drawable; +import android.widget.TextView; + import androidx.annotation.ColorInt; import androidx.annotation.IntDef; -import android.widget.TextView; import com.zzhoujay.richtext.drawable.DrawableBorderHolder; import com.zzhoujay.richtext.exceptions.ResetImageSourceException; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java b/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java index 4243267..0cc5b98 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java @@ -7,7 +7,8 @@ import android.os.Looper; import android.os.Message; import androidx.annotation.ColorInt; -import androidx.core.util.Pair; + +import android.util.Pair; import android.widget.TextView; import com.zzhoujay.richtext.callback.Callback; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java b/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java index 96ac3ac..493980f 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java @@ -1,8 +1,8 @@ package com.zzhoujay.richtext; -import androidx.collection.LruCache; import android.text.SpannableStringBuilder; import android.text.Spanned; +import android.util.LruCache; import com.zzhoujay.richtext.ext.Debug; import com.zzhoujay.richtext.ext.MD5; diff --git a/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java b/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java index d26323d..0f4a966 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java @@ -1,7 +1,7 @@ package com.zzhoujay.richtext.cache; import android.graphics.Bitmap; -import androidx.collection.LruCache; +import android.util.LruCache; import com.jakewharton.disklrucache.DiskLruCache; import com.zzhoujay.richtext.drawable.DrawableSizeHolder; From e81cb12ecc3a14047b0c54fe79b1e10fee41b646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A4=E5=AD=90=E5=95=8A?= Date: Fri, 23 Aug 2024 16:54:15 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=9A=84=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 8 ++--- .../java/zhou/demo/ApplicationTest.java | 10 ------ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- okhttpimagedownloader/build.gradle | 7 ++-- richtext/build.gradle | 10 ++---- .../com/zzhoujay/richtext/ImageHolder.java | 10 +++--- .../com/zzhoujay/richtext/RichTextConfig.java | 32 +++++++------------ .../com/zzhoujay/richtext/RichTextPool.java | 2 +- .../zzhoujay/richtext/cache/BitmapPool.java | 4 +-- 10 files changed, 32 insertions(+), 55 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b31307b..f42deb1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,13 +15,11 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - lintOptions { - abortOnError false - } productFlavors { } - dexOptions { - preDexLibraries = false + namespace 'zhou.demo' + lint { + abortOnError false } } diff --git a/app/src/androidTest/java/zhou/demo/ApplicationTest.java b/app/src/androidTest/java/zhou/demo/ApplicationTest.java index de58360..78fa1dc 100644 --- a/app/src/androidTest/java/zhou/demo/ApplicationTest.java +++ b/app/src/androidTest/java/zhou/demo/ApplicationTest.java @@ -1,13 +1,3 @@ package zhou.demo; import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index f8cbee2..3011b23 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,6 @@ allprojects { } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d6e1dd9..f5dea25 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Jul 18 17:25:42 CST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/okhttpimagedownloader/build.gradle b/okhttpimagedownloader/build.gradle index ae8daaf..57ced7e 100644 --- a/okhttpimagedownloader/build.gradle +++ b/okhttpimagedownloader/build.gradle @@ -6,8 +6,6 @@ android { defaultConfig { minSdkVersion 15 targetSdkVersion 33 - versionCode 3 - versionName "1.0.2" testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' @@ -18,13 +16,14 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - lintOptions { + namespace 'com.zzhoujay.okhttpimagedownloader' + lint { abortOnError false } } dependencies { - implementation 'com.squareup.okhttp3:okhttp:3.7.0' + implementation 'com.squareup.okhttp3:okhttp:3.10.0' // implementation project(':richtext') implementation 'com.zzhoujay.richtext:richtext:3.0.8' } diff --git a/richtext/build.gradle b/richtext/build.gradle index 385c405..2d1ab0c 100644 --- a/richtext/build.gradle +++ b/richtext/build.gradle @@ -2,12 +2,10 @@ apply plugin: 'com.android.library' android { - compileSdk 33 + compileSdk 34 defaultConfig { minSdkVersion 21 targetSdkVersion 33 - versionCode 65 - versionName "3.0.8" } buildTypes { release { @@ -15,12 +13,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - lintOptions { + namespace 'com.zzhoujay.richtext' + lint { abortOnError false } - dexOptions { - preDexLibraries = false - } } dependencies { diff --git a/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java b/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java index 0dbf49e..029c909 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/ImageHolder.java @@ -5,6 +5,7 @@ import androidx.annotation.ColorInt; import androidx.annotation.IntDef; +import androidx.annotation.NonNull; import com.zzhoujay.richtext.drawable.DrawableBorderHolder; import com.zzhoujay.richtext.exceptions.ResetImageSourceException; @@ -34,7 +35,7 @@ public enum ScaleType { none(0), center(1), center_crop(2), center_inside(3), fit_center(4), fit_start(5), fit_end(6), fit_xy(7), fit_auto(8); - int value; + final int value; ScaleType(int value) { this.value = value; @@ -114,10 +115,10 @@ public boolean isInvalidateSize() { private boolean autoPlay; private boolean show; private boolean isGif; - private DrawableBorderHolder borderHolder; + private final DrawableBorderHolder borderHolder; private Drawable placeHolder, errorImage; - private String prefixCode; - private int configHashcode; + private final String prefixCode; + private final int configHashcode; public ImageHolder(String source, int position, RichTextConfig config, TextView textView) { this.source = source; @@ -349,6 +350,7 @@ public int hashCode() { return result; } + @NonNull @Override public String toString() { return "ImageHolder{" + diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java b/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java index 0cc5b98..f5d48e7 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichTextConfig.java @@ -520,28 +520,20 @@ public void dispatchMessage(Message msg) { } }; - private static final DrawableGetter PLACE_HOLDER_DRAWABLE_GETTER = new DrawableGetter() { - - @Override - public Drawable getDrawable(ImageHolder holder, RichTextConfig config, TextView textView) { - ColorDrawable drawable = new ColorDrawable(Color.LTGRAY); - int width = textView.getWidth() ; - drawable.setBounds(0, 0, width, width / 2); - HANDLER.obtainMessage(SET_BOUNDS, Pair.create(drawable, textView)).sendToTarget(); - return drawable; - } + private static final DrawableGetter PLACE_HOLDER_DRAWABLE_GETTER = (holder, config, textView) -> { + ColorDrawable drawable = new ColorDrawable(Color.LTGRAY); + int width = textView.getWidth() ; + drawable.setBounds(0, 0, width, width / 2); + HANDLER.obtainMessage(SET_BOUNDS, Pair.create(drawable, textView)).sendToTarget(); + return drawable; }; - private static final DrawableGetter ERROR_IMAGE_DRAWABLE_GETTER = new DrawableGetter() { - - @Override - public Drawable getDrawable(ImageHolder holder, RichTextConfig config, TextView textView) { - ColorDrawable drawable = new ColorDrawable(Color.DKGRAY); - int width = textView.getWidth(); - drawable.setBounds(0, 0, width, width / 2); - HANDLER.obtainMessage(SET_BOUNDS, Pair.create(drawable, textView)).sendToTarget(); - return drawable; - } + private static final DrawableGetter ERROR_IMAGE_DRAWABLE_GETTER = (holder, config, textView) -> { + ColorDrawable drawable = new ColorDrawable(Color.DKGRAY); + int width = textView.getWidth(); + drawable.setBounds(0, 0, width, width / 2); + HANDLER.obtainMessage(SET_BOUNDS, Pair.create(drawable, textView)).sendToTarget(); + return drawable; }; /** diff --git a/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java b/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java index 493980f..36ecfee 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/RichTextPool.java @@ -72,7 +72,7 @@ SpannableStringBuilder clearSpans(SpannableStringBuilder ssb) { } LongClickableURLSpan[] lcus = ssb.getSpans(0, ssb.length(), LongClickableURLSpan.class); - if (lcus != null && lcus.length > 0) { + if (lcus != null) { for (LongClickableURLSpan span : lcus) { int start = ssb.getSpanStart(span); int end = ssb.getSpanEnd(span); diff --git a/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java b/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java index 0f4a966..bbef881 100644 --- a/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java +++ b/richtext/src/main/java/com/zzhoujay/richtext/cache/BitmapPool.java @@ -27,8 +27,8 @@ public class BitmapPool { private static final String SIZE_DIR_NAME = "_s"; private static final String TEMP_DIR_NAME = "_t"; - private LruCache bitmapCache; - private LruCache sizeHolderCache; + private final LruCache bitmapCache; + private final LruCache sizeHolderCache; private static File cacheDir; private static final int version = 1;