diff --git a/res/values/strings.xml b/res/values/strings.xml index 3bb8dc3113c..6c1ca6fd458 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1450,6 +1450,8 @@ Timeout Screen turns off automatically after %1$s + + Wallpaper Android Dreams diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml index 03d9641ef0b..b0abd9a27a1 100644 --- a/res/xml/display_settings.xml +++ b/res/xml/display_settings.xml @@ -41,7 +41,13 @@ android:persistent="false" android:entries="@array/screen_timeout_entries" android:entryValues="@array/screen_timeout_values" /> - + + + + + + + + diff --git a/src/com/android/settings/WallpaperTypeSettings.java b/src/com/android/settings/WallpaperTypeSettings.java new file mode 100644 index 00000000000..fa0b4e49064 --- /dev/null +++ b/src/com/android/settings/WallpaperTypeSettings.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 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.settings; + +import android.content.ComponentName; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.preference.Preference; + +import java.util.List; + +public class WallpaperTypeSettings extends SettingsPreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.wallpaper_settings); + + populateWallpaperTypes(); + } + + private void populateWallpaperTypes() { + // Search for activities that satisfy the ACTION_SET_WALLPAPER action + Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER); + final PackageManager pm = getPackageManager(); + List rList = pm.queryIntentActivities(intent, + PackageManager.MATCH_DEFAULT_ONLY); + + // Add Preference items for each of the matching activities + for (ResolveInfo info : rList) { + Preference pref = new Preference(getActivity()); + Intent prefIntent = new Intent(intent); + prefIntent.setComponent(new ComponentName( + info.activityInfo.packageName, info.activityInfo.name)); + pref.setIntent(prefIntent); + CharSequence label = info.loadLabel(pm); + if (label == null) label = info.activityInfo.packageName; + pref.setTitle(label); + getPreferenceScreen().addPreference(pref); + } + } +}