Skip to content

Commit

Permalink
Update library (#1)
Browse files Browse the repository at this point in the history
* Disable jetifier
* Update dependencies
* Update targetSdkVersion
* Update library version to 1.2.0
* Update readme
* Remove travis
  • Loading branch information
addyi authored Apr 22, 2021
1 parent a55f0de commit fcee4a8
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 114 deletions.
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Add the dependency in your app `build.gradle`:

```
dependencies {
implementation 'com.github.teresaholfeld:Stories:1.1.4'
implementation 'com.github.teresaholfeld:Stories:1.2.0'
}
```
Expand Down
42 changes: 18 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,28 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.teresaholfeld.stories.app"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
compileSdkVersion 30
defaultConfig {
applicationId "com.teresaholfeld.stories.app"
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}

dependencies {
implementation 'com.github.teresaholfeld:Stories:1.1.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(':library')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
}

repositories {
mavenCentral()
mavenCentral()
}
16 changes: 9 additions & 7 deletions app/src/main/java/com/teresaholfeld/stories/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.teresaholfeld.stories.app

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.teresaholfeld.stories.StoriesProgressView

class MainActivity : AppCompatActivity(), StoriesProgressView.StoriesListener {
Expand All @@ -15,12 +15,12 @@ class MainActivity : AppCompatActivity(), StoriesProgressView.StoriesListener {

private var counter = 0
private val resources = intArrayOf(
R.drawable.sample1,
R.drawable.sample2,
R.drawable.sample3,
R.drawable.sample4,
R.drawable.sample5,
R.drawable.sample6
R.drawable.sample1,
R.drawable.sample2,
R.drawable.sample3,
R.drawable.sample4,
R.drawable.sample5,
R.drawable.sample6
)

private val durations = longArrayOf(500L, 1000L, 1500L, 4000L, 5000L, 1000)
Expand Down Expand Up @@ -49,6 +49,8 @@ class MainActivity : AppCompatActivity(), StoriesProgressView.StoriesListener {
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
setContentView(R.layout.activity_main)

storiesProgressView = findViewById(R.id.stories)

storiesProgressView?.setStoriesCount(PROGRESS_COUNT)
storiesProgressView?.setStoryDuration(3000L)
// or
Expand Down
7 changes: 2 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_version = '1.4.32'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -19,7 +17,6 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
Expand Down
6 changes: 2 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.enableJetifier=false
android.useAndroidX=true
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 @@
#Mon Sep 10 10:57:05 WEST 2018
#Wed Mar 31 12:35:12 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
41 changes: 16 additions & 25 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
group = "com.teresaholfeld.stories"
compileSdkVersion 30

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.1.4"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
defaultConfig {
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.2.0'


}
repositories {
mavenCentral()
mavenCentral()
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import android.view.animation.Transformation
import android.widget.FrameLayout

@SuppressLint("ViewConstructor")
internal class PausableProgressBar constructor(context: Context,
attrs: AttributeSet? = null,
progressColor: Int,
progressBackgroundColor: Int)
: FrameLayout(context, attrs) {
internal class PausableProgressBar constructor(
context: Context,
attrs: AttributeSet? = null,
progressColor: Int,
progressBackgroundColor: Int
) : FrameLayout(context, attrs) {

private val frontProgressView: View?
private val backProgressView: View?
Expand All @@ -30,10 +31,12 @@ internal class PausableProgressBar constructor(context: Context,
fun onFinishProgress()
}

constructor(context: Context,
progressColor: Int,
progressBackgroundColor: Int)
: this(context, null, progressColor, progressBackgroundColor)
constructor(
context: Context,
progressColor: Int,
progressBackgroundColor: Int
) :
this(context, null, progressColor, progressBackgroundColor)

init {
LayoutInflater.from(context).inflate(R.layout.pausable_progress, this)
Expand Down Expand Up @@ -81,8 +84,10 @@ internal class PausableProgressBar constructor(context: Context,
}

fun startProgress() {
animation = PausableScaleAnimation(0f, 1f, 1f, 1f, Animation.ABSOLUTE, 0f,
Animation.RELATIVE_TO_SELF, 0f)
animation = PausableScaleAnimation(
0f, 1f, 1f, 1f, Animation.ABSOLUTE, 0f,
Animation.RELATIVE_TO_SELF, 0f
)
animation?.duration = duration
animation?.interpolator = LinearInterpolator()
animation?.setAnimationListener(object : Animation.AnimationListener {
Expand Down Expand Up @@ -115,15 +120,17 @@ internal class PausableProgressBar constructor(context: Context,
animation = null
}

private inner class PausableScaleAnimation internal constructor(fromX: Float,
toX: Float,
fromY: Float,
toY: Float,
pivotXType: Int,
pivotXValue: Float,
pivotYType: Int,
pivotYValue: Float)
: ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType, pivotYValue) {
private inner class PausableScaleAnimation internal constructor(
fromX: Float,
toX: Float,
fromY: Float,
toY: Float,
pivotXType: Int,
pivotXValue: Float,
pivotYType: Int,
pivotYValue: Float
) :
ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType, pivotYValue) {

private var mElapsedAtPause: Long = 0
private var mPaused = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ package com.teresaholfeld.stories
import android.annotation.TargetApi
import android.content.Context
import android.os.Build
import android.support.v4.content.ContextCompat
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import java.util.ArrayList
import androidx.core.content.ContextCompat

class StoriesProgressView : LinearLayout {

Expand All @@ -24,6 +23,7 @@ class StoriesProgressView : LinearLayout {
private val progressBars = ArrayList<PausableProgressBar>()

private var storiesCount = -1

/**
* pointer of running animation
*/
Expand All @@ -42,7 +42,8 @@ class StoriesProgressView : LinearLayout {
fun onComplete()
}

@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) {
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null) : super(context, attrs) {
init(context, attrs)
}

Expand All @@ -51,18 +52,20 @@ class StoriesProgressView : LinearLayout {
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)
: super(context, attrs, defStyleAttr, defStyleRes) {
init(context, attrs)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) :
super(context, attrs, defStyleAttr, defStyleRes) {
init(context, attrs)
}

private fun init(context: Context, attrs: AttributeSet?) {
orientation = LinearLayout.HORIZONTAL
orientation = HORIZONTAL
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.StoriesProgressView)
storiesCount = typedArray.getInt(R.styleable.StoriesProgressView_progressCount, 0)
progressColor = typedArray.getColor(R.styleable.StoriesProgressView_progressColor, defaultColor)
progressBackgroundColor = typedArray.getColor(R.styleable.StoriesProgressView_progressBackgroundColor,
defaultBackgroundColor)
progressBackgroundColor = typedArray.getColor(
R.styleable.StoriesProgressView_progressBackgroundColor,
defaultBackgroundColor
)
typedArray.recycle()
bindViews()
}
Expand Down

0 comments on commit fcee4a8

Please sign in to comment.