forked from upstream-mirrors/quik
Merge branch 'octoshrimpy:master' into rename-error-toast-string
This commit is contained in:
@@ -20,7 +20,7 @@ apply plugin: 'com.android.library'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.androidx_appcompat_version = '1.3.1'
|
ext.androidx_appcompat_version = '1.6.1'
|
||||||
|
ext.androidx_emoji2_version = '1.4.0'
|
||||||
ext.androidx_constraintlayout_version = '1.1.3'
|
ext.androidx_constraintlayout_version = '1.1.3'
|
||||||
ext.androidx_core_version = '1.1.0'
|
ext.androidx_core_version = '1.1.0'
|
||||||
ext.androidx_documentfile_version = '1.0.1'
|
ext.androidx_documentfile_version = '1.0.1'
|
||||||
ext.androidx_emoji_version = '1.0.0'
|
|
||||||
ext.androidx_exifinterface_version = '1.0.0'
|
ext.androidx_exifinterface_version = '1.0.0'
|
||||||
ext.androidx_testrunner_version = '1.1.0-alpha3'
|
ext.androidx_testrunner_version = '1.1.0-alpha3'
|
||||||
ext.androidx_viewpager_version = '1.0.0-beta05'
|
ext.androidx_viewpager_version = '1.0.0-beta05'
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
publishNonDefault true
|
publishNonDefault true
|
||||||
flavorDimensions "analytics"
|
flavorDimensions "analytics"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ apply plugin: 'kotlin-android-extensions'
|
|||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility 1.8
|
sourceCompatibility 1.8
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="dev.octoshrimpy.quik.messagesText"
|
android:authorities="${applicationId}.messagesText"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:grantUriPermissions="true">
|
android:grantUriPermissions="true">
|
||||||
|
|||||||
@@ -156,7 +156,8 @@ class Preferences @Inject constructor(
|
|||||||
val keyChanges: Observable<String> = Observable.create<String> { emitter ->
|
val keyChanges: Observable<String> = Observable.create<String> { emitter ->
|
||||||
// Making this a lambda would cause it to be GCd
|
// Making this a lambda would cause it to be GCd
|
||||||
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||||
emitter.onNext(key)
|
if (key != null)
|
||||||
|
emitter.onNext(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter.setCancellable {
|
emitter.setCancellable {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ apply plugin: 'kotlin-android-extensions'
|
|||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
flavorDimensions "analytics"
|
flavorDimensions "analytics"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -123,9 +123,9 @@ dependencies {
|
|||||||
|
|
||||||
// androidx
|
// androidx
|
||||||
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"
|
implementation "androidx.appcompat:appcompat:$androidx_appcompat_version"
|
||||||
|
implementation "androidx.emoji2:emoji2-bundled:$androidx_emoji2_version"
|
||||||
implementation "androidx.constraintlayout:constraintlayout:$androidx_constraintlayout_version"
|
implementation "androidx.constraintlayout:constraintlayout:$androidx_constraintlayout_version"
|
||||||
implementation "androidx.core:core-ktx:$androidx_core_version"
|
implementation "androidx.core:core-ktx:$androidx_core_version"
|
||||||
implementation "androidx.emoji:emoji-appcompat:$androidx_emoji_version"
|
|
||||||
implementation "androidx.viewpager2:viewpager2:$androidx_viewpager_version"
|
implementation "androidx.viewpager2:viewpager2:$androidx_viewpager_version"
|
||||||
implementation "com.google.android.material:material:$material_version"
|
implementation "com.google.android.material:material:$material_version"
|
||||||
implementation("androidx.work:work-runtime-ktx:$androidx_work_version")
|
implementation("androidx.work:work-runtime-ktx:$androidx_work_version")
|
||||||
|
|||||||
@@ -275,6 +275,9 @@
|
|||||||
<intent>
|
<intent>
|
||||||
<action android:name="android.intent.action.TTS_SERVICE" />
|
<action android:name="android.intent.action.TTS_SERVICE" />
|
||||||
</intent>
|
</intent>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.speech.RecognitionService" />
|
||||||
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ import android.app.Activity
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import androidx.core.provider.FontRequest
|
import androidx.emoji2.bundled.BundledEmojiCompatConfig
|
||||||
import androidx.emoji.text.EmojiCompat
|
import androidx.emoji2.text.EmojiCompat
|
||||||
import androidx.emoji.text.FontRequestEmojiCompatConfig
|
|
||||||
import androidx.work.Configuration
|
import androidx.work.Configuration
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import androidx.work.WorkerFactory
|
import androidx.work.WorkerFactory
|
||||||
@@ -106,16 +105,26 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
|||||||
|
|
||||||
nightModeManager.updateCurrentTheme()
|
nightModeManager.updateCurrentTheme()
|
||||||
|
|
||||||
val fontRequest = FontRequest(
|
// configure timber logging
|
||||||
"com.google.android.gms.fonts",
|
|
||||||
"com.google.android.gms",
|
|
||||||
"Noto Color Emoji Compat",
|
|
||||||
R.array.com_google_android_gms_fonts_certs)
|
|
||||||
|
|
||||||
EmojiCompat.init(FontRequestEmojiCompatConfig(this, fontRequest))
|
|
||||||
|
|
||||||
Timber.plant(Timber.DebugTree(), CrashlyticsTree(), fileLoggingTree)
|
Timber.plant(Timber.DebugTree(), CrashlyticsTree(), fileLoggingTree)
|
||||||
|
|
||||||
|
// configure emoji compatibility with bundled package
|
||||||
|
// (bundled library works with no play-services/gsm os versions)
|
||||||
|
EmojiCompat.init(BundledEmojiCompatConfig(this)
|
||||||
|
.registerInitCallback(object: EmojiCompat.InitCallback() {
|
||||||
|
override fun onInitialized() {
|
||||||
|
super.onInitialized()
|
||||||
|
Timber.v("bundled emojicompat initialized")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailed(throwable: Throwable?) {
|
||||||
|
super.onFailed(throwable)
|
||||||
|
Timber.e("bundled emojicompat initialization failed")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
// rxdogtag provides 'look-back' for exceptions in rxjava2 'chains'
|
||||||
RxDogTag.builder()
|
RxDogTag.builder()
|
||||||
.configureWith(AutoDisposeConfigurer::configure)
|
.configureWith(AutoDisposeConfigurer::configure)
|
||||||
.install()
|
.install()
|
||||||
|
|||||||
@@ -28,12 +28,11 @@ class QkActivityResultContracts {
|
|||||||
return intent
|
return intent
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun parseResult(resultCode: Int, intent: Intent?): Uri? {
|
override fun parseResult(resultCode: Int, intent: Intent?): Uri {
|
||||||
if (intent == null || resultCode != Activity.RESULT_OK) {
|
if (resultCode != Activity.RESULT_OK)
|
||||||
return null
|
return Uri.EMPTY
|
||||||
}
|
|
||||||
|
|
||||||
return intent.data
|
return intent?.data ?: Uri.EMPTY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import android.view.KeyEvent
|
|||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputConnection
|
import android.view.inputmethod.InputConnection
|
||||||
import android.view.inputmethod.InputConnectionWrapper
|
import android.view.inputmethod.InputConnectionWrapper
|
||||||
import android.widget.EditText
|
import androidx.appcompat.widget.AppCompatEditText
|
||||||
import androidx.core.view.inputmethod.EditorInfoCompat
|
import androidx.core.view.inputmethod.EditorInfoCompat
|
||||||
import androidx.core.view.inputmethod.InputConnectionCompat
|
import androidx.core.view.inputmethod.InputConnectionCompat
|
||||||
import androidx.core.view.inputmethod.InputContentInfoCompat
|
import androidx.core.view.inputmethod.InputContentInfoCompat
|
||||||
@@ -44,7 +44,8 @@ import javax.inject.Inject
|
|||||||
* Beware of updating to extend AppCompatTextView, as this inexplicably breaks the view in
|
* Beware of updating to extend AppCompatTextView, as this inexplicably breaks the view in
|
||||||
* the contacts chip view
|
* the contacts chip view
|
||||||
*/
|
*/
|
||||||
class QkEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : EditText(context, attrs) {
|
class QkEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null)
|
||||||
|
: AppCompatEditText(context, attrs) {
|
||||||
|
|
||||||
@Inject lateinit var textViewStyler: TextViewStyler
|
@Inject lateinit var textViewStyler: TextViewStyler
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ package dev.octoshrimpy.quik.common.widget
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import androidx.emoji.widget.EmojiAppCompatTextView
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
import dev.octoshrimpy.quik.common.util.TextViewStyler
|
import dev.octoshrimpy.quik.common.util.TextViewStyler
|
||||||
import dev.octoshrimpy.quik.injection.appComponent
|
import dev.octoshrimpy.quik.injection.appComponent
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class QkTextView @JvmOverloads constructor(
|
open class QkTextView @JvmOverloads constructor(
|
||||||
context: Context, attrs: AttributeSet? = null
|
context: Context, attrs: AttributeSet? = null
|
||||||
) : EmojiAppCompatTextView(context, attrs) {
|
) : AppCompatTextView(context, attrs) {
|
||||||
|
|
||||||
@Inject lateinit var textViewStyler: TextViewStyler
|
@Inject lateinit var textViewStyler: TextViewStyler
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class BackupController : QkController<BackupView, BackupState, BackupPresenter>(
|
|||||||
.create()
|
.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var openDirectory: ActivityResultLauncher<Uri>
|
private lateinit var openDirectory: ActivityResultLauncher<Uri?>
|
||||||
private lateinit var openDocument: ActivityResultLauncher<QkActivityResultContracts.OpenDocumentParams>
|
private lateinit var openDocument: ActivityResultLauncher<QkActivityResultContracts.OpenDocumentParams>
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -566,11 +566,12 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
|||||||
if (state.scheduling)
|
if (state.scheduling)
|
||||||
scheduleAction.onNext(true)
|
scheduleAction.onNext(true)
|
||||||
|
|
||||||
if (prefs.showStt.get()) {
|
// if stt is available and preference is set to show stt button
|
||||||
|
if (isSpeechRecognitionAvailable() && prefs.showStt.get()) {
|
||||||
speechToTextFrame.isVisible = true
|
speechToTextFrame.isVisible = true
|
||||||
|
|
||||||
var xPercent = prefs.showSttOffsetX.get()
|
val xPercent = prefs.showSttOffsetX.get()
|
||||||
var yPercent = prefs.showSttOffsetY.get()
|
val yPercent = prefs.showSttOffsetY.get()
|
||||||
|
|
||||||
// if the stt icon has a custom position, move it
|
// if the stt icon has a custom position, move it
|
||||||
if ((xPercent != Float.MAX_VALUE) && (yPercent != Float.MAX_VALUE)) {
|
if ((xPercent != Float.MAX_VALUE) && (yPercent != Float.MAX_VALUE)) {
|
||||||
@@ -676,7 +677,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun startSpeechRecognition() {
|
override fun startSpeechRecognition() {
|
||||||
if (!isSpeechRecognitionAvailable()) {
|
if (isSpeechRecognitionAvailable()) {
|
||||||
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
|
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
|
||||||
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
|
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
|
||||||
}
|
}
|
||||||
@@ -824,7 +825,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
|||||||
if (messageEditBox !== null) {
|
if (messageEditBox !== null) {
|
||||||
// populate message box with data returned by STT, set cursor to end, and focus
|
// populate message box with data returned by STT, set cursor to end, and focus
|
||||||
messageEditBox.append(match[0])
|
messageEditBox.append(match[0])
|
||||||
messageEditBox.setSelection(messageEditBox.text.length)
|
messageEditBox.setSelection(messageEditBox.text?.length ?: 0)
|
||||||
messageEditBox.requestFocus()
|
messageEditBox.requestFocus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -23,13 +23,13 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.moez.QKSMS.feature.extensions.LoadBestIconIntoImageView
|
|
||||||
import com.moez.QKSMS.feature.extensions.loadBestIconIntoImageView
|
|
||||||
import dev.octoshrimpy.quik.R
|
import dev.octoshrimpy.quik.R
|
||||||
import dev.octoshrimpy.quik.common.base.QkAdapter
|
import dev.octoshrimpy.quik.common.base.QkAdapter
|
||||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||||
import dev.octoshrimpy.quik.common.util.extensions.getDisplayName
|
import dev.octoshrimpy.quik.common.util.extensions.getDisplayName
|
||||||
import dev.octoshrimpy.quik.extensions.getName
|
import dev.octoshrimpy.quik.extensions.getName
|
||||||
|
import dev.octoshrimpy.quik.feature.extensions.LoadBestIconIntoImageView
|
||||||
|
import dev.octoshrimpy.quik.feature.extensions.loadBestIconIntoImageView
|
||||||
import dev.octoshrimpy.quik.model.Attachment
|
import dev.octoshrimpy.quik.model.Attachment
|
||||||
import ezvcard.Ezvcard
|
import ezvcard.Ezvcard
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.subjects.PublishSubject
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import dev.octoshrimpy.quik.extensions.truncateWithEllipses
|
|||||||
import dev.octoshrimpy.quik.feature.compose.BubbleUtils.canGroup
|
import dev.octoshrimpy.quik.feature.compose.BubbleUtils.canGroup
|
||||||
import dev.octoshrimpy.quik.feature.compose.BubbleUtils.getBubble
|
import dev.octoshrimpy.quik.feature.compose.BubbleUtils.getBubble
|
||||||
import dev.octoshrimpy.quik.feature.compose.part.PartsAdapter
|
import dev.octoshrimpy.quik.feature.compose.part.PartsAdapter
|
||||||
|
import dev.octoshrimpy.quik.feature.extensions.isEmojiOnly
|
||||||
import dev.octoshrimpy.quik.model.Conversation
|
import dev.octoshrimpy.quik.model.Conversation
|
||||||
import dev.octoshrimpy.quik.model.Message
|
import dev.octoshrimpy.quik.model.Message
|
||||||
import dev.octoshrimpy.quik.model.Recipient
|
import dev.octoshrimpy.quik.model.Recipient
|
||||||
@@ -109,30 +110,6 @@ class MessagesAdapter @Inject constructor(
|
|||||||
private const val VIEW_TYPE_MESSAGE_OUT = 1
|
private const val VIEW_TYPE_MESSAGE_OUT = 1
|
||||||
|
|
||||||
private const val MAX_MESSAGE_DISPLAY_LENGTH = 5000
|
private const val MAX_MESSAGE_DISPLAY_LENGTH = 5000
|
||||||
|
|
||||||
// Thanks to Cory Kilger for this regex
|
|
||||||
// https://gist.github.com/cmkilger/b8f7dba3e76244a84e7e
|
|
||||||
private val EMOJI_REGEX = Regex(
|
|
||||||
"^[\\s\n\r]*(?:(?:[\u00a9\u00ae\u203c\u2049\u2122\u2139\u2194-\u2199" +
|
|
||||||
"\u21a9-\u21aa\u231a-\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\u24c2" +
|
|
||||||
"\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614-" +
|
|
||||||
"\u2615\u2618\u261d\u2620\u2622-\u2623\u2626\u262a\u262e-\u262f\u2638-" +
|
|
||||||
"\u263a\u2648-\u2653\u2660\u2663\u2665-\u2666\u2668\u267b\u267f\u2692-" +
|
|
||||||
"\u2694\u2696-\u2697\u2699\u269b-\u269c\u26a0-\u26a1\u26aa-\u26ab\u26b0-" +
|
|
||||||
"\u26b1\u26bd-\u26be\u26c4-\u26c5\u26c8\u26ce-\u26cf\u26d1\u26d3-\u26d4" +
|
|
||||||
"\u26e9-\u26ea\u26f0-\u26f5\u26f7-\u26fa\u26fd\u2702\u2705\u2708-\u270d" +
|
|
||||||
"\u270f\u2712\u2714\u2716\u271d\u2721\u2728\u2733-\u2734\u2744\u2747\u274c" +
|
|
||||||
"\u274e\u2753-\u2755\u2757\u2763-\u2764\u2795-\u2797\u27a1\u27b0\u27bf" +
|
|
||||||
"\u2934-\u2935\u2b05-\u2b07\u2b1b-\u2b1c\u2b50\u2b55\u3030\u303d\u3297" +
|
|
||||||
"\u3299\ud83c\udc04\ud83c\udccf\ud83c\udd70-\ud83c\udd71\ud83c\udd7e-" +
|
|
||||||
"\ud83c\udd7f\ud83c\udd8e\ud83c\udd91-\ud83c\udd9a\ud83c\ude01-\ud83c" +
|
|
||||||
"\ude02\ud83c\ude1a\ud83c\ude2f\ud83c\ude32-\ud83c\ude3a\ud83c\ude50-" +
|
|
||||||
"\ud83c\ude51\u200d\ud83c\udf00-\ud83d\uddff\ud83d\ude00-\ud83d\ude4f" +
|
|
||||||
"\ud83d\ude80-\ud83d\udeff\ud83e\udd00-\ud83e\uddff\udb40\udc20-\udb40" +
|
|
||||||
"\udc7f]|\u200d[\u2640\u2642]|[\ud83c\udde6-\ud83c\uddff]" +
|
|
||||||
"{2}|.[\u20e0\u20e3\ufe0f]+)+[\\s\n\r]*)+$"
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// click events passed back to compose view model
|
// click events passed back to compose view model
|
||||||
@@ -345,8 +322,7 @@ class MessagesAdapter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bind the body text
|
// Bind the body text
|
||||||
val emojiOnly = (displayText.isNotBlank()) &&
|
val emojiOnly = displayText.isEmojiOnly()
|
||||||
(displayText.matches(EMOJI_REGEX))
|
|
||||||
textViewStyler.setTextSize(
|
textViewStyler.setTextSize(
|
||||||
holder.body,
|
holder.body,
|
||||||
when (emojiOnly) {
|
when (emojiOnly) {
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package dev.octoshrimpy.quik.feature.extensions
|
||||||
|
|
||||||
|
import android.text.Spannable
|
||||||
|
import androidx.emoji2.text.EmojiCompat
|
||||||
|
import androidx.emoji2.text.EmojiCompat.REPLACE_STRATEGY_ALL
|
||||||
|
import androidx.emoji2.text.EmojiSpan
|
||||||
|
|
||||||
|
|
||||||
|
fun CharSequence.isEmojiOnly(considerWhitespace: Boolean = false): Boolean {
|
||||||
|
val cs =
|
||||||
|
if (considerWhitespace) this
|
||||||
|
else this.replace(Regex("[\\s\n\r]"), "")
|
||||||
|
|
||||||
|
if (cs.isEmpty())
|
||||||
|
return false
|
||||||
|
|
||||||
|
return when (val spannable = EmojiCompat.get().process(
|
||||||
|
cs,
|
||||||
|
0,
|
||||||
|
(cs.length - 1),
|
||||||
|
Int.MAX_VALUE,
|
||||||
|
REPLACE_STRATEGY_ALL
|
||||||
|
)) {
|
||||||
|
is Spannable -> {
|
||||||
|
(spannable
|
||||||
|
.getSpans(0, (spannable.length - 1), EmojiSpan::class.java)
|
||||||
|
.fold(0) { acc, emojiSpan ->
|
||||||
|
acc + (spannable.getSpanEnd(emojiSpan) - spannable.getSpanStart(emojiSpan))
|
||||||
|
} == cs.length)
|
||||||
|
}
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.moez.QKSMS.feature.extensions
|
package dev.octoshrimpy.quik.feature.extensions
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView {
|
|||||||
|
|
||||||
// populate message box with data returned by STT, set cursor to end, and focus
|
// populate message box with data returned by STT, set cursor to end, and focus
|
||||||
message.setText(match[0])
|
message.setText(match[0])
|
||||||
message.setSelection(message.text.length)
|
message.setSelection(message.text?.length ?: 0)
|
||||||
message.requestFocus()
|
message.requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -23,12 +23,12 @@ import android.net.Uri
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.moez.QKSMS.feature.extensions.LoadBestIconIntoImageView
|
|
||||||
import com.moez.QKSMS.feature.extensions.loadBestIconIntoImageView
|
|
||||||
import dev.octoshrimpy.quik.R
|
import dev.octoshrimpy.quik.R
|
||||||
import dev.octoshrimpy.quik.common.base.QkAdapter
|
import dev.octoshrimpy.quik.common.base.QkAdapter
|
||||||
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
import dev.octoshrimpy.quik.common.base.QkViewHolder
|
||||||
import dev.octoshrimpy.quik.extensions.getName
|
import dev.octoshrimpy.quik.extensions.getName
|
||||||
|
import dev.octoshrimpy.quik.feature.extensions.LoadBestIconIntoImageView
|
||||||
|
import dev.octoshrimpy.quik.feature.extensions.loadBestIconIntoImageView
|
||||||
import kotlinx.android.synthetic.main.scheduled_message_image_list_item.fileName
|
import kotlinx.android.synthetic.main.scheduled_message_image_list_item.fileName
|
||||||
import kotlinx.android.synthetic.main.scheduled_message_image_list_item.thumbnail
|
import kotlinx.android.synthetic.main.scheduled_message_image_list_item.thumbnail
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|||||||
Reference in New Issue
Block a user