diff options
-rw-r--r-- | AndroidManifest.xml | 3 | ||||
-rw-r--r-- | res/values/strings.xml | 25 | ||||
-rw-r--r-- | res/xml/preferences.xml | 48 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Launcher.java | 11 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/preference/Preferences.java | 33 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java | 29 |
6 files changed, 148 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 71c3403..c6ca911 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -109,6 +109,9 @@ </intent-filter> </receiver> + <activity android:name="com.cyanogenmod.trebuchet.preference.Preferences" + android:label="@string/preferences_title" /> + <!-- Intent received used to install shortcuts from other applications --> <receiver android:name="com.cyanogenmod.trebuchet.InstallShortcutReceiver" diff --git a/res/values/strings.xml b/res/values/strings.xml index 2fa1778..794a636 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -153,6 +153,8 @@ s --> <string name="menu_notifications">Notifications</string> <!-- Noun, menu item used to show the system settings --> <string name="menu_settings">System settings</string> + <!-- Noun, menu item used to show the launcher preferences --> + <string name="menu_preferences">Preferences</string> <!-- Noun, menu item used to show help. [CHAR_LIMIT=none] --> <string name="menu_help">Help</string> @@ -278,4 +280,27 @@ s --> <!-- Dummy string [CHAR_LIMIT=60] --> <string name="custom_workspace_cling_description_2"></string> + <skip /> + <!-- --> + <!-- Preferences --> + <!-- --> + <string name="preferences_title">Preferences</string> + <!-- UI --> + <string name="preferences_interface_title">Interface</string> + <!-- General --> + <string name="preferences_general_title">General</string> + + <!-- UI --> + <!-- Homescreen --> + <string name="preferences_interface_homescreen_title">Homescreen</string> + + <!-- Drawer --> + <string name="preferences_interface_drawer_title">Drawer</string> + + <!-- Dock --> + <string name="preferences_interface_dock_title">Dock</string> + + <!-- Icons --> + <string name="preferences_interface_icons_title">Icons</string> + </resources> diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml new file mode 100644 index 0000000..6679751 --- /dev/null +++ b/res/xml/preferences.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Android Open Source Project + + 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. +--> + +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- UI --> + <PreferenceCategory android:title="@string/preferences_interface_title"> + <!-- Homescreen --> + <PreferenceScreen android:key="ui_homescreen" + android:title="@string/preferences_interface_homescreen_title"> + + </PreferenceScreen> + + <!-- Drawer --> + <PreferenceScreen android:key="ui_drawer" + android:title="@string/preferences_interface_drawer_title"> + + </PreferenceScreen> + + <!-- Dock --> + <PreferenceScreen android:key="ui_dock" + android:title="@string/preferences_interface_dock_title"> + + </PreferenceScreen> + + <!-- Icons --> + <PreferenceScreen android:key="ui_icons" + android:title="@string/preferences_interface_icons_title"> + + </PreferenceScreen> + </PreferenceCategory> + + <!-- General --> + <PreferenceCategory android:title="@string/preferences_general_title"> + </PreferenceCategory> +</PreferenceScreen> diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java index 88512cf..cd4af23 100644 --- a/src/com/cyanogenmod/trebuchet/Launcher.java +++ b/src/com/cyanogenmod/trebuchet/Launcher.java @@ -95,6 +95,7 @@ import android.widget.Toast; import com.android.common.Search; import com.cyanogenmod.trebuchet.R; import com.cyanogenmod.trebuchet.DropTarget.DragObject; +import com.cyanogenmod.trebuchet.preference.Preferences; import java.io.DataInputStream; import java.io.DataOutputStream; @@ -129,7 +130,8 @@ public final class Launcher extends Activity private static final int MENU_WALLPAPER_SETTINGS = Menu.FIRST + 1; private static final int MENU_MANAGE_APPS = MENU_WALLPAPER_SETTINGS + 1; private static final int MENU_SYSTEM_SETTINGS = MENU_MANAGE_APPS + 1; - private static final int MENU_HELP = MENU_SYSTEM_SETTINGS + 1; + private static final int MENU_PREFERENCES = MENU_SYSTEM_SETTINGS + 1; + private static final int MENU_HELP = MENU_PREFERENCES + 1; private static final int REQUEST_CREATE_SHORTCUT = 1; private static final int REQUEST_CREATE_APPWIDGET = 5; @@ -1614,6 +1616,9 @@ public final class Launcher extends Activity Intent settings = new Intent(android.provider.Settings.ACTION_SETTINGS); settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + Intent preferences = new Intent().setClass(this, Preferences.class); + preferences.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); String helpUrl = getString(R.string.help_url); Intent help = new Intent(Intent.ACTION_VIEW, Uri.parse(helpUrl)); help.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK @@ -1630,6 +1635,10 @@ public final class Launcher extends Activity .setIcon(android.R.drawable.ic_menu_preferences) .setIntent(settings) .setAlphabeticShortcut('P'); + menu.add(0, MENU_PREFERENCES, 0, R.string.menu_preferences) + .setIcon(android.R.drawable.ic_menu_preferences) + .setIntent(preferences) + .setAlphabeticShortcut('O'); if (!helpUrl.isEmpty()) { menu.add(0, MENU_HELP, 0, R.string.menu_help) .setIcon(android.R.drawable.ic_menu_help) diff --git a/src/com/cyanogenmod/trebuchet/preference/Preferences.java b/src/com/cyanogenmod/trebuchet/preference/Preferences.java new file mode 100644 index 0000000..c277bc3 --- /dev/null +++ b/src/com/cyanogenmod/trebuchet/preference/Preferences.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * 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. + */ + +package com.cyanogenmod.trebuchet.preference; + +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import com.cyanogenmod.trebuchet.R; + +public class Preferences extends PreferenceActivity { + + private static final String TAG = "Launcher.Preferences"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preferences); + } +} diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java new file mode 100644 index 0000000..2a12402 --- /dev/null +++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java @@ -0,0 +1,29 @@ +package com.cyanogenmod.trebuchet.preference; + +import android.content.Context; +import android.content.SharedPreferences; + +public final class PreferencesProvider { + private static final String PREFERENCES_FILE = "com.cyanogenmod.trebuchet_preferences"; + public static class Interface { + public static class Homescreen { + + } + + public static class Drawer { + + } + + public static class Dock { + + } + + public static class Icons { + + } + } + + public static class General { + + } +} |