Skip to content

Commit

Permalink
Migrate to Android X and update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
omurovch committed Apr 20, 2020
1 parent a9c8931 commit f3bc8d0
Show file tree
Hide file tree
Showing 56 changed files with 249 additions and 219 deletions.
28 changes: 13 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
compileSdkVersion 29
defaultConfig {
applicationId "io.horizontalsystems.bitcoinkit.demo"
minSdkVersion 23
targetSdkVersion 27
targetSdkVersion 29
versionCode 1
versionName "0.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -31,27 +31,25 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'

implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

// For debug
implementation 'com.facebook.stetho:stetho:1.5.1'

//LeakCanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation project(':bitcoinkit')
implementation project(':dashkit')
Expand Down
12 changes: 1 addition & 11 deletions app/src/main/java/io/horizontalsystems/bitcoinkit/demo/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@ package io.horizontalsystems.bitcoinkit.demo

import android.app.Application
import com.facebook.stetho.Stetho
import com.squareup.leakcanary.LeakCanary
import io.horizontalsystems.bitcoinkit.BitcoinKit

class App : Application() {

override fun onCreate() {
super.onCreate()

// Enable debug bridge
Stetho.initializeWithDefaults(this);

if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return
}

LeakCanary.install(this)
Stetho.initializeWithDefaults(this)

instance = this
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.horizontalsystems.bitcoinkit.demo

import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.v4.app.Fragment
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.horizontalsystems.bitcoinkit.demo

import android.os.Bundle
import android.support.design.widget.BottomNavigationView
import android.support.v4.app.Fragment
import android.support.v7.app.AppCompatActivity
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.fragment.app.Fragment
import androidx.appcompat.app.AppCompatActivity
import android.view.MenuItem

class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.horizontalsystems.bitcoinkit.demo

import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import io.horizontalsystems.bitcoincore.BitcoinCore
import io.horizontalsystems.bitcoincore.BitcoinCore.KitState
import io.horizontalsystems.bitcoincore.core.Bip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.horizontalsystems.bitcoinkit.demo

import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.support.v4.app.Fragment
import androidx.fragment.app.Fragment
import android.text.Editable
import android.text.TextWatcher
import android.view.Gravity
Expand All @@ -29,23 +29,23 @@ class SendReceiveFragment : Fragment() {
activity?.let { activity ->
viewModel = ViewModelProviders.of(activity).get(MainViewModel::class.java)

viewModel.receiveAddressLiveData.observe(this, Observer {
viewModel.receiveAddressLiveData.observe(viewLifecycleOwner, Observer {
receiveAddressText.text = it
})

viewModel.amountLiveData.observe(this, Observer {
viewModel.amountLiveData.observe(viewLifecycleOwner, Observer {
sendAmount.setText(it?.toString())
})

viewModel.addressLiveData.observe(this, Observer {
viewModel.addressLiveData.observe(viewLifecycleOwner, Observer {
sendAddress.setText(it)
})

viewModel.feeLiveData.observe(this, Observer {
viewModel.feeLiveData.observe(viewLifecycleOwner, Observer {
txFeeValue.text = it?.toString()
})

viewModel.errorLiveData.observe(this, Observer {
viewModel.errorLiveData.observe(viewLifecycleOwner, Observer {
val toast = Toast.makeText(context, it, Toast.LENGTH_LONG)

toast.setGravity(Gravity.CENTER, 0, 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.horizontalsystems.bitcoinkit.demo

import android.annotation.SuppressLint
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import android.graphics.Color
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/container"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
Expand All @@ -16,14 +16,15 @@
app:layout_constraintTop_toTopOf="parent"
/>

<android.support.design.widget.BottomNavigationView
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="@android:color/white"
app:menu="@menu/navigation"
/>

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_balance.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout 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"
Expand Down Expand Up @@ -155,4 +155,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonStart" />

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
16 changes: 8 additions & 8 deletions app/src/main/res/layout/fragment_send_receive.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView 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:scrollbars="vertical"
>

<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
Expand Down Expand Up @@ -52,7 +52,7 @@
app:layout_constraintTop_toBottomOf="@+id/receiveAddressButton"
/>

<android.support.design.widget.TextInputLayout
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/sendAddressLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -72,9 +72,9 @@
android:inputType="text"
/>

</android.support.design.widget.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>

<android.support.design.widget.TextInputLayout
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/sendAmountLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
Expand All @@ -93,7 +93,7 @@
android:inputType="numberDecimal"
/>

</android.support.design.widget.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>

<Button
android:id="@+id/maxButton"
Expand Down Expand Up @@ -218,5 +218,5 @@
/>


</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_transactions.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<android.support.v7.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/transactions"
android:layout_width="0dp"
android:layout_height="0dp"
Expand All @@ -16,4 +16,4 @@
app:layout_constraintTop_toTopOf="parent"
/>

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/layout/view_holder_transaction.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -14,4 +14,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
30 changes: 15 additions & 15 deletions bitcoincashkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 23
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "0.4.1"

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

buildTypes {
Expand All @@ -36,30 +36,30 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'androidx.annotation:annotation:1.1.0'

// Room
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
implementation 'androidx.room:room-runtime:2.2.5'
implementation 'androidx.room:room-rxjava2:2.2.5'
kapt 'androidx.room:room-compiler:2.2.5'

api project(':bitcoincore')

// Test helpers
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.1'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation 'junit:junit:4.13'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.1'
testImplementation 'org.mockito:mockito-core:3.3.3'
testImplementation 'com.nhaarman:mockito-kotlin-kt1.1:1.6.0'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.0-beta.5'
testImplementation 'org.powermock:powermock-module-junit4:2.0.0-beta.5'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.7'
testImplementation 'org.powermock:powermock-module-junit4:2.0.7'

// Spek
testImplementation "org.spekframework.spek2:spek-dsl-jvm:2.0.3"
testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:2.0.3"
testImplementation "org.spekframework.spek2:spek-dsl-jvm:2.0.9"
testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:2.0.9"
testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

// Android Instrumentation Test
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito-inline:2.19.1'
androidTestImplementation 'com.nhaarman:mockito-kotlin-kt1.1:1.6.0'
}
Expand Down
Loading

0 comments on commit f3bc8d0

Please sign in to comment.