From 0405d9e04f43349844d2e40ec681c9597284adfc Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Thu, 27 Sep 2018 07:19:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=AF=20Update=20dependencies,=20switch?= =?UTF-8?q?=20to=20AndroidX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 44 +-- app/src/main/AndroidManifest.xml | 5 +- .../apps/abit/AbstractItemListFragment.kt | 2 +- .../dissem/apps/abit/AddressDetailFragment.kt | 2 +- .../dissem/apps/abit/AddressListFragment.kt | 10 +- .../apps/abit/ComposeMessageActivity.kt | 4 +- .../apps/abit/ComposeMessageFragment.kt | 6 +- .../apps/abit/ConversationDetailFragment.kt | 7 +- .../apps/abit/ConversationListFragment.kt | 178 ++++------ .../dissem/apps/abit/CreateAddressActivity.kt | 2 +- .../ch/dissem/apps/abit/DetailActivity.kt | 4 +- .../java/ch/dissem/apps/abit/Identicon.kt | 12 +- .../apps/abit/ImportIdentitiesFragment.kt | 28 +- .../apps/abit/ImportIdentityActivity.kt | 18 +- .../ch/dissem/apps/abit/InputWifFragment.kt | 19 +- .../java/ch/dissem/apps/abit/MainActivity.kt | 47 +-- .../dissem/apps/abit/MessageDetailActivity.kt | 2 +- .../dissem/apps/abit/MessageDetailFragment.kt | 10 +- .../dissem/apps/abit/MessageListFragment.kt | 180 ++++------ .../ch/dissem/apps/abit/SettingsFragment.kt | 82 +++-- .../ch/dissem/apps/abit/StatusActivity.kt | 2 +- .../ch/dissem/apps/abit/StatusFragment.kt | 2 +- .../abit/adapter/AddressSelectorAdapter.kt | 6 +- .../apps/abit/adapter/ContactAdapter.kt | 1 - .../apps/abit/adapter/ConversationAdapter.kt | 96 +++--- .../dissem/apps/abit/adapter/LabelAdapter.kt | 4 +- .../apps/abit/adapter/SwipeableAdapters.kt | 312 ++++++++++++++++++ .../adapter/SwipeableConversationAdapter.kt | 275 --------------- .../abit/adapter/SwipeableMessageAdapter.kt | 262 --------------- .../abit/dialog/AddIdentityDialogFragment.kt | 6 +- .../DeterministicIdentityDialogFragment.kt | 2 +- .../dialog/SelectEncodingDialogFragment.kt | 2 +- .../abit/drawer/ProfileSelectionListener.kt | 2 +- .../abit/notification/AbstractNotification.kt | 4 +- .../abit/notification/BatchNotification.kt | 2 +- .../abit/notification/ErrorNotification.kt | 4 +- .../abit/notification/NetworkNotification.kt | 2 +- .../notification/NewMessageNotification.kt | 6 +- .../notification/ProofOfWorkNotification.kt | 2 +- .../repository/AndroidMessageRepository.kt | 2 +- .../abit/service/BatchProcessorService.kt | 6 +- .../apps/abit/service/NodeStartupService.kt | 1 + .../apps/abit/service/ProofOfWorkService.kt | 2 +- .../ch/dissem/apps/abit/service/Singleton.kt | 8 +- .../java/ch/dissem/apps/abit/util/Labels.kt | 2 +- .../ch/dissem/apps/abit/util/Observable.kt | 37 --- .../ch/dissem/apps/abit/util/Preferences.kt | 2 +- .../main/res/drawable/ic_battery_charging.xml | 13 + app/src/main/res/drawable/ic_broom.xml | 8 + app/src/main/res/drawable/ic_bug_report.xml | 9 + app/src/main/res/drawable/ic_check_all.xml | 8 + .../res/drawable/ic_emulate_conversations.xml | 9 + app/src/main/res/drawable/ic_export.xml | 9 + app/src/main/res/drawable/ic_import.xml | 9 + app/src/main/res/drawable/ic_info.xml | 9 + app/src/main/res/drawable/ic_network_wifi.xml | 13 + app/src/main/res/drawable/ic_port.xml | 9 + .../res/drawable/ic_separate_identities.xml | 9 + app/src/main/res/drawable/ic_support_app.xml | 9 + app/src/main/res/drawable/list_divider_h.xml | 22 -- .../main/res/layout-w720dp/activity_main.xml | 8 +- .../activity_create_bitmessage_address.xml | 20 +- app/src/main/res/layout/activity_main.xml | 2 +- .../layout/activity_open_bitmessage_link.xml | 5 +- app/src/main/res/layout/activity_status.xml | 10 +- .../dialog_add_deterministic_identity.xml | 25 +- .../main/res/layout/dialog_add_identity.xml | 4 +- app/src/main/res/layout/dialog_full_node.xml | 4 +- .../res/layout/dialog_input_passphrase.xml | 1 + .../res/layout/fragment_address_detail.xml | 46 +-- .../main/res/layout/fragment_address_list.xml | 2 +- .../res/layout/fragment_compose_message.xml | 11 +- .../layout/fragment_conversation_detail.xml | 2 +- .../main/res/layout/fragment_import_input.xml | 5 +- .../fragment_import_select_identities.xml | 6 +- .../res/layout/fragment_message_detail.xml | 6 +- .../main/res/layout/fragment_message_list.xml | 2 +- .../main/res/layout/item_message_detail.xml | 2 +- .../res/layout/scrolling_toolbar_layout.xml | 10 +- app/src/main/res/layout/toolbar_layout.xml | 10 +- app/src/main/res/values-de/strings.xml | 3 +- app/src/main/res/values/strings.xml | 12 +- app/src/main/res/xml/preferences.xml | 67 ++-- .../AndroidMessageRepositoryTest.kt | 3 +- .../AndroidProofOfWorkRepositoryTest.kt | 3 +- build.gradle | 7 +- gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 4 +- 88 files changed, 940 insertions(+), 1192 deletions(-) create mode 100644 app/src/main/java/ch/dissem/apps/abit/adapter/SwipeableAdapters.kt delete mode 100644 app/src/main/java/ch/dissem/apps/abit/adapter/SwipeableConversationAdapter.kt delete mode 100644 app/src/main/java/ch/dissem/apps/abit/adapter/SwipeableMessageAdapter.kt delete mode 100644 app/src/main/java/ch/dissem/apps/abit/util/Observable.kt create mode 100644 app/src/main/res/drawable/ic_battery_charging.xml create mode 100644 app/src/main/res/drawable/ic_broom.xml create mode 100644 app/src/main/res/drawable/ic_bug_report.xml create mode 100644 app/src/main/res/drawable/ic_check_all.xml create mode 100644 app/src/main/res/drawable/ic_emulate_conversations.xml create mode 100644 app/src/main/res/drawable/ic_export.xml create mode 100644 app/src/main/res/drawable/ic_import.xml create mode 100644 app/src/main/res/drawable/ic_info.xml create mode 100644 app/src/main/res/drawable/ic_network_wifi.xml create mode 100644 app/src/main/res/drawable/ic_port.xml create mode 100644 app/src/main/res/drawable/ic_separate_identities.xml create mode 100644 app/src/main/res/drawable/ic_support_app.xml delete mode 100644 app/src/main/res/drawable/list_divider_h.xml diff --git a/app/build.gradle b/app/build.gradle index 7e7426c..6cc05a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ if (project.hasProperty("project.configs") //noinspection GroovyMissingReturnStatement android { - compileSdkVersion 27 - buildToolsVersion "27.0.3" + compileSdkVersion 28 + buildToolsVersion "28.0.3" signingConfigs { release @@ -22,7 +22,7 @@ android { defaultConfig { applicationId "ch.dissem.apps.${appName.toLowerCase()}" minSdkVersion 21 - targetSdkVersion 27 + targetSdkVersion 28 versionCode 23 versionName "1.0-rc1" multiDexEnabled true @@ -62,13 +62,16 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "org.jetbrains.anko:anko:$anko_version" - implementation "com.android.support:appcompat-v7:$supportVersion" - implementation "com.android.support:preference-v7:$supportVersion" - implementation "com.android.support:cardview-v7:$supportVersion" - implementation "com.android.support:support-v13:$supportVersion" - implementation "com.android.support:preference-v14:$supportVersion" - implementation "com.android.support:design:$supportVersion" - implementation "com.android.support:multidex:1.0.3" + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.preference:preference:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.legacy:legacy-support-v13:1.0.0' + implementation 'androidx.legacy:legacy-preference-v14:1.0.0' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.multidex:multidex:2.0.0' + implementation 'androidx.core:core-ktx:1.0.0' + implementation 'androidx.sqlite:sqlite-ktx:2.0.0-rc01' + implementation 'androidx.fragment:fragment-ktx:1.0.0' implementation "ch.dissem.jabit:jabit-core:$jabitVersion" implementation "ch.dissem.jabit:jabit-networking:$jabitVersion" @@ -80,15 +83,15 @@ dependencies { implementation 'org.slf4j:slf4j-android:1.7.25' - implementation 'com.mikepenz:materialize:1.1.2@aar' - implementation('com.mikepenz:materialdrawer:6.0.8@aar') { + implementation 'com.mikepenz:materialize:1.2.0-rc01@aar' + implementation('com.mikepenz:materialdrawer:6.1.0-rc01.2@aar') { transitive = true } - implementation('com.mikepenz:aboutlibraries:6.0.9@aar') { + implementation('com.mikepenz:aboutlibraries:6.2.0-rc01@aar') { transitive = true } - implementation "com.mikepenz:iconics-core:3.0.4@aar" - implementation "com.mikepenz:iconics-views:3.0.4@aar" + implementation "com.mikepenz:iconics-core:3.1.0-rc01@aar" + implementation "com.mikepenz:iconics-views:3.1.0-rc01@aar" implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@aar' implementation 'com.mikepenz:community-material-typeface:2.0.46.1@aar' @@ -97,11 +100,12 @@ dependencies { implementation 'com.github.kobakei:MaterialFabSpeedDial:1.2.0' implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0@aar' - implementation('com.github.h6ah4i:android-advancedrecyclerview:0.11.0@aar') { - transitive = true - } implementation 'com.github.angads25:filepicker:1.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.2' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' + + implementation "io.reactivex.rxjava2:rxjava:2.2.2" + implementation "io.reactivex.rxjava2:rxkotlin:2.3.0" + implementation "io.reactivex.rxjava2:rxandroid:2.1.0" testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.19.0' @@ -111,7 +115,7 @@ dependencies { testImplementation 'org.robolectric:robolectric:3.7.1' testImplementation "org.robolectric:shadows-multidex:3.7.1" - androidTestImplementation "com.android.support:multidex:1.0.3" + androidTestImplementation "androidx.multidex:multidex:2.0.0" } idea.module { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e8ed1be..21b654b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,9 +11,10 @@ + diff --git a/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.kt b/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.kt index a87a73e..3036f9f 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/AbstractItemListFragment.kt @@ -18,7 +18,7 @@ package ch.dissem.apps.abit import android.content.Context import android.os.Bundle -import android.support.v4.app.ListFragment +import androidx.fragment.app.ListFragment import android.view.View import android.widget.ListView diff --git a/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.kt b/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.kt index 6fc090c..8bd70db 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/AddressDetailFragment.kt @@ -19,7 +19,7 @@ package ch.dissem.apps.abit import android.app.AlertDialog import android.content.Intent 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.* diff --git a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt index 8c8e051..3e4f7ec 100644 --- a/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/AddressListFragment.kt @@ -28,7 +28,6 @@ import android.widget.ImageView import android.widget.TextView import ch.dissem.apps.abit.service.Singleton import ch.dissem.bitmessage.entity.BitmessageAddress -import com.google.zxing.integration.android.IntentIntegrator import io.github.kobakei.materialfabspeeddial.FabSpeedDialMenu import org.jetbrains.anko.doAsync import org.jetbrains.anko.uiThread @@ -44,7 +43,7 @@ class AddressListFragment : AbstractItemListFragment() super.onCreate(savedInstanceState) adapter = object : ArrayAdapter( - activity, + activity!!, R.layout.subscription_row, R.id.name, LinkedList() @@ -109,9 +108,10 @@ class AddressListFragment : AbstractItemListFragment() activity.initFab(R.drawable.ic_action_add_contact, menu) .addOnMenuItemClickListener { _, _, itemId -> when (itemId) { - 1 -> IntentIntegrator.forSupportFragment(this@AddressListFragment) - .setDesiredBarcodeFormats(IntentIntegrator.QR_CODE) - .initiateScan() + // FIXME +// 1 -> IntentIntegrator.forSupportFragment(this@AddressListFragment) +// .setDesiredBarcodeFormats(IntentIntegrator.QR_CODE) +// .initiateScan() 2 -> { val intent = Intent(getActivity(), CreateAddressActivity::class.java) startActivity(intent) diff --git a/app/src/main/java/ch/dissem/apps/abit/ComposeMessageActivity.kt b/app/src/main/java/ch/dissem/apps/abit/ComposeMessageActivity.kt index a900abf..2cb3352 100644 --- a/app/src/main/java/ch/dissem/apps/abit/ComposeMessageActivity.kt +++ b/app/src/main/java/ch/dissem/apps/abit/ComposeMessageActivity.kt @@ -20,8 +20,8 @@ import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle -import android.support.v4.app.Fragment -import android.support.v7.app.AppCompatActivity +import androidx.fragment.app.Fragment +import androidx.appcompat.app.AppCompatActivity import ch.dissem.apps.abit.service.Singleton import ch.dissem.bitmessage.entity.Plaintext import ch.dissem.bitmessage.entity.Plaintext.Encoding.EXTENDED diff --git a/app/src/main/java/ch/dissem/apps/abit/ComposeMessageFragment.kt b/app/src/main/java/ch/dissem/apps/abit/ComposeMessageFragment.kt index bca4f5f..b1e8f82 100644 --- a/app/src/main/java/ch/dissem/apps/abit/ComposeMessageFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/ComposeMessageFragment.kt @@ -20,7 +20,7 @@ import android.app.Activity.RESULT_OK import android.content.Context import android.content.Intent import android.os.Bundle -import android.support.v4.app.Fragment +import androidx.fragment.app.Fragment import android.view.* import android.widget.AdapterView import android.widget.Toast @@ -89,10 +89,10 @@ class ComposeMessageFragment : Fragment() { recipient = getSerializable(EXTRA_RECIPIENT) as BitmessageAddress } if (containsKey(EXTRA_SUBJECT)) { - subject = getString(EXTRA_SUBJECT) + subject = getString(EXTRA_SUBJECT) ?: throw IllegalStateException("EXTRA_SUBJECT expected") } if (containsKey(EXTRA_CONTENT)) { - content = getString(EXTRA_CONTENT) + content = getString(EXTRA_CONTENT) ?: throw IllegalStateException("EXTRA_CONTENT expected") } encoding = getSerializable(EXTRA_ENCODING) as? Plaintext.Encoding ?: Plaintext.Encoding.SIMPLE diff --git a/app/src/main/java/ch/dissem/apps/abit/ConversationDetailFragment.kt b/app/src/main/java/ch/dissem/apps/abit/ConversationDetailFragment.kt index f611ff1..8b24ca9 100644 --- a/app/src/main/java/ch/dissem/apps/abit/ConversationDetailFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/ConversationDetailFragment.kt @@ -17,8 +17,8 @@ package ch.dissem.apps.abit import android.os.Bundle -import android.support.v4.app.Fragment -import android.support.v7.widget.LinearLayoutManager +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.LinearLayoutManager import android.view.* import ch.dissem.apps.abit.adapter.ConversationAdapter import ch.dissem.apps.abit.service.Singleton @@ -74,8 +74,7 @@ class ConversationDetailFragment : Fragment() { item?.let { item -> subject.text = item.subject avatar.setImageDrawable(MultiIdenticon(item.participants)) - messages.adapter = - ConversationAdapter(ctx, this@ConversationDetailFragment, item, Singleton.currentLabel.value) + messages.adapter = ConversationAdapter(ctx, this@ConversationDetailFragment, item, Singleton.currentLabel) messages.layoutManager = LinearLayoutManager(activity) } } diff --git a/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt b/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt index ab09695..fe20a28 100644 --- a/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt +++ b/app/src/main/java/ch/dissem/apps/abit/ConversationListFragment.kt @@ -19,36 +19,29 @@ package ch.dissem.apps.abit import android.content.Intent import android.os.Bundle -import android.support.v4.app.Fragment -import android.support.v4.content.ContextCompat -import android.support.v7.widget.LinearLayoutManager -import android.support.v7.widget.RecyclerView -import android.support.v7.widget.RecyclerView.OnScrollListener import android.view.* import android.widget.Toast +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.ItemTouchHelper +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.RecyclerView.OnScrollListener import ch.dissem.apps.abit.ComposeMessageActivity.Companion.EXTRA_BROADCAST import ch.dissem.apps.abit.ComposeMessageActivity.Companion.EXTRA_IDENTITY +import ch.dissem.apps.abit.adapter.EventListener +import ch.dissem.apps.abit.adapter.SwipeToDeleteCallback import ch.dissem.apps.abit.adapter.SwipeableConversationAdapter import ch.dissem.apps.abit.listener.ListSelectionListener import ch.dissem.apps.abit.repository.AndroidMessageRepository import ch.dissem.apps.abit.service.Singleton import ch.dissem.apps.abit.service.Singleton.currentLabel import ch.dissem.apps.abit.util.preferences -import ch.dissem.bitmessage.entity.Conversation import ch.dissem.bitmessage.entity.valueobject.Label import ch.dissem.bitmessage.utils.ConversationService -import com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator -import com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator -import com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager -import com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager -import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils import io.github.kobakei.materialfabspeeddial.FabSpeedDialMenu +import io.reactivex.disposables.Disposable import kotlinx.android.synthetic.main.fragment_message_list.* -import org.jetbrains.anko.cancelButton -import org.jetbrains.anko.doAsync -import org.jetbrains.anko.support.v4.alert -import org.jetbrains.anko.support.v4.onUiThread -import org.jetbrains.anko.uiThread +import org.jetbrains.anko.* import java.util.* private const val PAGE_SIZE = 15 @@ -70,12 +63,9 @@ class ConversationListFragment : Fragment(), ListHolder