Fix some warnings
This commit is contained in:
parent
e8aca9ee88
commit
17f2ca0f7b
@ -23,7 +23,6 @@ import im.vector.app.features.crypto.keysrequest.KeyRequestHandler
|
||||
import im.vector.app.features.crypto.verification.IncomingVerificationRequestHandler
|
||||
import im.vector.app.features.notifications.PushRuleTriggerListener
|
||||
import im.vector.app.features.session.SessionListener
|
||||
import org.matrix.android.sdk.api.auth.AuthenticationService
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import timber.log.Timber
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
@ -31,8 +30,7 @@ import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class ActiveSessionHolder @Inject constructor(private val authenticationService: AuthenticationService,
|
||||
private val sessionObservableStore: ActiveSessionDataSource,
|
||||
class ActiveSessionHolder @Inject constructor(private val sessionObservableStore: ActiveSessionDataSource,
|
||||
private val keyRequestHandler: KeyRequestHandler,
|
||||
private val incomingVerificationRequestHandler: IncomingVerificationRequestHandler,
|
||||
private val callManager: WebRtcCallManager,
|
||||
|
@ -25,11 +25,11 @@ import im.vector.app.core.utils.FirstThrottler
|
||||
import im.vector.app.core.utils.LiveEvent
|
||||
|
||||
inline fun <T> LiveData<T>.observeK(owner: LifecycleOwner, crossinline observer: (T?) -> Unit) {
|
||||
this.observe(owner, Observer { observer(it) })
|
||||
this.observe(owner, { observer(it) })
|
||||
}
|
||||
|
||||
inline fun <T> LiveData<T>.observeNotNull(owner: LifecycleOwner, crossinline observer: (T) -> Unit) {
|
||||
this.observe(owner, Observer { it?.run(observer) })
|
||||
this.observe(owner, { it?.run(observer) })
|
||||
}
|
||||
|
||||
inline fun <T> LiveData<LiveEvent<T>>.observeEvent(owner: LifecycleOwner, crossinline observer: (T) -> Unit) {
|
||||
|
@ -208,12 +208,12 @@ abstract class VectorBaseActivity<VB: ViewBinding> : AppCompatActivity(), HasScr
|
||||
navigator = screenComponent.navigator()
|
||||
activeSessionHolder = screenComponent.activeSessionHolder()
|
||||
vectorPreferences = vectorComponent.vectorPreferences()
|
||||
configurationViewModel.activityRestarter.observe(this, Observer {
|
||||
configurationViewModel.activityRestarter.observe(this) {
|
||||
if (!it.hasBeenHandled) {
|
||||
// Recreate the Activity because configuration has changed
|
||||
restart()
|
||||
}
|
||||
})
|
||||
}
|
||||
pinLocker.getLiveState().observeNotNull(this) {
|
||||
if (this@VectorBaseActivity !is UnlockedActivity && it == PinLocker.State.LOCKED) {
|
||||
navigator.openPinCode(this, pinStartForActivityResult, PinMode.AUTH)
|
||||
|
@ -49,7 +49,7 @@ open class BehaviorDataSource<T>(private val defaultValue: T? = null) : MutableD
|
||||
|
||||
private fun createRelay(): BehaviorRelay<T> {
|
||||
return if (defaultValue == null) {
|
||||
BehaviorRelay.create<T>()
|
||||
BehaviorRelay.create()
|
||||
} else {
|
||||
BehaviorRelay.createDefault(defaultValue)
|
||||
}
|
||||
|
@ -19,12 +19,11 @@ package im.vector.app.core.utils
|
||||
import io.reactivex.Completable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.functions.Consumer
|
||||
import io.reactivex.internal.functions.Functions
|
||||
import timber.log.Timber
|
||||
|
||||
fun <T> Single<T>.subscribeLogError(): Disposable {
|
||||
return subscribe(Functions.emptyConsumer(), Consumer { Timber.e(it) })
|
||||
return subscribe(Functions.emptyConsumer(), { Timber.e(it) })
|
||||
}
|
||||
|
||||
fun Completable.subscribeLogError(): Disposable {
|
||||
|
@ -102,7 +102,7 @@ abstract class RecyclerViewPresenter<T>(context: Context?) : AutocompletePresent
|
||||
return LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
private class Observer internal constructor(private val root: DataSetObserver) : RecyclerView.AdapterDataObserver() {
|
||||
private class Observer constructor(private val root: DataSetObserver) : RecyclerView.AdapterDataObserver() {
|
||||
override fun onChanged() {
|
||||
root.onChanged()
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
||||
mode: String?): Intent {
|
||||
return Intent(context, VectorCallActivity::class.java).apply {
|
||||
// what could be the best flags?
|
||||
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
flags = FLAG_ACTIVITY_CLEAR_TOP
|
||||
putExtra(MvRx.KEY_ARG, CallArgs(roomId, callId, otherUserId, isIncomingCall, isVideoCall))
|
||||
putExtra(EXTRA_MODE, mode)
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
|
||||
viewModel = viewModelProvider.get(KeysBackupRestoreSharedViewModel::class.java)
|
||||
viewModel.initSession(session)
|
||||
|
||||
viewModel.keySourceModel.observe(this, Observer { keySource ->
|
||||
viewModel.keySourceModel.observe(this) { keySource ->
|
||||
if (keySource != null && !keySource.isInQuadS && supportFragmentManager.fragments.isEmpty()) {
|
||||
val isBackupCreatedFromPassphrase =
|
||||
viewModel.keyVersionResult.value?.getAuthDataAsMegolmBackupAuthData()?.privateKeySalt != null
|
||||
@ -64,7 +64,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
|
||||
replaceFragment(R.id.container, KeysBackupRestoreFromKeyFragment::class.java)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.keyVersionResultError.observeEvent(this) { message ->
|
||||
AlertDialog.Builder(this)
|
||||
@ -111,9 +111,9 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.loadingEvent.observe(this, Observer {
|
||||
viewModel.loadingEvent.observe(this) {
|
||||
updateWaitingView(it)
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.importRoomKeysFinishWithResult.observeEvent(this) {
|
||||
// set data?
|
||||
|
@ -56,9 +56,9 @@ class KeysBackupRestoreFromKeyFragment @Inject constructor()
|
||||
}
|
||||
|
||||
views.keyInputLayout.error = viewModel.recoveryCodeErrorText.value
|
||||
viewModel.recoveryCodeErrorText.observe(viewLifecycleOwner, Observer { newValue ->
|
||||
viewModel.recoveryCodeErrorText.observe(viewLifecycleOwner) { newValue ->
|
||||
views.keyInputLayout.error = newValue
|
||||
})
|
||||
}
|
||||
|
||||
views.keysRestoreButton.setOnClickListener { onRestoreFromKey() }
|
||||
views.keysBackupImport.setOnClickListener { onImport() }
|
||||
|
@ -51,17 +51,17 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
|
||||
viewModel = fragmentViewModelProvider.get(KeysBackupRestoreFromPassphraseViewModel::class.java)
|
||||
sharedViewModel = activityViewModelProvider.get(KeysBackupRestoreSharedViewModel::class.java)
|
||||
|
||||
viewModel.passphraseErrorText.observe(viewLifecycleOwner, Observer { newValue ->
|
||||
viewModel.passphraseErrorText.observe(viewLifecycleOwner) { newValue ->
|
||||
views.keysBackupPassphraseEnterTil.error = newValue
|
||||
})
|
||||
}
|
||||
|
||||
views.helperTextWithLink.text = spannableStringForHelperText()
|
||||
|
||||
viewModel.showPasswordMode.observe(viewLifecycleOwner, Observer {
|
||||
viewModel.showPasswordMode.observe(viewLifecycleOwner) {
|
||||
val shouldBeVisible = it ?: false
|
||||
views.keysBackupPassphraseEnterEdittext.showPassword(shouldBeVisible)
|
||||
views.keysBackupViewShowPassword.render(shouldBeVisible)
|
||||
})
|
||||
}
|
||||
|
||||
views.keysBackupPassphraseEnterEdittext.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
|
@ -49,20 +49,20 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() {
|
||||
viewModel.showManualExport.value = intent.getBooleanExtra(EXTRA_SHOW_MANUAL_EXPORT, false)
|
||||
viewModel.initSession(session)
|
||||
|
||||
viewModel.isCreatingBackupVersion.observe(this, Observer {
|
||||
viewModel.isCreatingBackupVersion.observe(this) {
|
||||
val isCreating = it ?: false
|
||||
if (isCreating) {
|
||||
showWaitingView()
|
||||
} else {
|
||||
hideWaitingView()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.loadingStatus.observe(this, Observer {
|
||||
viewModel.loadingStatus.observe(this) {
|
||||
it?.let {
|
||||
updateWaitingView(it)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.navigateEvent.observeEvent(this) { uxStateEvent ->
|
||||
when (uxStateEvent) {
|
||||
@ -99,7 +99,7 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.prepareRecoverFailError.observe(this, Observer { error ->
|
||||
viewModel.prepareRecoverFailError.observe(this) { error ->
|
||||
if (error != null) {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(R.string.unknown_error)
|
||||
@ -110,9 +110,9 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() {
|
||||
}
|
||||
.show()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.creatingBackupError.observe(this, Observer { error ->
|
||||
viewModel.creatingBackupError.observe(this) { error ->
|
||||
if (error != null) {
|
||||
AlertDialog.Builder(this)
|
||||
.setTitle(R.string.unexpected_error)
|
||||
@ -123,7 +123,7 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() {
|
||||
}
|
||||
.show()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private val saveStartForActivityResult = registerStartForActivityResult { activityResult ->
|
||||
|
@ -40,12 +40,12 @@ class KeysBackupSetupStep1Fragment @Inject constructor() : VectorBaseFragment<Fr
|
||||
|
||||
viewModel = activityViewModelProvider.get(KeysBackupSetupSharedViewModel::class.java)
|
||||
|
||||
viewModel.showManualExport.observe(viewLifecycleOwner, Observer {
|
||||
viewModel.showManualExport.observe(viewLifecycleOwner) {
|
||||
val showOption = it ?: false
|
||||
// Can't use isVisible because the kotlin compiler will crash with Back-end (JVM) Internal error: wrong code generated
|
||||
views.keysBackupSetupStep1AdvancedOptionText.visibility = if (showOption) View.VISIBLE else View.GONE
|
||||
views.keysBackupSetupStep1ManualExportButton.visibility = if (showOption) View.VISIBLE else View.GONE
|
||||
})
|
||||
}
|
||||
|
||||
views.keysBackupSetupStep1Button.setOnClickListener { onButtonClick() }
|
||||
views.keysBackupSetupStep1ManualExportButton.setOnClickListener { onManualExportClick() }
|
||||
|
@ -69,63 +69,65 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment<Fr
|
||||
* ========================================================================================== */
|
||||
|
||||
private fun bindViewToViewModel() {
|
||||
viewModel.passwordStrength.observe(viewLifecycleOwner, Observer { strength ->
|
||||
if (strength == null) {
|
||||
views.keysBackupSetupStep2PassphraseStrengthLevel.strength = 0
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = null
|
||||
} else {
|
||||
val score = strength.score
|
||||
views.keysBackupSetupStep2PassphraseStrengthLevel.strength = score
|
||||
|
||||
if (score in 1..3) {
|
||||
val warning = strength.feedback?.getWarning(VectorLocale.applicationLocale)
|
||||
if (warning != null) {
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = warning
|
||||
}
|
||||
|
||||
val suggestions = strength.feedback?.getSuggestions(VectorLocale.applicationLocale)
|
||||
if (suggestions != null) {
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = suggestions.firstOrNull()
|
||||
}
|
||||
} else {
|
||||
viewModel.run {
|
||||
passwordStrength.observe(viewLifecycleOwner, Observer { strength ->
|
||||
if (strength == null) {
|
||||
views.keysBackupSetupStep2PassphraseStrengthLevel.strength = 0
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = null
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
val score = strength.score
|
||||
views.keysBackupSetupStep2PassphraseStrengthLevel.strength = score
|
||||
|
||||
viewModel.passphrase.observe(viewLifecycleOwner, Observer<String> { newValue ->
|
||||
if (newValue.isEmpty()) {
|
||||
viewModel.passwordStrength.value = null
|
||||
} else {
|
||||
viewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||
val strength = zxcvbn.measure(newValue)
|
||||
launch(Dispatchers.Main) {
|
||||
viewModel.passwordStrength.value = strength
|
||||
if (score in 1..3) {
|
||||
val warning = strength.feedback?.getWarning(VectorLocale.applicationLocale)
|
||||
if (warning != null) {
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = warning
|
||||
}
|
||||
|
||||
val suggestions = strength.feedback?.getSuggestions(VectorLocale.applicationLocale)
|
||||
if (suggestions != null) {
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = suggestions.firstOrNull()
|
||||
}
|
||||
} else {
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = null
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
passphrase.observe(viewLifecycleOwner) { newValue ->
|
||||
if (newValue.isEmpty()) {
|
||||
passwordStrength.value = null
|
||||
} else {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val strength = zxcvbn.measure(newValue)
|
||||
launch(Dispatchers.Main) {
|
||||
passwordStrength.value = strength
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
views.keysBackupSetupStep2PassphraseEnterEdittext.setText(viewModel.passphrase.value)
|
||||
|
||||
viewModel.passphraseError.observe(viewLifecycleOwner, Observer {
|
||||
viewModel.passphraseError.observe(viewLifecycleOwner) {
|
||||
TransitionManager.beginDelayedTransition(views.keysBackupRoot)
|
||||
views.keysBackupSetupStep2PassphraseEnterTil.error = it
|
||||
})
|
||||
}
|
||||
|
||||
views.keysBackupSetupStep2PassphraseConfirmEditText.setText(viewModel.confirmPassphrase.value)
|
||||
|
||||
viewModel.showPasswordMode.observe(viewLifecycleOwner, Observer {
|
||||
viewModel.showPasswordMode.observe(viewLifecycleOwner) {
|
||||
val shouldBeVisible = it ?: false
|
||||
views.keysBackupSetupStep2PassphraseEnterEdittext.showPassword(shouldBeVisible)
|
||||
views.keysBackupSetupStep2PassphraseConfirmEditText.showPassword(shouldBeVisible)
|
||||
views.keysBackupSetupStep2ShowPassword.render(shouldBeVisible)
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.confirmPassphraseError.observe(viewLifecycleOwner, Observer {
|
||||
viewModel.confirmPassphraseError.observe(viewLifecycleOwner) {
|
||||
TransitionManager.beginDelayedTransition(views.keysBackupRoot)
|
||||
views.keysBackupSetupStep2PassphraseConfirmTil.error = it
|
||||
})
|
||||
}
|
||||
|
||||
views.keysBackupSetupStep2PassphraseConfirmEditText.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
|
@ -61,7 +61,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment<Fr
|
||||
|
||||
viewModel.shouldPromptOnBack = false
|
||||
|
||||
viewModel.passphrase.observe(viewLifecycleOwner, Observer {
|
||||
viewModel.passphrase.observe(viewLifecycleOwner) {
|
||||
if (it.isNullOrBlank()) {
|
||||
// Recovery was generated, so show key and options to save
|
||||
views.keysBackupSetupStep3Label2.text = getString(R.string.keys_backup_setup_step3_text_line2_no_passphrase)
|
||||
@ -81,7 +81,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment<Fr
|
||||
views.keysBackupSetupStep3FinishButton.text = getString(R.string.keys_backup_setup_step3_button_title)
|
||||
views.keysBackupSetupStep3RecoveryKeyText.isVisible = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setupViews()
|
||||
}
|
||||
|
@ -183,11 +183,11 @@ class KeyRequestHandler @Inject constructor(
|
||||
denyAllRequests(mappingKey)
|
||||
}
|
||||
|
||||
alert.addButton(context.getString(R.string.share_without_verifying_short_label), Runnable {
|
||||
alert.addButton(context.getString(R.string.share_without_verifying_short_label), {
|
||||
shareAllSessions(mappingKey)
|
||||
})
|
||||
|
||||
alert.addButton(context.getString(R.string.ignore_request_short_label), Runnable {
|
||||
alert.addButton(context.getString(R.string.ignore_request_short_label), {
|
||||
denyAllRequests(mappingKey)
|
||||
})
|
||||
|
||||
|
@ -97,7 +97,7 @@ class BackupToQuadSMigrationTask @Inject constructor(
|
||||
when {
|
||||
params.passphrase?.isNotEmpty() == true -> {
|
||||
reportProgress(params, R.string.bootstrap_progress_generating_ssss)
|
||||
awaitCallback<SsssKeyCreationInfo> {
|
||||
awaitCallback {
|
||||
quadS.generateKeyWithPassphrase(
|
||||
UUID.randomUUID().toString(),
|
||||
"ssss_key",
|
||||
|
@ -92,13 +92,11 @@ class IncomingVerificationRequestHandler @Inject constructor(
|
||||
}
|
||||
addButton(
|
||||
context.getString(R.string.ignore),
|
||||
Runnable {
|
||||
tx.cancel()
|
||||
}
|
||||
{ tx.cancel() }
|
||||
)
|
||||
addButton(
|
||||
context.getString(R.string.action_open),
|
||||
Runnable {
|
||||
{
|
||||
(weakCurrentActivity?.get() as? VectorBaseActivity<*>)?.let {
|
||||
it.navigator.performDeviceVerification(it, tx.otherUserId, tx.transactionId)
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class GroupListViewModel @AssistedInject constructor(@Assisted initialState: Gro
|
||||
session
|
||||
.rx()
|
||||
.liveGroupSummaries(groupSummariesQueryParams),
|
||||
BiFunction { allCommunityGroup, communityGroups ->
|
||||
{ allCommunityGroup, communityGroups ->
|
||||
listOf(allCommunityGroup) + communityGroups
|
||||
}
|
||||
)
|
||||
|
@ -285,10 +285,10 @@ class HomeActivity :
|
||||
dismissedAction = Runnable {
|
||||
homeActivityViewModel.handle(HomeActivityViewActions.PushPromptHasBeenReviewed)
|
||||
}
|
||||
addButton(getString(R.string.dismiss), Runnable {
|
||||
addButton(getString(R.string.dismiss), {
|
||||
homeActivityViewModel.handle(HomeActivityViewActions.PushPromptHasBeenReviewed)
|
||||
}, true)
|
||||
addButton(getString(R.string.settings), Runnable {
|
||||
addButton(getString(R.string.settings), {
|
||||
(weakCurrentActivity?.get() as? VectorBaseActivity<*>)?.let {
|
||||
// action(it)
|
||||
homeActivityViewModel.handle(HomeActivityViewActions.PushPromptHasBeenReviewed)
|
||||
|
@ -103,7 +103,7 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted
|
||||
session.rx().liveUserCryptoDevices(session.myUserId),
|
||||
session.rx().liveMyDevicesInfo(),
|
||||
session.rx().liveCrossSigningPrivateKeys(),
|
||||
Function3 { cryptoList, infoList, pInfo ->
|
||||
{ cryptoList, infoList, pInfo ->
|
||||
// Timber.v("## Detector trigger ${cryptoList.map { "${it.deviceId} ${it.trustLevel}" }}")
|
||||
// Timber.v("## Detector trigger canCrossSign ${pInfo.get().selfSigned != null}")
|
||||
infoList
|
||||
|
@ -65,7 +65,7 @@ class BreadcrumbsController @Inject constructor(
|
||||
hasUnreadMessage(it.hasUnreadMessages)
|
||||
hasDraft(it.userDrafts.isNotEmpty())
|
||||
itemClickListener(
|
||||
DebouncedClickListener(View.OnClickListener { _ ->
|
||||
DebouncedClickListener({ _ ->
|
||||
listener?.onBreadcrumbClicked(it.roomId)
|
||||
})
|
||||
)
|
||||
|
@ -60,9 +60,9 @@ class JumpToBottomViewVisibilityManager(
|
||||
}
|
||||
|
||||
fun maybeShowJumpToBottomViewVisibilityWithDelay() {
|
||||
debouncer.debounce("jump_to_bottom_visibility", 250, Runnable {
|
||||
debouncer.debounce("jump_to_bottom_visibility", 250) {
|
||||
maybeShowJumpToBottomViewVisibility()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun maybeShowJumpToBottomViewVisibility() {
|
||||
|
@ -1330,7 +1330,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||
.combineLatest<List<TimelineEvent>, RoomSummary, UnreadState>(
|
||||
timelineEvents.observeOn(Schedulers.computation()),
|
||||
room.rx().liveRoomSummary().unwrap(),
|
||||
BiFunction { timelineEvents, roomSummary ->
|
||||
{ timelineEvents, roomSummary ->
|
||||
computeUnreadState(timelineEvents, roomSummary)
|
||||
}
|
||||
)
|
||||
|
@ -42,7 +42,7 @@ class DefaultItemFactory @Inject constructor(private val avatarSizeProvider: Ava
|
||||
avatarRenderer = avatarRenderer,
|
||||
informationData = informationData,
|
||||
text = text,
|
||||
itemLongClickListener = View.OnLongClickListener { view ->
|
||||
itemLongClickListener = { view ->
|
||||
callback?.onEventLongClicked(informationData, null, view) ?: false
|
||||
},
|
||||
readReceiptsCallback = callback
|
||||
|
@ -322,7 +322,7 @@ class MessageItemFactory @Inject constructor(
|
||||
mode(ImageContentRenderer.Mode.STICKER)
|
||||
} else {
|
||||
clickListener(
|
||||
DebouncedClickListener(View.OnClickListener { view ->
|
||||
DebouncedClickListener({ view ->
|
||||
callback?.onImageMessageClicked(messageContent, data, view)
|
||||
}))
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class NoticeItemFactory @Inject constructor(private val eventFormatter: NoticeEv
|
||||
avatarRenderer = avatarRenderer,
|
||||
informationData = informationData,
|
||||
noticeText = formattedText,
|
||||
itemLongClickListener = View.OnLongClickListener { view ->
|
||||
itemLongClickListener = { view ->
|
||||
callback?.onEventLongClicked(informationData, null, view) ?: false
|
||||
},
|
||||
readReceiptsCallback = callback,
|
||||
|
@ -39,13 +39,13 @@ class MessageItemAttributesFactory @Inject constructor(
|
||||
informationData = informationData,
|
||||
avatarRenderer = avatarRenderer,
|
||||
messageColorProvider = messageColorProvider,
|
||||
itemLongClickListener = View.OnLongClickListener { view ->
|
||||
itemLongClickListener = { view ->
|
||||
callback?.onEventLongClicked(informationData, messageContent, view) ?: false
|
||||
},
|
||||
itemClickListener = DebouncedClickListener(View.OnClickListener { view ->
|
||||
itemClickListener = DebouncedClickListener({ view ->
|
||||
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||
}),
|
||||
memberClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
memberClickListener = DebouncedClickListener({
|
||||
callback?.onMemberNameClicked(informationData)
|
||||
}),
|
||||
reactionPillCallback = callback,
|
||||
|
@ -39,7 +39,7 @@ abstract class AbsBaseMessageItem<H : AbsBaseMessageItem.Holder> : BaseEventItem
|
||||
|
||||
abstract val baseAttributes: Attributes
|
||||
|
||||
private val _readReceiptsClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
private val _readReceiptsClickListener = DebouncedClickListener({
|
||||
baseAttributes.readReceiptsCallback?.onReadReceiptsClicked(baseAttributes.informationData.readReceipts)
|
||||
})
|
||||
|
||||
|
@ -42,10 +42,10 @@ abstract class AbsMessageItem<H : AbsMessageItem.Holder> : AbsBaseMessageItem<H>
|
||||
@EpoxyAttribute
|
||||
lateinit var attributes: Attributes
|
||||
|
||||
private val _avatarClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
private val _avatarClickListener = DebouncedClickListener({
|
||||
attributes.avatarCallback?.onAvatarClicked(attributes.informationData)
|
||||
})
|
||||
private val _memberNameClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
private val _memberNameClickListener = DebouncedClickListener({
|
||||
attributes.avatarCallback?.onMemberNameClicked(attributes.informationData)
|
||||
})
|
||||
|
||||
|
@ -32,7 +32,7 @@ abstract class DefaultItem : BaseEventItem<DefaultItem.Holder>() {
|
||||
@EpoxyAttribute
|
||||
lateinit var attributes: Attributes
|
||||
|
||||
private val _readReceiptsClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
private val _readReceiptsClickListener = DebouncedClickListener({
|
||||
attributes.readReceiptsCallback?.onReadReceiptsClicked(attributes.informationData.readReceipts)
|
||||
})
|
||||
|
||||
|
@ -143,7 +143,7 @@ abstract class MessagePollItem : AbsMessageItem<MessagePollItem.Holder>() {
|
||||
override fun bindView(itemView: View) {
|
||||
super.bindView(itemView)
|
||||
val buttons = listOf(button1, button2, button3, button4, button5)
|
||||
val clickListener = DebouncedClickListener(View.OnClickListener {
|
||||
val clickListener = DebouncedClickListener({
|
||||
val optionIndex = buttons.indexOf(it)
|
||||
if (optionIndex != -1 && pollId != null) {
|
||||
val compatValue = if (optionIndex < optionValues?.size ?: 0) optionValues?.get(optionIndex) else null
|
||||
|
@ -35,7 +35,7 @@ abstract class NoticeItem : BaseEventItem<NoticeItem.Holder>() {
|
||||
@EpoxyAttribute
|
||||
lateinit var attributes: Attributes
|
||||
|
||||
private val _readReceiptsClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
private val _readReceiptsClickListener = DebouncedClickListener({
|
||||
attributes.readReceiptsCallback?.onReadReceiptsClicked(attributes.informationData.readReceipts)
|
||||
})
|
||||
|
||||
|
@ -225,7 +225,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment<FragmentLog
|
||||
.combineLatest(
|
||||
views.loginField.textChanges().map { it.trim().isNotEmpty() },
|
||||
views.passwordField.textChanges().map { it.isNotEmpty() },
|
||||
BiFunction<Boolean, Boolean, Boolean> { isLoginNotEmpty, isPasswordNotEmpty ->
|
||||
{ isLoginNotEmpty, isPasswordNotEmpty ->
|
||||
isLoginNotEmpty && isPasswordNotEmpty
|
||||
}
|
||||
)
|
||||
|
@ -69,7 +69,7 @@ class LoginResetPasswordFragment @Inject constructor() : AbstractLoginFragment<F
|
||||
.combineLatest(
|
||||
views.resetPasswordEmail.textChanges().map { it.isEmail() },
|
||||
views.passwordField.textChanges().map { it.isNotEmpty() },
|
||||
BiFunction<Boolean, Boolean, Boolean> { isEmail, isPasswordNotEmpty ->
|
||||
{ isEmail, isPasswordNotEmpty ->
|
||||
isEmail && isPasswordNotEmpty
|
||||
}
|
||||
)
|
||||
|
@ -138,7 +138,7 @@ class MatrixToBottomSheet :
|
||||
fun withLink(matrixToLink: String, listener: InteractionListener?): MatrixToBottomSheet {
|
||||
return MatrixToBottomSheet().apply {
|
||||
arguments = Bundle().apply {
|
||||
putParcelable(MvRx.KEY_ARG, MatrixToBottomSheet.MatrixToArgs(
|
||||
putParcelable(MvRx.KEY_ARG, MatrixToArgs(
|
||||
matrixToLink = matrixToLink
|
||||
))
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import android.view.MenuItem
|
||||
import android.widget.SearchView
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.Observer
|
||||
import com.airbnb.mvrx.viewModel
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.jakewharton.rxbinding3.widget.queryTextChanges
|
||||
@ -107,13 +106,13 @@ class EmojiReactionPickerActivity : VectorBaseActivity<ActivityEmojiReactionPick
|
||||
}
|
||||
views.tabs.addOnTabSelectedListener(tabLayoutSelectionListener)
|
||||
|
||||
viewModel.currentSection.observe(this, Observer { section ->
|
||||
viewModel.currentSection.observe(this) { section ->
|
||||
section?.let {
|
||||
views.tabs.removeOnTabSelectedListener(tabLayoutSelectionListener)
|
||||
views.tabs.getTabAt(it)?.select()
|
||||
views.tabs.addOnTabSelectedListener(tabLayoutSelectionListener)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.navigateEvent.observeEvent(this) {
|
||||
if (it == EmojiChooserViewModel.NAVIGATE_FINISH) {
|
||||
|
@ -90,7 +90,7 @@ class RoomMemberListViewModel @AssistedInject constructor(@Assisted initialState
|
||||
.liveStateEvent(EventType.STATE_ROOM_POWER_LEVELS, QueryStringValue.NoCondition)
|
||||
.mapOptional { it.content.toModel<PowerLevelsContent>() }
|
||||
.unwrap(),
|
||||
BiFunction { roomMembers, powerLevelsContent ->
|
||||
{ roomMembers, powerLevelsContent ->
|
||||
buildRoomMemberSummaries(powerLevelsContent, roomMembers)
|
||||
}
|
||||
)
|
||||
|
@ -62,7 +62,7 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(
|
||||
Observable.combineLatest<List<DeviceInfo>, Optional<MXCrossSigningInfo>, Pair<List<DeviceInfo>, Optional<MXCrossSigningInfo>>>(
|
||||
session.rx().liveMyDevicesInfo(),
|
||||
session.rx().liveCrossSigningInfo(session.myUserId),
|
||||
BiFunction { myDevicesInfo, mxCrossSigningInfo ->
|
||||
{ myDevicesInfo, mxCrossSigningInfo ->
|
||||
myDevicesInfo to mxCrossSigningInfo
|
||||
}
|
||||
)
|
||||
|
@ -121,7 +121,7 @@ class DevicesViewModel @AssistedInject constructor(
|
||||
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, List<DeviceFullInfo>>(
|
||||
session.rx().liveUserCryptoDevices(session.myUserId),
|
||||
session.rx().liveMyDevicesInfo(),
|
||||
BiFunction { cryptoList, infoList ->
|
||||
{ cryptoList, infoList ->
|
||||
infoList
|
||||
.sortedByDescending { it.lastSeenTs }
|
||||
.map { deviceInfo ->
|
||||
|
@ -68,7 +68,7 @@ class AccountDataEpoxyController @Inject constructor(
|
||||
genericItemWithValue {
|
||||
id(accountData.type)
|
||||
title(accountData.type)
|
||||
itemClickAction(DebouncedClickListener(View.OnClickListener {
|
||||
itemClickAction(DebouncedClickListener({
|
||||
interactionListener?.didTap(accountData)
|
||||
}))
|
||||
itemLongClickAction(View.OnLongClickListener {
|
||||
|
@ -34,7 +34,6 @@ import im.vector.app.databinding.BottomSheetRoomWidgetPermissionBinding
|
||||
import im.vector.app.features.home.AvatarRenderer
|
||||
import im.vector.app.features.widgets.WidgetArgs
|
||||
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
import javax.inject.Inject
|
||||
|
||||
class RoomWidgetPermissionBottomSheet :
|
||||
|
Loading…
x
Reference in New Issue
Block a user