From 25bab08b5ee9eb6776621e057bffc37631027a64 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Tue, 19 Mar 2019 18:05:08 -0600 Subject: [PATCH] Updated the Material Components library to 1.1.0-alpha04 and fixed some issues presented because of the migration. --- app/build.gradle | 15 ++++++++++++++- .../fragments/BaseSecurityLockDialog.kt | 2 +- .../fragments/EReceiptFragment.kt | 4 ++-- .../fragments/MerchantsFragment.kt | 4 ++-- .../fragments/PINSecurityLockDialog.kt | 2 +- .../fragments/ReceiveTransactionFragment.kt | 4 ++-- .../fragments/SendTransactionFragment.kt | 4 ++-- .../fragments/TransactionsFragment.kt | 4 ++-- app/src/main/res/layout/fragment_home.xml | 11 ++++------- 9 files changed, 30 insertions(+), 20 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1b6463e..e3d5f1f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,7 +72,7 @@ dependencies { // Google implementation 'com.google.zxing:core:3.3.1' implementation 'com.google.code.gson:gson:2.8.5' - implementation 'com.google.android.material:material:1.0.0' + implementation 'com.google.android.material:material:1.1.0-alpha04' implementation 'com.google.android.gms:play-services-maps:16.1.0' implementation 'com.google.maps.android:android-maps-utils:0.5' // AAC Lifecycle @@ -103,6 +103,7 @@ dependencies { implementation 'com.itextpdf:itextpdf:5.5.13' implementation 'com.opencsv:opencsv:3.7' // Others + api 'com.google.guava:guava:27.0.1-android' implementation 'org.bitcoinj:bitcoinj-core:0.14.3' implementation 'com.moldedbits.r2d2:r2d2:1.0.1' implementation 'me.dm7.barcodescanner:zxing:1.9.8' @@ -121,3 +122,15 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'com.jraska.livedata:testing-ktx:1.0.0' } + +// Added to avoid the compilation problem due to a duplicate ListenableFuture library +afterEvaluate { + configurations.all { + def group = 'com.google.guava', name = 'guava', version = '27.0.1-android' + resolutionStrategy.eachDependency { details -> + if (requested.group == group && requested.name == name) { + details.useTarget group: details.requested.group, name: name, version: version + } + } + } +} diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BaseSecurityLockDialog.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BaseSecurityLockDialog.kt index 64dcee6..c272618 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BaseSecurityLockDialog.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BaseSecurityLockDialog.kt @@ -173,7 +173,7 @@ abstract class BaseSecurityLockDialog : DialogFragment() { super.onResume() // Force dialog fragment to use the full width of the screen - val dialogWindow = dialog.window + val dialogWindow = dialog?.window dialogWindow?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/EReceiptFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/EReceiptFragment.kt index 20cfd9f..d6ce4bf 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/EReceiptFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/EReceiptFragment.kt @@ -127,8 +127,8 @@ class EReceiptFragment : Fragment() { inflater.inflate(R.menu.menu_e_receipt, menu) } - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - if (item?.itemId == R.id.menu_share) { + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == R.id.menu_share) { verifyStoragePermission() return true } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt index 3684140..601e15f 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt @@ -314,8 +314,8 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio return true } - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - if (item?.itemId == R.id.menu_filter) { + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == R.id.menu_filter) { // Try to show or dismiss the custom popup window with the merchants and tellers switches if (mPopupWindow?.isShowing == false) { mPopupWindow?.showAsDropDown(toolbar, screenWidth, 8) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/PINSecurityLockDialog.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/PINSecurityLockDialog.kt index b85330f..1b53926 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/PINSecurityLockDialog.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/PINSecurityLockDialog.kt @@ -39,7 +39,7 @@ class PINSecurityLockDialog : BaseSecurityLockDialog() { // Request focus to the PIN EditText and automatically show the keyboard when the dialog appears. tietPIN.requestFocus() - dialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) + dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) setupScreen() diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt index 9470b14..8906c46 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt @@ -364,8 +364,8 @@ class ReceiveTransactionFragment : ConnectedFragment() { inflater.inflate(R.menu.menu_receive_transaction, menu) } - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - if (item?.itemId == R.id.menu_share) { + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == R.id.menu_share) { verifyStoragePermission() return true } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt index 51c323b..94b3966 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt @@ -574,8 +574,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand inflater.inflate(R.menu.menu_send_transaction, menu) } - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - if (item?.itemId == R.id.menu_info) { + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == R.id.menu_info) { MaterialDialog(context!!).show { customView(R.layout.dialog_send_transaction_info, scrollable = true) positiveButton(android.R.string.ok) { dismiss() } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt index 9f3e988..bcd7cf5 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt @@ -121,8 +121,8 @@ class TransactionsFragment : Fragment(), FilterOptionsDialog.OnFilterOptionsSele searchView.maxWidth = getScreenWidth(activity) * 3 / 5 } - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - return when (item?.itemId) { + override fun onOptionsItemSelected(item: MenuItem): Boolean { + return when (item.itemId) { R.id.menu_filter -> { val filterOptionsDialog = FilterOptionsDialog.newInstance( filterTransactionsDirection, filterDateRangeAll, filterStartDate * 1000, diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 5c9b442..4aa9f6a 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -31,7 +31,6 @@