Skip to content

Commit

Permalink
support-compat
Browse files Browse the repository at this point in the history
  • Loading branch information
zj565061763 committed Dec 21, 2018
1 parent 23da40a commit 9ef70fb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion 27
defaultConfig {
applicationId "com.sd.www.switchbutton"
minSdkVersion 16
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
Expand Down
7 changes: 4 additions & 3 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ group = 'com.github.zj565061763'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 16
minSdkVersion 15
targetSdkVersion 22
versionCode 20180903
versionName "1.2.0-rc1"
versionCode 20181221
versionName "1.2.0-rc2"
}
buildTypes {
release {
Expand All @@ -26,6 +26,7 @@ android {

dependencies {
implementation 'com.github.zj565061763:gesture:1.1.2'
implementation 'com.android.support:support-compat:27.1.1'
}

// 指定编码
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sd.lib.switchbutton;

import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -167,7 +168,7 @@ protected final void updateViewByState(boolean anim)
if (isScrollerStarted)
{
// 触发滚动成功,不需要立即更新view的可见状态,动画结束后更新
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(this);
} else
{
// 立即更新view的可见状态
Expand Down Expand Up @@ -226,7 +227,7 @@ protected final void moveView(int delta)
if (delta == 0)
return;

mViewThumb.offsetLeftAndRight(delta);
ViewCompat.offsetLeftAndRight(mViewThumb, delta);
notifyViewPositionChanged();
}

Expand Down
3 changes: 2 additions & 1 deletion lib/src/main/java/com/sd/lib/switchbutton/FSwitchButton.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sd.lib.switchbutton;

import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
Expand Down Expand Up @@ -215,6 +216,6 @@ public void computeScroll()
{
super.computeScroll();
if (getScroller().computeScrollOffset())
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(this);
}
}

0 comments on commit 9ef70fb

Please sign in to comment.