add some things related to setting custom reminder sound
This commit is contained in:
parent
7f8058580b
commit
91f0fe4955
|
@ -10,6 +10,7 @@ import com.simplemobiletools.calendar.extensions.hideKeyboard
|
||||||
import com.simplemobiletools.calendar.extensions.showKeyboard
|
import com.simplemobiletools.calendar.extensions.showKeyboard
|
||||||
import com.simplemobiletools.calendar.extensions.value
|
import com.simplemobiletools.calendar.extensions.value
|
||||||
import com.simplemobiletools.calendar.helpers.*
|
import com.simplemobiletools.calendar.helpers.*
|
||||||
|
import com.simplemobiletools.filepicker.extensions.getFilenameFromPath
|
||||||
import com.simplemobiletools.filepicker.extensions.toast
|
import com.simplemobiletools.filepicker.extensions.toast
|
||||||
import kotlinx.android.synthetic.main.activity_settings.*
|
import kotlinx.android.synthetic.main.activity_settings.*
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupSundayFirst()
|
setupSundayFirst()
|
||||||
setupWeekNumbers()
|
setupWeekNumbers()
|
||||||
setupVibrate()
|
setupVibrate()
|
||||||
|
setupReminderSound()
|
||||||
setupEventReminder()
|
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() {
|
private fun setupVibrate() {
|
||||||
settings_vibrate.isChecked = mConfig.vibrateOnReminder
|
settings_vibrate.isChecked = mConfig.vibrateOnReminder
|
||||||
settings_vibrate_holder.setOnClickListener {
|
settings_vibrate_holder.setOnClickListener {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.helpers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.media.RingtoneManager
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class Config(context: Context) {
|
class Config(context: Context) {
|
||||||
|
@ -38,6 +39,10 @@ class Config(context: Context) {
|
||||||
get() = mPrefs.getBoolean(VIBRATE, false)
|
get() = mPrefs.getBoolean(VIBRATE, false)
|
||||||
set(vibrate) = mPrefs.edit().putBoolean(VIBRATE, vibrate).apply()
|
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
|
var storedView: Int
|
||||||
get() = mPrefs.getInt(VIEW, MONTHLY_VIEW)
|
get() = mPrefs.getInt(VIEW, MONTHLY_VIEW)
|
||||||
set(view) = mPrefs.edit().putInt(VIEW, view).apply()
|
set(view) = mPrefs.edit().putInt(VIEW, view).apply()
|
||||||
|
|
|
@ -34,6 +34,7 @@ val IS_DARK_THEME = "is_dark_theme"
|
||||||
val SUNDAY_FIRST = "sunday_first"
|
val SUNDAY_FIRST = "sunday_first"
|
||||||
val WEEK_NUMBERS = "week_numbers"
|
val WEEK_NUMBERS = "week_numbers"
|
||||||
val VIBRATE = "vibrate"
|
val VIBRATE = "vibrate"
|
||||||
|
val REMINDER_SOUND = "reminder_sound"
|
||||||
val VIEW = "view"
|
val VIEW = "view"
|
||||||
val REMINDER_TYPE = "reminder_type"
|
val REMINDER_TYPE = "reminder_type"
|
||||||
val REMINDER_MINUTES = "reminder_minutes"
|
val REMINDER_MINUTES = "reminder_minutes"
|
||||||
|
|
|
@ -123,6 +123,36 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</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
|
<RelativeLayout
|
||||||
android:id="@+id/settings_default_reminder_holder"
|
android:id="@+id/settings_default_reminder_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
android:paddingBottom="@dimen/event_padding"
|
android:paddingBottom="@dimen/event_padding"
|
||||||
android:paddingLeft="@dimen/activity_margin"
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
android:paddingRight="@dimen/activity_margin"
|
android:paddingRight="@dimen/activity_margin"
|
||||||
android:paddingTop="@dimen/small_padding">
|
android:paddingTop="@dimen/tiny_margin">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/event_item_start"
|
android:id="@+id/event_item_start"
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawablePadding="1dp"
|
android:drawablePadding="1dp"
|
||||||
android:drawableTop="@drawable/divider"
|
android:drawableTop="@drawable/divider"
|
||||||
android:paddingTop="@dimen/small_padding"
|
android:paddingTop="@dimen/tiny_margin"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawablePadding="1dp"
|
android:drawablePadding="1dp"
|
||||||
android:drawableTop="@drawable/divider"
|
android:drawableTop="@drawable/divider"
|
||||||
android:paddingTop="@dimen/small_padding"
|
android:paddingTop="@dimen/tiny_margin"
|
||||||
android:textSize="@dimen/normal_text_size"
|
android:textSize="@dimen/normal_text_size"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold"/>
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">Sonntag als erster Wochentag</string>
|
<string name="sunday_first">Sonntag als erster Wochentag</string>
|
||||||
<string name="week_numbers">Zeige Kalenderwoche an</string>
|
<string name="week_numbers">Zeige Kalenderwoche an</string>
|
||||||
<string name="vibrate">Vibrate on reminder notification</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="default_event_reminder">Standard Termin Erinnerung</string>
|
||||||
<string name="reminder_saved">Erinnerung gespeichert</string>
|
<string name="reminder_saved">Erinnerung gespeichert</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">Domingo como primer día</string>
|
<string name="sunday_first">Domingo como primer día</string>
|
||||||
<string name="week_numbers">Mostrar los números de la semana</string>
|
<string name="week_numbers">Mostrar los números de la semana</string>
|
||||||
<string name="vibrate">Vibrate on reminder notification</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="default_event_reminder">Recordatorio predeterminado de un evento</string>
|
||||||
<string name="reminder_saved">Recordatorio guardado</string>
|
<string name="reminder_saved">Recordatorio guardado</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">रविवार पहला दिन हैं</string>
|
<string name="sunday_first">रविवार पहला दिन हैं</string>
|
||||||
<string name="week_numbers">सफ्ताह क्रमांक दिखाए</string>
|
<string name="week_numbers">सफ्ताह क्रमांक दिखाए</string>
|
||||||
<string name="vibrate">Vibrate on reminder notification</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="default_event_reminder">Default event reminder</string>
|
||||||
<string name="reminder_saved">Reminder saved</string>
|
<string name="reminder_saved">Reminder saved</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">Vasárnap a hét első napja</string>
|
<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="week_numbers">Hetek sorszámának mutatása</string>
|
||||||
<string name="vibrate">Emlékeztetőnél rezgés</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="default_event_reminder">Alapértelmezett emlékeztetés</string>
|
||||||
<string name="reminder_saved">Emlékeztető elmentve</string>
|
<string name="reminder_saved">Emlékeztető elmentve</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">Sunday as first day</string>
|
<string name="sunday_first">Sunday as first day</string>
|
||||||
<string name="week_numbers">Display week numbers</string>
|
<string name="week_numbers">Display week numbers</string>
|
||||||
<string name="vibrate">Vibrate on reminder notification</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="default_event_reminder">Default event reminder</string>
|
||||||
<string name="reminder_saved">Reminder saved</string>
|
<string name="reminder_saved">Reminder saved</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">日曜日が最初</string>
|
<string name="sunday_first">日曜日が最初</string>
|
||||||
<string name="week_numbers">週番号を表示</string>
|
<string name="week_numbers">週番号を表示</string>
|
||||||
<string name="vibrate">リマインダー通知で振動</string>
|
<string name="vibrate">リマインダー通知で振動</string>
|
||||||
|
<string name="reminder_sound">Reminder sound</string>
|
||||||
<string name="default_event_reminder">デフォルトのイベント リマインダー</string>
|
<string name="default_event_reminder">デフォルトのイベント リマインダー</string>
|
||||||
<string name="reminder_saved">リマインダーを保存しました</string>
|
<string name="reminder_saved">リマインダーを保存しました</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">Domingo como primeiro dia</string>
|
<string name="sunday_first">Domingo como primeiro dia</string>
|
||||||
<string name="week_numbers">Mostrar número das semanas</string>
|
<string name="week_numbers">Mostrar número das semanas</string>
|
||||||
<string name="vibrate">Vibrar ao notificar sobre o lembrete</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="default_event_reminder">Lembrete padrão</string>
|
||||||
<string name="reminder_saved">Lembrete guardado</string>
|
<string name="reminder_saved">Lembrete guardado</string>
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<string name="sunday_first">Sunday as first day</string>
|
<string name="sunday_first">Sunday as first day</string>
|
||||||
<string name="week_numbers">Display week numbers</string>
|
<string name="week_numbers">Display week numbers</string>
|
||||||
<string name="vibrate">Vibrate on reminder notification</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="default_event_reminder">Default event reminder</string>
|
||||||
<string name="reminder_saved">Reminder saved</string>
|
<string name="reminder_saved">Reminder saved</string>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="activity_margin">16dp</dimen>
|
<dimen name="activity_margin">16dp</dimen>
|
||||||
<dimen name="big_margin">24dp</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="medium_padding">8dp</dimen>
|
||||||
<dimen name="social_padding">8dp</dimen>
|
<dimen name="social_padding">8dp</dimen>
|
||||||
<dimen name="social_logo">40dp</dimen>
|
<dimen name="social_logo">40dp</dimen>
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
<string name="sunday_first">Sunday as first day</string>
|
<string name="sunday_first">Sunday as first day</string>
|
||||||
<string name="week_numbers">Display week numbers</string>
|
<string name="week_numbers">Display week numbers</string>
|
||||||
<string name="vibrate">Vibrate on reminder notification</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="default_event_reminder">Default event reminder</string>
|
||||||
<string name="reminder_saved">Reminder saved</string>
|
<string name="reminder_saved">Reminder saved</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue