From 0ce613b64dee0cd2a17c9b7abfe3542ac1c376aa Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Fri, 10 Jul 2020 01:21:23 +0300 Subject: [PATCH] Drop dependency on kotlin-android-extensions * Not available on AOSP. --- app/build.gradle | 1 - .../restore/InstallProgressFragment.kt | 21 ++++++++- .../restore/RestoreProgressFragment.kt | 21 ++++++++- .../seedvault/restore/RestoreSetFragment.kt | 18 +++++++- .../seedvault/settings/AboutDialogFragment.kt | 19 ++++++-- .../seedvault/settings/AppStatusFragment.kt | 13 +++++- .../recoverycode/RecoveryCodeInputFragment.kt | 44 +++++++++++++++++-- .../RecoveryCodeOutputFragment.kt | 12 ++++- .../ui/storage/StorageCheckFragment.kt | 18 +++++++- .../ui/storage/StorageRootsFragment.kt | 24 +++++++++- 10 files changed, 170 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1d3a42ee..b46dd453 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ import groovy.xml.XmlUtil apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' android { diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressFragment.kt index 78a34a1c..dc56bb44 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressFragment.kt @@ -4,16 +4,19 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Button +import android.widget.ProgressBar +import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL +import androidx.recyclerview.widget.RecyclerView import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.QUEUED import com.stevesoltys.seedvault.transport.restore.InstallResult import com.stevesoltys.seedvault.transport.restore.getInProgress -import kotlinx.android.synthetic.main.fragment_restore_progress.* import org.koin.androidx.viewmodel.ext.android.sharedViewModel class InstallProgressFragment : Fragment() { @@ -23,9 +26,23 @@ class InstallProgressFragment : Fragment() { private val layoutManager = LinearLayoutManager(context) private val adapter = InstallProgressAdapter() + private lateinit var progressBar: ProgressBar + private lateinit var titleView: TextView + private lateinit var backupNameView: TextView + private lateinit var appList: RecyclerView + private lateinit var button: Button + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_restore_progress, container, false) + val v: View = inflater.inflate(R.layout.fragment_restore_progress, container, false) + + progressBar = v.findViewById(R.id.progressBar) + titleView = v.findViewById(R.id.titleView) + backupNameView = v.findViewById(R.id.backupNameView) + appList = v.findViewById(R.id.appList) + button = v.findViewById(R.id.button) + + return v } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressFragment.kt index c2aa421e..69cd69b3 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressFragment.kt @@ -6,14 +6,17 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON +import android.widget.Button +import android.widget.ProgressBar +import android.widget.TextView import androidx.core.content.ContextCompat.getColor import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL +import androidx.recyclerview.widget.RecyclerView import com.stevesoltys.seedvault.R -import kotlinx.android.synthetic.main.fragment_restore_progress.* import org.koin.androidx.viewmodel.ext.android.sharedViewModel class RestoreProgressFragment : Fragment() { @@ -23,9 +26,23 @@ class RestoreProgressFragment : Fragment() { private val layoutManager = LinearLayoutManager(context) private val adapter = RestoreProgressAdapter() + private lateinit var progressBar: ProgressBar + private lateinit var titleView: TextView + private lateinit var backupNameView: TextView + private lateinit var appList: RecyclerView + private lateinit var button: Button + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_restore_progress, container, false) + val v: View = inflater.inflate(R.layout.fragment_restore_progress, container, false) + + progressBar = v.findViewById(R.id.progressBar) + titleView = v.findViewById(R.id.titleView) + backupNameView = v.findViewById(R.id.backupNameView) + appList = v.findViewById(R.id.appList) + button = v.findViewById(R.id.button) + + return v } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetFragment.kt index bcc4a2d0..49448187 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetFragment.kt @@ -7,19 +7,33 @@ import android.view.View.INVISIBLE import android.view.View.VISIBLE import android.view.ViewGroup import android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON +import android.widget.ProgressBar +import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.Observer +import androidx.recyclerview.widget.RecyclerView import com.stevesoltys.seedvault.R -import kotlinx.android.synthetic.main.fragment_restore_set.* import org.koin.androidx.viewmodel.ext.android.sharedViewModel class RestoreSetFragment : Fragment() { private val viewModel: RestoreViewModel by sharedViewModel() + private lateinit var listView: RecyclerView + private lateinit var progressBar: ProgressBar + private lateinit var errorView: TextView + private lateinit var backView: TextView + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_restore_set, container, false) + val v: View = inflater.inflate(R.layout.fragment_restore_set, container, false) + + listView = v.findViewById(R.id.listView) + progressBar = v.findViewById(R.id.progressBar) + errorView = v.findViewById(R.id.errorView) + backView = v.findViewById(R.id.backView) + + return v } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt index 2008d444..e06a598f 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt @@ -5,18 +5,31 @@ import android.text.method.LinkMovementMethod import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.TextView import androidx.fragment.app.DialogFragment import com.stevesoltys.seedvault.R -import kotlinx.android.synthetic.main.fragment_about.* class AboutDialogFragment : DialogFragment() { + private lateinit var licenseView: TextView + private lateinit var authorView: TextView + private lateinit var designView: TextView + private lateinit var sponsorView: TextView + companion object { internal val TAG = AboutDialogFragment::class.java.simpleName } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_about, container, false) + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle?): View? { + val v: View = inflater.inflate(R.layout.fragment_about, container, false) + + licenseView = v.findViewById(R.id.licenseView) + authorView = v.findViewById(R.id.authorView) + designView = v.findViewById(R.id.designView) + sponsorView = v.findViewById(R.id.sponsorView) + + return v } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/AppStatusFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/AppStatusFragment.kt index bd442158..255376cb 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/AppStatusFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/AppStatusFragment.kt @@ -9,11 +9,12 @@ import android.view.View import android.view.View.INVISIBLE import android.view.View.VISIBLE import android.view.ViewGroup +import android.widget.ProgressBar import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView import com.stevesoltys.seedvault.R -import kotlinx.android.synthetic.main.fragment_app_status.* import org.koin.androidx.viewmodel.ext.android.sharedViewModel internal interface AppStatusToggleListener { @@ -26,12 +27,20 @@ class AppStatusFragment : Fragment(), AppStatusToggleListener { private val layoutManager = LinearLayoutManager(context) private val adapter = AppStatusAdapter(this) + private lateinit var appEditMenuItem: MenuItem + private lateinit var list: RecyclerView + private lateinit var progressBar: ProgressBar override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { setHasOptionsMenu(true) - return inflater.inflate(R.layout.fragment_app_status, container, false) + val v: View = inflater.inflate(R.layout.fragment_app_status, container, false) + + progressBar = v.findViewById(R.id.progressBar) + list = v.findViewById(R.id.list) + + return v } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt index cc5f8dbe..e604c68a 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt @@ -8,25 +8,63 @@ import android.view.View.VISIBLE import android.view.ViewGroup import android.widget.ArrayAdapter import android.widget.AutoCompleteTextView +import android.widget.Button +import android.widget.TextView import android.widget.Toast import android.widget.Toast.LENGTH_LONG +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment +import com.google.android.material.textfield.TextInputLayout import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.isDebugBuild import io.github.novacrypto.bip39.Validation.InvalidChecksumException import io.github.novacrypto.bip39.Validation.WordNotFoundException import io.github.novacrypto.bip39.wordlists.English -import kotlinx.android.synthetic.main.fragment_recovery_code_input.* -import kotlinx.android.synthetic.main.recovery_code_input.* import org.koin.androidx.viewmodel.ext.android.sharedViewModel class RecoveryCodeInputFragment : Fragment() { private val viewModel: RecoveryCodeViewModel by sharedViewModel() + private lateinit var introText: TextView + private lateinit var doneButton: Button + private lateinit var backView: TextView + private lateinit var wordLayout1: TextInputLayout + private lateinit var wordLayout2: TextInputLayout + private lateinit var wordLayout3: TextInputLayout + private lateinit var wordLayout4: TextInputLayout + private lateinit var wordLayout5: TextInputLayout + private lateinit var wordLayout6: TextInputLayout + private lateinit var wordLayout7: TextInputLayout + private lateinit var wordLayout8: TextInputLayout + private lateinit var wordLayout9: TextInputLayout + private lateinit var wordLayout10: TextInputLayout + private lateinit var wordLayout11: TextInputLayout + private lateinit var wordLayout12: TextInputLayout + private lateinit var wordList: ConstraintLayout + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_recovery_code_input, container, false) + val v: View = inflater.inflate(R.layout.fragment_recovery_code_input, container, false) + + introText = v.findViewById(R.id.introText) + doneButton = v.findViewById(R.id.doneButton) + backView = v.findViewById(R.id.backView) + wordLayout1 = v.findViewById(R.id.wordLayout1) + wordLayout2 = v.findViewById(R.id.wordLayout2) + wordLayout3 = v.findViewById(R.id.wordLayout3) + wordLayout4 = v.findViewById(R.id.wordLayout4) + wordLayout5 = v.findViewById(R.id.wordLayout5) + wordLayout6 = v.findViewById(R.id.wordLayout6) + wordLayout7 = v.findViewById(R.id.wordLayout7) + wordLayout8 = v.findViewById(R.id.wordLayout8) + wordLayout9 = v.findViewById(R.id.wordLayout9) + wordLayout10 = v.findViewById(R.id.wordLayout10) + wordLayout11 = v.findViewById(R.id.wordLayout11) + wordLayout12 = v.findViewById(R.id.wordLayout12) + wordList = v.findViewById(R.id.wordList) + + return v } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeOutputFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeOutputFragment.kt index 7f1b9dcb..50d81712 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeOutputFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeOutputFragment.kt @@ -5,20 +5,28 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.Button import androidx.fragment.app.Fragment import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.stevesoltys.seedvault.R -import kotlinx.android.synthetic.main.fragment_recovery_code_output.* import org.koin.androidx.viewmodel.ext.android.sharedViewModel class RecoveryCodeOutputFragment : Fragment() { private val viewModel: RecoveryCodeViewModel by sharedViewModel() + private lateinit var wordList: RecyclerView + private lateinit var confirmCodeButton: Button + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_recovery_code_output, container, false) + val v: View = inflater.inflate(R.layout.fragment_recovery_code_output, container, false) + + wordList = v.findViewById(R.id.wordList) + confirmCodeButton = v.findViewById(R.id.confirmCodeButton) + + return v } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageCheckFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageCheckFragment.kt index faa4609e..29da229b 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageCheckFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageCheckFragment.kt @@ -6,15 +6,22 @@ import android.view.View import android.view.View.INVISIBLE import android.view.View.VISIBLE import android.view.ViewGroup +import android.widget.Button +import android.widget.ProgressBar +import android.widget.TextView import androidx.fragment.app.Fragment import com.stevesoltys.seedvault.R -import kotlinx.android.synthetic.main.fragment_storage_check.* private const val TITLE = "title" private const val ERROR_MSG = "errorMsg" class StorageCheckFragment : Fragment() { + private lateinit var titleView: TextView + private lateinit var progressBar: ProgressBar + private lateinit var errorView: TextView + private lateinit var backButton: Button + companion object { fun newInstance(title: String, errorMsg: String? = null): StorageCheckFragment { val f = StorageCheckFragment() @@ -28,7 +35,14 @@ class StorageCheckFragment : Fragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_storage_check, container, false) + val v: View = inflater.inflate(R.layout.fragment_storage_check, container, false) + + titleView = v.findViewById(R.id.titleView) + progressBar = v.findViewById(R.id.progressBar) + errorView = v.findViewById(R.id.errorView) + backButton = v.findViewById(R.id.backButton) + + return v } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt index a7de2dcd..bafb074d 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt @@ -10,13 +10,16 @@ import android.view.View import android.view.View.INVISIBLE import android.view.View.VISIBLE import android.view.ViewGroup +import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView import androidx.appcompat.app.AppCompatActivity.RESULT_OK import androidx.fragment.app.Fragment import androidx.lifecycle.Observer +import androidx.recyclerview.widget.RecyclerView import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.ui.INTENT_EXTRA_IS_RESTORE import com.stevesoltys.seedvault.ui.REQUEST_CODE_OPEN_DOCUMENT_TREE -import kotlinx.android.synthetic.main.fragment_storage_root.* import org.koin.androidx.viewmodel.ext.android.getSharedViewModel internal class StorageRootsFragment : Fragment(), StorageRootClickedListener { @@ -32,12 +35,29 @@ internal class StorageRootsFragment : Fragment(), StorageRootClickedListener { } private lateinit var viewModel: StorageViewModel + private lateinit var titleView: TextView + private lateinit var warningIcon: ImageView + private lateinit var warningText: TextView + private lateinit var divider: View + private lateinit var listView: RecyclerView + private lateinit var progressBar: ProgressBar + private lateinit var backView: TextView private val adapter by lazy { StorageRootAdapter(viewModel.isRestoreOperation, this) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_storage_root, container, false) + val v: View = inflater.inflate(R.layout.fragment_storage_root, container, false) + + titleView = v.findViewById(R.id.titleView) + warningIcon = v.findViewById(R.id.warningIcon) + warningText = v.findViewById(R.id.warningText) + divider = v.findViewById(R.id.divider) + listView = v.findViewById(R.id.listView) + progressBar = v.findViewById(R.id.progressBar) + backView = v.findViewById(R.id.backView) + + return v } override fun onActivityCreated(savedInstanceState: Bundle?) {