mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 20:10:04 +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.media.RingtoneManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
|
import androidx.annotation.BoolRes
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import com.squareup.seismic.ShakeDetector
|
import com.squareup.seismic.ShakeDetector
|
||||||
import im.vector.app.BuildConfig
|
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 {
|
fun areNotificationEnabledForDevice(): Boolean {
|
||||||
return defaultPrefs.getBoolean(SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY, true)
|
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.
|
* @return true to show timeline message in bubble.
|
||||||
*/
|
*/
|
||||||
fun useMessageBubblesLayout(): Boolean {
|
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>
|
<item>riot.im</item>
|
||||||
</string-array>
|
</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>
|
</resources>
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_category_timeline">
|
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_category_timeline">
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorSwitchPreference
|
<im.vector.app.core.preference.VectorSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="@bool/settings_interface_bubble_default"
|
||||||
android:key="SETTINGS_INTERFACE_BUBBLE_KEY"
|
android:key="SETTINGS_INTERFACE_BUBBLE_KEY"
|
||||||
android:title="@string/message_bubbles" />
|
android:title="@string/message_bubbles" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue