From 8eae569d697a5fc183be3cb4b56694fab9b0c629 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 22 Apr 2020 17:40:12 +0200 Subject: [PATCH] Upgraded to AndroidX AppCompat --- build.gradle | 16 ++++++++ fints4javaAndroidApp/build.gradle | 27 ++++++++----- .../fints4java/android/MainActivity.kt | 15 ++++---- .../fints4java/android/RouterAndroid.kt | 2 +- .../AccountTransactionViewHolder.kt | 2 +- .../android/ui/dialogs/AddAccountDialog.kt | 6 +-- .../android/ui/dialogs/EnterAtcDialog.kt | 6 +-- .../android/ui/dialogs/EnterTanDialog.kt | 6 +-- .../android/ui/dialogs/TransferMoneyDialog.kt | 6 +-- .../android/ui/home/HomeFragment.kt | 28 +++++++------- .../android/ui/home/HomeViewModel.kt | 6 +-- .../MainActivityFloatingActionMenuButton.kt | 2 +- .../src/main/res/layout/activity_main.xml | 22 ++++++----- .../src/main/res/layout/app_bar_main.xml | 22 ++++++----- .../src/main/res/layout/content_main.xml | 4 +- .../main/res/layout/dialog_add_account.xml | 22 +++++------ .../main/res/layout/dialog_transfer_money.xml | 38 +++++++++---------- .../src/main/res/layout/fragment_home.xml | 6 +-- .../main/res/layout/list_item_bank_info.xml | 2 +- .../src/main/res/menu/menu_main.xml | 2 +- .../src/main/res/values/strings.xml | 2 +- gradle.properties | 2 + 22 files changed, 136 insertions(+), 108 deletions(-) diff --git a/build.gradle b/build.gradle index 15472664..71dfc288 100644 --- a/build.gradle +++ b/build.gradle @@ -12,12 +12,28 @@ ext { hbci4jVersion = '3.1.37' + /* Android */ + androidUtilsVersion = '1.1.0' clansFloatingActionButtonVersion = '1.6.4' + multiDexVersion = "2.0.1" + + appCompatVersion = "1.1.0" + + constraintLayoutVersion = "1.1.3" + + materialComponentsVersion = "1.1.0" + + + /* JavaFX */ + javaFxUtilsVersion = '1.0.3' + + /* Test */ + junitVersion = '4.12' assertJVersion = '3.12.2' diff --git a/fints4javaAndroidApp/build.gradle b/fints4javaAndroidApp/build.gradle index 6f1ef512..d4d0a70c 100644 --- a/fints4javaAndroidApp/build.gradle +++ b/fints4javaAndroidApp/build.gradle @@ -13,7 +13,9 @@ android { versionCode appVersionCode versionName appVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + multiDexEnabled true + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -66,12 +68,19 @@ dependencies { implementation "org.slf4j:slf4j-android:$slf4JVersion" - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:design:28.0.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'android.arch.navigation:navigation-fragment:1.0.0' - implementation 'android.arch.navigation:navigation-ui:1.0.0' - implementation 'android.arch.lifecycle:extensions:1.1.1' - implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0' - implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0' + + implementation "androidx.multidex:multidex:$multiDexVersion" + + implementation "androidx.appcompat:appcompat:$appCompatVersion" + implementation "androidx.recyclerview:recyclerview:$appCompatVersion" + implementation "androidx.annotation:annotation:$appCompatVersion" + implementation "com.google.android.material:material:$materialComponentsVersion" + implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" + + + implementation 'androidx.navigation:navigation-fragment:2.0.0-rc02' + implementation 'androidx.navigation:navigation-ui:2.0.0-rc02' + implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' + implementation 'androidx.navigation:navigation-fragment-ktx:2.0.0-rc02' + implementation 'androidx.navigation:navigation-ui-ktx:2.0.0-rc02' } diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt index f718902c..e6228d88 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt @@ -1,19 +1,18 @@ package net.dankito.banking.fints4java.android import android.os.Bundle -import android.support.design.widget.NavigationView -import android.support.v4.view.GravityCompat -import android.support.v4.widget.DrawerLayout -import android.support.v7.app.ActionBarDrawerToggle -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.Toolbar import android.view.Menu import android.view.MenuItem import android.view.MotionEvent import android.view.SubMenu import android.widget.TextView -import androidx.navigation.findNavController +import androidx.appcompat.app.ActionBarDrawerToggle +import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.widget.Toolbar +import androidx.core.view.GravityCompat +import androidx.drawerlayout.widget.DrawerLayout import com.github.clans.fab.FloatingActionMenu +import com.google.android.material.navigation.NavigationView import kotlinx.android.synthetic.main.action_view_account_menu_item.view.* import net.dankito.banking.fints4java.android.ui.views.MainActivityFloatingActionMenuButton import net.dankito.banking.fints4java.android.util.Base64ServiceAndroid @@ -62,7 +61,7 @@ class MainActivity : AppCompatActivity() { val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) val navigationView: NavigationView = findViewById(R.id.nav_view) - val navController = findNavController(R.id.nav_host_fragment) +// val navController = findNavController(R.id.nav_host_fragment) // // Passing each menu ID as a set of Ids because each // // menu should be considered as top level destinations. diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt index 4d478724..08198985 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt @@ -1,6 +1,6 @@ package net.dankito.banking.fints4java.android -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog import net.dankito.banking.fints4java.android.ui.dialogs.EnterAtcDialog import net.dankito.banking.fints4java.android.ui.dialogs.EnterTanDialog diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/viewholder/AccountTransactionViewHolder.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/viewholder/AccountTransactionViewHolder.kt index 21906726..ea417e5c 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/viewholder/AccountTransactionViewHolder.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/viewholder/AccountTransactionViewHolder.kt @@ -1,8 +1,8 @@ package net.dankito.banking.fints4java.android.ui.adapter.viewholder -import android.support.v7.widget.RecyclerView import android.view.View import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.list_item_account_transaction.view.* diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt index 45a508b0..58b01944 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt @@ -3,15 +3,15 @@ package net.dankito.banking.fints4java.android.ui.dialogs import android.content.Context import android.content.DialogInterface import android.os.Bundle -import android.support.v4.app.DialogFragment -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity import android.text.Editable import android.text.TextWatcher import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.DialogFragment import kotlinx.android.synthetic.main.dialog_add_account.* import kotlinx.android.synthetic.main.dialog_add_account.view.* import net.dankito.banking.fints4java.android.R diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterAtcDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterAtcDialog.kt index 1e05844e..b48a8146 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterAtcDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterAtcDialog.kt @@ -1,13 +1,13 @@ package net.dankito.banking.fints4java.android.ui.dialogs import android.os.Bundle -import android.support.v4.app.DialogFragment -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity import android.text.Html import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.DialogFragment import kotlinx.android.synthetic.main.dialog_enter_atc.view.* import net.dankito.banking.fints4java.android.R import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt index 0b6f7b9a..1b557e28 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt @@ -4,14 +4,14 @@ import android.content.Context import android.graphics.BitmapFactory import android.os.Bundle import android.os.Handler -import android.support.v4.app.DialogFragment -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity import android.text.InputType import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Spinner +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.DialogFragment import kotlinx.android.synthetic.main.dialog_enter_tan.view.* import kotlinx.android.synthetic.main.view_tan_image.view.* import net.dankito.banking.fints4java.android.R diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt index 7a986885..fa6667cd 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt @@ -1,14 +1,14 @@ package net.dankito.banking.fints4java.android.ui.dialogs import android.os.Bundle -import android.support.v4.app.DialogFragment -import android.support.v7.app.AlertDialog -import android.support.v7.app.AppCompatActivity import android.text.Editable import android.text.TextWatcher import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.DialogFragment import kotlinx.android.synthetic.main.dialog_transfer_money.* import kotlinx.android.synthetic.main.dialog_transfer_money.view.* import net.dankito.banking.fints4java.android.R diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt index a2a7ff65..133085df 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt @@ -1,17 +1,17 @@ package net.dankito.banking.fints4java.android.ui.home import android.app.SearchManager -import android.arch.lifecycle.ViewModelProviders import android.content.Context import android.os.Bundle -import android.support.v4.app.Fragment -import android.support.v7.app.AlertDialog -import android.support.v7.widget.LinearLayoutManager -import android.support.v7.widget.RecyclerView -import android.support.v7.widget.SearchView import android.view.* import android.view.inputmethod.EditorInfo import android.widget.EditText +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.widget.SearchView +import androidx.fragment.app.Fragment +import androidx.lifecycle.ViewModelProviders +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView import net.dankito.banking.fints4java.android.MainActivity import net.dankito.banking.fints4java.android.R import net.dankito.banking.fints4java.android.ui.adapter.AccountTransactionAdapter @@ -68,19 +68,17 @@ class HomeFragment : Fragment() { } - override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) { + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) - menu?.let { - mnitmBalance = menu.findItem(R.id.mnitmBalance) + mnitmBalance = menu.findItem(R.id.mnitmBalance) - mnitmSearchTransactions = menu.findItem(R.id.mnitmSearchTransactions) - mnitmUpdateTransactions = menu.findItem(R.id.mnitmUpdateTransactions) + mnitmSearchTransactions = menu.findItem(R.id.mnitmSearchTransactions) + mnitmUpdateTransactions = menu.findItem(R.id.mnitmUpdateTransactions) - initSearchView() + initSearchView() - initLogicAfterUiInitialized() - } + initLogicAfterUiInitialized() } override fun onOptionsItemSelected(item: MenuItem): Boolean { @@ -102,7 +100,7 @@ class HomeFragment : Fragment() { // if imeOptions aren't set like this searchView would take whole remaining screen when focused in landscape mode (see https://stackoverflow.com/questions/15296129/searchview-and-keyboard) val searchInput = - searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text) as? EditText + searchView.findViewById(androidx.appcompat.R.id.search_src_text) as? EditText searchInput?.imeOptions = EditorInfo.IME_ACTION_SEARCH or EditorInfo.IME_FLAG_NO_EXTRACT_UI searchView.setOnQueryTextListener(searchAccountTransactionsTextListener) diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeViewModel.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeViewModel.kt index e801d897..63d4eb7d 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeViewModel.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeViewModel.kt @@ -1,8 +1,8 @@ package net.dankito.banking.fints4java.android.ui.home -import android.arch.lifecycle.LiveData -import android.arch.lifecycle.MutableLiveData -import android.arch.lifecycle.ViewModel +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel class HomeViewModel : ViewModel() { diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt index d0581acb..7f62f8fe 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt @@ -1,6 +1,6 @@ package net.dankito.banking.fints4java.android.ui.views -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import com.github.clans.fab.FloatingActionButton import com.github.clans.fab.FloatingActionMenu import kotlinx.android.synthetic.main.view_floating_action_button_main.view.* diff --git a/fints4javaAndroidApp/src/main/res/layout/activity_main.xml b/fints4javaAndroidApp/src/main/res/layout/activity_main.xml index bc641837..d57ff59a 100644 --- a/fints4javaAndroidApp/src/main/res/layout/activity_main.xml +++ b/fints4javaAndroidApp/src/main/res/layout/activity_main.xml @@ -1,19 +1,21 @@ - + - - + diff --git a/fints4javaAndroidApp/src/main/res/layout/app_bar_main.xml b/fints4javaAndroidApp/src/main/res/layout/app_bar_main.xml index 3cdbaa5c..e1db80d5 100644 --- a/fints4javaAndroidApp/src/main/res/layout/app_bar_main.xml +++ b/fints4javaAndroidApp/src/main/res/layout/app_bar_main.xml @@ -1,24 +1,26 @@ - + - - - + @@ -33,4 +35,4 @@ app:layout_behavior="@string/move_upward_behaviour" /> - \ No newline at end of file + \ No newline at end of file diff --git a/fints4javaAndroidApp/src/main/res/layout/content_main.xml b/fints4javaAndroidApp/src/main/res/layout/content_main.xml index b7cf46c2..e85b60ef 100644 --- a/fints4javaAndroidApp/src/main/res/layout/content_main.xml +++ b/fints4javaAndroidApp/src/main/res/layout/content_main.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/fints4javaAndroidApp/src/main/res/layout/dialog_add_account.xml b/fints4javaAndroidApp/src/main/res/layout/dialog_add_account.xml index 50097d83..bbc37674 100644 --- a/fints4javaAndroidApp/src/main/res/layout/dialog_add_account.xml +++ b/fints4javaAndroidApp/src/main/res/layout/dialog_add_account.xml @@ -6,7 +6,7 @@ android:padding="@dimen/dialog_add_account_padding" > - - + - - - + - - - + - - - + - - - + - + - - - + - - - + - - - + - - - + - - - + - - - \ No newline at end of file + \ No newline at end of file diff --git a/fints4javaAndroidApp/src/main/res/layout/list_item_bank_info.xml b/fints4javaAndroidApp/src/main/res/layout/list_item_bank_info.xml index 64cc38f3..d623eab0 100644 --- a/fints4javaAndroidApp/src/main/res/layout/list_item_bank_info.xml +++ b/fints4javaAndroidApp/src/main/res/layout/list_item_bank_info.xml @@ -7,7 +7,7 @@ android:layout_gravity="center_vertical" > - diff --git a/fints4javaAndroidApp/src/main/res/values/strings.xml b/fints4javaAndroidApp/src/main/res/values/strings.xml index 8c53d653..8f786b10 100644 --- a/fints4javaAndroidApp/src/main/res/values/strings.xml +++ b/fints4javaAndroidApp/src/main/res/values/strings.xml @@ -70,7 +70,7 @@ Enter TAN: Could not decode flicker code or QR code / PhotoTan. Most likely an internal error:\n%s. TAN medium successfully changed to \'%s\'. - Could not change TAN medium to \'%s\':\n%s. + Could not change TAN medium to \'%s\':\n%s.