mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Create a new resource in config file for default setting value. First case: message bubbles
This commit is contained in:
parent
5bfb8fe294
commit
5cfcd65b38
3 changed files with 10 additions and 2 deletions
|
@ -20,6 +20,7 @@ import android.content.SharedPreferences
|
|||
import android.media.RingtoneManager
|
||||
import android.net.Uri
|
||||
import android.provider.MediaStore
|
||||
import androidx.annotation.BoolRes
|
||||
import androidx.core.content.edit
|
||||
import com.squareup.seismic.ShakeDetector
|
||||
import im.vector.app.BuildConfig
|
||||
|
@ -300,6 +301,8 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getDefault(@BoolRes resId: Int) = context.resources.getBoolean(resId)
|
||||
|
||||
fun areNotificationEnabledForDevice(): Boolean {
|
||||
return defaultPrefs.getBoolean(SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY, true)
|
||||
}
|
||||
|
@ -856,7 +859,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||
* @return true to show timeline message in bubble.
|
||||
*/
|
||||
fun useMessageBubblesLayout(): Boolean {
|
||||
return defaultPrefs.getBoolean(SETTINGS_INTERFACE_BUBBLE_KEY, false)
|
||||
return defaultPrefs.getBoolean(SETTINGS_INTERFACE_BUBBLE_KEY, getDefault(R.bool.settings_interface_bubble_default))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,4 +40,9 @@
|
|||
<item>riot.im</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Default preference values -->
|
||||
|
||||
<!-- If set to true, bubbles will be enabled by default in the preference -->
|
||||
<bool name="settings_interface_bubble_default">false</bool>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_category_timeline">
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:defaultValue="@bool/settings_interface_bubble_default"
|
||||
android:key="SETTINGS_INTERFACE_BUBBLE_KEY"
|
||||
android:title="@string/message_bubbles" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue