Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复小时数大于100时显示异常 #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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'
}
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,5 +14,6 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com/'}
}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down
16 changes: 16 additions & 0 deletions library/src/main/java/cn/iwgang/countdownview/BaseCountdown.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ public void updateShow(long ms) {
}
}

if (mCountdown.handlerAutoShowTime() || mCountdown.handlerDayLargeNinetyNine()) {
if (mCountdown.handlerAutoShowTime() || mCountdown.handlerDayLargeNinetyNine()
|| mCountdown.handlerHourLargeNinetyNine()) {
reLayout();
} else {
invalidate();
Expand Down