From c7ad96877360bd9a486bfe812575ef6bf0f3fbc9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 7 Dec 2020 09:31:40 +0100 Subject: [PATCH 1/5] plugin: 'kotlin-android-extensions' deprecrated use viewbinding see: https://developer.android.com/topic/libraries/view-binding/migration Signed-off-by: tobiasKaminsky --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 08bf0fd16d..ba87a9c593 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,6 @@ buildscript { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'checkstyle' apply plugin: 'pmd' From 71e6540a7266a95c059be0b151539072d26fd27c Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 7 Dec 2020 09:31:40 +0100 Subject: [PATCH 2/5] plugin: 'kotlin-android-extensions' deprecrated use viewbinding see: https://developer.android.com/topic/libraries/view-binding/migration Signed-off-by: tobiasKaminsky --- .../client/errorhandling/ShowErrorActivity.kt | 19 ++-- .../client/etm/pages/EtmAccountsFragment.kt | 19 +++- .../client/etm/pages/EtmMigrations.kt | 16 +++- .../etm/pages/EtmPreferencesFragment.kt | 18 +++- .../ui/ChooseAccountDialogFragment.kt | 69 ++++++++------ .../nextcloud/ui/SetStatusDialogFragment.kt | 91 +++++++++---------- src/main/res/layout/activity_show_error.xml | 11 ++- src/main/res/layout/toolbar_standard.xml | 3 +- 8 files changed, 146 insertions(+), 100 deletions(-) diff --git a/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt b/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt index 572a3172f4..44ebf7569c 100644 --- a/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt +++ b/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt @@ -28,27 +28,30 @@ import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.google.android.material.snackbar.Snackbar import com.owncloud.android.R +import com.owncloud.android.databinding.ActivityShowErrorBinding import com.owncloud.android.utils.ClipboardUtil import com.owncloud.android.utils.DisplayUtils -import kotlinx.android.synthetic.main.activity_show_error.* -import kotlinx.android.synthetic.main.toolbar_standard.* class ShowErrorActivity : AppCompatActivity() { + private lateinit var binding: ActivityShowErrorBinding + companion object { const val EXTRA_ERROR_TEXT = "error" } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_show_error) - text_view_error.text = intent.getStringExtra(EXTRA_ERROR_TEXT) + binding = ActivityShowErrorBinding.inflate(layoutInflater) + setContentView(binding.root) - setSupportActionBar(toolbar) + binding.textViewError.text = intent.getStringExtra(EXTRA_ERROR_TEXT) + + setSupportActionBar(findViewById(R.id.toolbar)) supportActionBar!!.title = createErrorTitle() val snackbar = DisplayUtils.createSnackbar( - error_page_container, + binding.errorPageContainer, R.string.error_report_issue_text, Snackbar.LENGTH_INDEFINITE ) @@ -60,7 +63,7 @@ class ShowErrorActivity : AppCompatActivity() { private fun createErrorTitle() = String.format(getString(R.string.error_crash_title), getString(R.string.app_name)) private fun reportIssue() { - ClipboardUtil.copyToClipboard(this, text_view_error.text.toString(), false) + ClipboardUtil.copyToClipboard(this, binding.textViewError.text.toString(), false) val issueLink = getString(R.string.report_issue_link) if (issueLink.isNotEmpty()) { val uriUrl = Uri.parse(issueLink) @@ -85,7 +88,7 @@ class ShowErrorActivity : AppCompatActivity() { private fun onClickedShare() { val intent = Intent(Intent.ACTION_SEND) intent.putExtra(Intent.EXTRA_SUBJECT, createErrorTitle()) - intent.putExtra(Intent.EXTRA_TEXT, text_view_error.text) + intent.putExtra(Intent.EXTRA_TEXT, binding.textViewError.text) intent.type = "text/plain" startActivity(intent) } diff --git a/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt b/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt index 756d2bf10a..80a4ffed69 100644 --- a/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt +++ b/src/main/java/com/nextcloud/client/etm/pages/EtmAccountsFragment.kt @@ -29,10 +29,11 @@ import android.view.View import android.view.ViewGroup import com.nextcloud.client.etm.EtmBaseFragment import com.owncloud.android.R -import kotlinx.android.synthetic.main.fragment_etm_accounts.* -import kotlinx.android.synthetic.main.fragment_etm_preferences.* +import com.owncloud.android.databinding.FragmentEtmAccountsBinding class EtmAccountsFragment : EtmBaseFragment() { + private var _binding: FragmentEtmAccountsBinding? = null + private val binding get() = _binding!! override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -40,7 +41,9 @@ class EtmAccountsFragment : EtmBaseFragment() { } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_etm_accounts, container, false) + _binding = FragmentEtmAccountsBinding.inflate(inflater, container, false) + + return binding.root } override fun onResume() { @@ -52,7 +55,7 @@ class EtmAccountsFragment : EtmBaseFragment() { builder.append("\t${it.key}: ${it.value}\n") } } - etm_accounts_text.text = builder.toString() + binding.etmAccountsText.text = builder.toString() } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { @@ -72,8 +75,14 @@ class EtmAccountsFragment : EtmBaseFragment() { private fun onClickedShare() { val intent = Intent(Intent.ACTION_SEND) intent.putExtra(Intent.EXTRA_SUBJECT, "Nextcloud accounts information") - intent.putExtra(Intent.EXTRA_TEXT, etm_accounts_text.text) + intent.putExtra(Intent.EXTRA_TEXT, binding.etmAccountsText.text) intent.type = "text/plain" startActivity(intent) } + + override fun onDestroyView() { + super.onDestroyView() + + _binding = null + } } diff --git a/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt b/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt index 52e9bb1b57..61db9117fc 100644 --- a/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt +++ b/src/main/java/com/nextcloud/client/etm/pages/EtmMigrations.kt @@ -9,10 +9,12 @@ import android.view.View import android.view.ViewGroup import com.nextcloud.client.etm.EtmBaseFragment import com.owncloud.android.R -import kotlinx.android.synthetic.main.fragment_etm_migrations.* +import com.owncloud.android.databinding.FragmentEtmMigrationsBinding import java.util.Locale class EtmMigrations : EtmBaseFragment() { + private var _binding: FragmentEtmMigrationsBinding? = null + private val binding get() = _binding!! override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -20,7 +22,9 @@ class EtmMigrations : EtmBaseFragment() { } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_etm_migrations, container, false) + _binding = FragmentEtmMigrationsBinding.inflate(inflater, container, false) + + return binding.root } override fun onResume() { @@ -47,7 +51,7 @@ class EtmMigrations : EtmBaseFragment() { } builder.append(" - ${it.id} ${it.description} - $migrationStatus\n") } - etm_migrations_text.text = builder.toString() + binding.etmMigrationsText.text = builder.toString() } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { @@ -68,4 +72,10 @@ class EtmMigrations : EtmBaseFragment() { vm.clearMigrations() showStatus() } + + override fun onDestroyView() { + super.onDestroyView() + + _binding = null + } } diff --git a/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt b/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt index a14506feff..632a6c82a6 100644 --- a/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt +++ b/src/main/java/com/nextcloud/client/etm/pages/EtmPreferencesFragment.kt @@ -29,9 +29,11 @@ import android.view.View import android.view.ViewGroup import com.nextcloud.client.etm.EtmBaseFragment import com.owncloud.android.R -import kotlinx.android.synthetic.main.fragment_etm_preferences.* +import com.owncloud.android.databinding.FragmentEtmPreferencesBinding class EtmPreferencesFragment : EtmBaseFragment() { + private var _binding: FragmentEtmPreferencesBinding? = null + private val binding get() = _binding!! override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -39,14 +41,16 @@ class EtmPreferencesFragment : EtmBaseFragment() { } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - return inflater.inflate(R.layout.fragment_etm_preferences, container, false) + _binding = FragmentEtmPreferencesBinding.inflate(inflater, container, false) + + return binding.root } override fun onResume() { super.onResume() val builder = StringBuilder() vm.preferences.forEach { builder.append("${it.key}: ${it.value}\n") } - etm_preferences_text.text = builder + binding.etmPreferencesText.text = builder } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { @@ -66,8 +70,14 @@ class EtmPreferencesFragment : EtmBaseFragment() { private fun onClickedShare() { val intent = Intent(Intent.ACTION_SEND) intent.putExtra(Intent.EXTRA_SUBJECT, "Nextcloud preferences") - intent.putExtra(Intent.EXTRA_TEXT, etm_preferences_text.text) + intent.putExtra(Intent.EXTRA_TEXT, binding.etmPreferencesText.text) intent.type = "text/plain" startActivity(intent) } + + override fun onDestroyView() { + super.onDestroyView() + + _binding = null + } } diff --git a/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt b/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt index 98ec4ce794..47172cd1d8 100644 --- a/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt +++ b/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt @@ -37,6 +37,7 @@ import com.nextcloud.client.account.UserAccountManager import com.nextcloud.client.di.Injectable import com.nextcloud.client.network.ClientFactory import com.owncloud.android.R +import com.owncloud.android.databinding.DialogChooseAccountBinding import com.owncloud.android.datamodel.FileDataStorageManager import com.owncloud.android.lib.resources.users.Status import com.owncloud.android.ui.StatusDrawable @@ -68,6 +69,9 @@ class ChooseAccountDialogFragment : private lateinit var accountManager: UserAccountManager private var currentStatus: Status? = null + private var _binding: DialogChooseAccountBinding? = null + private val binding get() = _binding!! + @Inject lateinit var clientFactory: ClientFactory @@ -80,9 +84,11 @@ class ChooseAccountDialogFragment : @SuppressLint("InflateParams") override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - dialogView = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_choose_account, null) + _binding = DialogChooseAccountBinding.inflate(LayoutInflater.from(requireContext())) + dialogView = binding.root + return MaterialAlertDialogBuilder(requireContext()) - .setView(dialogView) + .setView(binding.root) .create() } @@ -92,27 +98,27 @@ class ChooseAccountDialogFragment : currentUser?.let { user -> // Defining user picture - user_icon.tag = user.accountName + binding.currentAccount.userIcon.tag = user.accountName DisplayUtils.setAvatar( user, this, resources.getDimension(R.dimen.list_item_avatar_icon_radius), resources, - user_icon, + binding.currentAccount.userIcon, context ) // Defining user texts, accounts, etc. - user_name.text = user.toOwnCloudAccount().displayName - ticker.visibility = View.GONE - account.text = user.accountName + binding.currentAccount.userName.text = user.toOwnCloudAccount().displayName + binding.currentAccount.ticker.visibility = View.GONE + binding.currentAccount.account.text = user.accountName // Defining user right indicator val icon = ThemeDrawableUtils.tintDrawable( ContextCompat.getDrawable(requireContext(), R.drawable.ic_check_circle), ThemeColorUtils.primaryColor(requireContext(), true) ) - account_menu.setImageDrawable(icon) + binding.currentAccount.accountMenu.setImageDrawable(icon) // Creating adapter for accounts list val adapter = UserListAdapter( @@ -123,20 +129,21 @@ class ChooseAccountDialogFragment : false, false ) - accounts_list.adapter = adapter + + binding.accountsList.adapter = adapter // Creating listeners for quick-actions - current_account.setOnClickListener { + binding.currentAccount.root.setOnClickListener { dismiss() } - add_account.setOnClickListener { + binding.addAccount.setOnClickListener { (activity as DrawerActivity).openAddAccount() } - manage_accounts.setOnClickListener { + binding.manageAccounts.setOnClickListener { (activity as DrawerActivity).openManageAccounts() } - set_status.setOnClickListener { + binding.setStatus.setOnClickListener { val setStatusDialog = SetStatusDialogFragment.newInstance(accountManager.user, currentStatus) setStatusDialog.show((activity as DrawerActivity).supportFragmentManager, "fragment_set_status") @@ -147,14 +154,14 @@ class ChooseAccountDialogFragment : .getCapability(user) if (capability.userStatus.isTrue) { - statusView.visibility = View.VISIBLE + binding.statusView.visibility = View.VISIBLE } RetrieveStatusAsyncTask(user, this, clientFactory).execute() } } - private fun getAccountListItems(): List? { + private fun getAccountListItems(): List { val users = accountManager.allUsers val adapterUserList: MutableList = ArrayList(users.size) // Remove the current account from the adapter to display only other accounts @@ -179,7 +186,7 @@ class ChooseAccountDialogFragment : } } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return dialogView } @@ -188,9 +195,7 @@ class ChooseAccountDialogFragment : } override fun avatarGenerated(avatarDrawable: Drawable?, callContext: Any?) { - if (user_icon != null) { - user_icon.setImageDrawable(avatarDrawable) - } + binding.currentAccount.userIcon.setImageDrawable(avatarDrawable) } override fun onAccountClicked(user: User?) { @@ -205,18 +210,26 @@ class ChooseAccountDialogFragment : currentStatus = newStatus val size = DisplayUtils.convertDpToPixel(STATUS_SIZE_IN_DP, context) - ticker.background = null - ticker.setImageDrawable(StatusDrawable(newStatus, size.toFloat(), context)) - ticker.visibility = View.VISIBLE + binding.currentAccount.ticker.background = null + binding.currentAccount.ticker.setImageDrawable(StatusDrawable(newStatus, size.toFloat(), context)) + binding.currentAccount.ticker.visibility = View.VISIBLE - if (newStatus.message.isNullOrBlank()) { - status.text = "" - status.visibility = View.GONE - } else { - status.text = newStatus.message - status.visibility = View.VISIBLE + binding.currentAccount.status.let { + if (newStatus.message.isNullOrBlank()) { + it.text = "" + it.visibility = View.GONE + } else { + it.text = newStatus.message + it.visibility = View.VISIBLE + } } view?.invalidate() } + + override fun onDestroyView() { + super.onDestroyView() + + _binding = null + } } diff --git a/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt b/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt index 33b3ecbcb5..2a5c8e809f 100644 --- a/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt +++ b/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt @@ -59,7 +59,6 @@ import com.owncloud.android.utils.theme.ThemeTextInputUtils import com.vanniktech.emoji.EmojiManager import com.vanniktech.emoji.EmojiPopup import com.vanniktech.emoji.google.GoogleEmojiProvider -import kotlinx.android.synthetic.main.dialog_set_status.* import java.util.ArrayList import java.util.Calendar import java.util.Locale @@ -140,23 +139,23 @@ class SetStatusDialogFragment : accountManager = (activity as BaseActivity).userAccountManager currentStatus?.let { - emoji.setText(it.icon) - binding.customStatusInput.text?.clear() + binding.emoji.setText(it.icon) + binding.customStatusInput.text.clear() binding.customStatusInput.setText(it.message) visualizeStatus(it.status) if (it.clearAt > 0) { - clearStatusAfterSpinner.visibility = View.GONE - remainingClearTime.apply { - clearStatusMessageTextView.text = getString(R.string.clear_status_message) + binding.clearStatusAfterSpinner.visibility = View.GONE + binding.remainingClearTime.apply { + binding.clearStatusMessageTextView.text = getString(R.string.clear_status_message) visibility = View.VISIBLE text = DisplayUtils.getRelativeTimestamp(context, it.clearAt * ONE_SECOND_IN_MILLIS, true) .toString() .decapitalize(Locale.getDefault()) setOnClickListener { visibility = View.GONE - clearStatusAfterSpinner.visibility = View.VISIBLE - clearStatusMessageTextView.text = getString(R.string.clear_status_message_after) + binding.clearStatusAfterSpinner.visibility = View.VISIBLE + binding.clearStatusMessageTextView.text = getString(R.string.clear_status_message_after) } } } @@ -166,30 +165,30 @@ class SetStatusDialogFragment : if (this::predefinedStatus.isInitialized) { adapter.list = predefinedStatus } - predefinedStatusList.adapter = adapter - predefinedStatusList.layoutManager = LinearLayoutManager(context) + binding.predefinedStatusList.adapter = adapter + binding.predefinedStatusList.layoutManager = LinearLayoutManager(context) - onlineStatus.setOnClickListener { setStatus(StatusType.ONLINE) } - dndStatus.setOnClickListener { setStatus(StatusType.DND) } - awayStatus.setOnClickListener { setStatus(StatusType.AWAY) } - invisibleStatus.setOnClickListener { setStatus(StatusType.INVISIBLE) } + binding.onlineStatus.setOnClickListener { setStatus(StatusType.ONLINE) } + binding.dndStatus.setOnClickListener { setStatus(StatusType.DND) } + binding.awayStatus.setOnClickListener { setStatus(StatusType.AWAY) } + binding.invisibleStatus.setOnClickListener { setStatus(StatusType.INVISIBLE) } - clearStatus.setOnClickListener { clearStatus() } - setStatus.setOnClickListener { setStatusMessage() } - emoji.setOnClickListener { openEmojiPopup() } + binding.clearStatus.setOnClickListener { clearStatus() } + binding.setStatus.setOnClickListener { setStatusMessage() } + binding. emoji.setOnClickListener { openEmojiPopup() } popup = EmojiPopup.Builder .fromRootView(view) .setOnEmojiClickListener { _, _ -> popup.dismiss() - emoji.clearFocus() + binding.emoji.clearFocus() val imm: InputMethodManager = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager - imm.hideSoftInputFromWindow(emoji.windowToken, 0) + imm.hideSoftInputFromWindow(binding.emoji.windowToken, 0) } - .build(emoji) - emoji.disableKeyboardInput(popup) - emoji.forceSingleEmoji() + .build(binding.emoji) + binding.emoji.disableKeyboardInput(popup) + binding.emoji.forceSingleEmoji() val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item) adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) @@ -200,7 +199,7 @@ class SetStatusDialogFragment : adapter.add(getString(R.string.today)) adapter.add(getString(R.string.thisWeek)) - clearStatusAfterSpinner.apply { + binding.clearStatusAfterSpinner.apply { this.adapter = adapter onItemSelectedListener = object : OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { @@ -327,19 +326,19 @@ class SetStatusDialogFragment : when (statusType) { StatusType.ONLINE -> { clearTopStatus() - onlineStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) + binding.onlineStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) } StatusType.AWAY -> { clearTopStatus() - awayStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) + binding.awayStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) } StatusType.DND -> { clearTopStatus() - dndStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) + binding.dndStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) } StatusType.INVISIBLE -> { clearTopStatus() - invisibleStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) + binding.invisibleStatus.setBackgroundColor(ThemeColorUtils.primaryColor(context)) } else -> clearTopStatus() } @@ -348,10 +347,10 @@ class SetStatusDialogFragment : private fun clearTopStatus() { context?.let { val grey = it.resources.getColor(R.color.grey_200) - onlineStatus.setBackgroundColor(grey) - awayStatus.setBackgroundColor(grey) - dndStatus.setBackgroundColor(grey) - invisibleStatus.setBackgroundColor(grey) + binding.onlineStatus.setBackgroundColor(grey) + binding.awayStatus.setBackgroundColor(grey) + binding.dndStatus.setBackgroundColor(grey) + binding.invisibleStatus.setBackgroundColor(grey) } } @@ -369,8 +368,8 @@ class SetStatusDialogFragment : } else { asyncRunner.postQuickTask( SetUserDefinedCustomStatusTask( - customStatusInput.text.toString(), - emoji.text.toString(), + binding.customStatusInput.text.toString(), + binding.emoji.text.toString(), clearAt, accountManager.currentOwnCloudAccount?.savedAccount, context @@ -413,35 +412,35 @@ class SetStatusDialogFragment : binding.customStatusInput.text?.clear() binding.customStatusInput.text?.append(predefinedStatus.message) - remainingClearTime.visibility = View.GONE - clearStatusAfterSpinner.visibility = View.VISIBLE - clearStatusMessageTextView.text = getString(R.string.clear_status_message_after) + binding.remainingClearTime.visibility = View.GONE + binding.clearStatusAfterSpinner.visibility = View.VISIBLE + binding.clearStatusMessageTextView.text = getString(R.string.clear_status_message_after) if (predefinedStatus.clearAt == null) { - clearStatusAfterSpinner.setSelection(0) + binding.clearStatusAfterSpinner.setSelection(0) } else { val clearAt = predefinedStatus.clearAt!! if (clearAt.type.equals("period")) { when (clearAt.time) { - "1800" -> clearStatusAfterSpinner.setSelection(POS_HALF_AN_HOUR) - "3600" -> clearStatusAfterSpinner.setSelection(POS_AN_HOUR) - "14400" -> clearStatusAfterSpinner.setSelection(POS_FOUR_HOURS) - else -> clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR) + "1800" -> binding.clearStatusAfterSpinner.setSelection(POS_HALF_AN_HOUR) + "3600" -> binding.clearStatusAfterSpinner.setSelection(POS_AN_HOUR) + "14400" -> binding.clearStatusAfterSpinner.setSelection(POS_FOUR_HOURS) + else -> binding.clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR) } } else if (clearAt.type.equals("end-of")) { when (clearAt.time) { - "day" -> clearStatusAfterSpinner.setSelection(POS_TODAY) - "week" -> clearStatusAfterSpinner.setSelection(POS_END_OF_WEEK) - else -> clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR) + "day" -> binding.clearStatusAfterSpinner.setSelection(POS_TODAY) + "week" -> binding.clearStatusAfterSpinner.setSelection(POS_END_OF_WEEK) + else -> binding.clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR) } } } - setClearStatusAfterValue(clearStatusAfterSpinner.selectedItemPosition) + setClearStatusAfterValue(binding.clearStatusAfterSpinner.selectedItemPosition) } @VisibleForTesting fun setPredefinedStatus(predefinedStatus: ArrayList) { adapter.list = predefinedStatus - predefinedStatusList.adapter?.notifyDataSetChanged() + binding.predefinedStatusList.adapter?.notifyDataSetChanged() } } diff --git a/src/main/res/layout/activity_show_error.xml b/src/main/res/layout/activity_show_error.xml index ca3e246a53..133543a5ab 100644 --- a/src/main/res/layout/activity_show_error.xml +++ b/src/main/res/layout/activity_show_error.xml @@ -18,12 +18,15 @@ --> + android:layout_height="match_parent"> - + + + + android:background="@color/bg_default"> Date: Wed, 27 Jan 2021 13:47:51 +0100 Subject: [PATCH 3/5] use binding instead of findById Signed-off-by: Andy Scherzinger --- .../com/nextcloud/client/errorhandling/ShowErrorActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt b/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt index 44ebf7569c..4073f3169b 100644 --- a/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt +++ b/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt @@ -47,7 +47,7 @@ class ShowErrorActivity : AppCompatActivity() { binding.textViewError.text = intent.getStringExtra(EXTRA_ERROR_TEXT) - setSupportActionBar(findViewById(R.id.toolbar)) + setSupportActionBar(binding.toolbarInclude.toolbar) supportActionBar!!.title = createErrorTitle() val snackbar = DisplayUtils.createSnackbar( From 5073e04b0b9b0e8fe88d4896c9208aa462e8a3b4 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 1 Feb 2021 14:48:23 +0100 Subject: [PATCH 4/5] remove unexpected spacing Signed-off-by: Andy Scherzinger --- src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt b/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt index 2a5c8e809f..2a99d923b0 100644 --- a/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt +++ b/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt @@ -175,7 +175,7 @@ class SetStatusDialogFragment : binding.clearStatus.setOnClickListener { clearStatus() } binding.setStatus.setOnClickListener { setStatusMessage() } - binding. emoji.setOnClickListener { openEmojiPopup() } + binding.emoji.setOnClickListener { openEmojiPopup() } popup = EmojiPopup.Builder .fromRootView(view) From b4283b26541411f93417df46098dd9326a4079f0 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 23 Feb 2021 08:25:39 +0100 Subject: [PATCH 5/5] Fix after rebase Signed-off-by: tobiasKaminsky --- .../java/com/nextcloud/ui/ChooseAccountDialogFragment.kt | 2 -- src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt b/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt index 47172cd1d8..2775df0be2 100644 --- a/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt +++ b/src/main/java/com/nextcloud/ui/ChooseAccountDialogFragment.kt @@ -50,8 +50,6 @@ import com.owncloud.android.utils.DisplayUtils import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener import com.owncloud.android.utils.theme.ThemeColorUtils import com.owncloud.android.utils.theme.ThemeDrawableUtils -import kotlinx.android.synthetic.main.account_item.* -import kotlinx.android.synthetic.main.dialog_choose_account.* import java.util.ArrayList import javax.inject.Inject diff --git a/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt b/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt index 2a99d923b0..bc528c9fd0 100644 --- a/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt +++ b/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt @@ -140,7 +140,7 @@ class SetStatusDialogFragment : currentStatus?.let { binding.emoji.setText(it.icon) - binding.customStatusInput.text.clear() + binding.customStatusInput.text?.clear() binding.customStatusInput.setText(it.message) visualizeStatus(it.status) @@ -212,8 +212,8 @@ class SetStatusDialogFragment : } } - clearStatus.setTextColor(ThemeColorUtils.primaryColor(context, true)) - ThemeButtonUtils.colorPrimaryButton(setStatus, context) + binding.clearStatus.setTextColor(ThemeColorUtils.primaryColor(context, true)) + ThemeButtonUtils.colorPrimaryButton(binding.setStatus, context) ThemeTextInputUtils.colorTextInput( binding.customStatusInputContainer, binding.customStatusInput, @@ -408,7 +408,7 @@ class SetStatusDialogFragment : override fun onClick(predefinedStatus: PredefinedStatus) { selectedPredefinedMessageId = predefinedStatus.id clearAt = clearAtToUnixTime(predefinedStatus.clearAt) - emoji.setText(predefinedStatus.icon) + binding.emoji.setText(predefinedStatus.icon) binding.customStatusInput.text?.clear() binding.customStatusInput.text?.append(predefinedStatus.message)