From e6d74b6a1b67cf5ce1ee53be3aaaaf23f3a7810b Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Sat, 24 Mar 2012 01:44:44 -0500 Subject: [PATCH] Split preferences into multiple screens; add about page --- AndroidManifest.xml | 7 + assets/about.html | 60 +++++ res/values/translatable.xml | 14 +- res/xml/preference_audio.xml | 52 +++++ res/xml/preference_headers.xml | 45 ++++ res/xml/preference_library.xml | 50 +++++ res/xml/preference_misc.xml | 61 +++++ res/xml/preference_notifications.xml | 43 ++++ res/xml/preference_playback.xml | 61 +++++ res/xml/preference_shake.xml | 46 ++++ res/xml/preferences.xml | 211 ++++-------------- .../kreed/vanilla/PreferencesActivity.java | 175 ++++++++++++++- src/org/kreed/vanilla/TabOrderPreference.java | 47 ---- 13 files changed, 647 insertions(+), 225 deletions(-) create mode 100644 assets/about.html create mode 100644 res/xml/preference_audio.xml create mode 100644 res/xml/preference_headers.xml create mode 100644 res/xml/preference_library.xml create mode 100644 res/xml/preference_misc.xml create mode 100644 res/xml/preference_notifications.xml create mode 100644 res/xml/preference_playback.xml create mode 100644 res/xml/preference_shake.xml delete mode 100644 src/org/kreed/vanilla/TabOrderPreference.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 26d4e8ed..08a2726d 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -125,6 +125,13 @@ THE SOFTWARE. + + + + + + + diff --git a/assets/about.html b/assets/about.html new file mode 100644 index 00000000..6056ca00 --- /dev/null +++ b/assets/about.html @@ -0,0 +1,60 @@ + + + + + + +

Vanilla Music

+

Version: 0.9.10 (65db705baa3a) released March 14, 2012

+Website: https://github.com/kreed/vanilla
+Issue tracker: https://github.com/kreed/vanilla/issues
+Help translate: http://crowdin.net/project/vanilla-music

+

Contributors

+
    +
  • Chris Eby (creator)
  • +
  • David Beswick (various contributions)
  • +
  • Ferenc Nagy (icon)
  • +
  • Jean-Baptiste Lab (notication color invert)
  • +
  • Jean-François Im (cover art loading)
  • +
  • Magnus Anderssen (headset button)
  • +
  • Mildred Ki'Lya (stop after track mode)
  • + +
+

Licenses

+

Vanilla Music [show]

+
+Copyright (C) 2012 Vanilla Music contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+

ViewPageIndicator [show]

+
+Copyright (C) 2011 The Android Open Source Project
+Copyright (C) 2011 Jake Wharton
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+
+ + diff --git a/res/values/translatable.xml b/res/values/translatable.xml index e367fdf7..77256ba7 100644 --- a/res/values/translatable.xml +++ b/res/values/translatable.xml @@ -137,7 +137,7 @@ THE SOFTWARE. %d hours - Audio Output + Audio Volume Headset/Bluetooth Controls This is also required for ICS lockscreen controls. @@ -148,13 +148,13 @@ THE SOFTWARE. Play When Plugged Play when the headphones are plugged in. (Only works when the service is running.) - Notifications + Notifications Notification Mode Notification Action Invert Notification Color Use white text instead of black text - Playback View + Playback Screen Open on Startup Open playback view on startup Display Mode @@ -163,19 +163,19 @@ THE SOFTWARE. Cover Tap Action Cover Long Press Action - Library View + Library Screen Controls in Library Show the currently playing song and media controls in the library view Default Action Default Playlist Action - Accelerometer Shake + Accelerometer Shake Enable Accelerometer Shake Only active when music is playing. Does not work when screen is off on some devices. Shake Action Shake Force Threshold - Miscellaneous Features + Miscellaneous Features Disable Lockscreen Prevent the lockscreen from activating when in the library or playback screen Enable Idle Timeout @@ -195,6 +195,8 @@ THE SOFTWARE. Scan in progress… Finished scanning. Tap to scan again. + About + Tab Order Adjust the order and visibility of library tabs Restore default diff --git a/res/xml/preference_audio.xml b/res/xml/preference_audio.xml new file mode 100644 index 00000000..5022c434 --- /dev/null +++ b/res/xml/preference_audio.xml @@ -0,0 +1,52 @@ + + + + + + + + + diff --git a/res/xml/preference_headers.xml b/res/xml/preference_headers.xml new file mode 100644 index 00000000..78c72641 --- /dev/null +++ b/res/xml/preference_headers.xml @@ -0,0 +1,45 @@ + + + +
+
+
+
+
+
+
+ diff --git a/res/xml/preference_library.xml b/res/xml/preference_library.xml new file mode 100644 index 00000000..b96696b6 --- /dev/null +++ b/res/xml/preference_library.xml @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/res/xml/preference_misc.xml b/res/xml/preference_misc.xml new file mode 100644 index 00000000..cec5a249 --- /dev/null +++ b/res/xml/preference_misc.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + diff --git a/res/xml/preference_notifications.xml b/res/xml/preference_notifications.xml new file mode 100644 index 00000000..92efb70e --- /dev/null +++ b/res/xml/preference_notifications.xml @@ -0,0 +1,43 @@ + + + + + + + diff --git a/res/xml/preference_playback.xml b/res/xml/preference_playback.xml new file mode 100644 index 00000000..722f16fb --- /dev/null +++ b/res/xml/preference_playback.xml @@ -0,0 +1,61 @@ + + + + + + + + + + diff --git a/res/xml/preference_shake.xml b/res/xml/preference_shake.xml new file mode 100644 index 00000000..3e7e29d5 --- /dev/null +++ b/res/xml/preference_shake.xml @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 357c8892..29d025ac 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org/kreed/vanilla/PreferencesActivity.java b/src/org/kreed/vanilla/PreferencesActivity.java index 5062c154..6baf53df 100644 --- a/src/org/kreed/vanilla/PreferencesActivity.java +++ b/src/org/kreed/vanilla/PreferencesActivity.java @@ -22,11 +22,21 @@ package org.kreed.vanilla; +import android.annotation.TargetApi; +import android.app.Activity; +import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; import android.preference.PreferenceGroup; +import android.view.LayoutInflater; import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebView; +import android.webkit.WebViewFragment; +import java.util.List; /** * The preferences activity in which one can change application preferences. @@ -35,18 +45,23 @@ public class PreferencesActivity extends PreferenceActivity { /** * Initialize the activity, loading the preference specifications. */ + @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.preferences); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - PreferenceGroup library = (PreferenceGroup)findPreference("library"); - library.removePreference(findPreference("controls_in_selector")); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + addPreferencesFromResource(R.xml.preferences); } } + @TargetApi(11) + @Override + public void onBuildHeaders(List
target) + { + loadHeadersFromResource(R.xml.preference_headers, target); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { @@ -57,4 +72,154 @@ public class PreferencesActivity extends PreferenceActivity { return super.onOptionsItemSelected(item); } } + + public static class AudioActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_audio); + } + } + + @TargetApi(11) + public static class AudioFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_audio); + } + } + + public static class PlaybackActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_playback); + } + } + + @TargetApi(11) + public static class PlaybackFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_playback); + } + } + + public static class LibraryActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_library); + } + } + + @TargetApi(11) + public static class LibraryFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_library); + PreferenceGroup group = getPreferenceScreen(); + group.removePreference(group.findPreference("controls_in_selector")); + } + } + + public static class NotificationsActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_notifications); + } + } + + @TargetApi(11) + public static class NotificationsFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_notifications); + } + } + + public static class ShakeActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_shake); + } + } + + @TargetApi(11) + public static class ShakeFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_shake); + } + } + + public static class MiscActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_misc); + } + } + + @TargetApi(11) + public static class MiscFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_misc); + } + } + + public static class AboutActivity extends Activity { + @Override + public void onCreate(Bundle state) + { + super.onCreate(state); + + WebView view = new WebView(this); + view.getSettings().setJavaScriptEnabled(true); + view.loadUrl("file:///android_asset/about.html"); + view.setBackgroundColor(Color.TRANSPARENT); + setContentView(view); + } + } + + @TargetApi(11) + public static class AboutFragment extends WebViewFragment { + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + WebView view = (WebView)super.onCreateView(inflater, container, savedInstanceState); + view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); + view.getSettings().setJavaScriptEnabled(true); + view.loadUrl("file:///android_asset/about.html"); + view.setBackgroundColor(Color.TRANSPARENT); + return view; + } + } } diff --git a/src/org/kreed/vanilla/TabOrderPreference.java b/src/org/kreed/vanilla/TabOrderPreference.java deleted file mode 100644 index 8396cae3..00000000 --- a/src/org/kreed/vanilla/TabOrderPreference.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2012 Christopher Eby - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package org.kreed.vanilla; - -import android.content.Context; -import android.content.Intent; -import android.preference.Preference; -import android.util.AttributeSet; - -/** - * A preference that opens the tab order selector. - */ -public class TabOrderPreference extends Preference { - public TabOrderPreference(Context context, AttributeSet attrs) - { - super(context, attrs); - setTitle(R.string.tabs); - setSummary(R.string.customize_tab_order); - } - - @Override - public void onClick() - { - Context context = getContext(); - context.startActivity(new Intent(context, TabOrderActivity.class)); - } -}