Skip to content

Commit

Permalink
Merge pull request #35 from agrawalsuneet/dev
Browse files Browse the repository at this point in the history
Merge Dev to master fir 1.4.1 release
  • Loading branch information
agrawalsuneet committed Jun 9, 2019
2 parents 3cd22ca + e6acab0 commit b391301
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_bounce)
setContentView(R.layout.main_lineardotsloader)

supportActionBar?.title = "BounceLoader"

Expand Down
6 changes: 3 additions & 3 deletions dotsloader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
ext {
PUBLISH_GROUP_ID = 'com.agrawalsuneet.androidlibs'
PUBLISH_ARTIFACT_ID = 'dotsloader'
PUBLISH_VERSION = '1.4'
PUBLISH_VERSION = '1.4.1'
}

configurations {
Expand All @@ -29,8 +29,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 14
versionName "1.4"
versionCode 15
versionName "1.4.1"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.view.View
import com.agrawalsuneet.dotsloader.R
import com.agrawalsuneet.dotsloader.contracts.CircularAbstractView
import com.agrawalsuneet.dotsloader.utils.Utils
import java.util.*

/**
Expand Down Expand Up @@ -68,7 +69,7 @@ class CircularDotsLoader : CircularAbstractView {
selectedDotPos = 1
}

(context as Activity).runOnUiThread { invalidate() }
(Utils.scanForActivity(context))?.runOnUiThread { invalidate() }
}
}, 0, animDur.toLong())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.view.View
import com.agrawalsuneet.dotsloader.R
import com.agrawalsuneet.dotsloader.contracts.DotsLoaderBaseView
import com.agrawalsuneet.dotsloader.utils.Utils
import java.util.*

/**
Expand Down Expand Up @@ -119,7 +120,7 @@ class LinearDotsLoader : DotsLoaderBaseView {
}
}

(context as Activity).runOnUiThread { invalidate() }
(Utils.scanForActivity(context))?.runOnUiThread { invalidate() }
}
}, 0, animDur.toLong())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.agrawalsuneet.dotsloader.utils

import android.content.ContextWrapper
import android.app.Activity
import android.content.Context


object Utils {

fun scanForActivity(context: Context?): Activity? {
return when (context) {
null -> null
is Activity -> context
is ContextWrapper -> scanForActivity(context.baseContext)
else -> null
}

}

}

0 comments on commit b391301

Please sign in to comment.