Split long lines and cleanup

This commit is contained in:
Benoit Marty 2020-12-16 14:33:44 +01:00
parent b52f8b1dbf
commit 929d711149
7 changed files with 53 additions and 41 deletions

View File

@ -19,10 +19,10 @@ package im.vector.app.features.debug
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import im.vector.app.R import im.vector.app.R
import im.vector.app.databinding.ActivityTestLinkifyBinding import im.vector.app.databinding.ActivityTestLinkifyBinding
import im.vector.app.databinding.ItemTestLinkifyBinding
class TestLinkifyActivity : AppCompatActivity() { class TestLinkifyActivity : AppCompatActivity() {
@ -80,42 +80,41 @@ class TestLinkifyActivity : AppCompatActivity() {
.forEach { textContent -> .forEach { textContent ->
val item = LayoutInflater.from(this) val item = LayoutInflater.from(this)
.inflate(R.layout.item_test_linkify, views.testLinkifyContentView, false) .inflate(R.layout.item_test_linkify, views.testLinkifyContentView, false)
val subViews = ItemTestLinkifyBinding.bind(item)
item.findViewById<TextView>(R.id.test_linkify_auto_text) subViews.testLinkifyAutoText.apply {
?.apply { text = textContent
text = textContent /* TODO Use BetterLinkMovementMethod when the other PR is merged
/* TODO Use BetterLinkMovementMethod when the other PR is merged movementMethod = MatrixLinkMovementMethod(object : MockMessageAdapterActionListener() {
movementMethod = MatrixLinkMovementMethod(object : MockMessageAdapterActionListener() { override fun onURLClick(uri: Uri?) {
override fun onURLClick(uri: Uri?) { Snackbar.make(coordinatorLayout, "URI Clicked: $uri", Snackbar.LENGTH_LONG)
Snackbar.make(coordinatorLayout, "URI Clicked: $uri", Snackbar.LENGTH_LONG) .setAction("open") {
.setAction("open") { openUrlInExternalBrowser(this@TestLinkifyActivity, uri)
openUrlInExternalBrowser(this@TestLinkifyActivity, uri) }
} .show()
.show()
}
})
*/
} }
})
*/
}
item.findViewById<TextView>(R.id.test_linkify_custom_text) subViews.testLinkifyCustomText.apply {
?.apply { text = textContent
text = textContent /* TODO Use BetterLinkMovementMethod when the other PR is merged
/* TODO Use BetterLinkMovementMethod when the other PR is merged movementMethod = MatrixLinkMovementMethod(object : MockMessageAdapterActionListener() {
movementMethod = MatrixLinkMovementMethod(object : MockMessageAdapterActionListener() { override fun onURLClick(uri: Uri?) {
override fun onURLClick(uri: Uri?) { Snackbar.make(coordinatorLayout, "URI Clicked: $uri", Snackbar.LENGTH_LONG)
Snackbar.make(coordinatorLayout, "URI Clicked: $uri", Snackbar.LENGTH_LONG) .setAction("open") {
.setAction("open") { openUrlInExternalBrowser(this@TestLinkifyActivity, uri)
openUrlInExternalBrowser(this@TestLinkifyActivity, uri) }
} .show()
.show()
}
})
*/
// TODO Call VectorLinkify.addLinks(text)
} }
})
*/
views.testLinkifyContentView.addView(item, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)) // TODO Call VectorLinkify.addLinks(text)
}
views.testLinkifyContentView
.addView(item, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
} }
} }
} }

View File

@ -119,7 +119,9 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
} }
VerificationBottomSheetViewEvents.GoToSettings -> { VerificationBottomSheetViewEvents.GoToSettings -> {
dismiss() dismiss()
(activity as? VectorBaseActivity<*>)?.navigator?.openSettings(requireContext(), VectorSettingsActivity.EXTRA_DIRECT_ACCESS_SECURITY_PRIVACY) (activity as? VectorBaseActivity<*>)?.let { activity ->
activity.navigator.openSettings(activity, VectorSettingsActivity.EXTRA_DIRECT_ACCESS_SECURITY_PRIVACY)
}
} }
}.exhaustive }.exhaustive
} }

View File

@ -73,7 +73,12 @@ class RoomListQuickActionsBottomSheet :
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
sharedActionViewModel = activityViewModelProvider.get(RoomListQuickActionsSharedActionViewModel::class.java) sharedActionViewModel = activityViewModelProvider.get(RoomListQuickActionsSharedActionViewModel::class.java)
views.bottomSheetRecyclerView.configureWith(roomListActionsEpoxyController, viewPool = sharedViewPool, hasFixedSize = false, disableItemAnimation = true) views.bottomSheetRecyclerView.configureWith(
epoxyController = roomListActionsEpoxyController,
viewPool = sharedViewPool,
hasFixedSize = false,
disableItemAnimation = true
)
roomListActionsEpoxyController.listener = this roomListActionsEpoxyController.listener = this
} }

View File

@ -113,7 +113,11 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
// This can be called by the IME action, so deal with empty cases // This can be called by the IME action, so deal with empty cases
var error = 0 var error = 0
if (login.isEmpty()) { if (login.isEmpty()) {
views.loginFieldTil.error = getString(if (isSignupMode) R.string.error_empty_field_choose_user_name else R.string.error_empty_field_enter_user_name) views.loginFieldTil.error = getString(if (isSignupMode) {
R.string.error_empty_field_choose_user_name
} else {
R.string.error_empty_field_enter_user_name
})
error++ error++
} }
if (isSignupMode && isNumericOnlyUserIdForbidden && login.isDigitsOnly()) { if (isSignupMode && isNumericOnlyUserIdForbidden && login.isDigitsOnly()) {
@ -121,7 +125,11 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
error++ error++
} }
if (password.isEmpty()) { if (password.isEmpty()) {
views.passwordFieldTil.error = getString(if (isSignupMode) R.string.error_empty_field_choose_password else R.string.error_empty_field_your_password) views.passwordFieldTil.error = getString(if (isSignupMode) {
R.string.error_empty_field_choose_password
} else {
R.string.error_empty_field_your_password
})
error++ error++
} }

View File

@ -199,7 +199,8 @@ class ReactionButton @JvmOverloads constructor(context: Context,
starScaleXAnimator.startDelay = 250 starScaleXAnimator.startDelay = 250
starScaleXAnimator.interpolator = OVERSHOOT_INTERPOLATOR starScaleXAnimator.interpolator = OVERSHOOT_INTERPOLATOR
val dotsAnimator = ObjectAnimator.ofFloat(views.dots, DotsView.DOTS_PROGRESS, 0f, 1f) // .ofFloat<DotsView>(views.dots, DotsView.DOTS_PROGRESS, 0, 1f) val dotsAnimator = ObjectAnimator.ofFloat(views.dots, DotsView.DOTS_PROGRESS, 0f, 1f)
// .ofFloat<DotsView>(views.dots, DotsView.DOTS_PROGRESS, 0, 1f)
dotsAnimator.duration = 900 dotsAnimator.duration = 900
dotsAnimator.startDelay = 50 dotsAnimator.startDelay = 50
dotsAnimator.interpolator = ACCELERATE_DECELERATE_INTERPOLATOR dotsAnimator.interpolator = ACCELERATE_DECELERATE_INTERPOLATOR

View File

@ -19,7 +19,6 @@ package im.vector.app.features.settings
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.widget.CheckedTextView import android.widget.CheckedTextView
import android.widget.LinearLayout
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.view.children import androidx.core.view.children
import androidx.preference.Preference import androidx.preference.Preference
@ -170,4 +169,3 @@ class VectorSettingsPreferencesFragment @Inject constructor(
} }
} }
} }

View File

@ -20,7 +20,6 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.EditText
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible import androidx.core.view.isVisible