Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add preference to select stop playing music when headphone is

unplugged, or continue playing
  • Loading branch information...
commit 9a7572760f7b25bbc620bab11dfe3a5764318ddb 1 parent 2b76409
@mamewotoko authored
View
3  README.md
@@ -66,8 +66,7 @@ TODO
* localize: French, Chinese
* support podcast
* add callback which is called when music is stopped
-* show music title as a notificaition
-* add preference of "stop music on unplugged headphone"
+* show music title as a notificaition, not filename
* add play button on volume preference to check volume
* show mark on playing music in playlist preference
* improve UI to create and edit playlist
View
3  res/values-ja/strings.xml
@@ -88,4 +88,7 @@
<string name="play_with_sleep_timer">スリープタイマをセットしました。</string>
<string name="sleep_playlist_not_exist">プレイリストsleep.m3uが存在しません。</string>
<string name="playing">再生中</string>
+ <string name="pref_stop_on_unplugged_title">ヘッドホンを抜いたとき</string>
+ <string name="pref_stop_on_unplugged_on_summary">音楽をとめる</string>
+ <string name="pref_stop_on_unplugged_off_summary">音楽をとめない</string>
</resources>
View
4 res/values-ko/strings.xml
@@ -88,4 +88,8 @@
<string name="play_with_sleep_timer">휴식 대마를 세트 했습니다. </string>
<string name="sleep_playlist_not_exist">플레이 리스트 sleep.m3u 가 존재하지 않습니다 </string>
<string name="playing">재생중</string>
+
+ <string name="pref_stop_on_unplugged_title">헤드폰을 뺐을 때</string>
+ <string name="pref_stop_on_unplugged_on_summary">음악을 멈춘다</string>
+ <string name="pref_stop_on_unplugged_off_summary">음악을 멈추지 않는다</string>
</resources>
View
4 res/values/strings.xml
@@ -89,4 +89,8 @@
<string name="play_with_sleep_timer">Playing music with sleep timer</string>
<string name="sleep_playlist_not_exist">Playlist sleep.m3u does not exist.</string>
<string name="playing">Playing</string>
+
+ <string name="pref_stop_on_unplugged_title">Stop music when unplugged</string>
+ <string name="pref_stop_on_unplugged_on_summary">stop playing</string>
+ <string name="pref_stop_on_unplugged_off_summary">continue playing</string>
</resources>
View
11 res/xml/preference.xml
@@ -73,8 +73,14 @@
android:summaryOn="@string/enable_vibration"
android:title="@string/pref_vibration" >
</CheckBoxPreference>
-
- <com.mamewo.malarm24.VolumePreference
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:enabled="true"
+ android:key="stop_on_unplugged"
+ android:summaryOff="@string/pref_stop_on_unplugged_off_summary"
+ android:summaryOn="@string/pref_stop_on_unplugged_on_summary"
+ android:title="@string/pref_stop_on_unplugged_title" />
+<com.mamewo.malarm24.VolumePreference
android:defaultValue="2"
android:key="sleep_volume"
android:title="@string/pref_sleep_volume_title" />
@@ -82,6 +88,7 @@
android:defaultValue="10"
android:key="wakeup_volume"
android:title="@string/pref_wakeup_volume_title" />
+
</PreferenceCategory>
<PreferenceCategory
android:key="other_category"
View
12 src/com/mamewo/malarm24/MalarmPlayerService.java
@@ -126,9 +126,15 @@ else if (LOAD_PLAYLIST_ACTION.equals(action)) {
loadPlaylist();
}
else if (UNPLUGGED_ACTION.equals(action)) {
- pauseMusic();
- if (null != listener_) {
- listener_.onStopMusic();
+ SharedPreferences pref =
+ PreferenceManager.getDefaultSharedPreferences(this);
+ boolean stop = pref.getBoolean("stop_on_unplugged", true);
+ if (stop) {
+ pauseMusic();
+ if (null != listener_) {
+ listener_.onStopMusic();
+ }
+ //TODO: fix notification
}
}
return START_STICKY;
2  test/malarm_scirocco_test
@@ -1 +1 @@
-Subproject commit 97950d75d8b824e352ad7d8e02421ae37069fc6b
+Subproject commit 6cc224d7daacd393bf5bb10bf6183063592e6c16
Please sign in to comment.
Something went wrong with that request. Please try again.