mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-18 19:19:33 +01:00
Merge 4792f171fc
into 2a7359c1e9
This commit is contained in:
commit
9d451d7cad
@ -193,6 +193,7 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SCROLL_OFFSET
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM
|
||||
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil
|
||||
@ -367,6 +368,7 @@ class ChatActivity :
|
||||
|
||||
var myFirstMessage: CharSequence? = null
|
||||
var checkingLobbyStatus: Boolean = false
|
||||
private var listScrollOffset: Int = 0
|
||||
|
||||
private var conversationVoiceCallMenuItem: MenuItem? = null
|
||||
private var conversationVideoMenuItem: MenuItem? = null
|
||||
@ -390,7 +392,10 @@ class ChatActivity :
|
||||
private val onBackPressedCallback = object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
val intent = Intent(this@ChatActivity, ConversationsListActivity::class.java)
|
||||
intent.putExtras(Bundle())
|
||||
val bundle = bundleOf()
|
||||
bundle.putInt(KEY_SCROLL_OFFSET, listScrollOffset)
|
||||
bundle.putString(KEY_ROOM_TOKEN, roomToken)
|
||||
intent.putExtras(bundle)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
@ -526,6 +531,7 @@ class ChatActivity :
|
||||
val extras: Bundle? = intent.extras
|
||||
|
||||
roomToken = extras?.getString(KEY_ROOM_TOKEN).orEmpty()
|
||||
listScrollOffset = extras?.getInt(KEY_SCROLL_OFFSET, 0) ?: 0
|
||||
|
||||
sharedText = extras?.getString(BundleKeys.KEY_SHARED_TEXT).orEmpty()
|
||||
|
||||
|
@ -51,6 +51,7 @@ import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.work.Data
|
||||
import androidx.work.OneTimeWorkRequest
|
||||
@ -140,6 +141,7 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FORWARD_MSG_FLAG
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FORWARD_MSG_TEXT
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SCROLL_OFFSET
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SCROLL_TO_NOTIFICATION_CATEGORY
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SHARED_TEXT
|
||||
import com.nextcloud.talk.utils.permissions.PlatformPermissionUtil
|
||||
@ -235,6 +237,8 @@ class ConversationsListActivity :
|
||||
private var conversationsListBottomDialog: ConversationsListBottomDialog? = null
|
||||
private var searchHelper: MessageSearchHelper? = null
|
||||
private var searchViewDisposable: Disposable? = null
|
||||
private var roomTokenFromIntent: String? = null
|
||||
private var scrollOffset: Int = 0
|
||||
private var filterState =
|
||||
mutableMapOf(
|
||||
MENTION to false,
|
||||
@ -306,6 +310,8 @@ class ConversationsListActivity :
|
||||
showNotificationWarning()
|
||||
|
||||
showShareToScreen = hasActivityActionSendIntent()
|
||||
roomTokenFromIntent = intent.extras?.getString(KEY_ROOM_TOKEN)
|
||||
scrollOffset = intent.extras?.getInt(KEY_SCROLL_OFFSET, 0) ?: 0
|
||||
|
||||
if (!eventBus.isRegistered(this)) {
|
||||
eventBus.register(this)
|
||||
@ -415,6 +421,17 @@ class ConversationsListActivity :
|
||||
.firstOrNull { ConversationUtils.isNoteToSelfConversation(it) }
|
||||
val isNoteToSelfAvailable = noteToSelf != null
|
||||
handleNoteToSelfShortcut(isNoteToSelfAvailable, noteToSelf?.token ?: "")
|
||||
if (roomTokenFromIntent != null) {
|
||||
val item = adapter?.currentItems?.first {
|
||||
it is ConversationItem && it.model.token == roomTokenFromIntent
|
||||
}
|
||||
val pos = adapter?.currentItems?.indexOf(item)
|
||||
pos?.let {
|
||||
val layoutManager = binding.recyclerView.layoutManager as LinearLayoutManager
|
||||
layoutManager.scrollToPosition(scrollOffset)
|
||||
}
|
||||
roomTokenFromIntent = null
|
||||
}
|
||||
}.collect()
|
||||
}
|
||||
|
||||
@ -1871,7 +1888,8 @@ class ConversationsListActivity :
|
||||
bundle.putString(BundleKeys.KEY_MESSAGE_ID, selectedMessageId)
|
||||
selectedMessageId = null
|
||||
}
|
||||
|
||||
val firstVisible = layoutManager?.findFirstVisibleItemPosition() ?: 0
|
||||
bundle.putInt(KEY_SCROLL_OFFSET, firstVisible)
|
||||
val intent = Intent(context, ChatActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
startActivity(intent)
|
||||
|
@ -81,5 +81,6 @@ object BundleKeys {
|
||||
const val KEY_FIELD_MAP: String = "KEY_FIELD_MAP"
|
||||
const val KEY_CHAT_URL: String = "KEY_CHAT_URL"
|
||||
const val KEY_SCROLL_TO_NOTIFICATION_CATEGORY: String = "KEY_SCROLL_TO_NOTIFICATION_CATEGORY"
|
||||
const val KEY_SCROLL_OFFSET: String = "KEY_SCROLL_OFFSET"
|
||||
const val KEY_FOCUS_INPUT: String = "KEY_FOCUS_INPUT"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user