use emoji2-bundled version for compatibility with non playstore/gsm os'

emoji2 compat library to 1.4.0 (required compilesdk upgrade to 34)
make qkedittext use appcompatedittext for emoji compatibility
fix small incompatibilities introduced by new library versions
This commit is contained in:
gavine99
2025-04-01 10:02:34 +11:00
parent 7d743a5969
commit 2c2c8e90a2
11 changed files with 36 additions and 13 deletions
+1 -1
View File
@@ -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
+1
View File
@@ -2,6 +2,7 @@
buildscript { buildscript {
ext.androidx_appcompat_version = '1.6.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'
+1 -1
View File
@@ -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
View File
@@ -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
@@ -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 {
+2 -1
View File
@@ -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,6 +123,7 @@ 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.viewpager2:viewpager2:$androidx_viewpager_version" implementation "androidx.viewpager2:viewpager2:$androidx_viewpager_version"
@@ -22,7 +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.emoji2.text.EmojiCompat
import androidx.work.Configuration import androidx.work.Configuration
import androidx.work.WorkManager import androidx.work.WorkManager
import androidx.work.WorkerFactory import androidx.work.WorkerFactory
@@ -104,8 +105,26 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
nightModeManager.updateCurrentTheme() nightModeManager.updateCurrentTheme()
// configure timber logging
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()
@@ -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
@@ -824,7 +824,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()
} }
} }
@@ -1,9 +1,9 @@
package dev.octoshrimpy.quik.feature.extensions package dev.octoshrimpy.quik.feature.extensions
import android.text.Spannable import android.text.Spannable
import androidx.emoji.text.EmojiCompat import androidx.emoji2.text.EmojiCompat
import androidx.emoji.text.EmojiCompat.REPLACE_STRATEGY_ALL import androidx.emoji2.text.EmojiCompat.REPLACE_STRATEGY_ALL
import androidx.emoji.text.EmojiSpan import androidx.emoji2.text.EmojiSpan
fun CharSequence.isEmojiOnly(considerWhitespace: Boolean = false): Boolean { fun CharSequence.isEmojiOnly(considerWhitespace: Boolean = false): Boolean {
@@ -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()
} }