add some things related to setting custom reminder sound

This commit is contained in:
tibbi 2016-12-10 12:25:54 +01:00
parent 7f8058580b
commit 91f0fe4955
17 changed files with 58 additions and 4 deletions

View file

@ -10,6 +10,7 @@ import com.simplemobiletools.calendar.extensions.hideKeyboard
import com.simplemobiletools.calendar.extensions.showKeyboard
import com.simplemobiletools.calendar.extensions.value
import com.simplemobiletools.calendar.helpers.*
import com.simplemobiletools.filepicker.extensions.getFilenameFromPath
import com.simplemobiletools.filepicker.extensions.toast
import kotlinx.android.synthetic.main.activity_settings.*
@ -22,6 +23,7 @@ class SettingsActivity : SimpleActivity() {
setupSundayFirst()
setupWeekNumbers()
setupVibrate()
setupReminderSound()
setupEventReminder()
}
@ -50,6 +52,13 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupReminderSound() {
settings_reminder_sound.text = mConfig.reminderSound.getFilenameFromPath()
settings_reminder_sound_holder.setOnClickListener {
}
}
private fun setupVibrate() {
settings_vibrate.isChecked = mConfig.vibrateOnReminder
settings_vibrate_holder.setOnClickListener {

View file

@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.helpers
import android.content.Context
import android.content.SharedPreferences
import android.media.RingtoneManager
import java.util.*
class Config(context: Context) {
@ -38,6 +39,10 @@ class Config(context: Context) {
get() = mPrefs.getBoolean(VIBRATE, false)
set(vibrate) = mPrefs.edit().putBoolean(VIBRATE, vibrate).apply()
var reminderSound: String
get() = mPrefs.getString(REMINDER_SOUND, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION).toString())
set(path) = mPrefs.edit().putString(REMINDER_SOUND, path).apply()
var storedView: Int
get() = mPrefs.getInt(VIEW, MONTHLY_VIEW)
set(view) = mPrefs.edit().putInt(VIEW, view).apply()

View file

@ -34,6 +34,7 @@ val IS_DARK_THEME = "is_dark_theme"
val SUNDAY_FIRST = "sunday_first"
val WEEK_NUMBERS = "week_numbers"
val VIBRATE = "vibrate"
val REMINDER_SOUND = "reminder_sound"
val VIEW = "view"
val REMINDER_TYPE = "reminder_type"
val REMINDER_MINUTES = "reminder_minutes"

View file

@ -123,6 +123,36 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_reminder_sound_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<TextView
android:id="@+id/settings_reminder_sound_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/settings_padding"
android:paddingStart="@dimen/settings_padding"
android:text="@string/reminder_sound"/>
<TextView
android:id="@+id/settings_reminder_sound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/tiny_margin"
android:layout_marginRight="@dimen/tiny_margin"
android:background="@null"
android:clickable="false"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_default_reminder_holder"
android:layout_width="match_parent"

View file

@ -15,7 +15,7 @@
android:paddingBottom="@dimen/event_padding"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/small_padding">
android:paddingTop="@dimen/tiny_margin">
<TextView
android:id="@+id/event_item_start"

View file

@ -6,6 +6,6 @@
android:layout_height="wrap_content"
android:drawablePadding="1dp"
android:drawableTop="@drawable/divider"
android:paddingTop="@dimen/small_padding"
android:paddingTop="@dimen/tiny_margin"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold"/>

View file

@ -6,6 +6,6 @@
android:layout_height="wrap_content"
android:drawablePadding="1dp"
android:drawableTop="@drawable/divider"
android:paddingTop="@dimen/small_padding"
android:paddingTop="@dimen/tiny_margin"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold"/>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">Sonntag als erster Wochentag</string>
<string name="week_numbers">Zeige Kalenderwoche an</string>
<string name="vibrate">Vibrate on reminder notification</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Standard Termin Erinnerung</string>
<string name="reminder_saved">Erinnerung gespeichert</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">Domingo como primer día</string>
<string name="week_numbers">Mostrar los números de la semana</string>
<string name="vibrate">Vibrate on reminder notification</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Recordatorio predeterminado de un evento</string>
<string name="reminder_saved">Recordatorio guardado</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">रविवार पहला दिन हैं</string>
<string name="week_numbers">सफ्ताह क्रमांक दिखाए</string>
<string name="vibrate">Vibrate on reminder notification</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Default event reminder</string>
<string name="reminder_saved">Reminder saved</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">Vasárnap a hét első napja</string>
<string name="week_numbers">Hetek sorszámának mutatása</string>
<string name="vibrate">Emlékeztetőnél rezgés</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Alapértelmezett emlékeztetés</string>
<string name="reminder_saved">Emlékeztető elmentve</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">Sunday as first day</string>
<string name="week_numbers">Display week numbers</string>
<string name="vibrate">Vibrate on reminder notification</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Default event reminder</string>
<string name="reminder_saved">Reminder saved</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">日曜日が最初</string>
<string name="week_numbers">週番号を表示</string>
<string name="vibrate">リマインダー通知で振動</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">デフォルトのイベント リマインダー</string>
<string name="reminder_saved">リマインダーを保存しました</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">Domingo como primeiro dia</string>
<string name="week_numbers">Mostrar número das semanas</string>
<string name="vibrate">Vibrar ao notificar sobre o lembrete</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Lembrete padrão</string>
<string name="reminder_saved">Lembrete guardado</string>

View file

@ -71,6 +71,7 @@
<string name="sunday_first">Sunday as first day</string>
<string name="week_numbers">Display week numbers</string>
<string name="vibrate">Vibrate on reminder notification</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Default event reminder</string>
<string name="reminder_saved">Reminder saved</string>

View file

@ -1,7 +1,7 @@
<resources>
<dimen name="activity_margin">16dp</dimen>
<dimen name="big_margin">24dp</dimen>
<dimen name="small_padding">4dp</dimen>
<dimen name="tiny_margin">4dp</dimen>
<dimen name="medium_padding">8dp</dimen>
<dimen name="social_padding">8dp</dimen>
<dimen name="social_logo">40dp</dimen>

View file

@ -72,6 +72,7 @@
<string name="sunday_first">Sunday as first day</string>
<string name="week_numbers">Display week numbers</string>
<string name="vibrate">Vibrate on reminder notification</string>
<string name="reminder_sound">Reminder sound</string>
<string name="default_event_reminder">Default event reminder</string>
<string name="reminder_saved">Reminder saved</string>