mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-13 15:54:59 +01:00
clears the state when returning to ConversationsListActivity.kt
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
666c4c9853
commit
46edec93b2
@ -109,10 +109,10 @@ class MessageInputFragment : Fragment() {
|
||||
private const val CONNECTION_ESTABLISHED_ANIM_DURATION: Long = 3000
|
||||
private const val FULLY_OPAQUE: Float = 1.0f
|
||||
private const val FULLY_TRANSPARENT: Float = 0.0f
|
||||
private const val QUOTED_MESSAGE_TEXT = "QUOTED_MESSAGE_TEXT"
|
||||
private const val QUOTED_MESSAGE_ID = "QUOTED_MESSAGE_ID"
|
||||
private const val QUOTED_MESSAGE_URL = "QUOTED_MESSAGE_URL"
|
||||
private const val QUOTED_MESSAGE_NAME = "QUOTED_MESSAGE_NAME"
|
||||
const val QUOTED_MESSAGE_TEXT = "QUOTED_MESSAGE_TEXT"
|
||||
const val QUOTED_MESSAGE_ID = "QUOTED_MESSAGE_ID"
|
||||
const val QUOTED_MESSAGE_URL = "QUOTED_MESSAGE_URL"
|
||||
const val QUOTED_MESSAGE_NAME = "QUOTED_MESSAGE_NAME"
|
||||
}
|
||||
|
||||
@Inject
|
||||
@ -176,7 +176,8 @@ class MessageInputFragment : Fragment() {
|
||||
clearEditUI()
|
||||
val isInReplyState = (quotedJsonId != -1 && quotedActorDisplayName != null && quotedMessageText != "")
|
||||
if (!isInReplyState) {
|
||||
cancelReply()
|
||||
cancelReply() // TODO - I could move this to the view model, in a onBackPressCallback to remove all from
|
||||
// storage
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,6 +312,7 @@ class MessageInputFragment : Fragment() {
|
||||
|
||||
private fun restoreState() {
|
||||
if (binding.fragmentMessageInputView.inputEditText.text.isEmpty()) {
|
||||
Log.d("Julius", "State restored from: ${chatActivity.localClassName}")
|
||||
requireContext().getSharedPreferences(chatActivity.localClassName, AppCompatActivity.MODE_PRIVATE).apply {
|
||||
val text = getString(chatActivity.roomToken, "")
|
||||
val cursor = getInt(chatActivity.roomToken + CURSOR_KEY, 0)
|
||||
|
@ -83,6 +83,10 @@ import com.nextcloud.talk.api.NcApi
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager
|
||||
import com.nextcloud.talk.chat.ChatActivity
|
||||
import com.nextcloud.talk.chat.MessageInputFragment.Companion.QUOTED_MESSAGE_ID
|
||||
import com.nextcloud.talk.chat.MessageInputFragment.Companion.QUOTED_MESSAGE_NAME
|
||||
import com.nextcloud.talk.chat.MessageInputFragment.Companion.QUOTED_MESSAGE_TEXT
|
||||
import com.nextcloud.talk.chat.MessageInputFragment.Companion.QUOTED_MESSAGE_URL
|
||||
import com.nextcloud.talk.chat.viewmodels.ChatViewModel
|
||||
import com.nextcloud.talk.contacts.ContactsActivity
|
||||
import com.nextcloud.talk.contacts.ContactsUiState
|
||||
@ -304,6 +308,16 @@ class ConversationsListActivity :
|
||||
showNotificationWarning()
|
||||
|
||||
showShareToScreen = hasActivityActionSendIntent()
|
||||
context.getSharedPreferences(
|
||||
CHAT_ACTIVITY_LOCAL_NAME,
|
||||
MODE_PRIVATE
|
||||
).edit().apply {
|
||||
putInt(QUOTED_MESSAGE_ID, -1)
|
||||
putString(QUOTED_MESSAGE_NAME, null)
|
||||
putString(QUOTED_MESSAGE_TEXT, "")
|
||||
putString(QUOTED_MESSAGE_URL, null)
|
||||
apply()
|
||||
}
|
||||
|
||||
if (!eventBus.isRegistered(this)) {
|
||||
eventBus.register(this)
|
||||
@ -640,7 +654,7 @@ class ConversationsListActivity :
|
||||
}
|
||||
}
|
||||
|
||||
val archiveFilterOn = filterState[ARCHIVE] ?: false
|
||||
val archiveFilterOn = filterState[ARCHIVE] == true
|
||||
if (archiveFilterOn && newItems.isEmpty()) {
|
||||
binding.noArchivedConversationLayout.visibility = View.VISIBLE
|
||||
} else {
|
||||
@ -755,7 +769,7 @@ class ConversationsListActivity :
|
||||
}
|
||||
|
||||
private fun initSearchView() {
|
||||
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager?
|
||||
val searchManager = getSystemService(SEARCH_SERVICE) as SearchManager?
|
||||
if (searchItem != null) {
|
||||
searchView = MenuItemCompat.getActionView(searchItem) as SearchView
|
||||
viewThemeUtils.talk.themeSearchView(searchView!!)
|
||||
@ -1217,7 +1231,7 @@ class ConversationsListActivity :
|
||||
})
|
||||
binding.recyclerView.setOnTouchListener { v: View, _: MotionEvent? ->
|
||||
if (!isDestroyed) {
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(v.windowToken, 0)
|
||||
}
|
||||
false
|
||||
@ -1398,7 +1412,7 @@ class ConversationsListActivity :
|
||||
adapter?.updateDataSet(conversationItems)
|
||||
adapter?.setFilter("")
|
||||
adapter?.filterItems()
|
||||
val archiveFilterOn = filterState[ARCHIVE] ?: false
|
||||
val archiveFilterOn = filterState[ARCHIVE] == true
|
||||
if (archiveFilterOn && adapter!!.isEmpty) {
|
||||
binding.noArchivedConversationLayout.visibility = View.VISIBLE
|
||||
} else {
|
||||
@ -1809,7 +1823,7 @@ class ConversationsListActivity :
|
||||
val callsChannelNotEnabled = !NotificationUtils.isCallsNotificationChannelEnabled(this)
|
||||
|
||||
val serverNotificationAppInstalled =
|
||||
currentUser?.capabilities?.notificationsCapability?.features?.isNotEmpty() ?: false
|
||||
currentUser?.capabilities?.notificationsCapability?.features?.isNotEmpty() == true
|
||||
|
||||
val settingsOfUserAreWrong = notificationPermissionNotGranted ||
|
||||
batteryOptimizationNotIgnored ||
|
||||
@ -2167,6 +2181,7 @@ class ConversationsListActivity :
|
||||
const val UNREAD_BUBBLE_DELAY = 2500
|
||||
const val BOTTOM_SHEET_DELAY: Long = 2500
|
||||
private const val KEY_SEARCH_QUERY = "ConversationsListActivity.searchQuery"
|
||||
private const val CHAT_ACTIVITY_LOCAL_NAME = "com.nextcloud.talk.chat.ChatActivity"
|
||||
const val SEARCH_DEBOUNCE_INTERVAL_MS = 300
|
||||
const val SEARCH_MIN_CHARS = 1
|
||||
const val HTTP_UNAUTHORIZED = 401
|
||||
|
Loading…
Reference in New Issue
Block a user