diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 7a5d64b..f5a939f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,9 +11,8 @@ android {
applicationId "tech.nicesky.balloonpicker"
minSdkVersion 21
targetSdkVersion 29
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ versionCode 2
+ versionName "1.0.1"
}
buildTypes {
release {
@@ -27,11 +26,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
- implementation 'androidx.core:core-ktx:1.0.2'
+ implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.1.1'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation project(':balloonpicker')
}
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
index 7b5377e..9344ad4 100644
Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ
diff --git a/app/release/output.json b/app/release/output.json
new file mode 100644
index 0000000..773d283
--- /dev/null
+++ b/app/release/output.json
@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.0.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/main/java/tech/nicesky/balloonpickerdemo/MainActivity.kt b/app/src/main/java/tech/nicesky/balloonpickerdemo/MainActivity.kt
index 00a186f..b9dcaad 100644
--- a/app/src/main/java/tech/nicesky/balloonpickerdemo/MainActivity.kt
+++ b/app/src/main/java/tech/nicesky/balloonpickerdemo/MainActivity.kt
@@ -6,12 +6,14 @@ import android.os.Handler
import android.util.Log
import androidx.core.graphics.toColorInt
import kotlinx.android.synthetic.main.activity_main.*
+import tech.nicesky.balloonpicker.BalloonPickerListener
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
+
balloon_picker.layerValues(10, 50, 5)
balloon_picker.setColorFoThumb("#FFFFFF".toColorInt(), "#512DA8".toColorInt())
balloon_picker.setColorForLayer("#512DA8".toColorInt(), "#BDBDBD".toColorInt())
@@ -20,7 +22,7 @@ class MainActivity : AppCompatActivity() {
balloon_picker.colorOfDesc = "#000000".toColorInt()
balloon_picker.colorOfValue = "#000000".toColorInt()
balloon_picker.desc = "Quantity"
- balloon_picker.valueListener = object : BalloonPickerListener{
+ balloon_picker.valueListener = object : BalloonPickerListener {
override fun changed(value: Long) {
Log.w("MainActivity","value: $value")
}
@@ -29,6 +31,6 @@ class MainActivity : AppCompatActivity() {
Handler().postDelayed({
balloon_picker.defaultValue(30)
},3000)
- val valueSelected = balloon_picker.getValue()
+ //val valueSelected = balloon_picker.getValue()
}
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 456b3f1..00e5338 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,18 +6,10 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
-
-
distanceVerticalBetweenBalloonAndTrackLayer.toInt()){
-// initAnimation(ValueAnimator.ofInt(centerOfBalloon.x.toInt(), pointThumb.x.toInt()))
-// val valueAtBalloon =trackLayer?.minValue()!! + (trackLayer?.maxValue()!! - trackLayer?.minValue()!!) * centerOfBalloon.x/measuredWidth
-// val disScaleHeight =maxScale * balloonHeightDefault * (valueAtBalloon - trackLayer?.minValue()!!) / (trackLayer?.maxValue()!! - trackLayer?.minValue()!!)
-// val disScaleWidth = maxScale * balloonWidthDefault/2 * (valueAtBalloon - trackLayer?.minValue()!!) / (trackLayer?.maxValue()!! - trackLayer?.minValue()!!)
-// val xOfBalloon = (centerOfBalloon.x - balloonWidthDefault / 2 - disScaleWidth.toInt() + if (b > 0) b-distanceVerticalBetweenBalloonAndTrackLayer else b + distanceVerticalBetweenBalloonAndTrackLayer).toInt()
-//
-// balloon?.layout( xOfBalloon , balloonDefaultY.toInt() - disScaleHeight.toInt(), xOfBalloon + balloonWidthDefault.toInt() + disScaleWidth.toInt() * 2, (balloonDefaultY + balloonHeightDefault).toInt())
-// centerOfBalloon.set(xOfBalloon + disScaleWidth + balloonWidthDefault / 2F, balloonDefaultY + balloonHeightDefault/2 - disScaleHeight/2 )
-// rotateBalloon()
-// }
moveBalloon()
balloon?.valueOfBalloon = value
}
diff --git a/balloonpicker/src/main/java/tech/nicesky/balloonpicker/BalloonView.kt b/balloonpicker/src/main/java/tech/nicesky/balloonpicker/BalloonView.kt
index 40ec587..443437b 100644
--- a/balloonpicker/src/main/java/tech/nicesky/balloonpicker/BalloonView.kt
+++ b/balloonpicker/src/main/java/tech/nicesky/balloonpicker/BalloonView.kt
@@ -122,5 +122,4 @@ class BalloonView : View {
drawable?.draw(canvas)
return bitmap
}
-
}
\ No newline at end of file
diff --git a/balloonpicker/src/main/java/tech/nicesky/balloonpicker/TrackLayerView.kt b/balloonpicker/src/main/java/tech/nicesky/balloonpicker/TrackLayerView.kt
index 0934da5..ffc76b7 100644
--- a/balloonpicker/src/main/java/tech/nicesky/balloonpicker/TrackLayerView.kt
+++ b/balloonpicker/src/main/java/tech/nicesky/balloonpicker/TrackLayerView.kt
@@ -24,25 +24,18 @@ class TrackLayerView : View {
private var paintOfTrackLayerUnSelected= Paint()
private var paintOfThumb = Paint()
private var paintOfThumbStroke = Paint()
-
- /**当前位置*/
private var pointOfThumb = PointF(-1F,-1F)
- /**出师位置*/
private var pointOfThumbDefault = PointF(-1F, -1F)
private var pointOfThumbTemp = PointF(0F,0F)
-
private var pointOfTouchDown= PointF(0F,0F)
-
private var thumbOuterCircleRadiusMax : Float = DpUtil.dp2px(25.toFloat())
private var thumbOuterCircleRadiusDefault : Float = DpUtil.dp2px(15.toFloat())
private var thumbOuterCircleRadius : Float = thumbOuterCircleRadiusDefault
private var thumbOuterCircleRadiusTemp : Float = thumbOuterCircleRadius
-
private var thumbInnerCircleRadiusDefault : Float = DpUtil.dp2px(7.5.toFloat())
private var thumbInnerCircleRadiusMax : Float = thumbOuterCircleRadiusMax - DpUtil.dp2px(0.8F)
private var thumbInnerCircleRadius : Float = thumbInnerCircleRadiusDefault
private var thumbInnerCircleRadiusTemp : Float = thumbInnerCircleRadius
-
private var yOfTrackLayer : Float = 0F
private var padding : Float = DpUtil.dp2px(5F)
private var widthOfView : Float = DpUtil.dp2px(10F)
@@ -51,18 +44,18 @@ class TrackLayerView : View {
private var xOfTrackLayerEnd = 0F
private var xOfValue = 0F
private var yOfValue = 0F
-
private var anim : ValueAnimator = ValueAnimator.ofInt(0,1)
-
- private val duration = 200L
+ private val duration = 300L
internal var increase : Boolean = false
private var touchWithinRange : Boolean = false
+
internal var colorOFThumb = "#FFFFFF".toColorInt()
set(value) {
field = value
paintOfThumb.color = colorOFThumb
postInvalidate()
}
+
internal var colorOFThumbStroke = "#512DA8".toColorInt()
set(value) {
field = value
@@ -159,17 +152,14 @@ class TrackLayerView : View {
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
- Log.w(TAG, "onMeasure")
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
- // Log.w(TAG, "onSizeChanged")
}
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
- Log.w(TAG, "onLayout")
widthOfView = width.toFloat()
heightOfView = height.toFloat()
@@ -181,7 +171,6 @@ class TrackLayerView : View {
pointOfThumbDefault.set(if (xNew < (xOfTrackLayerStart)) xOfTrackLayerStart else xNew, yOfTrackLayer)
pointOfThumb = pointOfThumbDefault
pointOfThumbTemp = pointOfThumb
-
}
override fun onFinishInflate() {
@@ -190,7 +179,6 @@ class TrackLayerView : View {
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
-
canvas?.drawLine(xOfTrackLayerStart, yOfTrackLayer ,pointOfThumb.x, yOfTrackLayer, paintOfTrackLayerSelected)
canvas?.drawLine(pointOfThumb.x, yOfTrackLayer ,xOfTrackLayerEnd, yOfTrackLayer, paintOfTrackLayerUnSelected)
canvas?.drawCircle(pointOfThumb.x, pointOfThumb.y, thumbOuterCircleRadius, paintOfThumbStroke)
@@ -203,7 +191,6 @@ class TrackLayerView : View {
if (event.x < pointOfThumb.x + DpUtil.dp2px(50F) && event.x > pointOfThumb.x - DpUtil.dp2px(50F)
&& event.y < pointOfThumb.y + DpUtil.dp2px(50F) && event.y > pointOfThumb.y - DpUtil.dp2px(50F)
){
- // Log.w(TAG, "in side")
//动画变大内圆paintOfThumb 的 radius半径
touchWithinRange = true
pointOfTouchDown = PointF(event.x, event.y)
@@ -216,9 +203,6 @@ class TrackLayerView : View {
true
}
MotionEvent.ACTION_UP ->{
- //Log.d("onTouchEvent", "UP")
- //动画变大内圆paintOfThumb 的 radius半径
-
xOfValue = xOfTrackLayerEnd - selectedValue.toString().length.toFloat() * paintOfValueSelected.textSize
yOfValue = yOfTrackLayer - thumbOuterCircleRadiusMax - padding
scalingInnerCircleRadius(false)
@@ -228,8 +212,6 @@ class TrackLayerView : View {
true
}
MotionEvent.ACTION_MOVE->{
- //Log.d("onTouchEvent", "MOVE")
-
//TODO Refining logic
if (touchWithinRange){
val x = pointOfThumbTemp.x + event.x - pointOfTouchDown.x
@@ -255,7 +237,6 @@ class TrackLayerView : View {
this.increase -> (duration* (thumbInnerCircleRadiusMax - thumbInnerCircleRadiusTemp)/(thumbInnerCircleRadiusMax - thumbInnerCircleRadiusDefault)).toLong()
else -> (duration* (thumbInnerCircleRadiusTemp - thumbInnerCircleRadiusDefault)/(thumbInnerCircleRadiusMax - thumbInnerCircleRadiusDefault)).toLong()
}
- //Log.w(TAG, "Last time is $remainingTime")
anim.duration = if (remainingTime < 0) 5 else remainingTime
}
anim.duration = duration
@@ -276,7 +257,6 @@ class TrackLayerView : View {
this.minValue = minValue
this.maxValue = maxValue
this.selectedValue = defaultValue
-
refreshView()
}
@@ -309,5 +289,4 @@ class TrackLayerView : View {
fun selectedValue(): Long{
return selectedValue
}
-
}
\ No newline at end of file
diff --git a/balloonpicker/src/main/java/tech/nicesky/balloonpicker/sss.java b/balloonpicker/src/main/java/tech/nicesky/balloonpicker/sss.java
deleted file mode 100644
index 5a3905c..0000000
--- a/balloonpicker/src/main/java/tech/nicesky/balloonpicker/sss.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package tech.nicesky.balloonpicker;
-
-import android.animation.Animator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.util.Log;
-
-import androidx.appcompat.widget.AppCompatDrawableManager;
-import androidx.core.graphics.drawable.DrawableCompat;
-
-import static android.view.animation.AnimationUtils.loadAnimation;
-
-public class sss {
- public void te(){
- ValueAnimator animator = ValueAnimator.ofFloat(0,1);
- animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- long tiem = animation.getCurrentPlayTime();
- if (tiem /animation.getDuration() == 100){
- Log.w("","");
- Log.w("","");
- }
- }
- });
- animator.addListener(new Animator.AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animation) {
-
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
-
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
-
- }
-
- @Override
- public void onAnimationRepeat(Animator animation) {
-
- }
- });
- Float s = 12F;
-
- float a = s.longValue()^2;
- Math.toDegrees(-1.4656447);
-
-// Build.VERSION
-
-
- }
-
- public void initAnimation(float... values){
-// sss
- }
-
-
- public Bitmap getBitmapFromVectorDrawable(Context context, int drawableId)
- {
- Drawable drawable = AppCompatDrawableManager. get ().getDrawable(context, drawableId);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
- drawable = (DrawableCompat.wrap(drawable)).mutate();
- }
- Bitmap bitmap = Bitmap . createBitmap (drawable.getIntrinsicWidth(),
- drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
- drawable.draw(canvas);
- return bitmap;
- }
-}
diff --git a/balloonpicker/src/main/res/drawable/ic_keyboard_arrow_left_black_24dp.xml b/balloonpicker/src/main/res/drawable/ic_keyboard_arrow_left_black_24dp.xml
deleted file mode 100644
index 7ab63fe..0000000
--- a/balloonpicker/src/main/res/drawable/ic_keyboard_arrow_left_black_24dp.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
diff --git a/balloonpicker/src/main/res/values/strings.xml b/balloonpicker/src/main/res/values/strings.xml
index de8f0c3..0a33168 100644
--- a/balloonpicker/src/main/res/values/strings.xml
+++ b/balloonpicker/src/main/res/values/strings.xml
@@ -1,3 +1,2 @@
- BalloonPicker
diff --git a/blogpost/key/release.jks b/blogpost/key/release.jks
new file mode 100644
index 0000000..43d3f4b
Binary files /dev/null and b/blogpost/key/release.jks differ