From f015ac6ef61c18f6d33d816a28f051b76fe92bc8 Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 16 Feb 2024 11:10:52 +0530 Subject: [PATCH] Change MMS compression to auto --- .../java/com/moez/QKSMS/util/Preferences.kt | 2 +- .../moez/QKSMS/feature/main/MainActivity.kt | 18 ++++++++++++++++++ presentation/src/main/res/values/strings.xml | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) 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 debc976b..b9aa9303 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -120,7 +120,7 @@ class Preferences @Inject constructor( val mobileOnly = rxPrefs.getBoolean("mobileOnly", false) val autoDelete = rxPrefs.getInteger("autoDelete", 0) val longAsMms = rxPrefs.getBoolean("longAsMms", false) - val mmsSize = rxPrefs.getInteger("mmsSize", 300) + val mmsSize = rxPrefs.getInteger("mmsSize", -1) val logging = rxPrefs.getBoolean("logging", false) init { diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt index 06ab61d5..aad641a4 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt @@ -23,8 +23,10 @@ import android.animation.ObjectAnimator import android.app.AlertDialog import android.content.Intent import android.content.res.ColorStateList +import android.content.SharedPreferences import android.os.Build import android.os.Bundle +import android.preference.PreferenceManager import android.view.Gravity import android.view.Menu import android.view.MenuItem @@ -179,6 +181,22 @@ class MainActivity : QkThemedActivity(), MainView { if (Build.VERSION.SDK_INT <= 22) { toolbarSearch.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor)) } + + val sharedPreferences: SharedPreferences = + PreferenceManager.getDefaultSharedPreferences(this) + val editor: SharedPreferences.Editor = sharedPreferences.edit() + var changeDefault: Int = sharedPreferences.getInt("changeDefault", 0) + when (changeDefault) { + 0 -> { + // Set MMS site auto (-1) if its 300kb + val mmsSize: Int = sharedPreferences.getInt("mmsSize", 300) + if (mmsSize == 300) { + editor.putInt("mmsSize", -1) + } + changeDefault++ + } + } + editor.putInt("changeDefault", changeDefault).apply() } override fun onNewIntent(intent: Intent?) { diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index ac330d35..73514329 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -457,7 +457,7 @@ - Automatic + Automatic (uses allowed carrier max size) 100KB 200KB 300KB -- GitLab