Skip to content

Commit

Permalink
Update project using latest versions of plugins/libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusM committed Oct 4, 2017
1 parent 22bf47f commit be9f8a3
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 56 deletions.
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -20,16 +18,17 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

ext {
minSdkVersion = 23
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = '25.0.3'
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = '26.0.2'

supportLibsVersion = '25.1.0'
supportLibsVersion = '26.0.2'
}

task clean(type: Delete) {
Expand Down
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 @@
#Thu May 18 07:41:34 CEST 2017
#Sat Sep 02 09:56:43 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
2 changes: 1 addition & 1 deletion kfingerprintmanager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:' + parent.ext.supportLibsVersion
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2-3"
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2"

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.7.21'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ class FingerprintAuthenticationDialogFragment : FingerprintBaseDialogFragment<Fi
fun onPasswordInserted(password: String)
}

val passwordContainer : View by lazy {
dialogRootView.findViewById(R.id.fingerprint_dialog_backup_content)
private val passwordContainer : View by lazy {
dialogRootView.findViewById<View>(R.id.fingerprint_dialog_backup_content)
}
val password by lazy {
dialogRootView.findViewById(R.id.password) as EditText
val password: EditText by lazy {
dialogRootView.findViewById<EditText>(R.id.password)
}

val textInputLayout by lazy {
dialogRootView.findViewById(R.id.input_layout_password) as TextInputLayout
val textInputLayout: TextInputLayout by lazy {
dialogRootView.findViewById<TextInputLayout>(R.id.input_layout_password)
}

val useFingerprintFutureCheckBox by lazy {
dialogRootView.findViewById(R.id.use_fingerprint_in_future_check) as CheckBox
private val useFingerprintFutureCheckBox by lazy {
dialogRootView.findViewById<CheckBox>(R.id.use_fingerprint_in_future_check)
}

private val sharedPreferences: SharedPreferences by lazy {
Expand All @@ -51,12 +51,6 @@ class FingerprintAuthenticationDialogFragment : FingerprintBaseDialogFragment<Fi

private var startWithNewFingerprintEnrolled: Boolean = false

fun onPresenterChanged(new: FingerprintAuthenticationDialogPresenter) {
if (startWithNewFingerprintEnrolled) {
new.newFingerprintEnrolled()
}
}

override fun inflateViews(rootView: View) {
super.inflateViews(rootView)

Expand Down Expand Up @@ -96,18 +90,17 @@ class FingerprintAuthenticationDialogFragment : FingerprintBaseDialogFragment<Fi
dialogBuilder.setPositiveButton(R.string.use_password, null)
}

override fun onEditorAction(v: TextView?, actionId: Int, event: KeyEvent?): Boolean {
return when (actionId) {
EditorInfo.IME_ACTION_GO -> {
dismiss()
true
}
else -> {
textInputLayout.error = null
false
override fun onEditorAction(v: TextView?, actionId: Int, event: KeyEvent?): Boolean =
when (actionId) {
EditorInfo.IME_ACTION_GO -> {
dismiss()
true
}
else -> {
textInputLayout.error = null
false
}
}
}
}

override fun onFingerprintDisplayed() {
fingerprintContainer.visibility = VISIBLE
Expand Down Expand Up @@ -177,26 +170,24 @@ class FingerprintAuthenticationDialogFragment : FingerprintBaseDialogFragment<Fi
}

class Builder : FingerprintBaseDialogFragment.Builder<FingerprintAuthenticationDialogFragment, FingerprintAuthenticationDialogPresenter>() {
internal var newFingerprintEnrolled: Boolean = false
private var newFingerprintEnrolled: Boolean = false

fun newFingerprintEnrolled(newFingerprintEnrolled: Boolean): Builder {
this.newFingerprintEnrolled = newFingerprintEnrolled
return this
}

override fun createDialogFragment(): FingerprintAuthenticationDialogFragment {
return FingerprintAuthenticationDialogFragment()
}
override fun createDialogFragment(): FingerprintAuthenticationDialogFragment =
FingerprintAuthenticationDialogFragment()

override fun addProperties(dialogFragment: FingerprintAuthenticationDialogFragment) {
if (newFingerprintEnrolled) {
dialogFragment.startWithNewFingerprintEnrolled()
}
}

override fun createPresenter(view: FingerprintAuthenticationDialogFragment): FingerprintAuthenticationDialogPresenter {
return FingerprintAuthenticationDialogPresenter(view)
}
override fun createPresenter(view: FingerprintAuthenticationDialogFragment): FingerprintAuthenticationDialogPresenter =
FingerprintAuthenticationDialogPresenter(view)
}

private open class TextWatcherAdapter : TextWatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ abstract class FingerprintBaseDialogFragment<T : FingerprintBaseDialogPresenter>
}

@CallSuper
open fun inflateViews(rootView: View) {
}
open fun inflateViews(rootView: View) {}

@CallSuper
open fun onDialogShown() {
Expand Down Expand Up @@ -89,7 +88,7 @@ abstract class FingerprintBaseDialogFragment<T : FingerprintBaseDialogPresenter>
}

override fun close() {
dismiss()
dismissAllowingStateLoss()
}

override fun onCancel(dialog: DialogInterface?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class FingerprintEncryptionDialogFragment : FingerprintBaseDialogFragment<Finger

}

override fun createDialogFragment(): FingerprintEncryptionDialogFragment {
return FingerprintEncryptionDialogFragment()
}
override fun createDialogFragment(): FingerprintEncryptionDialogFragment =
FingerprintEncryptionDialogFragment()

override fun createPresenter(view: FingerprintEncryptionDialogFragment): FingerprintEncryptionDialogPresenter {
return FingerprintEncryptionDialogPresenter(view)
}
override fun createPresenter(view: FingerprintEncryptionDialogFragment): FingerprintEncryptionDialogPresenter =
FingerprintEncryptionDialogPresenter(view)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.view.View

fun <T : View> Activity.bind(@IdRes idRes: Int): Lazy<T> {
@Suppress("UNCHECKED_CAST")
return unsafeLazy { findViewById(idRes) as T }
return unsafeLazy { findViewById<T>(idRes)}
}

private fun <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE, initializer)
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
dependencies {
compile 'com.android.support:appcompat-v7:' + parent.ext.supportLibsVersion
compile project(':kfingerprintmanager')
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2-4"
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ class MainActivity : AppCompatActivity() {

private fun initClickListeners() {

findViewById(R.id.buttonDialogThemeLight).setOnClickListener { v ->
findViewById<Button>(R.id.buttonDialogThemeLight).setOnClickListener { v ->
selectView(v)

deselectView(findViewById(R.id.buttonDialogThemeDark))

dialogTheme = R.style.DialogThemeLight
}

findViewById(R.id.buttonDialogThemeDark).setOnClickListener { v ->
findViewById<Button>(R.id.buttonDialogThemeDark).setOnClickListener { v ->
selectView(v)

deselectView(findViewById(R.id.buttonDialogThemeLight))
Expand Down

0 comments on commit be9f8a3

Please sign in to comment.