summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@gmail.com>2011-11-27 21:34:20 +0000
committernebkat <nebkat@gmail.com>2011-11-28 19:31:31 +0000
commit11717ad53ff0c5fc13bbead8c2593a49fd7f4ea7 (patch)
tree5fb4a53f47061bc1427d303d4951ca7d4ee92479
parentfe446895560586e6ec5cd0115c137e0cad4bffa9 (diff)
downloadandroid_packages_apps_Trebuchet-11717ad53ff0c5fc13bbead8c2593a49fd7f4ea7.tar.gz
android_packages_apps_Trebuchet-11717ad53ff0c5fc13bbead8c2593a49fd7f4ea7.tar.bz2
android_packages_apps_Trebuchet-11717ad53ff0c5fc13bbead8c2593a49fd7f4ea7.zip
Preferences: initial Preferences Activity, Provider and XML
Change-Id: I27d44993c4e34e08cfafff6d7a418df7c4f06fd2
-rw-r--r--AndroidManifest.xml3
-rw-r--r--res/values/strings.xml25
-rw-r--r--res/xml/preferences.xml48
-rw-r--r--src/com/android/launcher2/Launcher.java11
-rw-r--r--src/com/android/launcher2/preference/Preferences.java33
-rw-r--r--src/com/android/launcher2/preference/PreferencesProvider.java29
6 files changed, 148 insertions, 1 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index cbb06f6e9..193542b8f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -103,6 +103,9 @@
</intent-filter>
</activity>
+ <activity android:name="com.android.launcher2.preference.Preferences"
+ android:label="@string/preferences_title" />
+
<!-- Intent received used to install shortcuts from other applications -->
<receiver
android:name="com.android.launcher2.InstallShortcutReceiver"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6f6a15811..41215fcd1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -143,6 +143,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>
@@ -237,4 +239,27 @@ s -->
<string name="cling_dismiss">OK</string>
<add-resource type="string" name="default_folder_name" />
+ <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 000000000..6679751a3
--- /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/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index c04bdb761..c940ac5fb 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -92,6 +92,7 @@ import android.widget.Toast;
import com.android.common.Search;
import com.android.launcher.R;
import com.android.launcher2.DropTarget.DragObject;
+import com.android.launcher2.preference.Preferences;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -118,7 +119,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;
@@ -1343,6 +1345,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
@@ -1359,6 +1364,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/android/launcher2/preference/Preferences.java b/src/com/android/launcher2/preference/Preferences.java
new file mode 100644
index 000000000..24337c5d7
--- /dev/null
+++ b/src/com/android/launcher2/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.android.launcher2.preference;
+
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import com.android.launcher.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/android/launcher2/preference/PreferencesProvider.java b/src/com/android/launcher2/preference/PreferencesProvider.java
new file mode 100644
index 000000000..a53b3bd8d
--- /dev/null
+++ b/src/com/android/launcher2/preference/PreferencesProvider.java
@@ -0,0 +1,29 @@
+package com.android.launcher2.preference;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+public final class PreferencesProvider {
+ private static final String PREFERENCES_FILE = "com.android.launcher2_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 {
+
+ }
+}