Open keyboard when replying to a message if no text / file / voice record is pending + bumped gradle
This commit is contained in:
parent
77993d74aa
commit
ea32b92465
4 changed files with 29 additions and 13 deletions
|
@ -26,6 +26,7 @@ Group changes to describe their impact on the project, as follows:
|
|||
- Account EXPIRES is now set to 1 month instead of 1 year for sip.linphone.org accounts
|
||||
- Replaced voice recordings file name by localized placeholder text, like for video conferences invitations
|
||||
- Decline incoming calls with Busy reason if there is at least another active call
|
||||
- Open keyboard when replying to a message if no text / file / voice record is pending
|
||||
- Removed jetifier as it is not needed
|
||||
- Switched from gradle 7.5 to 8.0, requires JDK 17 (instead of 11)
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.linphone.activities.main
|
||||
|
||||
import android.content.ComponentCallbacks2
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
|
@ -28,6 +29,7 @@ import android.os.Parcelable
|
|||
import android.view.Gravity
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.core.view.doOnAttach
|
||||
|
@ -248,6 +250,16 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
currentFocus?.hideKeyboard()
|
||||
}
|
||||
|
||||
fun showKeyboard() {
|
||||
// Requires a text field to have the focus
|
||||
if (currentFocus != null) {
|
||||
(getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager)
|
||||
.showSoftInput(currentFocus, 0)
|
||||
} else {
|
||||
Log.w("[Main Activity] Can't show the keyboard, no focused view")
|
||||
}
|
||||
}
|
||||
|
||||
fun hideStatusFragment(hide: Boolean) {
|
||||
statusFragment.visibility = if (hide) View.GONE else View.VISIBLE
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import java.io.File
|
||||
import java.lang.IllegalArgumentException
|
||||
import kotlinx.coroutines.*
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
|
@ -57,9 +56,6 @@ import org.linphone.activities.main.chat.viewmodels.*
|
|||
import org.linphone.activities.main.chat.views.RichEditTextSendListener
|
||||
import org.linphone.activities.main.fragments.MasterFragment
|
||||
import org.linphone.activities.main.viewmodels.DialogViewModel
|
||||
import org.linphone.activities.navigateToContacts
|
||||
import org.linphone.activities.navigateToImageFileViewer
|
||||
import org.linphone.activities.navigateToImdn
|
||||
import org.linphone.compatibility.Compatibility
|
||||
import org.linphone.core.*
|
||||
import org.linphone.core.tools.Log
|
||||
|
@ -274,10 +270,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
val chatMessageEventLog = adapter.currentList[index]
|
||||
val chatMessage = chatMessageEventLog.eventLog.chatMessage
|
||||
if (chatMessage != null) {
|
||||
chatSendingViewModel.pendingChatMessageToReplyTo.value?.destroy()
|
||||
chatSendingViewModel.pendingChatMessageToReplyTo.value =
|
||||
ChatMessageData(chatMessage)
|
||||
chatSendingViewModel.isPendingAnswer.value = true
|
||||
replyToChatMessage(chatMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,10 +430,7 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
viewLifecycleOwner
|
||||
) {
|
||||
it.consume { chatMessage ->
|
||||
chatSendingViewModel.pendingChatMessageToReplyTo.value?.destroy()
|
||||
chatSendingViewModel.pendingChatMessageToReplyTo.value =
|
||||
ChatMessageData(chatMessage)
|
||||
chatSendingViewModel.isPendingAnswer.value = true
|
||||
replyToChatMessage(chatMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1344,4 +1334,17 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
Log.e("[Chat Room] Can't scroll to position $position")
|
||||
}
|
||||
}
|
||||
|
||||
private fun replyToChatMessage(chatMessage: ChatMessage) {
|
||||
chatSendingViewModel.pendingChatMessageToReplyTo.value?.destroy()
|
||||
chatSendingViewModel.pendingChatMessageToReplyTo.value =
|
||||
ChatMessageData(chatMessage)
|
||||
chatSendingViewModel.isPendingAnswer.value = true
|
||||
|
||||
if (chatSendingViewModel.sendMessageEnabled.value == false) {
|
||||
// Open keyboard
|
||||
binding.footer.message.requestFocus()
|
||||
(requireActivity() as MainActivity).showKeyboard()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ buildscript {
|
|||
} // for com.github.chrisbanes:PhotoView
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.0.0'
|
||||
classpath 'com.android.tools.build:gradle:8.0.1'
|
||||
classpath 'com.google.gms:google-services:4.3.15'
|
||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
|
||||
|
|
Loading…
Reference in a new issue