Fix warnings in the App
This commit is contained in:
parent
a9c474105a
commit
119e4c0d32
@ -14,6 +14,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package im.vector.riotx.push.fcm
|
||||
|
||||
import android.app.Activity
|
||||
|
@ -56,7 +56,7 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
|
||||
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_token_registration_quick_fix) {
|
||||
override fun doFix() {
|
||||
val workId = pushersManager.registerPusherWithFcmKey(fcmToken)
|
||||
WorkManager.getInstance().getWorkInfoByIdLiveData(workId).observe(context, Observer { workInfo ->
|
||||
WorkManager.getInstance(context).getWorkInfoByIdLiveData(workId).observe(context, Observer { workInfo ->
|
||||
if (workInfo != null) {
|
||||
if (workInfo.state == WorkInfo.State.SUCCEEDED) {
|
||||
manager?.retry()
|
||||
|
@ -155,7 +155,7 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onMessageReceivedInternal() failed : " + e.message)
|
||||
Timber.e(e, "## onMessageReceivedInternal() failed")
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,17 +234,11 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
|
||||
}
|
||||
|
||||
private fun findRoomNameBestEffort(data: Map<String, String>, session: Session?): String? {
|
||||
val roomName: String? = data["room_name"]
|
||||
var roomName: String? = data["room_name"]
|
||||
val roomId = data["room_id"]
|
||||
if (null == roomName && null != roomId) {
|
||||
// Try to get the room name from our store
|
||||
/*
|
||||
TODO
|
||||
if (session?.dataHandler?.store?.isReady == true) {
|
||||
val room = session.getRoom(roomId)
|
||||
roomName = room?.getRoomDisplayName(this)
|
||||
}
|
||||
*/
|
||||
roomName = session?.getRoom(roomId)?.roomSummary()?.displayName
|
||||
}
|
||||
return roomName
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ object FcmHelper {
|
||||
storeFcmToken(activity, instanceIdResult.token)
|
||||
pushersManager.registerPusherWithFcmKey(instanceIdResult.token)
|
||||
}
|
||||
.addOnFailureListener(activity) { e -> Timber.e(e, "## ensureFcmTokenIsRetrieved() : failed " + e.message) }
|
||||
.addOnFailureListener(activity) { e -> Timber.e(e, "## ensureFcmTokenIsRetrieved() : failed") }
|
||||
} catch (e: Throwable) {
|
||||
Timber.e(e, "## ensureFcmTokenIsRetrieved() : failed " + e.message)
|
||||
Timber.e(e, "## ensureFcmTokenIsRetrieved() : failed")
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -102,10 +102,12 @@ object FcmHelper {
|
||||
return resultCode == ConnectionResult.SUCCESS
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun onEnterForeground(context: Context) {
|
||||
// No op
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun onEnterBackground(context: Context, vectorPreferences: VectorPreferences, activeSessionHolder: ActiveSessionHolder) {
|
||||
// TODO FCM fallback
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ class VectorApplication : Application(), HasVectorInjector, MatrixConfiguration.
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
vectorConfiguration.onConfigurationChanged(newConfig)
|
||||
vectorConfiguration.onConfigurationChanged()
|
||||
}
|
||||
|
||||
private fun getFontThreadHandler(): Handler {
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.core.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import im.vector.riotx.R
|
||||
|
||||
internal abstract class DialogAdapter(context: Context) : ArrayAdapter<DialogListItem>(context, R.layout.item_dialog) {
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||
val view: View
|
||||
if (convertView == null) {
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_dialog, parent, false)
|
||||
view.tag = DialogListItemHolder(view)
|
||||
} else {
|
||||
view = convertView
|
||||
}
|
||||
with(view.tag as DialogListItemHolder) {
|
||||
icon.setImageResource(getItem(position).iconRes)
|
||||
text.setText(getItem(position).titleRes)
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.core.dialogs
|
||||
|
||||
import android.content.Context
|
||||
|
||||
internal class DialogCallAdapter(context: Context) : DialogAdapter(context) {
|
||||
|
||||
init {
|
||||
add(DialogListItem.StartVoiceCall)
|
||||
add(DialogListItem.StartVideoCall)
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.core.dialogs
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import im.vector.riotx.R
|
||||
|
||||
internal sealed class DialogListItem(@DrawableRes val iconRes: Int,
|
||||
@StringRes val titleRes: Int) {
|
||||
|
||||
object StartVoiceCall : DialogListItem(R.drawable.voice_call_green, R.string.action_voice_call)
|
||||
object StartVideoCall : DialogListItem(R.drawable.video_call_green, R.string.action_video_call)
|
||||
|
||||
object SendFile : DialogListItem(R.drawable.ic_material_file, R.string.option_send_files)
|
||||
object SendVoice : DialogListItem(R.drawable.vector_micro_green, R.string.option_send_voice)
|
||||
object SendSticker : DialogListItem(R.drawable.ic_send_sticker, R.string.option_send_sticker)
|
||||
object TakePhoto : DialogListItem(R.drawable.ic_material_camera, R.string.option_take_photo)
|
||||
object TakeVideo : DialogListItem(R.drawable.ic_material_videocam, R.string.option_take_video)
|
||||
object TakePhotoVideo : DialogListItem(R.drawable.ic_material_camera, R.string.option_take_photo_video)
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.core.dialogs
|
||||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import im.vector.riotx.R
|
||||
|
||||
class DialogListItemHolder(view: View) {
|
||||
|
||||
@BindView(R.id.adapter_item_dialog_icon)
|
||||
lateinit var icon: ImageView
|
||||
|
||||
@BindView(R.id.adapter_item_dialog_text)
|
||||
lateinit var text: TextView
|
||||
|
||||
init {
|
||||
ButterKnife.bind(this, view)
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.riotx.core.dialogs
|
||||
|
||||
import android.content.Context
|
||||
|
||||
internal class DialogSendItemAdapter(context: Context, items: MutableList<DialogListItem>) : DialogAdapter(context) {
|
||||
|
||||
init {
|
||||
addAll(items)
|
||||
}
|
||||
}
|
@ -17,8 +17,8 @@
|
||||
package im.vector.riotx.core.error
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.text.HtmlCompat
|
||||
import im.vector.matrix.android.api.failure.MatrixError
|
||||
import im.vector.riotx.R
|
||||
import me.gujun.android.span.span
|
||||
@ -46,7 +46,7 @@ class ResourceLimitErrorFormatter(private val context: Context) {
|
||||
val contact = if (clickable && matrixError.adminUri != null) {
|
||||
val contactSubString = uriAsLink(matrixError.adminUri!!)
|
||||
val contactFullString = context.getString(mode.contactRes, contactSubString)
|
||||
Html.fromHtml(contactFullString)
|
||||
HtmlCompat.fromHtml(contactFullString, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
} else {
|
||||
val contactSubString = context.getString(R.string.resource_limit_contact_admin)
|
||||
context.getString(mode.contactRes, contactSubString)
|
||||
|
@ -39,7 +39,7 @@ fun EditText.setupAsSearch(@DrawableRes searchIconRes: Int = R.drawable.ic_filte
|
||||
maxLines = 1
|
||||
inputType = InputType.TYPE_CLASS_TEXT
|
||||
imeOptions = EditorInfo.IME_ACTION_SEARCH
|
||||
setOnEditorActionListener { _, actionId, event ->
|
||||
setOnEditorActionListener { _, actionId, _ ->
|
||||
var consumed = false
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
hideKeyboard()
|
||||
|
@ -61,8 +61,11 @@ class ImageTools @Inject constructor(private val context: Context) {
|
||||
}
|
||||
} else if (uri.scheme == "file") {
|
||||
try {
|
||||
val exif = ExifInterface(uri.path)
|
||||
orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)
|
||||
val path = uri.path
|
||||
if (path != null) {
|
||||
val exif = ExifInterface(path)
|
||||
orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Cannot get EXIF for file uri $uri")
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import androidx.preference.PreferenceViewHolder
|
||||
import im.vector.riotx.R
|
||||
|
||||
// TODO Replace by real Bingrule class, then delete
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
class BingRule(rule: BingRule) {
|
||||
fun shouldNotNotify() = false
|
||||
fun shouldNotify() = false
|
||||
@ -216,7 +217,7 @@ class BingRulePreference : VectorPreference {
|
||||
}
|
||||
}
|
||||
|
||||
radioGroup?.setOnCheckedChangeListener { group, checkedId ->
|
||||
radioGroup?.setOnCheckedChangeListener { _, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.bingPreferenceRadioBingRuleOff -> {
|
||||
onPreferenceChangeListener?.onPreferenceChange(this, NOTIFICATION_OFF_INDEX)
|
||||
|
@ -47,7 +47,7 @@ class VectorEditTextPreference : EditTextPreference {
|
||||
try {
|
||||
holder.itemView.findViewById<TextView>(android.R.id.title)?.setSingleLine(false)
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "onBindView " + e.message)
|
||||
Timber.e(e, "onBindView")
|
||||
}
|
||||
|
||||
super.onBindViewHolder(holder)
|
||||
|
@ -41,16 +41,8 @@ open class VectorPreference : Preference {
|
||||
|
||||
var mTypeface = Typeface.NORMAL
|
||||
|
||||
// long press listener
|
||||
/**
|
||||
* Returns the callback to be invoked when this Preference is long clicked.
|
||||
*
|
||||
* @return The callback to be invoked.
|
||||
*/
|
||||
/**
|
||||
* Sets the callback to be invoked when this Preference is long clicked.
|
||||
*
|
||||
* @param onPreferenceLongClickListener The callback to be invoked.
|
||||
* Callback to be invoked when this Preference is long clicked.
|
||||
*/
|
||||
var onPreferenceLongClickListener: OnPreferenceLongClickListener? = null
|
||||
|
||||
@ -112,13 +104,13 @@ open class VectorPreference : Preference {
|
||||
currentHighlightAnimator = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo).apply {
|
||||
duration = 250 // milliseconds
|
||||
addUpdateListener { animator ->
|
||||
itemView?.setBackgroundColor(animator.animatedValue as Int)
|
||||
itemView.setBackgroundColor(animator.animatedValue as Int)
|
||||
}
|
||||
doOnEnd {
|
||||
currentHighlightAnimator = ValueAnimator.ofObject(ArgbEvaluator(), colorTo, colorFrom).apply {
|
||||
duration = 250 // milliseconds
|
||||
addUpdateListener { animator ->
|
||||
itemView?.setBackgroundColor(animator.animatedValue as Int)
|
||||
itemView.setBackgroundColor(animator.animatedValue as Int)
|
||||
}
|
||||
doOnEnd {
|
||||
isHighlighted = false
|
||||
|
@ -36,7 +36,7 @@ class AppNameProvider @Inject constructor(private val context: Context) {
|
||||
}
|
||||
return appName
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## AppNameProvider() : failed " + e.message)
|
||||
Timber.e(e, "## AppNameProvider() : failed")
|
||||
return "RiotXAndroid"
|
||||
}
|
||||
}
|
||||
|
@ -64,14 +64,14 @@ data class Resource(
|
||||
/**
|
||||
* Get a resource stream and metadata about it given its URI returned from onActivityResult.
|
||||
*
|
||||
* @param context the context.
|
||||
* @param uri the URI
|
||||
* @param mimetype the mimetype
|
||||
* @param context the context.
|
||||
* @param uri the URI
|
||||
* @param providedMimetype the mimetype
|
||||
* @return a [Resource] encapsulating the opened resource stream and associated metadata
|
||||
* or `null` if opening the resource stream failed.
|
||||
*/
|
||||
fun openResource(context: Context, uri: Uri, mimetype: String?): Resource? {
|
||||
var mimetype = mimetype
|
||||
fun openResource(context: Context, uri: Uri, providedMimetype: String?): Resource? {
|
||||
var mimetype = providedMimetype
|
||||
try {
|
||||
// if the mime type is not provided, try to find it out
|
||||
if (TextUtils.isEmpty(mimetype)) {
|
||||
@ -86,9 +86,7 @@ fun openResource(context: Context, uri: Uri, mimetype: String?): Resource? {
|
||||
}
|
||||
}
|
||||
|
||||
return Resource(
|
||||
context.contentResolver.openInputStream(uri),
|
||||
mimetype)
|
||||
return Resource(context.contentResolver.openInputStream(uri), mimetype)
|
||||
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Failed to open resource input stream")
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package im.vector.riotx.core.services
|
||||
|
||||
import android.content.Context
|
||||
|
@ -243,7 +243,7 @@ fun shareMedia(context: Context, file: File, mediaMimeType: String?) {
|
||||
try {
|
||||
mediaUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileProvider", file)
|
||||
} catch (e: Exception) {
|
||||
Timber.e("onMediaAction Selected File cannot be shared " + e.message)
|
||||
Timber.e(e, "onMediaAction Selected File cannot be shared")
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ import java.util.*
|
||||
fun isIgnoringBatteryOptimizations(context: Context): Boolean {
|
||||
// no issue before Android M, battery optimisations did not exist
|
||||
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|
||||
|| (context.getSystemService(Context.POWER_SERVICE) as PowerManager?)?.isIgnoringBatteryOptimizations(context.packageName) == true
|
||||
|| (context.getSystemService(Context.POWER_SERVICE) as PowerManager?)?.isIgnoringBatteryOptimizations(context.packageName) == true
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ fun requestDisablingBatteryOptimization(activity: Activity, fragment: Fragment?,
|
||||
* @param context the context
|
||||
* @param text the text to copy
|
||||
*/
|
||||
fun copyToClipboard(context: Context, text: CharSequence, showToast: Boolean = true, @StringRes toastMessage : Int = R.string.copied_to_clipboard) {
|
||||
fun copyToClipboard(context: Context, text: CharSequence, showToast: Boolean = true, @StringRes toastMessage: Int = R.string.copied_to_clipboard) {
|
||||
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboard.primaryClip = ClipData.newPlainText("", text)
|
||||
if (showToast) {
|
||||
@ -92,19 +92,16 @@ fun copyToClipboard(context: Context, text: CharSequence, showToast: Boolean = t
|
||||
* @return the device locale
|
||||
*/
|
||||
fun getDeviceLocale(context: Context): Locale {
|
||||
var locale: Locale
|
||||
|
||||
locale = try {
|
||||
return try {
|
||||
val packageManager = context.packageManager
|
||||
val resources = packageManager.getResourcesForApplication("android")
|
||||
@Suppress("DEPRECATION")
|
||||
resources.configuration.locale
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## getDeviceLocale() failed " + e.message)
|
||||
Timber.e(e, "## getDeviceLocale() failed")
|
||||
// Fallback to application locale
|
||||
VectorLocale.applicationLocale
|
||||
}
|
||||
|
||||
return locale
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package im.vector.riotx.features.badge
|
||||
|
||||
import android.content.Context
|
||||
|
@ -49,7 +49,7 @@ object CommandParser {
|
||||
try {
|
||||
messageParts = textMessage.split("\\s+".toRegex()).dropLastWhile { it.isEmpty() }
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## manageSplashCommand() : split failed " + e.message)
|
||||
Timber.e(e, "## manageSplashCommand() : split failed")
|
||||
}
|
||||
|
||||
// test if the string cut fails
|
||||
|
@ -34,7 +34,7 @@ import javax.inject.Inject
|
||||
class VectorConfiguration @Inject constructor(private val context: Context) {
|
||||
|
||||
// TODO Import mLanguageReceiver From Riot?
|
||||
fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
fun onConfigurationChanged() {
|
||||
if (Locale.getDefault().toString() != VectorLocale.applicationLocale.toString()) {
|
||||
Timber.v("## onConfigurationChanged() : the locale has been updated to " + Locale.getDefault().toString()
|
||||
+ ", restore the expected value " + VectorLocale.applicationLocale.toString())
|
||||
@ -51,8 +51,10 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
|
||||
Locale.setDefault(locale)
|
||||
|
||||
val config = Configuration(context.resources.configuration)
|
||||
@Suppress("DEPRECATION")
|
||||
config.locale = locale
|
||||
config.fontScale = FontScale.getFontScale(context)
|
||||
@Suppress("DEPRECATION")
|
||||
context.resources.updateConfiguration(config, context.resources.displayMetrics)
|
||||
|
||||
ThemeUtils.setApplicationTheme(context, theme)
|
||||
@ -82,8 +84,10 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
|
||||
|
||||
Locale.setDefault(locale)
|
||||
val config = Configuration(context.resources.configuration)
|
||||
@Suppress("DEPRECATION")
|
||||
config.locale = locale
|
||||
config.fontScale = fontScale
|
||||
@Suppress("DEPRECATION")
|
||||
context.resources.updateConfiguration(config, context.resources.displayMetrics)
|
||||
|
||||
// init the theme
|
||||
@ -119,10 +123,12 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
|
||||
configuration.setLayoutDirection(locale)
|
||||
return context.createConfigurationContext(configuration)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
configuration.locale = locale
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
configuration.setLayoutDirection(locale)
|
||||
}
|
||||
@Suppress("DEPRECATION")
|
||||
resources.updateConfiguration(configuration, resources.displayMetrics)
|
||||
return context
|
||||
}
|
||||
@ -135,7 +141,6 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
|
||||
|
||||
/**
|
||||
* Compute the locale status value
|
||||
* @param activity the activity
|
||||
* @return the local status value
|
||||
*/
|
||||
// TODO Create data class for this
|
||||
|
@ -84,9 +84,9 @@ class KeysBackupRestoreFromKeyViewModel @Inject constructor() : ViewModel() {
|
||||
}
|
||||
},
|
||||
object : MatrixCallback<ImportRoomKeysResult> {
|
||||
override fun onSuccess(info: ImportRoomKeysResult) {
|
||||
override fun onSuccess(data: ImportRoomKeysResult) {
|
||||
sharedViewModel.loadingEvent.value = null
|
||||
sharedViewModel.didRecoverSucceed(info)
|
||||
sharedViewModel.didRecoverSucceed(data)
|
||||
|
||||
KeysBackupBanner.onRecoverDoneForVersion(context, keysVersionResult.version!!)
|
||||
trustOnDecrypt(keysBackup, keysVersionResult)
|
||||
|
@ -148,7 +148,7 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() {
|
||||
AlertDialog.Builder(this@KeysBackupSetupActivity)
|
||||
.setMessage(getString(R.string.encryption_export_saved_as, data))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.ok) { dialog, which ->
|
||||
.setPositiveButton(R.string.ok) { _, _ ->
|
||||
val resultIntent = Intent()
|
||||
resultIntent.putExtra(MANUAL_EXPORT, true)
|
||||
setResult(RESULT_OK, resultIntent)
|
||||
|
@ -139,7 +139,7 @@ class KeysBackupSetupSharedViewModel @Inject constructor() : ViewModel() {
|
||||
loadingStatus.value = null
|
||||
|
||||
isCreatingBackupVersion.value = false
|
||||
prepareRecoverFailError.value = failure ?: Exception()
|
||||
prepareRecoverFailError.value = failure
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ import im.vector.matrix.android.api.session.room.timeline.getLastMessageContent
|
||||
import im.vector.matrix.android.api.session.user.model.User
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
import im.vector.riotx.core.dialogs.DialogListItem
|
||||
import im.vector.riotx.core.epoxy.LayoutManagerStateRestorer
|
||||
import im.vector.riotx.core.error.ErrorFormatter
|
||||
import im.vector.riotx.core.extensions.hideKeyboard
|
||||
@ -642,6 +641,7 @@ class RoomDetailFragment :
|
||||
inviteView.callback = this
|
||||
}
|
||||
|
||||
/*
|
||||
private fun onSendChoiceClicked(dialogListItem: DialogListItem) {
|
||||
Timber.v("On send choice clicked: $dialogListItem")
|
||||
when (dialogListItem) {
|
||||
@ -668,7 +668,7 @@ class RoomDetailFragment :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
private fun handleMediaIntent(data: Intent) {
|
||||
val files: ArrayList<MediaFile> = data.getParcelableArrayListExtra(FilePickerActivity.MEDIA_FILES)
|
||||
roomDetailViewModel.process(RoomDetailActions.SendMedia(files))
|
||||
|
@ -46,7 +46,6 @@ import im.vector.matrix.android.api.session.room.model.tombstone.RoomTombstoneCo
|
||||
import im.vector.matrix.android.api.session.room.send.UserDraft
|
||||
import im.vector.matrix.android.api.session.room.timeline.TimelineSettings
|
||||
import im.vector.matrix.android.api.session.room.timeline.getTextEditableContent
|
||||
import im.vector.matrix.android.api.util.Optional
|
||||
import im.vector.matrix.android.internal.crypto.attachments.toElementToDecrypt
|
||||
import im.vector.matrix.android.internal.crypto.model.event.EncryptedEventContent
|
||||
import im.vector.matrix.rx.rx
|
||||
@ -64,8 +63,6 @@ import im.vector.riotx.features.command.CommandParser
|
||||
import im.vector.riotx.features.command.ParsedCommand
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineDisplayableEvents
|
||||
import im.vector.riotx.features.settings.VectorPreferences
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.functions.BiFunction
|
||||
import io.reactivex.rxkotlin.subscribeBy
|
||||
import org.commonmark.parser.Parser
|
||||
import org.commonmark.renderer.html.HtmlRenderer
|
||||
@ -75,21 +72,28 @@ import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: RoomDetailViewState,
|
||||
private val userPreferencesProvider: UserPreferencesProvider,
|
||||
userPreferencesProvider: UserPreferencesProvider,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val imageTools: ImageTools,
|
||||
private val session: Session
|
||||
) : VectorViewModel<RoomDetailViewState>(initialState) {
|
||||
|
||||
private val room = session.getRoom(initialState.roomId)!!
|
||||
private val roomId = initialState.roomId
|
||||
private val eventId = initialState.eventId
|
||||
private val invisibleEventsObservable = BehaviorRelay.create<RoomDetailActions.TimelineEventTurnsInvisible>()
|
||||
private val visibleEventsObservable = BehaviorRelay.create<RoomDetailActions.TimelineEventTurnsVisible>()
|
||||
private val timelineSettings = if (userPreferencesProvider.shouldShowHiddenEvents()) {
|
||||
TimelineSettings(30, false, true, TimelineDisplayableEvents.DEBUG_DISPLAYABLE_TYPES, userPreferencesProvider.shouldShowReadReceipts())
|
||||
TimelineSettings(30,
|
||||
filterEdits = false,
|
||||
filterTypes = true,
|
||||
allowedTypes = TimelineDisplayableEvents.DEBUG_DISPLAYABLE_TYPES,
|
||||
buildReadReceipts = userPreferencesProvider.shouldShowReadReceipts())
|
||||
} else {
|
||||
TimelineSettings(30, true, true, TimelineDisplayableEvents.DISPLAYABLE_TYPES, userPreferencesProvider.shouldShowReadReceipts())
|
||||
TimelineSettings(30,
|
||||
filterEdits = true,
|
||||
filterTypes = true,
|
||||
allowedTypes = TimelineDisplayableEvents.DISPLAYABLE_TYPES,
|
||||
buildReadReceipts = userPreferencesProvider.shouldShowReadReceipts())
|
||||
}
|
||||
|
||||
private var timeline = room.createTimeline(eventId, timelineSettings)
|
||||
@ -152,7 +156,6 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
is RoomDetailActions.ResendAll -> handleResendAll()
|
||||
is RoomDetailActions.SetReadMarkerAction -> handleSetReadMarkerAction(action)
|
||||
is RoomDetailActions.MarkAllAsRead -> handleMarkAllAsRead()
|
||||
else -> Timber.e("Unhandled Action: $action")
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,23 +186,23 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
copy(
|
||||
// Create a sendMode from a draft and retrieve the TimelineEvent
|
||||
sendMode = when (draft) {
|
||||
is UserDraft.REGULAR -> SendMode.REGULAR(draft.text)
|
||||
is UserDraft.QUOTE -> {
|
||||
room.getTimeLineEvent(draft.linkedEventId)?.let { timelineEvent ->
|
||||
SendMode.QUOTE(timelineEvent, draft.text)
|
||||
}
|
||||
}
|
||||
is UserDraft.REPLY -> {
|
||||
room.getTimeLineEvent(draft.linkedEventId)?.let { timelineEvent ->
|
||||
SendMode.REPLY(timelineEvent, draft.text)
|
||||
}
|
||||
}
|
||||
is UserDraft.EDIT -> {
|
||||
room.getTimeLineEvent(draft.linkedEventId)?.let { timelineEvent ->
|
||||
SendMode.EDIT(timelineEvent, draft.text)
|
||||
}
|
||||
}
|
||||
} ?: SendMode.REGULAR("")
|
||||
is UserDraft.REGULAR -> SendMode.REGULAR(draft.text)
|
||||
is UserDraft.QUOTE -> {
|
||||
room.getTimeLineEvent(draft.linkedEventId)?.let { timelineEvent ->
|
||||
SendMode.QUOTE(timelineEvent, draft.text)
|
||||
}
|
||||
}
|
||||
is UserDraft.REPLY -> {
|
||||
room.getTimeLineEvent(draft.linkedEventId)?.let { timelineEvent ->
|
||||
SendMode.REPLY(timelineEvent, draft.text)
|
||||
}
|
||||
}
|
||||
is UserDraft.EDIT -> {
|
||||
room.getTimeLineEvent(draft.linkedEventId)?.let { timelineEvent ->
|
||||
SendMode.EDIT(timelineEvent, draft.text)
|
||||
}
|
||||
}
|
||||
} ?: SendMode.REGULAR("")
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -208,7 +211,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
|
||||
private fun handleTombstoneEvent(action: RoomDetailActions.HandleTombstoneEvent) {
|
||||
val tombstoneContent = action.event.getClearContent().toModel<RoomTombstoneContent>()
|
||||
?: return
|
||||
?: return
|
||||
|
||||
val roomId = tombstoneContent.replacementRoom ?: ""
|
||||
val isRoomJoined = session.getRoom(roomId)?.roomSummary()?.membership == Membership.JOIN
|
||||
@ -268,9 +271,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
withState { state ->
|
||||
when (state.sendMode) {
|
||||
is SendMode.REGULAR -> {
|
||||
val slashCommandResult = CommandParser.parseSplashCommand(action.text)
|
||||
|
||||
when (slashCommandResult) {
|
||||
when (val slashCommandResult = CommandParser.parseSplashCommand(action.text)) {
|
||||
is ParsedCommand.ErrorNotACommand -> {
|
||||
// Send the text message to the room
|
||||
room.sendTextMessage(action.text, autoMarkdown = action.autoMarkdown)
|
||||
@ -342,7 +343,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
is SendMode.EDIT -> {
|
||||
//is original event a reply?
|
||||
val inReplyTo = state.sendMode.timelineEvent.root.getClearContent().toModel<MessageContent>()?.relatesTo?.inReplyTo?.eventId
|
||||
?: state.sendMode.timelineEvent.root.content.toModel<EncryptedEventContent>()?.relatesTo?.inReplyTo?.eventId
|
||||
?: state.sendMode.timelineEvent.root.content.toModel<EncryptedEventContent>()?.relatesTo?.inReplyTo?.eventId
|
||||
if (inReplyTo != null) {
|
||||
//TODO check if same content?
|
||||
room.getTimeLineEvent(inReplyTo)?.let {
|
||||
@ -351,13 +352,13 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
} else {
|
||||
val messageContent: MessageContent? =
|
||||
state.sendMode.timelineEvent.annotations?.editSummary?.aggregatedContent.toModel()
|
||||
?: state.sendMode.timelineEvent.root.getClearContent().toModel()
|
||||
?: state.sendMode.timelineEvent.root.getClearContent().toModel()
|
||||
val existingBody = messageContent?.body ?: ""
|
||||
if (existingBody != action.text) {
|
||||
room.editTextMessage(state.sendMode.timelineEvent.root.eventId ?: "",
|
||||
messageContent?.type ?: MessageType.MSGTYPE_TEXT,
|
||||
action.text,
|
||||
action.autoMarkdown)
|
||||
messageContent?.type ?: MessageType.MSGTYPE_TEXT,
|
||||
action.text,
|
||||
action.autoMarkdown)
|
||||
} else {
|
||||
Timber.w("Same message content, do not send edition")
|
||||
}
|
||||
@ -368,7 +369,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
is SendMode.QUOTE -> {
|
||||
val messageContent: MessageContent? =
|
||||
state.sendMode.timelineEvent.annotations?.editSummary?.aggregatedContent.toModel()
|
||||
?: state.sendMode.timelineEvent.root.getClearContent().toModel()
|
||||
?: state.sendMode.timelineEvent.root.getClearContent().toModel()
|
||||
val textMsg = messageContent?.body
|
||||
|
||||
val finalText = legacyRiotQuoteText(textMsg, action.text)
|
||||
@ -403,10 +404,10 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
|
||||
private fun legacyRiotQuoteText(quotedText: String?, myText: String): String {
|
||||
val messageParagraphs = quotedText?.split("\n\n".toRegex())?.dropLastWhile { it.isEmpty() }?.toTypedArray()
|
||||
var quotedTextMsg = StringBuilder()
|
||||
val quotedTextMsg = StringBuilder()
|
||||
if (messageParagraphs != null) {
|
||||
for (i in messageParagraphs.indices) {
|
||||
if (messageParagraphs[i].trim({ it <= ' ' }) != "") {
|
||||
if (messageParagraphs[i].trim { it <= ' ' } != "") {
|
||||
quotedTextMsg.append("> ").append(messageParagraphs[i])
|
||||
}
|
||||
|
||||
@ -415,8 +416,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
}
|
||||
}
|
||||
}
|
||||
val finalText = "$quotedTextMsg\n\n$myText"
|
||||
return finalText
|
||||
return "$quotedTextMsg\n\n$myText"
|
||||
}
|
||||
|
||||
private fun handleChangeTopicSlashCommand(changeTopic: ParsedCommand.ChangeTopic) {
|
||||
@ -654,12 +654,12 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
Timber.e("Cannot resend message, it is not failed, Cancel first")
|
||||
return
|
||||
}
|
||||
if (it.root.isTextMessage()) {
|
||||
room.resendTextMessage(it)
|
||||
} else if (it.root.isImageMessage()) {
|
||||
room.resendMediaMessage(it)
|
||||
} else {
|
||||
//TODO
|
||||
when {
|
||||
it.root.isTextMessage() -> room.resendTextMessage(it)
|
||||
it.root.isImageMessage() -> room.resendMediaMessage(it)
|
||||
else -> {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,7 +701,7 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
|
||||
.disposeOnClear()
|
||||
}
|
||||
|
||||
private fun handleSetReadMarkerAction(action: RoomDetailActions.SetReadMarkerAction) = withState { state ->
|
||||
private fun handleSetReadMarkerAction(action: RoomDetailActions.SetReadMarkerAction) = withState {
|
||||
var readMarkerId = action.eventId
|
||||
val indexOfEvent = timeline.getIndexOfEvent(readMarkerId)
|
||||
// force to set the read marker on the next event
|
||||
|
@ -32,6 +32,7 @@ import com.airbnb.epoxy.EpoxyModel
|
||||
import com.airbnb.epoxy.EpoxyTouchHelperCallback
|
||||
import com.airbnb.epoxy.EpoxyViewHolder
|
||||
import timber.log.Timber
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
class RoomMessageTouchHelperCallback(private val context: Context,
|
||||
@ -104,6 +105,7 @@ class RoomMessageTouchHelperCallback(private val context: Context,
|
||||
}
|
||||
|
||||
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun setTouchListener(c: Canvas,
|
||||
recyclerView: RecyclerView,
|
||||
@ -112,11 +114,11 @@ class RoomMessageTouchHelperCallback(private val context: Context,
|
||||
dY: Float,
|
||||
actionState: Int,
|
||||
isCurrentlyActive: Boolean) {
|
||||
//TODO can this interfer with other interactions? should i remove it
|
||||
recyclerView.setOnTouchListener { v, event ->
|
||||
//TODO can this interfere with other interactions? should i remove it
|
||||
recyclerView.setOnTouchListener { _, event ->
|
||||
swipeBack = event.action == MotionEvent.ACTION_CANCEL || event.action == MotionEvent.ACTION_UP
|
||||
if (swipeBack) {
|
||||
if (Math.abs(dX) >= triggerDistance) {
|
||||
if (abs(dX) >= triggerDistance) {
|
||||
try {
|
||||
viewHolder.model?.let { handler.performQuickReplyOnHolder(it) }
|
||||
} catch (e: IllegalStateException) {
|
||||
|
@ -31,6 +31,8 @@ import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
|
||||
import im.vector.riotx.core.date.VectorDateFormatter
|
||||
import im.vector.riotx.core.epoxy.LoadingItem_
|
||||
import im.vector.riotx.core.extensions.localDateTime
|
||||
import im.vector.riotx.core.utils.DimensionConverter
|
||||
import im.vector.riotx.features.home.AvatarRenderer
|
||||
import im.vector.riotx.features.home.room.detail.RoomDetailViewState
|
||||
import im.vector.riotx.features.home.room.detail.timeline.factory.MergedHeaderItemFactory
|
||||
import im.vector.riotx.features.home.room.detail.timeline.factory.TimelineItemFactory
|
||||
@ -38,8 +40,6 @@ import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineEventDi
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineEventVisibilityStateChangedListener
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.nextOrNull
|
||||
import im.vector.riotx.core.utils.DimensionConverter
|
||||
import im.vector.riotx.features.home.AvatarRenderer
|
||||
import im.vector.riotx.features.home.room.detail.timeline.item.*
|
||||
import im.vector.riotx.features.media.ImageContentRenderer
|
||||
import im.vector.riotx.features.media.VideoContentRenderer
|
||||
@ -327,7 +327,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||
* Return true if added
|
||||
*/
|
||||
private fun LoadingItem_.setVisibilityStateChangedListener(direction: Timeline.Direction): LoadingItem_ {
|
||||
return onVisibilityStateChanged { model, view, visibilityState ->
|
||||
return onVisibilityStateChanged { _, _, visibilityState ->
|
||||
if (visibilityState == VisibilityState.VISIBLE) {
|
||||
callback?.onLoadMore(direction)
|
||||
}
|
||||
|
@ -78,17 +78,13 @@ class MessageMenuFragment : VectorBaseFragment() {
|
||||
|
||||
private fun inflateActionView(action: SimpleAction, inflater: LayoutInflater, container: ViewGroup?): View? {
|
||||
return inflater.inflate(R.layout.adapter_item_action, container, false)?.apply {
|
||||
if (action.iconResId != null) {
|
||||
findViewById<ImageView>(R.id.action_icon)?.setImageResource(action.iconResId)
|
||||
} else {
|
||||
findViewById<ImageView>(R.id.action_icon)?.setImageDrawable(null)
|
||||
}
|
||||
findViewById<ImageView>(R.id.action_icon)?.setImageResource(action.iconResId)
|
||||
findViewById<TextView>(R.id.action_title)?.setText(action.titleRes)
|
||||
}
|
||||
}
|
||||
|
||||
private fun inflateSeparatorView(): View {
|
||||
val frame = FrameLayout(context)
|
||||
val frame = FrameLayout(requireContext())
|
||||
frame.setBackgroundColor(ThemeUtils.getColor(requireContext(), R.attr.vctr_list_divider_color))
|
||||
frame.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, requireContext().resources.displayMetrics.density.toInt())
|
||||
return frame
|
||||
|
@ -198,7 +198,7 @@ class MessageMenuViewModel @AssistedInject constructor(@Assisted initialState: M
|
||||
}
|
||||
}
|
||||
|
||||
private fun canCancel(event: TimelineEvent): Boolean {
|
||||
private fun canCancel(@Suppress("UNUSED_PARAMETER") event: TimelineEvent): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -28,15 +28,7 @@ import im.vector.matrix.android.api.permalinks.MatrixLinkify
|
||||
import im.vector.matrix.android.api.permalinks.MatrixPermalinkSpan
|
||||
import im.vector.matrix.android.api.session.events.model.RelationType
|
||||
import im.vector.matrix.android.api.session.events.model.toModel
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageAudioContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageEmoteContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageFileContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageImageContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageNoticeContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageTextContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.MessageVideoContent
|
||||
import im.vector.matrix.android.api.session.room.model.message.getFileUrl
|
||||
import im.vector.matrix.android.api.session.room.model.message.*
|
||||
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
|
||||
import im.vector.matrix.android.api.session.room.timeline.getLastMessageContent
|
||||
import im.vector.matrix.android.internal.crypto.attachments.toElementToDecrypt
|
||||
@ -47,17 +39,10 @@ import im.vector.riotx.core.linkify.VectorLinkify
|
||||
import im.vector.riotx.core.resources.ColorProvider
|
||||
import im.vector.riotx.core.resources.StringProvider
|
||||
import im.vector.riotx.core.utils.DebouncedClickListener
|
||||
import im.vector.riotx.core.utils.DimensionConverter
|
||||
import im.vector.riotx.core.utils.containsOnlyEmojis
|
||||
import im.vector.riotx.core.utils.isLocalFile
|
||||
import im.vector.riotx.features.home.AvatarRenderer
|
||||
import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.AvatarSizeProvider
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.*
|
||||
import im.vector.riotx.features.home.room.detail.timeline.item.*
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.MessageInformationDataFactory
|
||||
import im.vector.riotx.features.home.room.detail.timeline.helper.MessageItemAttributesFactory
|
||||
import im.vector.riotx.features.html.EventHtmlRenderer
|
||||
import im.vector.riotx.features.media.ImageContentRenderer
|
||||
import im.vector.riotx.features.media.VideoContentRenderer
|
||||
@ -130,6 +115,7 @@ class MessageItemFactory @Inject constructor(
|
||||
}
|
||||
|
||||
private fun buildAudioMessageItem(messageContent: MessageAudioContent,
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
informationData: MessageInformationData,
|
||||
highlight: Boolean,
|
||||
callback: TimelineEventController.Callback?,
|
||||
@ -162,7 +148,7 @@ class MessageItemFactory @Inject constructor(
|
||||
.filename(messageContent.body)
|
||||
.iconRes(R.drawable.filetype_attachment)
|
||||
.clickListener(
|
||||
DebouncedClickListener(View.OnClickListener { _ ->
|
||||
DebouncedClickListener(View.OnClickListener {
|
||||
callback?.onFileMessageClicked(informationData.eventId, messageContent)
|
||||
}))
|
||||
}
|
||||
@ -176,6 +162,7 @@ class MessageItemFactory @Inject constructor(
|
||||
}
|
||||
|
||||
private fun buildImageMessageItem(messageContent: MessageImageContent,
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
informationData: MessageInformationData,
|
||||
highlight: Boolean,
|
||||
callback: TimelineEventController.Callback?,
|
||||
@ -305,6 +292,7 @@ class MessageItemFactory @Inject constructor(
|
||||
}
|
||||
|
||||
private fun buildNoticeMessageItem(messageContent: MessageNoticeContent,
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
informationData: MessageInformationData,
|
||||
highlight: Boolean,
|
||||
callback: TimelineEventController.Callback?,
|
||||
|
@ -38,7 +38,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active
|
||||
EventType.STATE_ROOM_TOPIC -> formatRoomTopicEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName())
|
||||
EventType.STATE_ROOM_MEMBER -> formatRoomMemberEvent(timelineEvent.root, timelineEvent.senderName())
|
||||
EventType.STATE_HISTORY_VISIBILITY -> formatRoomHistoryVisibilityEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName())
|
||||
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName())
|
||||
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(timelineEvent.getDisambiguatedDisplayName())
|
||||
EventType.CALL_INVITE,
|
||||
EventType.CALL_HANGUP,
|
||||
EventType.CALL_ANSWER -> formatCallEvent(timelineEvent.root, timelineEvent.getDisambiguatedDisplayName())
|
||||
@ -61,7 +61,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active
|
||||
EventType.CALL_INVITE,
|
||||
EventType.CALL_HANGUP,
|
||||
EventType.CALL_ANSWER -> formatCallEvent(event, senderName)
|
||||
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(event, senderName)
|
||||
EventType.STATE_ROOM_TOMBSTONE -> formatRoomTombstoneEvent(senderName)
|
||||
else -> {
|
||||
Timber.v("Type $type not handled by this formatter")
|
||||
null
|
||||
@ -82,7 +82,7 @@ class NoticeEventFormatter @Inject constructor(private val sessionHolder: Active
|
||||
}
|
||||
}
|
||||
|
||||
private fun formatRoomTombstoneEvent(event: Event, senderName: String?): CharSequence? {
|
||||
private fun formatRoomTombstoneEvent(senderName: String?): CharSequence? {
|
||||
return stringProvider.getString(R.string.notice_room_update, senderName)
|
||||
}
|
||||
|
||||
|
@ -67,17 +67,17 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||
|
||||
override fun onUpdate(state: ContentUploadStateTracker.State) {
|
||||
when (state) {
|
||||
is ContentUploadStateTracker.State.Idle -> handleIdle(state)
|
||||
is ContentUploadStateTracker.State.EncryptingThumbnail -> handleEncryptingThumbnail(state)
|
||||
is ContentUploadStateTracker.State.Idle -> handleIdle()
|
||||
is ContentUploadStateTracker.State.EncryptingThumbnail -> handleEncryptingThumbnail()
|
||||
is ContentUploadStateTracker.State.UploadingThumbnail -> handleProgressThumbnail(state)
|
||||
is ContentUploadStateTracker.State.Encrypting -> handleEncrypting(state)
|
||||
is ContentUploadStateTracker.State.Encrypting -> handleEncrypting()
|
||||
is ContentUploadStateTracker.State.Uploading -> handleProgress(state)
|
||||
is ContentUploadStateTracker.State.Failure -> handleFailure(state)
|
||||
is ContentUploadStateTracker.State.Success -> handleSuccess(state)
|
||||
is ContentUploadStateTracker.State.Success -> handleSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleIdle(state: ContentUploadStateTracker.State.Idle) {
|
||||
private fun handleIdle() {
|
||||
if (isLocalFile) {
|
||||
progressLayout.isVisible = true
|
||||
val progressBar = progressLayout.findViewById<ProgressBar>(R.id.mediaProgressBar)
|
||||
@ -92,7 +92,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleEncryptingThumbnail(state: ContentUploadStateTracker.State.EncryptingThumbnail) {
|
||||
private fun handleEncryptingThumbnail() {
|
||||
doHandleEncrypting(R.string.send_file_step_encrypting_thumbnail)
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||
doHandleProgress(R.string.send_file_step_sending_thumbnail, state.current, state.total)
|
||||
}
|
||||
|
||||
private fun handleEncrypting(state: ContentUploadStateTracker.State.Encrypting) {
|
||||
private fun handleEncrypting() {
|
||||
doHandleEncrypting(R.string.send_file_step_encrypting_file)
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ private class ContentMediaProgressUpdater(private val progressLayout: ViewGroup,
|
||||
progressTextView?.setTextColor(colorProvider.getMessageTextColor(SendState.UNDELIVERED))
|
||||
}
|
||||
|
||||
private fun handleSuccess(state: ContentUploadStateTracker.State.Success) {
|
||||
private fun handleSuccess() {
|
||||
progressLayout.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class MessageItemAttributesFactory @Inject constructor(
|
||||
itemClickListener = DebouncedClickListener(View.OnClickListener { view ->
|
||||
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||
}),
|
||||
memberClickListener = DebouncedClickListener(View.OnClickListener { view ->
|
||||
memberClickListener = DebouncedClickListener(View.OnClickListener {
|
||||
callback?.onMemberNameClicked(informationData)
|
||||
}),
|
||||
reactionPillCallback = callback,
|
||||
|
@ -70,7 +70,7 @@ object ServerUrlsRepository {
|
||||
|
||||
return prefs.getString(HOME_SERVER_URL_PREF,
|
||||
prefs.getString(DEFAULT_REFERRER_HOME_SERVER_URL_PREF,
|
||||
getDefaultHomeServerUrl(context)))
|
||||
getDefaultHomeServerUrl(context))!!)!!
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package im.vector.riotx.features.html
|
||||
|
||||
import android.content.Context
|
||||
@ -101,7 +103,7 @@ class PillImageSpan(private val glideRequests: GlideRequests,
|
||||
private fun createChipDrawable(): ChipDrawable {
|
||||
val textPadding = context.resources.getDimension(R.dimen.pill_text_padding)
|
||||
return ChipDrawable.createFromResource(context, R.xml.pill_view).apply {
|
||||
setText(displayName)
|
||||
text = displayName
|
||||
textEndPadding = textPadding
|
||||
textStartPadding = textPadding
|
||||
setChipMinHeightResource(R.dimen.pill_min_height)
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package im.vector.riotx.features.login
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
@ -30,6 +32,7 @@ import android.webkit.WebViewClient
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import im.vector.matrix.android.api.auth.data.Credentials
|
||||
import im.vector.matrix.android.api.util.JsonDict
|
||||
import im.vector.matrix.android.internal.di.MoshiProvider
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
@ -128,8 +131,8 @@ class LoginSsoFallbackFragment : VectorBaseFragment(), OnBackPressed {
|
||||
error: SslError) {
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setMessage(R.string.ssl_could_not_verify)
|
||||
.setPositiveButton(R.string.ssl_trust) { dialog, which -> handler.proceed() }
|
||||
.setNegativeButton(R.string.ssl_do_not_trust) { dialog, which -> handler.cancel() }
|
||||
.setPositiveButton(R.string.ssl_trust) { _, _ -> handler.proceed() }
|
||||
.setNegativeButton(R.string.ssl_do_not_trust) { _, _ -> handler.cancel() }
|
||||
.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event ->
|
||||
if (event.action == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
handler.cancel()
|
||||
@ -224,7 +227,8 @@ class LoginSsoFallbackFragment : VectorBaseFragment(), OnBackPressed {
|
||||
|
||||
val adapter = MoshiProvider.providesMoshi().adapter(Map::class.java)
|
||||
|
||||
parameters = adapter.fromJson(json) as Map<String, Any>?
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
parameters = adapter.fromJson(json) as JsonDict?
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## shouldOverrideUrlLoading() : fromJson failed")
|
||||
}
|
||||
@ -236,6 +240,7 @@ class LoginSsoFallbackFragment : VectorBaseFragment(), OnBackPressed {
|
||||
if (mMode == Mode.MODE_LOGIN) {
|
||||
try {
|
||||
if (action == "onLogin") {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val credentials = parameters["credentials"] as Map<String, String>
|
||||
|
||||
val userId = credentials["user_id"]
|
||||
@ -245,7 +250,7 @@ class LoginSsoFallbackFragment : VectorBaseFragment(), OnBackPressed {
|
||||
|
||||
// check if the parameters are defined
|
||||
if (null != homeServer && null != userId && null != accessToken) {
|
||||
val credentials = Credentials(
|
||||
val safeCredentials = Credentials(
|
||||
userId = userId,
|
||||
accessToken = accessToken,
|
||||
homeServer = homeServer,
|
||||
@ -253,7 +258,7 @@ class LoginSsoFallbackFragment : VectorBaseFragment(), OnBackPressed {
|
||||
refreshToken = null
|
||||
)
|
||||
|
||||
viewModel.handle(LoginActions.SsoLoginSuccess(credentials))
|
||||
viewModel.handle(LoginActions.SsoLoginSuccess(safeCredentials))
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
@ -48,7 +48,7 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
|
||||
|
||||
@Inject lateinit var imageContentRenderer: ImageContentRenderer
|
||||
|
||||
lateinit var mediaData: ImageContentRenderer.Data
|
||||
private lateinit var mediaData: ImageContentRenderer.Data
|
||||
|
||||
override fun injectWith(injector: ScreenComponent) {
|
||||
injector.inject(this)
|
||||
@ -57,8 +57,8 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(im.vector.riotx.R.layout.activity_image_media_viewer)
|
||||
mediaData = intent.getParcelableExtra<ImageContentRenderer.Data>(EXTRA_MEDIA_DATA)
|
||||
intent.extras.getString(EXTRA_SHARED_TRANSITION_NAME)?.let {
|
||||
mediaData = intent.getParcelableExtra(EXTRA_MEDIA_DATA)
|
||||
intent.extras?.getString(EXTRA_SHARED_TRANSITION_NAME)?.let {
|
||||
ViewCompat.setTransitionName(imageTransitionView, it)
|
||||
}
|
||||
if (mediaData.url.isNullOrEmpty()) {
|
||||
|
@ -80,7 +80,7 @@ class DefaultNavigator @Inject constructor() : Navigator {
|
||||
}
|
||||
|
||||
override fun openSettings(context: Context) {
|
||||
val intent = VectorSettingsActivity.getIntent(context, "TODO")
|
||||
val intent = VectorSettingsActivity.getIntent(context)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,6 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||
//Can this happen? should we update notification?
|
||||
return
|
||||
}
|
||||
val matrixId = intent.getStringExtra(EXTRA_MATRIX_ID)
|
||||
activeSessionHolder.getActiveSession().let { session ->
|
||||
session.getRoom(roomId)?.let { room ->
|
||||
sendMatrixEvent(message, session, room, context)
|
||||
@ -203,6 +202,5 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||
companion object {
|
||||
const val KEY_ROOM_ID = "roomID"
|
||||
const val KEY_TEXT_REPLY = "key_text_reply"
|
||||
const val EXTRA_MATRIX_ID = "EXTRA_MATRIX_ID"
|
||||
}
|
||||
}
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package im.vector.riotx.features.notifications
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
@ -713,7 +715,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||
try {
|
||||
notificationManager.cancelAll()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## cancelAllNotifications() failed " + e.message)
|
||||
Timber.e(e, "## cancelAllNotifications() failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class BugReportActivity : VectorBaseActivity() {
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onUploadFailed() : failed to display the toast " + e.message)
|
||||
Timber.e(e, "## onUploadFailed() : failed to display the toast")
|
||||
}
|
||||
|
||||
bug_report_mask_view.isVisible = false
|
||||
@ -164,13 +164,13 @@ class BugReportActivity : VectorBaseActivity() {
|
||||
Toast.makeText(this@BugReportActivity, R.string.send_bug_report_sent, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the toast " + e.message)
|
||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the toast")
|
||||
}
|
||||
|
||||
try {
|
||||
finish()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the dialog " + e.message)
|
||||
Timber.e(e, "## onUploadSucceed() : failed to dismiss the dialog")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -36,9 +36,12 @@ import im.vector.riotx.core.utils.getDeviceLocale
|
||||
import im.vector.riotx.features.settings.VectorLocale
|
||||
import im.vector.riotx.features.themes.ThemeUtils
|
||||
import im.vector.riotx.features.version.VersionProvider
|
||||
import okhttp3.*
|
||||
import okhttp3.Call
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
import okhttp3.Response
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
@ -555,10 +558,13 @@ class BugReporter @Inject constructor(private val activeSessionHolder: ActiveSes
|
||||
return null
|
||||
}
|
||||
// refresh it
|
||||
@Suppress("DEPRECATION")
|
||||
rootView.isDrawingCacheEnabled = false
|
||||
@Suppress("DEPRECATION")
|
||||
rootView.isDrawingCacheEnabled = true
|
||||
|
||||
try {
|
||||
@Suppress("DEPRECATION")
|
||||
var bitmap = rootView.drawingCache
|
||||
|
||||
// Make a copy, because if Activity is destroyed, the bitmap will be recycled
|
||||
|
@ -124,7 +124,7 @@ class VectorFileLogger @Inject constructor(val context: Context, private val vec
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## addLogFiles() failed : %s", e.message)
|
||||
Timber.e(e, "## addLogFiles() failed")
|
||||
}
|
||||
|
||||
return files
|
||||
|
@ -39,7 +39,7 @@ import javax.inject.Inject
|
||||
/**
|
||||
*
|
||||
* TODO: Loading indicator while getting emoji data source?
|
||||
* TODO: migrate to maverick
|
||||
* TODO: migrate to MvRx
|
||||
* TODO: Finish Refactor to vector base activity
|
||||
* TODO: Move font request to app
|
||||
*/
|
||||
@ -58,15 +58,15 @@ class EmojiReactionPickerActivity : VectorBaseActivity(), EmojiCompatFontProvide
|
||||
|
||||
@Inject lateinit var emojiCompatFontProvider: EmojiCompatFontProvider
|
||||
|
||||
private var tabLayoutSelectionListener = object : TabLayout.BaseOnTabSelectedListener<TabLayout.Tab> {
|
||||
override fun onTabReselected(p0: TabLayout.Tab) {
|
||||
private var tabLayoutSelectionListener = object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabReselected(tab: TabLayout.Tab) {
|
||||
}
|
||||
|
||||
override fun onTabUnselected(p0: TabLayout.Tab) {
|
||||
override fun onTabUnselected(tab: TabLayout.Tab) {
|
||||
}
|
||||
|
||||
override fun onTabSelected(p0: TabLayout.Tab) {
|
||||
viewModel.scrollToSection(p0.position)
|
||||
override fun onTabSelected(tab: TabLayout.Tab) {
|
||||
viewModel.scrollToSection(tab.position)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ class EmojiRecyclerAdapter(private val dataSource: EmojiDataSource? = null,
|
||||
private fun isSection(position: Int): Boolean {
|
||||
dataSource?.rawData?.categories?.let { categories ->
|
||||
var sectionOffset = 1
|
||||
var lastItemInSection = 0
|
||||
var lastItemInSection: Int
|
||||
for (category in categories) {
|
||||
lastItemInSection = sectionOffset + category.emojis.size - 1
|
||||
if (position == sectionOffset - 1) return true
|
||||
@ -164,7 +164,7 @@ class EmojiRecyclerAdapter(private val dataSource: EmojiDataSource? = null,
|
||||
|
||||
private fun getSectionForAbsoluteIndex(position: Int): Int {
|
||||
var sectionOffset = 1
|
||||
var lastItemInSection = 0
|
||||
var lastItemInSection: Int
|
||||
var index = 0
|
||||
dataSource?.rawData?.categories?.let {
|
||||
for (category in it) {
|
||||
@ -180,7 +180,7 @@ class EmojiRecyclerAdapter(private val dataSource: EmojiDataSource? = null,
|
||||
private fun getSectionOffset(section: Int): Int {
|
||||
//Todo cache this for fast access
|
||||
var sectionOffset = 1
|
||||
var lastItemInSection = 0
|
||||
var lastItemInSection: Int
|
||||
dataSource?.rawData?.categories?.let {
|
||||
for ((index, category) in it.withIndex()) {
|
||||
lastItemInSection = sectionOffset + category.emojis.size - 1
|
||||
@ -296,12 +296,18 @@ class EmojiRecyclerAdapter(private val dataSource: EmojiDataSource? = null,
|
||||
private val staticLayoutCache = HashMap<String, StaticLayout>()
|
||||
|
||||
private fun getStaticLayoutForEmoji(emoji: String): StaticLayout {
|
||||
var cachedLayout = staticLayoutCache[emoji]
|
||||
if (cachedLayout == null) {
|
||||
cachedLayout = StaticLayout(emoji, EmojiDrawView.tPaint, EmojiDrawView.emojiSize, Layout.Alignment.ALIGN_CENTER, 1f, 0f, true)
|
||||
staticLayoutCache[emoji] = cachedLayout
|
||||
return staticLayoutCache.getOrPut(emoji) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
StaticLayout.Builder.obtain(emoji, 0, emoji.length, EmojiDrawView.tPaint, EmojiDrawView.emojiSize)
|
||||
.setAlignment(Layout.Alignment.ALIGN_CENTER)
|
||||
.setLineSpacing(0f, 1f)
|
||||
.setIncludePad(true)
|
||||
.build()
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
StaticLayout(emoji, EmojiDrawView.tPaint, EmojiDrawView.emojiSize, Layout.Alignment.ALIGN_CENTER, 1f, 0f, true)
|
||||
}
|
||||
}
|
||||
return cachedLayout
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,6 +330,7 @@ class EmojiRecyclerAdapter(private val dataSource: EmojiDataSource? = null,
|
||||
//TODO better
|
||||
if (scrollState == ScrollState.IDLE) {
|
||||
//
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val toUpdate = toUpdateWhenNotBusy.clone() as ArrayList<Pair<String, EmojiViewHolder>>
|
||||
toUpdateWhenNotBusy.clear()
|
||||
toUpdate.chunked(8).forEach {
|
||||
|
@ -21,6 +21,8 @@ import android.graphics.*
|
||||
import android.util.AttributeSet
|
||||
import android.util.Property
|
||||
import android.view.View
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
|
||||
/**
|
||||
@ -38,8 +40,8 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
private val circlePaint = Paint()
|
||||
private val maskPaint = Paint()
|
||||
|
||||
private var tempBitmap: Bitmap? = null
|
||||
private var tempCanvas: Canvas? = null
|
||||
private lateinit var tempBitmap: Bitmap
|
||||
private lateinit var tempCanvas: Canvas
|
||||
|
||||
var outerCircleRadiusProgress = 0f
|
||||
set(value) {
|
||||
@ -69,9 +71,9 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
tempCanvas!!.drawColor(0xffffff, PorterDuff.Mode.CLEAR)
|
||||
tempCanvas!!.drawCircle(width / 2f, height / 2f, outerCircleRadiusProgress * maxCircleSize, circlePaint)
|
||||
tempCanvas!!.drawCircle(width / 2f, height / 2f, innerCircleRadiusProgress * maxCircleSize, maskPaint)
|
||||
tempCanvas.drawColor(0xffffff, PorterDuff.Mode.CLEAR)
|
||||
tempCanvas.drawCircle(width / 2f, height / 2f, outerCircleRadiusProgress * maxCircleSize, circlePaint)
|
||||
tempCanvas.drawCircle(width / 2f, height / 2f, innerCircleRadiusProgress * maxCircleSize, maskPaint)
|
||||
canvas.drawBitmap(tempBitmap, 0f, 0f, null)
|
||||
}
|
||||
|
||||
@ -91,7 +93,7 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
// }
|
||||
|
||||
private fun updateCircleColor() {
|
||||
var colorProgress = clamp(outerCircleRadiusProgress, 0.5f, 1f) as Float
|
||||
var colorProgress = clamp(outerCircleRadiusProgress, 0.5f, 1f)
|
||||
colorProgress = mapValueFromRangeToRange(colorProgress, 0.5f, 1f, 0f, 1f)
|
||||
this.circlePaint.color = argbEvaluator.evaluate(colorProgress, startColor, endColor) as Int
|
||||
}
|
||||
@ -134,7 +136,7 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet
|
||||
}
|
||||
|
||||
fun clamp(value: Float, low: Float, high: Float): Float {
|
||||
return Math.min(Math.max(value, low), high)
|
||||
return min(max(value, low), high)
|
||||
}
|
||||
}
|
||||
}
|
@ -35,7 +35,12 @@ class DotsView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
||||
private var COLOR_3 = -0xa8de
|
||||
private var COLOR_4 = -0xbbcca
|
||||
|
||||
private val circlePaints = arrayOfNulls<Paint>(4)
|
||||
private val circlePaints = listOf(
|
||||
Paint().apply { style = Paint.Style.FILL },
|
||||
Paint().apply { style = Paint.Style.FILL },
|
||||
Paint().apply { style = Paint.Style.FILL },
|
||||
Paint().apply { style = Paint.Style.FILL }
|
||||
)
|
||||
|
||||
private var centerX: Int = 0
|
||||
private var centerY: Int = 0
|
||||
@ -63,13 +68,6 @@ class DotsView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
||||
|
||||
private val argbEvaluator = ArgbEvaluator()
|
||||
|
||||
init {
|
||||
for (i in circlePaints.indices) {
|
||||
circlePaints[i] = Paint()
|
||||
circlePaints[i]!!.style = Paint.Style.FILL
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
centerX = w / 2
|
||||
@ -161,32 +159,32 @@ class DotsView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
|
||||
|
||||
private fun updateDotsPaints() {
|
||||
if (currentProgress < 0.5f) {
|
||||
val progress = CircleView.mapValueFromRangeToRange(currentProgress, 0f, 0.5f, 0f, 1f) as Float
|
||||
circlePaints[0]?.color = argbEvaluator.evaluate(progress, COLOR_1, COLOR_2) as Int
|
||||
circlePaints[1]?.color = argbEvaluator.evaluate(progress, COLOR_2, COLOR_3) as Int
|
||||
circlePaints[2]?.color = argbEvaluator.evaluate(progress, COLOR_3, COLOR_4) as Int
|
||||
circlePaints[3]?.color = argbEvaluator.evaluate(progress, COLOR_4, COLOR_1) as Int
|
||||
val progress = CircleView.mapValueFromRangeToRange(currentProgress, 0f, 0.5f, 0f, 1f)
|
||||
circlePaints[0].color = argbEvaluator.evaluate(progress, COLOR_1, COLOR_2) as Int
|
||||
circlePaints[1].color = argbEvaluator.evaluate(progress, COLOR_2, COLOR_3) as Int
|
||||
circlePaints[2].color = argbEvaluator.evaluate(progress, COLOR_3, COLOR_4) as Int
|
||||
circlePaints[3].color = argbEvaluator.evaluate(progress, COLOR_4, COLOR_1) as Int
|
||||
} else {
|
||||
val progress = CircleView.mapValueFromRangeToRange(currentProgress, 0.5f, 1f, 0f, 1f) as Float
|
||||
circlePaints[0]?.color = argbEvaluator.evaluate(progress, COLOR_2, COLOR_3) as Int
|
||||
circlePaints[1]?.color = argbEvaluator.evaluate(progress, COLOR_3, COLOR_4) as Int
|
||||
circlePaints[2]?.color = argbEvaluator.evaluate(progress, COLOR_4, COLOR_1) as Int
|
||||
circlePaints[3]?.color = argbEvaluator.evaluate(progress, COLOR_1, COLOR_2) as Int
|
||||
val progress = CircleView.mapValueFromRangeToRange(currentProgress, 0.5f, 1f, 0f, 1f)
|
||||
circlePaints[0].color = argbEvaluator.evaluate(progress, COLOR_2, COLOR_3) as Int
|
||||
circlePaints[1].color = argbEvaluator.evaluate(progress, COLOR_3, COLOR_4) as Int
|
||||
circlePaints[2].color = argbEvaluator.evaluate(progress, COLOR_4, COLOR_1) as Int
|
||||
circlePaints[3].color = argbEvaluator.evaluate(progress, COLOR_1, COLOR_2) as Int
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateDotsAlpha() {
|
||||
val progress = CircleView.clamp(currentProgress, 0.6f, 1f) as Float
|
||||
val progress = CircleView.clamp(currentProgress, 0.6f, 1f)
|
||||
val alpha = (CircleView.mapValueFromRangeToRange(progress, 0.6f, 1f, 255f, 0f) as? Float)?.toInt()
|
||||
?: 0
|
||||
circlePaints.forEach { it?.alpha = alpha }
|
||||
circlePaints.forEach { it.alpha = alpha }
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
|
||||
private val DOTS_COUNT = 7
|
||||
private val OUTER_DOTS_POSITION_ANGLE = 360 / DOTS_COUNT
|
||||
private const val DOTS_COUNT = 7
|
||||
private const val OUTER_DOTS_POSITION_ANGLE = 360 / DOTS_COUNT
|
||||
|
||||
val DOTS_PROGRESS: Property<DotsView, Float> = object : Property<DotsView, Float>(Float::class.java, "dotsProgress") {
|
||||
override operator fun get(`object`: DotsView): Float? {
|
||||
|
@ -133,6 +133,7 @@ object FontScale {
|
||||
|
||||
val config = Configuration(context.resources.configuration)
|
||||
config.fontScale = getFontScale(context)
|
||||
@Suppress("DEPRECATION")
|
||||
context.resources.updateConfiguration(config, context.resources.displayMetrics)
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ import android.preference.PreferenceManager
|
||||
import android.text.TextUtils
|
||||
import android.util.Pair
|
||||
import androidx.core.content.edit
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import im.vector.riotx.R
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
@ -128,22 +128,27 @@ object VectorLocale {
|
||||
try {
|
||||
result = context.createConfigurationContext(config).getText(resourceId).toString()
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## getString() failed : " + e.message)
|
||||
Timber.e(e, "## getString() failed")
|
||||
// use the default one
|
||||
result = context.getString(resourceId)
|
||||
}
|
||||
} else {
|
||||
val resources = context.resources
|
||||
val conf = resources.configuration
|
||||
@Suppress("DEPRECATION")
|
||||
val savedLocale = conf.locale
|
||||
@Suppress("DEPRECATION")
|
||||
conf.locale = locale
|
||||
@Suppress("DEPRECATION")
|
||||
resources.updateConfiguration(conf, null)
|
||||
|
||||
// retrieve resources from desired locale
|
||||
result = resources.getString(resourceId)
|
||||
|
||||
// restore original locale
|
||||
@Suppress("DEPRECATION")
|
||||
conf.locale = savedLocale
|
||||
@Suppress("DEPRECATION")
|
||||
resources.updateConfiguration(conf, null)
|
||||
}
|
||||
|
||||
@ -166,7 +171,7 @@ object VectorLocale {
|
||||
getString(context, locale, R.string.resources_country_code)))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## getApplicationLocales() : failed " + e.message)
|
||||
Timber.e(e, "## getApplicationLocales() : failed")
|
||||
knownLocalesSet.add(Pair(context.getString(R.string.resources_language), context.getString(R.string.resources_country_code)))
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
||||
name = name.substring(0, name.lastIndexOf("."))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "## getNotificationRingToneName() failed() : " + e.message)
|
||||
Timber.e(e, "## getNotificationRingToneName() failed")
|
||||
} finally {
|
||||
cursor?.close()
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ class VectorSettingsActivity : VectorBaseActivity(),
|
||||
override fun onPreferenceStartFragment(caller: PreferenceFragmentCompat, pref: Preference): Boolean {
|
||||
val oFragment = when {
|
||||
VectorPreferences.SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY == pref.key ->
|
||||
VectorSettingsNotificationsTroubleshootFragment.newInstance(session.myUserId)
|
||||
VectorSettingsNotificationsTroubleshootFragment.newInstance()
|
||||
VectorPreferences.SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY == pref.key ->
|
||||
VectorSettingsAdvancedNotificationPreferenceFragment.newInstance(session.myUserId)
|
||||
VectorSettingsAdvancedNotificationPreferenceFragment.newInstance()
|
||||
else ->
|
||||
try {
|
||||
pref.fragment?.let {
|
||||
@ -115,10 +115,7 @@ class VectorSettingsActivity : VectorBaseActivity(),
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context, userId: String) = Intent(context, VectorSettingsActivity::class.java)
|
||||
.apply {
|
||||
//putExtra(MXCActionBarActivity.EXTRA_MATRIX_ID, userId)
|
||||
}
|
||||
fun getIntent(context: Context) = Intent(context, VectorSettingsActivity::class.java)
|
||||
|
||||
private const val FRAGMENT_TAG = "VectorSettingsPreferencesFragment"
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceManager
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
import im.vector.riotx.core.extensions.withArgs
|
||||
import im.vector.riotx.core.preference.BingRule
|
||||
import im.vector.riotx.core.preference.BingRulePreference
|
||||
import im.vector.riotx.core.preference.VectorPreference
|
||||
@ -119,8 +118,8 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
|
||||
preference.isVisible = true
|
||||
preference.setBingRule(rule)
|
||||
preference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
val rule = preference.createRule(newValue as Int)
|
||||
if (null != rule) {
|
||||
val rule2 = preference.createRule(newValue as Int)
|
||||
if (null != rule2) {
|
||||
/*
|
||||
TODO
|
||||
displayLoadingView()
|
||||
@ -233,9 +232,6 @@ class VectorSettingsAdvancedNotificationPreferenceFragment : VectorSettingsBaseF
|
||||
VectorPreferences.SETTINGS_MESSAGES_SENT_BY_BOT_PREFERENCE_KEY to BingRule.RULE_ID_SUPPRESS_BOTS_NOTIFICATIONS
|
||||
)
|
||||
|
||||
fun newInstance(matrixId: String) = VectorSettingsAdvancedNotificationPreferenceFragment()
|
||||
.withArgs {
|
||||
// putString(MXCActionBarActivity.EXTRA_MATRIX_ID, matrixId)
|
||||
}
|
||||
fun newInstance() = VectorSettingsAdvancedNotificationPreferenceFragment()
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ package im.vector.riotx.features.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
@ -134,8 +133,8 @@ abstract class VectorSettingsBaseFragment : PreferenceFragmentCompat(), HasScree
|
||||
return
|
||||
}
|
||||
activity?.runOnUiThread {
|
||||
if (!TextUtils.isEmpty(errorMessage) && errorMessage != null) {
|
||||
activity?.toast(errorMessage!!)
|
||||
if (errorMessage != null && errorMessage.isNotBlank()) {
|
||||
activity?.toast(errorMessage)
|
||||
}
|
||||
hideLoadingView()
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("UNUSED_VARIABLE", "UNUSED_ANONYMOUS_PARAMETER", "UNUSED_PARAMETER")
|
||||
|
||||
package im.vector.riotx.features.settings
|
||||
|
||||
import android.app.Activity
|
||||
|
@ -31,7 +31,6 @@ import butterknife.BindView
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
import im.vector.riotx.core.extensions.withArgs
|
||||
import im.vector.riotx.core.platform.VectorBaseActivity
|
||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||
import im.vector.riotx.features.rageshake.BugReporter
|
||||
@ -175,9 +174,6 @@ class VectorSettingsNotificationsTroubleshootFragment : VectorBaseFragment() {
|
||||
|
||||
companion object {
|
||||
// static constructor
|
||||
fun newInstance(matrixId: String) = VectorSettingsNotificationsTroubleshootFragment()
|
||||
.withArgs {
|
||||
// TODO putString(MXCActionBarActivity.EXTRA_MATRIX_ID, matrixId)
|
||||
}
|
||||
fun newInstance() = VectorSettingsNotificationsTroubleshootFragment()
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ import android.content.Intent
|
||||
import android.graphics.Typeface
|
||||
import android.text.TextUtils
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
@ -318,7 +317,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
|
||||
|
||||
val importDialog = builder.show()
|
||||
|
||||
importButton.setOnClickListener(View.OnClickListener {
|
||||
importButton.setOnClickListener {
|
||||
val password = passPhraseEditText.text.toString()
|
||||
|
||||
displayLoadingView()
|
||||
@ -351,7 +350,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
|
||||
})
|
||||
|
||||
importDialog.dismiss()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,7 +585,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
|
||||
val lastSeenIp = aDeviceInfo.lastSeenIp?.takeIf { ip -> ip.isNotBlank() } ?: "-"
|
||||
|
||||
val lastSeenTime = aDeviceInfo.lastSeenTs?.let { ts ->
|
||||
val dateFormatTime = SimpleDateFormat("HH:mm:ss")
|
||||
val dateFormatTime = SimpleDateFormat("HH:mm:ss", Locale.ROOT)
|
||||
val date = Date(ts)
|
||||
|
||||
val time = dateFormatTime.format(date)
|
||||
@ -605,7 +604,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
|
||||
.setPositiveButton(R.string.rename) { _, _ -> displayDeviceRenameDialog(aDeviceInfo) }
|
||||
|
||||
// disable the deletion for our own device
|
||||
if (!TextUtils.equals(session.getMyDevice()?.deviceId, aDeviceInfo.deviceId)) {
|
||||
if (!TextUtils.equals(session.getMyDevice().deviceId, aDeviceInfo.deviceId)) {
|
||||
builder.setNegativeButton(R.string.delete) { _, _ -> deleteDevice(aDeviceInfo) }
|
||||
}
|
||||
|
||||
@ -784,7 +783,7 @@ class VectorSettingsSecurityPrivacyFragment : VectorSettingsBaseFragment() {
|
||||
* Refresh the pushers list
|
||||
*/
|
||||
private fun refreshPushersList() {
|
||||
activity?.let { activity ->
|
||||
activity?.let { _ ->
|
||||
/* TODO
|
||||
val pushManager = Matrix.getInstance(activity).pushManager
|
||||
val pushersList = ArrayList(pushManager.mPushersList)
|
||||
|
@ -42,32 +42,28 @@ class TestBingRulesSettings @Inject constructor(private val activeSessionHolder:
|
||||
override fun perform() {
|
||||
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
||||
val pushRules = session.getPushRules()
|
||||
if (pushRules == null) {
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bing_settings_failed_to_load_rules)
|
||||
status = TestStatus.FAILED
|
||||
} else {
|
||||
var oneOrMoreRuleIsOff = false
|
||||
var oneOrMoreRuleAreSilent = false
|
||||
for ((index, ruleId) in testedRules.withIndex()) {
|
||||
pushRules.find { it.ruleId == ruleId }?.let { rule ->
|
||||
val actions = rule.getActions()
|
||||
val notifAction = actions.toNotificationAction()
|
||||
if (!rule.enabled || !notifAction.shouldNotify) {
|
||||
//off
|
||||
oneOrMoreRuleIsOff = true
|
||||
} else if (notifAction.soundName == null) {
|
||||
//silent
|
||||
oneOrMoreRuleAreSilent = true
|
||||
} else {
|
||||
//noisy
|
||||
}
|
||||
var oneOrMoreRuleIsOff = false
|
||||
var oneOrMoreRuleAreSilent = false
|
||||
testedRules.forEach { ruleId ->
|
||||
pushRules.find { it.ruleId == ruleId }?.let { rule ->
|
||||
val actions = rule.getActions()
|
||||
val notifAction = actions.toNotificationAction()
|
||||
if (!rule.enabled || !notifAction.shouldNotify) {
|
||||
//off
|
||||
oneOrMoreRuleIsOff = true
|
||||
} else if (notifAction.soundName == null) {
|
||||
//silent
|
||||
oneOrMoreRuleAreSilent = true
|
||||
} else {
|
||||
//noisy
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (oneOrMoreRuleIsOff) {
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bing_settings_failed)
|
||||
//TODO
|
||||
}
|
||||
|
||||
if (oneOrMoreRuleIsOff) {
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bing_settings_failed)
|
||||
//TODO
|
||||
// quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_bing_settings_quickfix) {
|
||||
// override fun doFix() {
|
||||
// val activity = fragment.activity
|
||||
@ -77,15 +73,14 @@ class TestBingRulesSettings @Inject constructor(private val activeSessionHolder:
|
||||
// activity?.supportFragmentManager?.popBackStack()
|
||||
// }
|
||||
// }
|
||||
status = TestStatus.FAILED
|
||||
status = TestStatus.FAILED
|
||||
} else {
|
||||
description = if (oneOrMoreRuleAreSilent) {
|
||||
stringProvider.getString(R.string.settings_troubleshoot_test_bing_settings_success_with_warn)
|
||||
} else {
|
||||
if (oneOrMoreRuleAreSilent) {
|
||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_bing_settings_success_with_warn)
|
||||
} else {
|
||||
description = null
|
||||
}
|
||||
status = TestStatus.SUCCESS
|
||||
null
|
||||
}
|
||||
status = TestStatus.SUCCESS
|
||||
}
|
||||
}
|
||||
}
|
@ -75,13 +75,13 @@ class VectorWebViewActivity : VectorBaseActivity() {
|
||||
cookieManager.setAcceptThirdPartyCookies(simple_webview, true)
|
||||
}
|
||||
|
||||
val url = intent.extras.getString(EXTRA_URL)
|
||||
val title = intent.extras.getString(EXTRA_TITLE, USE_TITLE_FROM_WEB_PAGE)
|
||||
val url = intent.extras?.getString(EXTRA_URL)
|
||||
val title = intent.extras?.getString(EXTRA_TITLE, USE_TITLE_FROM_WEB_PAGE)
|
||||
if (title != USE_TITLE_FROM_WEB_PAGE) {
|
||||
setTitle(title)
|
||||
}
|
||||
|
||||
val webViewMode = intent.extras.getSerializable(EXTRA_MODE) as WebViewMode
|
||||
val webViewMode = intent.extras?.getSerializable(EXTRA_MODE) as WebViewMode
|
||||
val eventListener = webViewMode.eventListener(this, session)
|
||||
simple_webview.webViewClient = VectorWebViewClient(eventListener)
|
||||
simple_webview.webChromeClient = object : WebChromeClient() {
|
||||
|
@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package im.vector.riotx.features.webview
|
||||
|
||||
import android.annotation.TargetApi
|
||||
|
@ -90,7 +90,7 @@ class SignOutBottomSheetDialogFragment : BottomSheetDialogFragment() {
|
||||
var onSignOut: Runnable? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(userId: String) = SignOutBottomSheetDialogFragment()
|
||||
fun newInstance() = SignOutBottomSheetDialogFragment()
|
||||
|
||||
private const val EXPORT_REQ = 0
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class SignOutUiWorker(private val activity: FragmentActivity) {
|
||||
activeSessionHolder = context.vectorComponent().activeSessionHolder()
|
||||
val session = activeSessionHolder.getActiveSession()
|
||||
if (SignOutViewModel.doYouNeedToBeDisplayed(session)) {
|
||||
val signOutDialog = SignOutBottomSheetDialogFragment.newInstance(session.myUserId)
|
||||
val signOutDialog = SignOutBottomSheetDialogFragment.newInstance()
|
||||
signOutDialog.onSignOut = Runnable {
|
||||
doSignOut()
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2019 New Vector Ltd
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<!-- Do not use drawableStart for icon size and for RTL -->
|
||||
<ImageView
|
||||
android:id="@+id/adapter_item_dialog_icon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:rotationY="@integer/rtl_mirror_flip"
|
||||
android:tint="?attr/colorAccent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/video_call_green" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/adapter_item_dialog_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/adapter_item_dialog_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@string/action_video_call" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
x
Reference in New Issue
Block a user