Move wallpapers to external activity
Also renaming Launcher's ApplicationInfo to AppInfo since ApplicationInfo is already a framework class Change-Id: Ib3e91d2ba4ace458d790a26c0ce850870fd3f146
Before Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 5.5 MiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 2.7 MiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 768 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 736 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 885 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 658 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 726 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 451 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 18 KiB |
|
@ -17,19 +17,5 @@
|
|||
|
||||
<resources>
|
||||
<string-array name="wallpapers" translatable="false">
|
||||
<item>wallpaper_01</item>
|
||||
<item>wallpaper_02</item>
|
||||
<item>wallpaper_03</item>
|
||||
<item>wallpaper_04</item>
|
||||
<item>wallpaper_05</item>
|
||||
<item>wallpaper_06</item>
|
||||
<item>wallpaper_07</item>
|
||||
<item>wallpaper_08</item>
|
||||
<item>wallpaper_09</item>
|
||||
<item>wallpaper_10</item>
|
||||
<item>wallpaper_11</item>
|
||||
<item>wallpaper_12</item>
|
||||
<item>wallpaper_13</item>
|
||||
<item>wallpaper_14</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string-array name="extra_wallpapers">
|
||||
</string-array>
|
||||
</resources>
|
|
@ -34,15 +34,15 @@ class AllAppsList {
|
|||
public static final int DEFAULT_APPLICATIONS_NUMBER = 42;
|
||||
|
||||
/** The list off all apps. */
|
||||
public ArrayList<ApplicationInfo> data =
|
||||
new ArrayList<ApplicationInfo>(DEFAULT_APPLICATIONS_NUMBER);
|
||||
public ArrayList<AppInfo> data =
|
||||
new ArrayList<AppInfo>(DEFAULT_APPLICATIONS_NUMBER);
|
||||
/** The list of apps that have been added since the last notify() call. */
|
||||
public ArrayList<ApplicationInfo> added =
|
||||
new ArrayList<ApplicationInfo>(DEFAULT_APPLICATIONS_NUMBER);
|
||||
public ArrayList<AppInfo> added =
|
||||
new ArrayList<AppInfo>(DEFAULT_APPLICATIONS_NUMBER);
|
||||
/** The list of apps that have been removed since the last notify() call. */
|
||||
public ArrayList<ApplicationInfo> removed = new ArrayList<ApplicationInfo>();
|
||||
public ArrayList<AppInfo> removed = new ArrayList<AppInfo>();
|
||||
/** The list of apps that have been modified since the last notify() call. */
|
||||
public ArrayList<ApplicationInfo> modified = new ArrayList<ApplicationInfo>();
|
||||
public ArrayList<AppInfo> modified = new ArrayList<AppInfo>();
|
||||
|
||||
private IconCache mIconCache;
|
||||
|
||||
|
@ -59,7 +59,7 @@ class AllAppsList {
|
|||
*
|
||||
* If the app is already in the list, doesn't add it.
|
||||
*/
|
||||
public void add(ApplicationInfo info) {
|
||||
public void add(AppInfo info) {
|
||||
if (findActivity(data, info.componentName)) {
|
||||
return;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class AllAppsList {
|
|||
return data.size();
|
||||
}
|
||||
|
||||
public ApplicationInfo get(int index) {
|
||||
public AppInfo get(int index) {
|
||||
return data.get(index);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class AllAppsList {
|
|||
|
||||
if (matches.size() > 0) {
|
||||
for (ResolveInfo info : matches) {
|
||||
add(new ApplicationInfo(context.getPackageManager(), info, mIconCache, null));
|
||||
add(new AppInfo(context.getPackageManager(), info, mIconCache, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,9 +100,9 @@ class AllAppsList {
|
|||
* Remove the apps for the given apk identified by packageName.
|
||||
*/
|
||||
public void removePackage(String packageName) {
|
||||
final List<ApplicationInfo> data = this.data;
|
||||
final List<AppInfo> data = this.data;
|
||||
for (int i = data.size() - 1; i >= 0; i--) {
|
||||
ApplicationInfo info = data.get(i);
|
||||
AppInfo info = data.get(i);
|
||||
final ComponentName component = info.intent.getComponent();
|
||||
if (packageName.equals(component.getPackageName())) {
|
||||
removed.add(info);
|
||||
|
@ -122,7 +122,7 @@ class AllAppsList {
|
|||
// Find disabled/removed activities and remove them from data and add them
|
||||
// to the removed list.
|
||||
for (int i = data.size() - 1; i >= 0; i--) {
|
||||
final ApplicationInfo applicationInfo = data.get(i);
|
||||
final AppInfo applicationInfo = data.get(i);
|
||||
final ComponentName component = applicationInfo.intent.getComponent();
|
||||
if (packageName.equals(component.getPackageName())) {
|
||||
if (!findActivity(matches, component)) {
|
||||
|
@ -138,11 +138,11 @@ class AllAppsList {
|
|||
int count = matches.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final ResolveInfo info = matches.get(i);
|
||||
ApplicationInfo applicationInfo = findApplicationInfoLocked(
|
||||
AppInfo applicationInfo = findApplicationInfoLocked(
|
||||
info.activityInfo.applicationInfo.packageName,
|
||||
info.activityInfo.name);
|
||||
if (applicationInfo == null) {
|
||||
add(new ApplicationInfo(context.getPackageManager(), info, mIconCache, null));
|
||||
add(new AppInfo(context.getPackageManager(), info, mIconCache, null));
|
||||
} else {
|
||||
mIconCache.remove(applicationInfo.componentName);
|
||||
mIconCache.getTitleAndIcon(applicationInfo, info, null);
|
||||
|
@ -152,7 +152,7 @@ class AllAppsList {
|
|||
} else {
|
||||
// Remove all data for this package.
|
||||
for (int i = data.size() - 1; i >= 0; i--) {
|
||||
final ApplicationInfo applicationInfo = data.get(i);
|
||||
final AppInfo applicationInfo = data.get(i);
|
||||
final ComponentName component = applicationInfo.intent.getComponent();
|
||||
if (packageName.equals(component.getPackageName())) {
|
||||
removed.add(applicationInfo);
|
||||
|
@ -194,10 +194,10 @@ class AllAppsList {
|
|||
/**
|
||||
* Returns whether <em>apps</em> contains <em>component</em>.
|
||||
*/
|
||||
private static boolean findActivity(ArrayList<ApplicationInfo> apps, ComponentName component) {
|
||||
private static boolean findActivity(ArrayList<AppInfo> apps, ComponentName component) {
|
||||
final int N = apps.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
final ApplicationInfo info = apps.get(i);
|
||||
final AppInfo info = apps.get(i);
|
||||
if (info.componentName.equals(component)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -208,8 +208,8 @@ class AllAppsList {
|
|||
/**
|
||||
* Find an ApplicationInfo object for the given packageName and className.
|
||||
*/
|
||||
private ApplicationInfo findApplicationInfoLocked(String packageName, String className) {
|
||||
for (ApplicationInfo info: data) {
|
||||
private AppInfo findApplicationInfoLocked(String packageName, String className) {
|
||||
for (AppInfo info: data) {
|
||||
final ComponentName component = info.intent.getComponent();
|
||||
if (packageName.equals(component.getPackageName())
|
||||
&& className.equals(component.getClassName())) {
|
||||
|
|
|
@ -31,8 +31,8 @@ import java.util.HashMap;
|
|||
/**
|
||||
* Represents an app in AllAppsView.
|
||||
*/
|
||||
class ApplicationInfo extends ItemInfo {
|
||||
private static final String TAG = "Launcher2.ApplicationInfo";
|
||||
class AppInfo extends ItemInfo {
|
||||
private static final String TAG = "Launcher3.AppInfo";
|
||||
|
||||
/**
|
||||
* The intent used to start the application.
|
||||
|
@ -56,7 +56,7 @@ class ApplicationInfo extends ItemInfo {
|
|||
|
||||
int flags = 0;
|
||||
|
||||
ApplicationInfo() {
|
||||
AppInfo() {
|
||||
itemType = LauncherSettings.BaseLauncherColumns.ITEM_TYPE_SHORTCUT;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class ApplicationInfo extends ItemInfo {
|
|||
/**
|
||||
* Must not hold the Context.
|
||||
*/
|
||||
public ApplicationInfo(PackageManager pm, ResolveInfo info, IconCache iconCache,
|
||||
public AppInfo(PackageManager pm, ResolveInfo info, IconCache iconCache,
|
||||
HashMap<Object, CharSequence> labelCache) {
|
||||
final String packageName = info.activityInfo.applicationInfo.packageName;
|
||||
|
||||
|
@ -104,7 +104,7 @@ class ApplicationInfo extends ItemInfo {
|
|||
return pi.firstInstallTime;
|
||||
}
|
||||
|
||||
public ApplicationInfo(ApplicationInfo info) {
|
||||
public AppInfo(AppInfo info) {
|
||||
super(info);
|
||||
componentName = info.componentName;
|
||||
title = info.title.toString();
|
||||
|
@ -136,10 +136,9 @@ class ApplicationInfo extends ItemInfo {
|
|||
+ " spanX=" + spanX + " spanY=" + spanY + " dropPos=" + dropPos + ")";
|
||||
}
|
||||
|
||||
public static void dumpApplicationInfoList(String tag, String label,
|
||||
ArrayList<ApplicationInfo> list) {
|
||||
public static void dumpApplicationInfoList(String tag, String label, ArrayList<AppInfo> list) {
|
||||
Log.d(tag, label + " size=" + list.size());
|
||||
for (ApplicationInfo info: list) {
|
||||
for (AppInfo info: list) {
|
||||
Log.d(tag, " title=\"" + info.title + "\" iconBitmap="
|
||||
+ info.iconBitmap + " firstInstallTime="
|
||||
+ info.firstInstallTime);
|
|
@ -168,7 +168,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||
private PagedViewIcon mPressedIcon;
|
||||
|
||||
// Content
|
||||
private ArrayList<ApplicationInfo> mApps;
|
||||
private ArrayList<AppInfo> mApps;
|
||||
private ArrayList<Object> mWidgets;
|
||||
|
||||
// Cling
|
||||
|
@ -247,7 +247,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||
super(context, attrs);
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
mPackageManager = context.getPackageManager();
|
||||
mApps = new ArrayList<ApplicationInfo>();
|
||||
mApps = new ArrayList<AppInfo>();
|
||||
mWidgets = new ArrayList<Object>();
|
||||
mIconCache = (LauncherAppState.getInstance()).getIconCache();
|
||||
mCanvas = new Canvas();
|
||||
|
@ -498,7 +498,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||
|
||||
if (v instanceof PagedViewIcon) {
|
||||
// Animate some feedback to the click
|
||||
final ApplicationInfo appInfo = (ApplicationInfo) v.getTag();
|
||||
final AppInfo appInfo = (AppInfo) v.getTag();
|
||||
|
||||
// Lock the drawable state to pressed until we return to Launcher
|
||||
if (mPressedIcon != null) {
|
||||
|
@ -1025,7 +1025,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||
ArrayList<Object> items = new ArrayList<Object>();
|
||||
ArrayList<Bitmap> images = new ArrayList<Bitmap>();
|
||||
for (int i = startIndex; i < endIndex; ++i) {
|
||||
ApplicationInfo info = mApps.get(i);
|
||||
AppInfo info = mApps.get(i);
|
||||
PagedViewIcon icon = (PagedViewIcon) mLayoutInflater.inflate(
|
||||
R.layout.apps_customize_application, layout, false);
|
||||
icon.applyFromApplicationInfo(info, true, this);
|
||||
|
@ -1541,59 +1541,59 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||
}
|
||||
}
|
||||
|
||||
public void setApps(ArrayList<ApplicationInfo> list) {
|
||||
public void setApps(ArrayList<AppInfo> list) {
|
||||
if (!DISABLE_ALL_APPS) {
|
||||
mApps = list;
|
||||
Collections.sort(mApps, LauncherModel.getAppNameComparator());
|
||||
updatePageCountsAndInvalidateData();
|
||||
}
|
||||
}
|
||||
private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
|
||||
private void addAppsWithoutInvalidate(ArrayList<AppInfo> list) {
|
||||
// We add it in place, in alphabetical order
|
||||
int count = list.size();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
ApplicationInfo info = list.get(i);
|
||||
AppInfo info = list.get(i);
|
||||
int index = Collections.binarySearch(mApps, info, LauncherModel.getAppNameComparator());
|
||||
if (index < 0) {
|
||||
mApps.add(-(index + 1), info);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addApps(ArrayList<ApplicationInfo> list) {
|
||||
public void addApps(ArrayList<AppInfo> list) {
|
||||
if (!DISABLE_ALL_APPS) {
|
||||
addAppsWithoutInvalidate(list);
|
||||
updatePageCountsAndInvalidateData();
|
||||
}
|
||||
}
|
||||
private int findAppByComponent(List<ApplicationInfo> list, ApplicationInfo item) {
|
||||
private int findAppByComponent(List<AppInfo> list, AppInfo item) {
|
||||
ComponentName removeComponent = item.intent.getComponent();
|
||||
int length = list.size();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
ApplicationInfo info = list.get(i);
|
||||
AppInfo info = list.get(i);
|
||||
if (info.intent.getComponent().equals(removeComponent)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
|
||||
private void removeAppsWithoutInvalidate(ArrayList<AppInfo> list) {
|
||||
// loop through all the apps and remove apps that have the same component
|
||||
int length = list.size();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
ApplicationInfo info = list.get(i);
|
||||
AppInfo info = list.get(i);
|
||||
int removeIndex = findAppByComponent(mApps, info);
|
||||
if (removeIndex > -1) {
|
||||
mApps.remove(removeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void removeApps(ArrayList<ApplicationInfo> appInfos) {
|
||||
public void removeApps(ArrayList<AppInfo> appInfos) {
|
||||
if (!DISABLE_ALL_APPS) {
|
||||
removeAppsWithoutInvalidate(appInfos);
|
||||
updatePageCountsAndInvalidateData();
|
||||
}
|
||||
}
|
||||
public void updateApps(ArrayList<ApplicationInfo> list) {
|
||||
public void updateApps(ArrayList<AppInfo> list) {
|
||||
// We remove and re-add the updated applications list because it's properties may have
|
||||
// changed (ie. the title), and this will ensure that the items will be in their proper
|
||||
// place in the list.
|
||||
|
@ -1627,7 +1627,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||
|
||||
public void dumpState() {
|
||||
// TODO: Dump information related to current list of Applications, Widgets, etc.
|
||||
ApplicationInfo.dumpApplicationInfoList(TAG, "mApps", mApps);
|
||||
AppInfo.dumpApplicationInfoList(TAG, "mApps", mApps);
|
||||
dumpAppWidgetProviderInfoList(TAG, "mWidgets", mWidgets);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
|||
}
|
||||
|
||||
private boolean isAllAppsApplication(DragSource source, Object info) {
|
||||
return (source instanceof AppsCustomizePagedView) && (info instanceof ApplicationInfo);
|
||||
return (source instanceof AppsCustomizePagedView) && (info instanceof AppInfo);
|
||||
}
|
||||
private boolean isAllAppsWidget(DragSource source, Object info) {
|
||||
if (source instanceof AppsCustomizePagedView) {
|
||||
|
@ -149,7 +149,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
|||
item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
|
||||
item instanceof ShortcutInfo) {
|
||||
ShortcutInfo shortcutInfo = (ShortcutInfo) info;
|
||||
return (shortcutInfo.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0;
|
||||
return (shortcutInfo.flags & AppInfo.DOWNLOADED_FLAG) != 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -259,14 +259,14 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
|||
mWaitingForUninstall = false;
|
||||
if (isAllAppsApplication(d.dragSource, item)) {
|
||||
// Uninstall the application if it is being dragged from AppsCustomize
|
||||
ApplicationInfo appInfo = (ApplicationInfo) item;
|
||||
AppInfo appInfo = (AppInfo) item;
|
||||
mLauncher.startApplicationUninstallActivity(appInfo.componentName, appInfo.flags);
|
||||
} else if (AppsCustomizePagedView.DISABLE_ALL_APPS && isWorkspaceOrFolderApplication(d)) {
|
||||
ShortcutInfo shortcut = (ShortcutInfo) item;
|
||||
if (shortcut.intent != null && shortcut.intent.getComponent() != null) {
|
||||
final ComponentName componentName = shortcut.intent.getComponent();
|
||||
final DragSource dragSource = d.dragSource;
|
||||
int flags = ApplicationInfo.initFlags(
|
||||
int flags = AppInfo.initFlags(
|
||||
ShortcutInfo.getPackageInfo(getContext(), componentName.getPackageName()));
|
||||
mWaitingForUninstall =
|
||||
mLauncher.startApplicationUninstallActivity(componentName, flags);
|
||||
|
|
|
@ -327,13 +327,13 @@ public class DragController {
|
|||
}
|
||||
endDrag();
|
||||
}
|
||||
public void onAppsRemoved(ArrayList<ApplicationInfo> appInfos, Context context) {
|
||||
public void onAppsRemoved(ArrayList<AppInfo> appInfos, Context context) {
|
||||
// Cancel the current drag if we are removing an app that we are dragging
|
||||
if (mDragObject != null) {
|
||||
Object rawDragInfo = mDragObject.dragInfo;
|
||||
if (rawDragInfo instanceof ShortcutInfo) {
|
||||
ShortcutInfo dragInfo = (ShortcutInfo) rawDragInfo;
|
||||
for (ApplicationInfo info : appInfos) {
|
||||
for (AppInfo info : appInfos) {
|
||||
// Added null checks to prevent NPE we've seen in the wild
|
||||
if (dragInfo != null &&
|
||||
dragInfo.intent != null) {
|
||||
|
|
|
@ -1090,9 +1090,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
|
|||
|
||||
public void onDrop(DragObject d) {
|
||||
ShortcutInfo item;
|
||||
if (d.dragInfo instanceof ApplicationInfo) {
|
||||
if (d.dragInfo instanceof AppInfo) {
|
||||
// Came from all apps -- make a copy
|
||||
item = ((ApplicationInfo) d.dragInfo).makeShortcut();
|
||||
item = ((AppInfo) d.dragInfo).makeShortcut();
|
||||
item.spanX = 1;
|
||||
item.spanY = 1;
|
||||
} else {
|
||||
|
|
|
@ -429,9 +429,9 @@ public class FolderIcon extends LinearLayout implements FolderListener {
|
|||
|
||||
public void onDrop(DragObject d) {
|
||||
ShortcutInfo item;
|
||||
if (d.dragInfo instanceof ApplicationInfo) {
|
||||
if (d.dragInfo instanceof AppInfo) {
|
||||
// Came from all apps -- make a copy
|
||||
item = ((ApplicationInfo) d.dragInfo).makeShortcut();
|
||||
item = ((AppInfo) d.dragInfo).makeShortcut();
|
||||
} else {
|
||||
item = (ShortcutInfo) d.dragInfo;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class Hotseat extends FrameLayout {
|
|||
}
|
||||
|
||||
void addAllAppsFolder(IconCache iconCache,
|
||||
ArrayList<ApplicationInfo> allApps, ArrayList<ComponentName> onWorkspace,
|
||||
ArrayList<AppInfo> allApps, ArrayList<ComponentName> onWorkspace,
|
||||
Launcher launcher, Workspace workspace) {
|
||||
FolderInfo fi = new FolderInfo();
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class Hotseat extends FrameLayout {
|
|||
workspace.addInScreen(folder, fi.container, fi.screenId, fi.cellX, fi.cellY,
|
||||
fi.spanX, fi.spanY);
|
||||
|
||||
for (ApplicationInfo info: allApps) {
|
||||
for (AppInfo info: allApps) {
|
||||
ComponentName cn = info.intent.getComponent();
|
||||
if (!onWorkspace.contains(cn)) {
|
||||
Log.d(TAG, "Adding to 'more apps': " + info.intent);
|
||||
|
@ -134,7 +134,7 @@ public class Hotseat extends FrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
void addAppsToAllAppsFolder(ArrayList<ApplicationInfo> apps) {
|
||||
void addAppsToAllAppsFolder(ArrayList<AppInfo> apps) {
|
||||
View v = mContent.getChildAt(getCellXFromOrder(mAllAppsButtonRank), getCellYFromOrder(mAllAppsButtonRank));
|
||||
FolderIcon fi = null;
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class Hotseat extends FrameLayout {
|
|||
}
|
||||
|
||||
FolderInfo info = fi.getFolderInfo();
|
||||
for (ApplicationInfo a: apps) {
|
||||
for (AppInfo a: apps) {
|
||||
ShortcutInfo si = a.makeShortcut();
|
||||
info.add(si);
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ public class IconCache {
|
|||
/**
|
||||
* Fill in "application" with the icon and label for "info."
|
||||
*/
|
||||
public void getTitleAndIcon(ApplicationInfo application, ResolveInfo info,
|
||||
public void getTitleAndIcon(AppInfo application, ResolveInfo info,
|
||||
HashMap<Object, CharSequence> labelCache) {
|
||||
synchronized (mCache) {
|
||||
CacheEntry entry = cacheLocked(application.componentName, info, labelCache);
|
||||
|
|
|
@ -72,8 +72,8 @@ public class InfoDropTarget extends ButtonDropTarget {
|
|||
// in onDrop, because it allows us to reject the drop (by returning false)
|
||||
// so that the object being dragged isn't removed from the drag source.
|
||||
ComponentName componentName = null;
|
||||
if (d.dragInfo instanceof ApplicationInfo) {
|
||||
componentName = ((ApplicationInfo) d.dragInfo).componentName;
|
||||
if (d.dragInfo instanceof AppInfo) {
|
||||
componentName = ((AppInfo) d.dragInfo).componentName;
|
||||
} else if (d.dragInfo instanceof ShortcutInfo) {
|
||||
componentName = ((ShortcutInfo) d.dragInfo).intent.getComponent();
|
||||
} else if (d.dragInfo instanceof PendingAddItemInfo) {
|
||||
|
|
|
@ -113,8 +113,6 @@ import java.io.PrintWriter;
|
|||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -2071,14 +2069,17 @@ public class Launcher extends Activity
|
|||
sFolders.remove(folder.id);
|
||||
}
|
||||
|
||||
private void startWallpaper() {
|
||||
protected void startWallpaper() {
|
||||
showWorkspace(true);
|
||||
final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
|
||||
pickWallpaper.setComponent(
|
||||
new ComponentName(getPackageName(), WallpaperPickerActivity.class.getName()));
|
||||
pickWallpaper.setComponent(getWallpaperPickerComponent());
|
||||
startActivityForResult(pickWallpaper, REQUEST_PICK_WALLPAPER);
|
||||
}
|
||||
|
||||
protected ComponentName getWallpaperPickerComponent() {
|
||||
return new ComponentName(getPackageName(), WallpaperPickerActivity.class.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers various content observers. The current implementation registers
|
||||
* only a favorites observer to keep track of the favorites applications.
|
||||
|
@ -2298,7 +2299,7 @@ public class Launcher extends Activity
|
|||
|
||||
// returns true if the activity was started
|
||||
boolean startApplicationUninstallActivity(ComponentName componentName, int flags) {
|
||||
if ((flags & ApplicationInfo.DOWNLOADED_FLAG) == 0) {
|
||||
if ((flags & AppInfo.DOWNLOADED_FLAG) == 0) {
|
||||
// System applications cannot be installed. For now, show a toast explaining that.
|
||||
// We may give them the option of disabling apps this way.
|
||||
int messageId = R.string.uninstall_system_app_text;
|
||||
|
@ -3873,7 +3874,7 @@ public class Launcher extends Activity
|
|||
*
|
||||
* Implementation of the method from LauncherModel.Callbacks.
|
||||
*/
|
||||
public void bindAllApplications(final ArrayList<ApplicationInfo> apps) {
|
||||
public void bindAllApplications(final ArrayList<AppInfo> apps) {
|
||||
if (mIntentsOnWorkspaceFromUpgradePath != null) {
|
||||
if (LauncherModel.UPGRADE_USE_MORE_APPS_FOLDER) {
|
||||
getHotseat().addAllAppsFolder(mIconCache, apps,
|
||||
|
@ -3888,7 +3889,7 @@ public class Launcher extends Activity
|
|||
*
|
||||
* Implementation of the method from LauncherModel.Callbacks.
|
||||
*/
|
||||
public void bindAppsUpdated(final ArrayList<ApplicationInfo> apps) {
|
||||
public void bindAppsUpdated(final ArrayList<AppInfo> apps) {
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
bindAppsUpdated(apps);
|
||||
|
@ -3913,7 +3914,7 @@ public class Launcher extends Activity
|
|||
* Implementation of the method from LauncherModel.Callbacks.
|
||||
*/
|
||||
public void bindComponentsRemoved(final ArrayList<String> packageNames,
|
||||
final ArrayList<ApplicationInfo> appInfos,
|
||||
final ArrayList<AppInfo> appInfos,
|
||||
final boolean packageRemoved) {
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
|
|
|
@ -156,13 +156,13 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
public void bindFolders(HashMap<Long,FolderInfo> folders);
|
||||
public void finishBindingItems(boolean upgradePath);
|
||||
public void bindAppWidget(LauncherAppWidgetInfo info);
|
||||
public void bindAllApplications(ArrayList<ApplicationInfo> apps);
|
||||
public void bindAllApplications(ArrayList<AppInfo> apps);
|
||||
public void bindAppsAdded(ArrayList<Long> newScreens,
|
||||
ArrayList<ItemInfo> addNotAnimated,
|
||||
ArrayList<ItemInfo> addAnimated);
|
||||
public void bindAppsUpdated(ArrayList<ApplicationInfo> apps);
|
||||
public void bindAppsUpdated(ArrayList<AppInfo> apps);
|
||||
public void bindComponentsRemoved(ArrayList<String> packageNames,
|
||||
ArrayList<ApplicationInfo> appInfos,
|
||||
ArrayList<AppInfo> appInfos,
|
||||
boolean matchPackageNamesOnly);
|
||||
public void bindPackagesUpdated(ArrayList<Object> widgetsAndShortcuts);
|
||||
public void bindSearchablesChanged();
|
||||
|
@ -347,8 +347,8 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
ShortcutInfo shortcutInfo;
|
||||
if (a instanceof ShortcutInfo) {
|
||||
shortcutInfo = (ShortcutInfo) a;
|
||||
} else if (a instanceof ApplicationInfo) {
|
||||
shortcutInfo = ((ApplicationInfo) a).makeShortcut();
|
||||
} else if (a instanceof AppInfo) {
|
||||
shortcutInfo = ((AppInfo) a).makeShortcut();
|
||||
} else {
|
||||
throw new RuntimeException("Unexpected info type");
|
||||
}
|
||||
|
@ -1544,7 +1544,7 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
ArrayList<ItemInfo> tmpInfos;
|
||||
ArrayList<ItemInfo> added = new ArrayList<ItemInfo>();
|
||||
synchronized (sBgLock) {
|
||||
for (ApplicationInfo app : mBgAllAppsList.data) {
|
||||
for (AppInfo app : mBgAllAppsList.data) {
|
||||
tmpInfos = getItemInfoForComponentName(app.componentName);
|
||||
Launcher.addDumpLog(TAG, "10249126 - \t" + app.componentName.getPackageName() + ", " + tmpInfos.isEmpty(), true);
|
||||
if (tmpInfos.isEmpty()) {
|
||||
|
@ -2397,8 +2397,8 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
|
||||
// shallow copy
|
||||
@SuppressWarnings("unchecked")
|
||||
final ArrayList<ApplicationInfo> list
|
||||
= (ArrayList<ApplicationInfo>) mBgAllAppsList.data.clone();
|
||||
final ArrayList<AppInfo> list
|
||||
= (ArrayList<AppInfo>) mBgAllAppsList.data.clone();
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
final long t = SystemClock.uptimeMillis();
|
||||
|
@ -2463,13 +2463,13 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
// Create the ApplicationInfos
|
||||
for (int i = 0; i < apps.size(); i++) {
|
||||
// This builds the icon bitmaps.
|
||||
mBgAllAppsList.add(new ApplicationInfo(packageManager, apps.get(i),
|
||||
mBgAllAppsList.add(new AppInfo(packageManager, apps.get(i),
|
||||
mIconCache, mLabelCache));
|
||||
}
|
||||
|
||||
final Callbacks callbacks = tryGetCallbacks(oldCallbacks);
|
||||
final ArrayList<ApplicationInfo> added = mBgAllAppsList.added;
|
||||
mBgAllAppsList.added = new ArrayList<ApplicationInfo>();
|
||||
final ArrayList<AppInfo> added = mBgAllAppsList.added;
|
||||
mBgAllAppsList.added = new ArrayList<AppInfo>();
|
||||
|
||||
// Post callback on main thread
|
||||
mHandler.post(new Runnable() {
|
||||
|
@ -2555,16 +2555,16 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
break;
|
||||
}
|
||||
|
||||
ArrayList<ApplicationInfo> added = null;
|
||||
ArrayList<ApplicationInfo> modified = null;
|
||||
final ArrayList<ApplicationInfo> removedApps = new ArrayList<ApplicationInfo>();
|
||||
ArrayList<AppInfo> added = null;
|
||||
ArrayList<AppInfo> modified = null;
|
||||
final ArrayList<AppInfo> removedApps = new ArrayList<AppInfo>();
|
||||
|
||||
if (mBgAllAppsList.added.size() > 0) {
|
||||
added = new ArrayList<ApplicationInfo>(mBgAllAppsList.added);
|
||||
added = new ArrayList<AppInfo>(mBgAllAppsList.added);
|
||||
mBgAllAppsList.added.clear();
|
||||
}
|
||||
if (mBgAllAppsList.modified.size() > 0) {
|
||||
modified = new ArrayList<ApplicationInfo>(mBgAllAppsList.modified);
|
||||
modified = new ArrayList<AppInfo>(mBgAllAppsList.modified);
|
||||
mBgAllAppsList.modified.clear();
|
||||
}
|
||||
if (mBgAllAppsList.removed.size() > 0) {
|
||||
|
@ -2585,10 +2585,10 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
addAndBindAddedApps(context, addedInfos, cb);
|
||||
}
|
||||
if (modified != null) {
|
||||
final ArrayList<ApplicationInfo> modifiedFinal = modified;
|
||||
final ArrayList<AppInfo> modifiedFinal = modified;
|
||||
|
||||
// Update the launcher db to reflect the changes
|
||||
for (ApplicationInfo a : modifiedFinal) {
|
||||
for (AppInfo a : modifiedFinal) {
|
||||
ArrayList<ItemInfo> infos =
|
||||
getItemInfoForComponentName(a.componentName);
|
||||
for (ItemInfo i : infos) {
|
||||
|
@ -2625,7 +2625,7 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (ApplicationInfo a : removedApps) {
|
||||
for (AppInfo a : removedApps) {
|
||||
ArrayList<ItemInfo> infos =
|
||||
getItemInfoForComponentName(a.componentName);
|
||||
for (ItemInfo i : infos) {
|
||||
|
@ -3120,10 +3120,10 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
return folderInfo;
|
||||
}
|
||||
|
||||
public static final Comparator<ApplicationInfo> getAppNameComparator() {
|
||||
public static final Comparator<AppInfo> getAppNameComparator() {
|
||||
final Collator collator = Collator.getInstance();
|
||||
return new Comparator<ApplicationInfo>() {
|
||||
public final int compare(ApplicationInfo a, ApplicationInfo b) {
|
||||
return new Comparator<AppInfo>() {
|
||||
public final int compare(AppInfo a, AppInfo b) {
|
||||
int result = collator.compare(a.title.toString(), b.title.toString());
|
||||
if (result == 0) {
|
||||
result = a.componentName.compareTo(b.componentName);
|
||||
|
@ -3132,9 +3132,9 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
}
|
||||
};
|
||||
}
|
||||
public static final Comparator<ApplicationInfo> APP_INSTALL_TIME_COMPARATOR
|
||||
= new Comparator<ApplicationInfo>() {
|
||||
public final int compare(ApplicationInfo a, ApplicationInfo b) {
|
||||
public static final Comparator<AppInfo> APP_INSTALL_TIME_COMPARATOR
|
||||
= new Comparator<AppInfo>() {
|
||||
public final int compare(AppInfo a, AppInfo b) {
|
||||
if (a.firstInstallTime < b.firstInstallTime) return 1;
|
||||
if (a.firstInstallTime > b.firstInstallTime) return -1;
|
||||
return 0;
|
||||
|
@ -3223,10 +3223,10 @@ public class LauncherModel extends BroadcastReceiver {
|
|||
|
||||
public void dumpState() {
|
||||
Log.d(TAG, "mCallbacks=" + mCallbacks);
|
||||
ApplicationInfo.dumpApplicationInfoList(TAG, "mAllAppsList.data", mBgAllAppsList.data);
|
||||
ApplicationInfo.dumpApplicationInfoList(TAG, "mAllAppsList.added", mBgAllAppsList.added);
|
||||
ApplicationInfo.dumpApplicationInfoList(TAG, "mAllAppsList.removed", mBgAllAppsList.removed);
|
||||
ApplicationInfo.dumpApplicationInfoList(TAG, "mAllAppsList.modified", mBgAllAppsList.modified);
|
||||
AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.data", mBgAllAppsList.data);
|
||||
AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.added", mBgAllAppsList.added);
|
||||
AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.removed", mBgAllAppsList.removed);
|
||||
AppInfo.dumpApplicationInfoList(TAG, "mAllAppsList.modified", mBgAllAppsList.modified);
|
||||
if (mLoaderTask != null) {
|
||||
mLoaderTask.dumpState();
|
||||
} else {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class PagedViewIcon extends TextView {
|
|||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public void applyFromApplicationInfo(ApplicationInfo info, boolean scaleUp,
|
||||
public void applyFromApplicationInfo(AppInfo info, boolean scaleUp,
|
||||
PagedViewIcon.PressedCallback cb) {
|
||||
mIcon = info.iconBitmap;
|
||||
mPressedCallback = cb;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class PagedViewIconCache {
|
|||
private final ComponentName mComponentName;
|
||||
private final Type mType;
|
||||
|
||||
public Key(ApplicationInfo info) {
|
||||
public Key(AppInfo info) {
|
||||
mComponentName = info.componentName;
|
||||
mType = Type.ApplicationInfoKey;
|
||||
}
|
||||
|
@ -95,9 +95,9 @@ public class PagedViewIconCache {
|
|||
}
|
||||
}
|
||||
/** Removes all the keys to applications that aren't in the passed in collection */
|
||||
public void retainAllApps(ArrayList<ApplicationInfo> keys) {
|
||||
public void retainAllApps(ArrayList<AppInfo> keys) {
|
||||
HashSet<Key> keysSet = new HashSet<Key>();
|
||||
for (ApplicationInfo info : keys) {
|
||||
for (AppInfo info : keys) {
|
||||
keysSet.add(new Key(info));
|
||||
}
|
||||
retainAll(keysSet, Key.Type.ApplicationInfoKey);
|
||||
|
|
|
@ -88,7 +88,7 @@ class ShortcutInfo extends ItemInfo {
|
|||
}
|
||||
|
||||
/** TODO: Remove this. It's only called by ApplicationInfo.makeShortcut. */
|
||||
public ShortcutInfo(ApplicationInfo info) {
|
||||
public ShortcutInfo(AppInfo info) {
|
||||
super(info);
|
||||
title = info.title.toString();
|
||||
intent = new Intent(info.intent);
|
||||
|
@ -109,8 +109,8 @@ class ShortcutInfo extends ItemInfo {
|
|||
}
|
||||
|
||||
void initFlagsAndFirstInstallTime(PackageInfo pi) {
|
||||
flags = ApplicationInfo.initFlags(pi);
|
||||
firstInstallTime = ApplicationInfo.initFirstInstallTime(pi);
|
||||
flags = AppInfo.initFlags(pi);
|
||||
firstInstallTime = AppInfo.initFirstInstallTime(pi);
|
||||
}
|
||||
|
||||
public void setIcon(Bitmap b) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.app.Activity;
|
|||
import android.app.WallpaperManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.CompressFormat;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
@ -73,8 +74,10 @@ public class WallpaperCropActivity extends Activity {
|
|||
boolean mSaveCroppedBitmap;
|
||||
Bitmap mCroppedBitmap;
|
||||
Runnable mOnEndRunnable;
|
||||
Resources mResources;
|
||||
|
||||
public BitmapCropTask(Uri inUri, RectF cropBounds, int outWidth, int outHeight,
|
||||
public BitmapCropTask(Uri inUri,
|
||||
RectF cropBounds, int outWidth, int outHeight,
|
||||
boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) {
|
||||
mInUri = inUri;
|
||||
mCropBounds = cropBounds;
|
||||
|
@ -86,7 +89,8 @@ public class WallpaperCropActivity extends Activity {
|
|||
mOnEndRunnable = onEndRunnable;
|
||||
}
|
||||
|
||||
public BitmapCropTask(int inResId, RectF cropBounds, int outWidth, int outHeight,
|
||||
public BitmapCropTask(Resources res, int inResId,
|
||||
RectF cropBounds, int outWidth, int outHeight,
|
||||
boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) {
|
||||
mInResId = inResId;
|
||||
mCropBounds = cropBounds;
|
||||
|
@ -96,6 +100,7 @@ public class WallpaperCropActivity extends Activity {
|
|||
mSetWallpaper = setWallpaper;
|
||||
mSaveCroppedBitmap = saveCroppedBitmap;
|
||||
mOnEndRunnable = onEndRunnable;
|
||||
mResources = res;
|
||||
}
|
||||
|
||||
// Helper to setup input stream
|
||||
|
@ -110,7 +115,7 @@ public class WallpaperCropActivity extends Activity {
|
|||
getContentResolver().openInputStream(mInUri));
|
||||
} else {
|
||||
mInStream = new BufferedInputStream(
|
||||
getResources().openRawResource(mInResId));
|
||||
mResources.openRawResource(mInResId));
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.w(LOGTAG, "cannot read file: " + mInUri.toString(), e);
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.content.ComponentName;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.Resources;
|
||||
|
@ -34,6 +35,7 @@ import android.graphics.drawable.LevelListDrawable;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.Display;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -63,8 +65,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
|||
private static final int PICK_WALLPAPER_THIRD_PARTY_ACTIVITY = 6;
|
||||
private static final float WALLPAPER_SCREENS_SPAN = 2f;
|
||||
|
||||
private ArrayList<Integer> mThumbs;
|
||||
private ArrayList<Drawable> mThumbs;
|
||||
private ArrayList<Integer> mImages;
|
||||
private Resources mWallpaperResources;
|
||||
|
||||
private View mSelectedThumb;
|
||||
private CropView mCropView;
|
||||
|
@ -98,7 +101,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
|||
meta.mGalleryImageUri, 1024, 0), null);
|
||||
mCropView.setTouchEnabled(true);
|
||||
} else {
|
||||
BitmapRegionTileSource source = new BitmapRegionTileSource(
|
||||
BitmapRegionTileSource source = new BitmapRegionTileSource(mWallpaperResources,
|
||||
WallpaperPickerActivity.this, meta.mWallpaperResId, 1024, 0);
|
||||
mCropView.setTileSource(source, null);
|
||||
Point wallpaperSize = getDefaultWallpaperSize(getResources(), getWindowManager());
|
||||
|
@ -311,8 +314,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
|||
updateWallpaperDimensions(0, 0);
|
||||
}
|
||||
};
|
||||
BitmapCropTask cropTask = new BitmapCropTask(meta.mWallpaperResId,
|
||||
crop, outSize.x, outSize.y,
|
||||
BitmapCropTask cropTask = new BitmapCropTask(mWallpaperResources,
|
||||
meta.mWallpaperResId, crop, outSize.x, outSize.y,
|
||||
true, false, onEndCrop);
|
||||
cropTask.execute();
|
||||
setResult(Activity.RESULT_OK);
|
||||
|
@ -389,22 +392,35 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
|||
}
|
||||
|
||||
private void findWallpapers() {
|
||||
mThumbs = new ArrayList<Integer>(24);
|
||||
mThumbs = new ArrayList<Drawable>(24);
|
||||
mImages = new ArrayList<Integer>(24);
|
||||
|
||||
final Resources resources = getResources();
|
||||
Pair<ApplicationInfo, Integer> r = getWallpaperArrayResourceId();
|
||||
if (r != null) {
|
||||
try {
|
||||
mWallpaperResources = getPackageManager().getResourcesForApplication(r.first);
|
||||
addWallpapers(mWallpaperResources, r.first.packageName, r.second);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Pair<ApplicationInfo, Integer> getWallpaperArrayResourceId() {
|
||||
// Context.getPackageName() may return the "original" package name,
|
||||
// com.android.launcher3; Resources needs the real package name,
|
||||
// com.android.launcher3. So we ask Resources for what it thinks the
|
||||
// package name should be.
|
||||
final String packageName = resources.getResourcePackageName(R.array.wallpapers);
|
||||
|
||||
addWallpapers(resources, packageName, R.array.wallpapers);
|
||||
addWallpapers(resources, packageName, R.array.extra_wallpapers);
|
||||
final String packageName = getResources().getResourcePackageName(R.array.wallpapers);
|
||||
try {
|
||||
ApplicationInfo info = getPackageManager().getApplicationInfo(packageName, 0);
|
||||
return new Pair<ApplicationInfo, Integer>(info, R.array.wallpapers);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addWallpapers(Resources resources, String packageName, int list) {
|
||||
final String[] extras = resources.getStringArray(list);
|
||||
private void addWallpapers(Resources resources, String packageName, int listResId) {
|
||||
final String[] extras = resources.getStringArray(listResId);
|
||||
for (String extra : extras) {
|
||||
int res = resources.getIdentifier(extra, "drawable", packageName);
|
||||
if (res != 0) {
|
||||
|
@ -412,7 +428,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
|||
"drawable", packageName);
|
||||
|
||||
if (thumbRes != 0) {
|
||||
mThumbs.add(thumbRes);
|
||||
mThumbs.add(resources.getDrawable(thumbRes));
|
||||
mImages.add(res);
|
||||
// Log.d(TAG, "add: [" + packageName + "]: " + extra + " (" + res + ")");
|
||||
}
|
||||
|
@ -537,14 +553,12 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
|
|||
|
||||
ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);
|
||||
|
||||
int thumbRes = mThumbs.get(position);
|
||||
image.setImageResource(thumbRes);
|
||||
Drawable thumbDrawable = image.getDrawable();
|
||||
Drawable thumbDrawable = mThumbs.get(position);
|
||||
if (thumbDrawable != null) {
|
||||
image.setImageDrawable(thumbDrawable);
|
||||
thumbDrawable.setDither(true);
|
||||
} else {
|
||||
Log.e(TAG, "Error decoding thumbnail resId=" + thumbRes + " for wallpaper #"
|
||||
+ position);
|
||||
Log.e(TAG, "Error decoding thumbnail for wallpaper #" + position);
|
||||
}
|
||||
|
||||
return view;
|
||||
|
|
|
@ -3246,9 +3246,9 @@ public class Workspace extends SmoothPagedView
|
|||
switch (info.itemType) {
|
||||
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
|
||||
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
|
||||
if (info.container == NO_ID && info instanceof ApplicationInfo) {
|
||||
if (info.container == NO_ID && info instanceof AppInfo) {
|
||||
// Came from all apps -- make a copy
|
||||
info = new ShortcutInfo((ApplicationInfo) info);
|
||||
info = new ShortcutInfo((AppInfo) info);
|
||||
}
|
||||
view = mLauncher.createShortcut(R.layout.application, cellLayout,
|
||||
(ShortcutInfo) info);
|
||||
|
@ -3943,10 +3943,10 @@ public class Workspace extends SmoothPagedView
|
|||
// Removes items that match the application info specified, when applications are removed
|
||||
// as a part of an update, this is called to ensure that other widgets and application
|
||||
// shortcuts are not removed.
|
||||
void removeItemsByApplicationInfo(final ArrayList<ApplicationInfo> appInfos) {
|
||||
void removeItemsByApplicationInfo(final ArrayList<AppInfo> appInfos) {
|
||||
// Just create a hash table of all the specific components that this will affect
|
||||
HashSet<ComponentName> cns = new HashSet<ComponentName>();
|
||||
for (ApplicationInfo info : appInfos) {
|
||||
for (AppInfo info : appInfos) {
|
||||
cns.add(info.componentName);
|
||||
}
|
||||
|
||||
|
@ -4024,7 +4024,7 @@ public class Workspace extends SmoothPagedView
|
|||
stripEmptyScreens();
|
||||
}
|
||||
|
||||
void updateShortcuts(ArrayList<ApplicationInfo> apps) {
|
||||
void updateShortcuts(ArrayList<AppInfo> apps) {
|
||||
ArrayList<ShortcutAndWidgetContainer> childrenLayouts = getAllShortcutAndWidgetContainers();
|
||||
for (ShortcutAndWidgetContainer layout: childrenLayouts) {
|
||||
int childCount = layout.getChildCount();
|
||||
|
@ -4039,7 +4039,7 @@ public class Workspace extends SmoothPagedView
|
|||
final ComponentName name = intent.getComponent();
|
||||
final int appCount = apps.size();
|
||||
for (int k = 0; k < appCount; k++) {
|
||||
ApplicationInfo app = apps.get(k);
|
||||
AppInfo app = apps.get(k);
|
||||
if (app.componentName.equals(name)) {
|
||||
BubbleTextView shortcut = (BubbleTextView) view;
|
||||
info.updateIcon(mIconCache);
|
||||
|
|
|
@ -18,6 +18,7 @@ package com.android.photos;
|
|||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.Config;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
@ -68,18 +69,19 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
|
|||
private Canvas mCanvas;
|
||||
|
||||
public BitmapRegionTileSource(Context context, String path, int previewSize, int rotation) {
|
||||
this(context, path, null, 0, previewSize, rotation);
|
||||
this(null, context, path, null, 0, previewSize, rotation);
|
||||
}
|
||||
|
||||
public BitmapRegionTileSource(Context context, Uri uri, int previewSize, int rotation) {
|
||||
this(context, null, uri, 0, previewSize, rotation);
|
||||
this(null, context, null, uri, 0, previewSize, rotation);
|
||||
}
|
||||
|
||||
public BitmapRegionTileSource(Context context, int resId, int previewSize, int rotation) {
|
||||
this(context, null, null, resId, previewSize, rotation);
|
||||
public BitmapRegionTileSource(Resources res,
|
||||
Context context, int resId, int previewSize, int rotation) {
|
||||
this(res, context, null, null, resId, previewSize, rotation);
|
||||
}
|
||||
|
||||
private BitmapRegionTileSource(
|
||||
private BitmapRegionTileSource(Resources res,
|
||||
Context context, String path, Uri uri, int resId, int previewSize, int rotation) {
|
||||
mTileSize = TiledImageRenderer.suggestedTileSize(context);
|
||||
mRotation = rotation;
|
||||
|
@ -91,7 +93,7 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
|
|||
BufferedInputStream bis = new BufferedInputStream(is);
|
||||
mDecoder = BitmapRegionDecoder.newInstance(bis, true);
|
||||
} else {
|
||||
InputStream is = context.getResources().openRawResource(resId);
|
||||
InputStream is = res.openRawResource(resId);
|
||||
BufferedInputStream bis = new BufferedInputStream(is);
|
||||
mDecoder = BitmapRegionDecoder.newInstance(bis, true);
|
||||
}
|
||||
|
@ -109,7 +111,7 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
|
|||
// Although this is the same size as the Bitmap that is likely already
|
||||
// loaded, the lifecycle is different and interactions are on a different
|
||||
// thread. Thus to simplify, this source will decode its own bitmap.
|
||||
Bitmap preview = decodePreview(context, path, uri, resId, previewSize);
|
||||
Bitmap preview = decodePreview(res, context, path, uri, resId, previewSize);
|
||||
if (preview.getWidth() <= GL_SIZE_LIMIT && preview.getHeight() <= GL_SIZE_LIMIT) {
|
||||
mPreview = new BitmapTexture(preview);
|
||||
} else {
|
||||
|
@ -213,7 +215,8 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
|
|||
* Note that the returned bitmap may have a long edge that's longer
|
||||
* than the targetSize, but it will always be less than 2x the targetSize
|
||||
*/
|
||||
private Bitmap decodePreview(Context context, String file, Uri uri, int resId, int targetSize) {
|
||||
private Bitmap decodePreview(
|
||||
Resources res, Context context, String file, Uri uri, int resId, int targetSize) {
|
||||
float scale = (float) targetSize / Math.max(mWidth, mHeight);
|
||||
mOptions.inSampleSize = BitmapUtils.computeSampleSizeLarger(scale);
|
||||
mOptions.inJustDecodeBounds = false;
|
||||
|
@ -230,7 +233,7 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource {
|
|||
Log.w("BitmapRegionTileSource", "getting preview failed", e);
|
||||
}
|
||||
} else {
|
||||
result = BitmapFactory.decodeResource(context.getResources(), resId, mOptions);
|
||||
result = BitmapFactory.decodeResource(res, resId, mOptions);
|
||||
}
|
||||
if (result == null) {
|
||||
return null;
|
||||
|
|