diff --git a/android-smsmms/build.gradle b/android-smsmms/build.gradle index 5f79535b..9c8c996f 100644 --- a/android-smsmms/build.gradle +++ b/android-smsmms/build.gradle @@ -20,7 +20,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdk 33 + compileSdk 34 defaultConfig { minSdkVersion 23 diff --git a/build.gradle b/build.gradle index 2cdad63f..1e6de0b2 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ buildscript { ext.androidx_appcompat_version = '1.6.1' + ext.androidx_emoji2_version = '1.4.0' ext.androidx_constraintlayout_version = '1.1.3' ext.androidx_core_version = '1.1.0' ext.androidx_documentfile_version = '1.0.1' diff --git a/data/build.gradle b/data/build.gradle index 1b333e5c..c376e7f4 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -21,7 +21,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' android { - compileSdk 33 + compileSdk 34 publishNonDefault true flavorDimensions "analytics" diff --git a/domain/build.gradle b/domain/build.gradle index d3d41487..2d07c9c1 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdk 33 + compileSdk 34 compileOptions { sourceCompatibility 1.8 diff --git a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt index 16857073..a84826c2 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -156,7 +156,8 @@ class Preferences @Inject constructor( val keyChanges: Observable = Observable.create { emitter -> // Making this a lambda would cause it to be GCd val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> - emitter.onNext(key) + if (key != null) + emitter.onNext(key) } emitter.setCancellable { diff --git a/presentation/build.gradle b/presentation/build.gradle index df724297..c5f87ee6 100644 --- a/presentation/build.gradle +++ b/presentation/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdk 33 + compileSdk 34 flavorDimensions "analytics" defaultConfig { @@ -123,6 +123,7 @@ dependencies { // androidx implementation "androidx.appcompat:appcompat:$androidx_appcompat_version" + implementation "androidx.emoji2:emoji2-bundled:$androidx_emoji2_version" implementation "androidx.constraintlayout:constraintlayout:$androidx_constraintlayout_version" implementation "androidx.core:core-ktx:$androidx_core_version" implementation "androidx.viewpager2:viewpager2:$androidx_viewpager_version" diff --git a/presentation/src/main/java/com/moez/QKSMS/common/QKApplication.kt b/presentation/src/main/java/com/moez/QKSMS/common/QKApplication.kt index 9b7b197f..51eaf1da 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/QKApplication.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/QKApplication.kt @@ -22,7 +22,8 @@ import android.app.Activity import android.app.Application import android.app.Service 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.WorkManager import androidx.work.WorkerFactory @@ -104,8 +105,26 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn nightModeManager.updateCurrentTheme() + // configure timber logging 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() .configureWith(AutoDisposeConfigurer::configure) .install() diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkEditText.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkEditText.kt index 17d05b1f..a8bf7628 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkEditText.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkEditText.kt @@ -25,7 +25,7 @@ import android.view.KeyEvent import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputConnection 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.InputConnectionCompat 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 * 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 diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index f04fe1cc..f4bb4c16 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -824,7 +824,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { if (messageEditBox !== null) { // populate message box with data returned by STT, set cursor to end, and focus messageEditBox.append(match[0]) - messageEditBox.setSelection(messageEditBox.text.length) + messageEditBox.setSelection(messageEditBox.text?.length ?: 0) messageEditBox.requestFocus() } } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/extensions/CharSequenceExtensions.kt b/presentation/src/main/java/com/moez/QKSMS/feature/extensions/CharSequenceExtensions.kt index 103e0612..cded1ce9 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/extensions/CharSequenceExtensions.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/extensions/CharSequenceExtensions.kt @@ -1,9 +1,9 @@ package dev.octoshrimpy.quik.feature.extensions import android.text.Spannable -import androidx.emoji.text.EmojiCompat -import androidx.emoji.text.EmojiCompat.REPLACE_STRATEGY_ALL -import androidx.emoji.text.EmojiSpan +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 { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt index 5b8caa23..ab20b9b4 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt @@ -80,7 +80,7 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView { // populate message box with data returned by STT, set cursor to end, and focus message.setText(match[0]) - message.setSelection(message.text.length) + message.setSelection(message.text?.length ?: 0) message.requestFocus() }