diff --git a/app/build.gradle b/app/build.gradle index fdb2b6fdc..3978f6789 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,16 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion 29 + namespace 'io.horizontalsystems.bitcoinkit.demo' + compileSdk 34 + defaultConfig { applicationId "io.horizontalsystems.bitcoinkit.demo" minSdkVersion 23 - targetSdkVersion 29 + targetSdkVersion 34 versionCode 1 versionName "0.3.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -19,11 +22,14 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } + kotlinOptions { jvmTarget = '17' } packagingOptions { - pickFirst("META-INF/atomicfu.kotlin_module") + resources { + pickFirsts += ['META-INF/atomicfu.kotlin_module'] + } } } @@ -31,9 +37,9 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.google.android.material:material:1.10.0' implementation 'io.reactivex.rxjava2:rxjava:2.2.19' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' @@ -41,15 +47,12 @@ dependencies { // ViewModel and LiveData 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:2.2' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10' - testImplementation 'junit:junit:4.13' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation project(':bitcoinkit') implementation project(':dashkit') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ddd7232f1..68e75920d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + @@ -12,7 +11,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/App.kt b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/App.kt index ed70614ad..38ad9349e 100644 --- a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/App.kt +++ b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/App.kt @@ -1,16 +1,12 @@ package io.horizontalsystems.bitcoinkit.demo import android.app.Application -import com.facebook.stetho.Stetho class App : Application() { override fun onCreate() { super.onCreate() - // Enable debug bridge - Stetho.initializeWithDefaults(this) - instance = this } diff --git a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/BalanceFragment.kt b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/BalanceFragment.kt index bfe85c52b..3fac4efde 100644 --- a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/BalanceFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/BalanceFragment.kt @@ -11,7 +11,6 @@ import android.widget.TextView import androidx.appcompat.app.AlertDialog import androidx.lifecycle.ViewModelProvider import io.horizontalsystems.bitcoincore.BitcoinCore -import kotlinx.android.synthetic.main.fragment_balance.* import java.text.SimpleDateFormat import java.util.* @@ -27,6 +26,7 @@ class BalanceFragment : Fragment() { lateinit var startButton: Button lateinit var clearButton: Button lateinit var buttonDebug: Button + lateinit var buttonStatus: Button override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -113,6 +113,7 @@ class BalanceFragment : Fragment() { startButton = view.findViewById(R.id.buttonStart) clearButton = view.findViewById(R.id.buttonClear) buttonDebug = view.findViewById(R.id.buttonDebug) + buttonStatus = view.findViewById(R.id.buttonStatus) startButton.setOnClickListener { viewModel.start() diff --git a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/SendReceiveFragment.kt b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/SendReceiveFragment.kt index 387648eab..c9acd08e2 100644 --- a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/SendReceiveFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/SendReceiveFragment.kt @@ -1,10 +1,7 @@ package io.horizontalsystems.bitcoinkit.demo -import androidx.lifecycle.Observer import android.os.Bundle -import androidx.fragment.app.Fragment import android.text.Editable -import android.text.SpannableStringBuilder import android.text.TextWatcher import android.view.Gravity import android.view.LayoutInflater @@ -12,16 +9,30 @@ import android.view.View import android.view.ViewGroup import android.widget.AdapterView import android.widget.ArrayAdapter +import android.widget.Button +import android.widget.EditText +import android.widget.RadioGroup +import android.widget.Spinner +import android.widget.TextView import android.widget.Toast +import androidx.fragment.app.Fragment +import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider -import io.horizontalsystems.bitcoincore.exceptions.AddressFormatException -import io.horizontalsystems.bitcoincore.managers.SendValueErrors import io.horizontalsystems.hodler.LockTimeInterval -import kotlinx.android.synthetic.main.fragment_send_receive.* class SendReceiveFragment : Fragment() { private lateinit var viewModel: MainViewModel + lateinit var receiveAddressText: TextView + lateinit var receiveAddressButton: Button + lateinit var sendAmount: EditText + lateinit var sendAddress: EditText + lateinit var txFeeValue: TextView + lateinit var sendButton: Button + lateinit var maxButton: Button + lateinit var radioGroup: RadioGroup + lateinit var lockTimePeriodValue: Spinner + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_send_receive, container, false) } @@ -60,6 +71,16 @@ class SendReceiveFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + receiveAddressText = view.findViewById(R.id.receiveAddressText) + receiveAddressButton = view.findViewById(R.id.receiveAddressButton) + sendAmount = view.findViewById(R.id.sendAmount) + sendAddress = view.findViewById(R.id.sendAddress) + txFeeValue = view.findViewById(R.id.txFeeValue) + sendButton = view.findViewById(R.id.sendButton) + maxButton = view.findViewById(R.id.maxButton) + radioGroup = view.findViewById(R.id.radioGroup) + lockTimePeriodValue = view.findViewById(R.id.lockTimePeriodValue) + receiveAddressButton.setOnClickListener { viewModel.onReceiveClick() } @@ -71,7 +92,7 @@ class SendReceiveFragment : Fragment() { maxButton.setOnClickListener { - viewModel.onMaxClick() + viewModel.onMaxClick() } diff --git a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/TransactionsFragment.kt b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/TransactionsFragment.kt index 615b3c1c6..87a0eaa26 100644 --- a/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/TransactionsFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bitcoinkit/demo/TransactionsFragment.kt @@ -21,7 +21,6 @@ import io.horizontalsystems.bitcoincore.models.TransactionOutputInfo import io.horizontalsystems.dashkit.models.DashTransactionInfo import io.horizontalsystems.hodler.HodlerOutputData import io.horizontalsystems.hodler.HodlerPlugin -import kotlinx.android.synthetic.main.fragment_transactions.* import java.text.DateFormat import java.util.* @@ -31,6 +30,8 @@ class TransactionsFragment : Fragment(), ViewHolderTransaction.Listener { private lateinit var transactionsRecyclerView: RecyclerView private val transactionsAdapter = TransactionsAdapter(this) + lateinit var tabs: TabLayout + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -62,6 +63,8 @@ class TransactionsFragment : Fragment(), ViewHolderTransaction.Listener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + tabs = view.findViewById(R.id.tabs) + transactionsRecyclerView = view.findViewById(R.id.transactions) transactionsRecyclerView.adapter = transactionsAdapter transactionsRecyclerView.layoutManager = LinearLayoutManager(context) diff --git a/app/src/main/res/layout/fragment_balance.xml b/app/src/main/res/layout/fragment_balance.xml index 435741ab4..cc717cbb9 100644 --- a/app/src/main/res/layout/fragment_balance.xml +++ b/app/src/main/res/layout/fragment_balance.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@android:color/white" android:padding="8dp"> + app:layout_constraintTop_toBottomOf="@+id/balanceTitle" /> + tools:text="100.0" /> + android:background="@android:color/white" + android:scrollbars="vertical"> + android:padding="8dp"> + app:layout_constraintTop_toTopOf="parent" />