diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 5be6bbd..a7a1d7a 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -19,7 +19,9 @@ Benachrichtigung Benachrichtigungston Der Ton der Benachrichtigung. - + System-Benachrichtigung + Kein Ton + Vibration bei Benachrichtigung Soll der der Timer vibrieren? diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 528f7b1..15f332c 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -19,6 +19,8 @@ Notification Avertissement sonore Effet sonore de la notification. + Avertissement standard + Silence Notification vibrante Faire vibrer le téléphone pour la notification. diff --git a/res/values/strings.xml b/res/values/strings.xml index c23945f..a9a87a3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7,7 +7,7 @@ Tea time! Hour:Min:Sec - The phone is in silent mode! Notification vibration and sound will be supressed. + The phone is in silent mode! Notification vibration and sound will be suppressed. Warning Ok @@ -19,7 +19,9 @@ Notification Notification Diddy The notification\'s sound effects. - + System default + No sound + Notification Vibrate Should the timer notification Vibrate. @@ -54,7 +56,8 @@ TeaTimer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. http://www.gnu.org/licenses/gpl.html Get the latest version of the source code on Github. - https://github.com/ralphleon/TeaTimer + https://github.com/ralphleon/TeaTimer + diff --git a/src/goo/TeaTimer/TimerPrefActivity.java b/src/goo/TeaTimer/TimerPrefActivity.java index bfefa95..0ef6a26 100644 --- a/src/goo/TeaTimer/TimerPrefActivity.java +++ b/src/goo/TeaTimer/TimerPrefActivity.java @@ -6,7 +6,7 @@ import android.preference.ListPreference; import android.preference.PreferenceActivity; import android.provider.MediaStore; -import android.util.Log; +//import android.util.Log; public class TimerPrefActivity extends PreferenceActivity { @@ -49,15 +49,18 @@ protected void onCreate(Bundle savedInstanceState) { i++; } - cursor.close(); + cursor.close(); } - CharSequence [] entries = {"No Sound","Big Ben"}; - CharSequence [] entryValues = {"","android.resource://goo.TeaTimer/" + R.raw.big_ben}; - - //Default value - if(tone.getValue() == null) tone.setValue((String)entryValues[1]); - + CharSequence [] entries = { getResources().getText(R.string.notification_no_sound), + getResources().getText(R.string.notification_default), + "Big Ben"}; + CharSequence [] entryValues = {"", "SYSTEM_DEFAULT", "android.resource://goo.TeaTimer/" + R.raw.big_ben}; + + //Default value + if (tone.getValue() == null){ + tone.setValue((String)entryValues[2]); + } if( items != null && items.length > 0){ tone.setEntries(concat(entries,items)); tone.setEntryValues(concat(entryValues,itemUris)); @@ -75,4 +78,4 @@ protected void onCreate(Bundle savedInstanceState) { return C; } -} \ No newline at end of file +} diff --git a/src/goo/TeaTimer/TimerReceiver.java b/src/goo/TeaTimer/TimerReceiver.java index 177c403..a7a8cb2 100644 --- a/src/goo/TeaTimer/TimerReceiver.java +++ b/src/goo/TeaTimer/TimerReceiver.java @@ -65,14 +65,24 @@ public void onReceive(Context context, Intent pintent) } // Play a sound! - if(notificationUri != ""){ - Uri uri = Uri.parse(notificationUri); - notification.sound = uri; + if(!notificationUri.toString().equals("")){ + if (notificationUri.toString().equals("SYSTEM_DEFAULT")){ + Log.v(TAG, "Using default sound for notification"); + notification.defaults |= Notification.DEFAULT_SOUND; + } + else{ + Log.v(TAG, "Using sound " + notificationUri.toString() + " for notification"); + Uri uri = Uri.parse(notificationUri); + notification.sound = uri; + } } - + else{ + Log.v(TAG, "No sound is played"); + } + notification.flags |= Notification.FLAG_AUTO_CANCEL; - - Intent intent = new Intent(context,TimerActivity.class); + + Intent intent = new Intent(context,TimerActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(context, 0,intent, Intent.FLAG_ACTIVITY_NEW_TASK); notification.setLatestEventInfo(context, text, @@ -117,6 +127,6 @@ public void onReceive(Context context, Intent pintent) // Show notification mNM.notify(0, notification); - } + } -} \ No newline at end of file +}