Back to project page vanilindy.
The source code is released under:
Apache License
If you think the Android project vanilindy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (C) 2012 Adrian Ulrich <adrian@blinkenlights.ch> * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> *//w ww .j a va 2 s . c om * 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 ch.blinkenlights.android.vanilla; import android.annotation.TargetApi; import android.app.Activity; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceGroup; import android.preference.CheckBoxPreference; 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. */ public class PreferencesActivity extends PreferenceActivity { /** * Initialize the activity, loading the preference specifications. */ @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.preference_headers, target); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } else { 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); } } public static class AudioFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_audio); } } public static class ReplayGainActivity extends PreferenceActivity { @SuppressWarnings("deprecation") CheckBoxPreference cbTrackReplayGain; CheckBoxPreference cbAlbumReplayGain; SeekBarPreference sbGainBump; SeekBarPreference sbUntaggedDebump; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.replaygain); addPreferencesFromResource(R.xml.preference_replaygain); cbTrackReplayGain = (CheckBoxPreference)findPreference(PrefKeys.ENABLE_TRACK_REPLAYGAIN); cbAlbumReplayGain = (CheckBoxPreference)findPreference(PrefKeys.ENABLE_ALBUM_REPLAYGAIN); sbGainBump = (SeekBarPreference)findPreference(PrefKeys.REPLAYGAIN_BUMP); sbUntaggedDebump = (SeekBarPreference)findPreference(PrefKeys.REPLAYGAIN_UNTAGGED_DEBUMP); Preference.OnPreferenceClickListener pcListener = new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { updateConfigWidgets(); return false; } }; cbTrackReplayGain.setOnPreferenceClickListener(pcListener); cbAlbumReplayGain.setOnPreferenceClickListener(pcListener); updateConfigWidgets(); } @Override public boolean onOptionsItemSelected(MenuItem item) { finish(); return true; } private void updateConfigWidgets() { boolean rgOn = (cbTrackReplayGain.isChecked() || cbAlbumReplayGain.isChecked()); sbGainBump.setEnabled(rgOn); sbUntaggedDebump.setEnabled(rgOn); } } public static class ReplayGainFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_replaygain); } } public static class PlaybackActivity extends PreferenceActivity { @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_playback); } } 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); } } 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); } } 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); } } public static class ShakeFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_shake); } } public static class CoverArtActivity extends PreferenceActivity { @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_coverart); } } public static class CoverArtFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_coverart); } } public static class MiscActivity extends PreferenceActivity { @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_misc); } } 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); } } 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; } } }