Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bitvale committed Feb 27, 2020
1 parent cd598c1 commit fd74a79
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 73 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Just add ValueProgress view in your layout XML and ValueProgress library in your

```gradle
dependencies {
implementation 'com.bitvale:valueprogress:1.0.0'
implementation 'com.bitvale:valueprogress:1.0.1'
}
```

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.0'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.6.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
10 changes: 5 additions & 5 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "com.bitvale.valueprogressdemo"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName "1.0.1"
}
buildTypes {
release {
Expand All @@ -24,7 +24,7 @@ android {
dependencies {
implementation project(':library')
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
1 change: 1 addition & 0 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:windowSoftInputMode="adjustPan"
android:theme="@style/AppTheme.Splash"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MainActivity : AppCompatActivity() {
val text = s.toString()
val value = if (text.isNotEmpty()) text.toFloat() else 0f

handler.removeCallbacks(workRunnable)
workRunnable?.let { handler.removeCallbacks(it) }
workRunnable = Runnable {
progress_percent.percent = value
progress_dollar.percent = value / 2
Expand All @@ -51,7 +51,7 @@ class MainActivity : AppCompatActivity() {
val text = s.toString()
val maxValue = if (text.isNotEmpty()) text.toFloat() else 0f

handler.removeCallbacks(workRunnable)
workRunnable?.let { handler.removeCallbacks(it) }
workRunnable = Runnable {
progress_percent.progressMaxValue = maxValue
progress_dollar.progressMaxValue = maxValue
Expand Down
127 changes: 69 additions & 58 deletions demo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,69 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:context=".MainActivity">

<com.bitvale.valueprogress.ValueProgress
android:id="@+id/progress_percent"
android:layout_width="@dimen/progress_size"
android:layout_height="@dimen/progress_size"
android:layout_marginBottom="@dimen/margin_medium"
app:progress_color="@color/progress_color"
app:layout_constraintBottom_toTopOf="@+id/progress_dollar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
app:progress_text_size="@dimen/progress_font_size"
app:progress_width="@dimen/progress_width" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true">

<com.bitvale.valueprogress.ValueProgress
android:id="@+id/progress_dollar"
android:layout_width="@dimen/progress_size"
android:layout_height="@dimen/progress_size"
app:progress_value_symbol="$"
app:layout_constraintBottom_toTopOf="@+id/edit_text_value"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progress_percent"
app:progress_text_size="@dimen/progress_font_size"
app:progress_width="@dimen/progress_width" />
<requestFocus />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:gravity="center"
android:hint="@string/edit_hint_value"
android:ems="10"
android:id="@+id/edit_text_value"
android:layout_marginEnd="@dimen/margin_small"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginRight="@dimen/margin_small"
android:layout_marginStart="@dimen/margin_small"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_medium"
app:layout_constraintBottom_toTopOf="@+id/edit_text_max_value"/>
<com.bitvale.valueprogress.ValueProgress
android:id="@+id/progress_percent"
android:layout_width="@dimen/progress_size"
android:layout_height="@dimen/progress_size"
android:layout_marginBottom="@dimen/margin_medium"
app:layout_constraintBottom_toTopOf="@+id/progress_dollar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
app:progress_color="@color/progress_color"
app:progress_text_size="@dimen/progress_font_size"
app:progress_width="@dimen/progress_width" />

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:gravity="center"
android:hint="@string/edit_hint_max_value"
android:ems="10"
android:id="@+id/edit_text_max_value"
android:layout_marginEnd="@dimen/margin_small"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginRight="@dimen/margin_small"
android:layout_marginStart="@dimen/margin_small"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_medium"
app:layout_constraintBottom_toBottomOf="parent"/>
<com.bitvale.valueprogress.ValueProgress
android:id="@+id/progress_dollar"
android:layout_width="@dimen/progress_size"
android:layout_height="@dimen/progress_size"
app:layout_constraintBottom_toTopOf="@+id/edit_text_value"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/progress_percent"
app:progress_text_size="@dimen/progress_font_size"
app:progress_value_symbol="$"
app:progress_width="@dimen/progress_width" />

<EditText
android:id="@+id/edit_text_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_small"
android:layout_marginLeft="@dimen/margin_small"
android:layout_marginEnd="@dimen/margin_small"
android:layout_marginRight="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_medium"
android:ems="10"
android:gravity="center"
android:hint="@string/edit_hint_value"
android:inputType="number"
app:layout_constraintBottom_toTopOf="@+id/edit_text_max_value"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<EditText
android:id="@+id/edit_text_max_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_small"
android:layout_marginLeft="@dimen/margin_small"
android:layout_marginEnd="@dimen/margin_small"
android:layout_marginRight="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_medium"
android:ems="10"
android:gravity="center"
android:hint="@string/edit_hint_max_value"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName "1.0.1"
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.text.StaticLayout
import android.text.TextPaint
import android.util.AttributeSet
import android.view.View
import kotlin.math.min

/**
* Created by Alexander Kolpakov on 11/23/2018
Expand Down Expand Up @@ -133,7 +134,7 @@ class ValueProgress @JvmOverloads constructor(

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
progressRadius = (Math.min(w, h)) / 2f
progressRadius = (min(w, h)) / 2f
progressArc.bottom = progressRadius * 2f
progressArc.right = progressRadius * 2f
}
Expand Down

0 comments on commit fd74a79

Please sign in to comment.