From c490901c7f96506cee3283ec51803b150ea18b4c Mon Sep 17 00:00:00 2001 From: Cammmmer Date: Fri, 11 Dec 2020 17:18:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=8F=E6=97=B6?= =?UTF-8?q?=E6=95=B0=E5=A4=A7=E4=BA=8E100=E6=97=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原因:updateShow时仅判断mDay的长度,没有判断mHour的值 解决方案:参考mDay方案来修改mHour的长度 验证建议: --- .../cn/iwgang/countdownview/BaseCountdown.java | 16 ++++++++++++++++ .../cn/iwgang/countdownview/CountdownView.java | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java b/library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java index d26533e..0c5ee1d 100644 --- a/library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java +++ b/library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java @@ -27,6 +27,7 @@ class BaseCountdown { protected String mSuffix, mSuffixDay, mSuffixHour, mSuffixMinute, mSuffixSecond, mSuffixMillisecond; protected float mSuffixDayTextWidth, mSuffixHourTextWidth, mSuffixMinuteTextWidth, mSuffixSecondTextWidth, mSuffixMillisecondTextWidth; protected boolean isDayLargeNinetyNine; + protected boolean isHourLargeNinetyNine; protected Paint mTimeTextPaint, mSuffixTextPaint, mMeasureHourWidthPaint; protected float mLeftPaddingSize; protected float mSuffixDayLeftMargin, mSuffixDayRightMargin; @@ -730,6 +731,21 @@ public boolean handlerDayLargeNinetyNine() { return isReLayout; } + public boolean handlerHourLargeNinetyNine() { + boolean isReLayout = false; + if (isShowHour && isConvertDaysToHours) { + // handler large ninety nine + if (!isHourLargeNinetyNine && mHour > 99) { + isHourLargeNinetyNine = true; + isReLayout = true; + } else if (isHourLargeNinetyNine && mHour <= 99) { + isHourLargeNinetyNine = false; + isReLayout = true; + } + } + return isReLayout; + } + public void setTimes(int day, int hour, int minute, int second, int millisecond) { mDay = day; mHour = hour; diff --git a/library/src/main/java/cn/iwgang/countdownview/CountdownView.java b/library/src/main/java/cn/iwgang/countdownview/CountdownView.java index 097df58..ceb0e71 100644 --- a/library/src/main/java/cn/iwgang/countdownview/CountdownView.java +++ b/library/src/main/java/cn/iwgang/countdownview/CountdownView.java @@ -268,7 +268,8 @@ public void updateShow(long ms) { } } - if (mCountdown.handlerAutoShowTime() || mCountdown.handlerDayLargeNinetyNine()) { + if (mCountdown.handlerAutoShowTime() || mCountdown.handlerDayLargeNinetyNine() + || mCountdown.handlerHourLargeNinetyNine()) { reLayout(); } else { invalidate(); From f32994010f1dab59db878064417f3ab5d3c404ce Mon Sep 17 00:00:00 2001 From: Cammmmer Date: Fri, 11 Dec 2020 17:24:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=20=E6=9B=B4=E6=96=B0gradle=E5=8F=8A?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 13 +++++++------ build.gradle | 4 +++- gradle/wrapper/gradle-wrapper.properties | 4 ++-- library/build.gradle | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0849fd1..ad48b22 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,13 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 23 - buildToolsVersion '25.0.2' + compileSdkVersion 28 + buildToolsVersion '27.0.3' defaultConfig { applicationId "cn.iwgang.countdownviewdemo" minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 28 versionCode 1 versionName "1.0" } @@ -21,9 +21,10 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:23.3.0' + //noinspection GradleCompatible + implementation 'com.android.support:appcompat-v7:27.0.0' compile 'com.github.iwgang:familiarrecyclerview:1.3.0' compile 'cn.qqtheme.framework:ColorPicker:1.1.3' -// compile project(':library') - compile 'com.github.iwgang:countdownview:2.1.6' + compile project(':library') + // compile 'com.github.iwgang:countdownview:2.1.6' } diff --git a/build.gradle b/build.gradle index 3cf5f30..03e0efb 100644 --- a/build.gradle +++ b/build.gradle @@ -2,9 +2,10 @@ buildscript { repositories { jcenter() + maven { url 'https://maven.google.com/'} } dependencies { - classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.android.tools.build:gradle:3.6.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -13,5 +14,6 @@ buildscript { allprojects { repositories { jcenter() + maven { url 'https://maven.google.com/'} } } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c71e76..40bb4ea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Fri Dec 11 15:46:33 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/library/build.gradle b/library/build.gradle index aff5590..75fa012 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 21 + compileSdkVersion 28 buildToolsVersion '25.0.2' defaultConfig { minSdkVersion 10 - targetSdkVersion 21 + targetSdkVersion 28 versionCode 1 versionName "1.0" }