summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--WallpaperPicker/src/com/android/photos/views/Pools.java165
-rw-r--r--WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java4
-rw-r--r--res/layout-sw600dp/apps_view.xml11
-rw-r--r--res/values-sw600dp/dimens.xml4
-rw-r--r--res/values/dimens.xml1
-rw-r--r--res/values/strings.xml5
-rw-r--r--src/com/android/launcher3/AppsContainerRecyclerView.java2
-rw-r--r--src/com/android/launcher3/AppsGridAdapter.java4
-rw-r--r--src/com/android/launcher3/DeviceProfile.java2
-rw-r--r--src/com/android/launcher3/FocusIndicatorView.java10
-rw-r--r--src/com/android/launcher3/PackageChangedReceiver.java13
-rw-r--r--src/com/android/launcher3/UninstallShortcutReceiver.java27
-rw-r--r--src/com/android/launcher3/UserInitializeReceiver.java32
14 files changed, 24 insertions, 259 deletions
diff --git a/.gitignore b/.gitignore
index 4d5667e54..aea5d6102 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@ db_files
*.iml
.project
.classpath
+.project.properties
gen/
tests/stress/gen/
WallpaperPicker/gen/
+WallpaperPicker/.project.properties
+bin/
diff --git a/WallpaperPicker/src/com/android/photos/views/Pools.java b/WallpaperPicker/src/com/android/photos/views/Pools.java
deleted file mode 100644
index c60f2f013..000000000
--- a/WallpaperPicker/src/com/android/photos/views/Pools.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.photos.views;
-
-/**
- * Helper class for crating pools of objects. An example use looks like this:
- * <pre>
- * public class MyPooledClass {
- *
- * private static final SynchronizedPool<MyPooledClass> sPool =
- * new SynchronizedPool<MyPooledClass>(10);
- *
- * public static MyPooledClass obtain() {
- * MyPooledClass instance = sPool.acquire();
- * return (instance != null) ? instance : new MyPooledClass();
- * }
- *
- * public void recycle() {
- * // Clear state if needed.
- * sPool.release(this);
- * }
- *
- * . . .
- * }
- * </pre>
- *
- * @hide
- */
-public final class Pools {
-
- /**
- * Interface for managing a pool of objects.
- *
- * @param <T> The pooled type.
- */
- public static interface Pool<T> {
-
- /**
- * @return An instance from the pool if such, null otherwise.
- */
- public T acquire();
-
- /**
- * Release an instance to the pool.
- *
- * @param instance The instance to release.
- * @return Whether the instance was put in the pool.
- *
- * @throws IllegalStateException If the instance is already in the pool.
- */
- public boolean release(T instance);
- }
-
- private Pools() {
- /* do nothing - hiding constructor */
- }
-
- /**
- * Simple (non-synchronized) pool of objects.
- *
- * @param <T> The pooled type.
- */
- public static class SimplePool<T> implements Pool<T> {
- private final Object[] mPool;
-
- private int mPoolSize;
-
- /**
- * Creates a new instance.
- *
- * @param maxPoolSize The max pool size.
- *
- * @throws IllegalArgumentException If the max pool size is less than zero.
- */
- public SimplePool(int maxPoolSize) {
- if (maxPoolSize <= 0) {
- throw new IllegalArgumentException("The max pool size must be > 0");
- }
- mPool = new Object[maxPoolSize];
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T acquire() {
- if (mPoolSize > 0) {
- final int lastPooledIndex = mPoolSize - 1;
- T instance = (T) mPool[lastPooledIndex];
- mPool[lastPooledIndex] = null;
- mPoolSize--;
- return instance;
- }
- return null;
- }
-
- @Override
- public boolean release(T instance) {
- if (isInPool(instance)) {
- throw new IllegalStateException("Already in the pool!");
- }
- if (mPoolSize < mPool.length) {
- mPool[mPoolSize] = instance;
- mPoolSize++;
- return true;
- }
- return false;
- }
-
- private boolean isInPool(T instance) {
- for (int i = 0; i < mPoolSize; i++) {
- if (mPool[i] == instance) {
- return true;
- }
- }
- return false;
- }
- }
-
- /**
- * Synchronized) pool of objects.
- *
- * @param <T> The pooled type.
- */
- public static class SynchronizedPool<T> extends SimplePool<T> {
- private final Object mLock = new Object();
-
- /**
- * Creates a new instance.
- *
- * @param maxPoolSize The max pool size.
- *
- * @throws IllegalArgumentException If the max pool size is less than zero.
- */
- public SynchronizedPool(int maxPoolSize) {
- super(maxPoolSize);
- }
-
- @Override
- public T acquire() {
- synchronized (mLock) {
- return super.acquire();
- }
- }
-
- @Override
- public boolean release(T element) {
- synchronized (mLock) {
- return super.release(element);
- }
- }
- }
-} \ No newline at end of file
diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java
index 39a73b9d5..e57ce70b9 100644
--- a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java
+++ b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java
@@ -20,6 +20,8 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.support.v4.util.Pools.Pool;
+import android.support.v4.util.Pools.SynchronizedPool;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.LongSparseArray;
@@ -31,8 +33,6 @@ import com.android.gallery3d.glrenderer.BasicTexture;
import com.android.gallery3d.glrenderer.GLCanvas;
import com.android.gallery3d.glrenderer.UploadedTexture;
import com.android.launcher3.util.Thunk;
-import com.android.photos.views.Pools.Pool;
-import com.android.photos.views.Pools.SynchronizedPool;
/**
* Handles laying out, decoding, and drawing of tiles in GL
diff --git a/res/layout-sw600dp/apps_view.xml b/res/layout-sw600dp/apps_view.xml
index 6f22460fa..fba170b2e 100644
--- a/res/layout-sw600dp/apps_view.xml
+++ b/res/layout-sw600dp/apps_view.xml
@@ -18,16 +18,17 @@
android:id="@+id/apps_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#22000000"
+ android:padding="@dimen/apps_container_inset"
+ android:background="@drawable/apps_customize_bg"
android:descendantFocusability="afterDescendants">
<include
layout="@layout/apps_reveal_view"
- android:layout_width="@dimen/apps_container_width"
- android:layout_height="540dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_gravity="center" />
<include
layout="@layout/apps_list_view"
- android:layout_width="@dimen/apps_container_width"
- android:layout_height="540dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_gravity="center" />
</com.android.launcher3.AppsContainerView> \ No newline at end of file
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index d9075872a..d80f18c9e 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -18,7 +18,9 @@
<dimen name="app_icon_size">64dp</dimen>
<!-- Apps view -->
- <dimen name="apps_container_width">480dp</dimen>
+ <dimen name="apps_container_inset">24dp</dimen>
+ <dimen name="apps_grid_view_start_margin">64dp</dimen>
+ <dimen name="apps_view_section_text_size">26sp</dimen>
<dimen name="apps_view_row_height">76dp</dimen>
<!-- AppsCustomize -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index c327ec2d4..735373d69 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -48,6 +48,7 @@
<!-- Apps view -->
<dimen name="apps_container_width">0dp</dimen>
+ <dimen name="apps_container_height">0dp</dimen>
<dimen name="apps_container_inset">8dp</dimen>
<dimen name="apps_grid_view_start_margin">52dp</dimen>
<dimen name="apps_view_row_height">64dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7f79b984c..1b58d75b9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -174,11 +174,6 @@ s -->
<string name="permdesc_install_shortcut">Allows an app to add
shortcuts without user intervention.</string>
<!-- Permission short label -->
- <string name="permlab_uninstall_shortcut">uninstall shortcuts</string>
- <!-- Permission description -->
- <string name="permdesc_uninstall_shortcut">Allows the app to remove
- shortcuts without user intervention.</string>
- <!-- Permission short label -->
<string name="permlab_read_settings">read Home settings and shortcuts</string>
<!-- Permission description -->
<string name="permdesc_read_settings">Allows the app to read the settings and
diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java
index 63e7fe4ac..c93bacf93 100644
--- a/src/com/android/launcher3/AppsContainerRecyclerView.java
+++ b/src/com/android/launcher3/AppsContainerRecyclerView.java
@@ -339,7 +339,7 @@ public class AppsContainerRecyclerView extends RecyclerView
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
- int position = getChildAdapterPosition(child);
+ int position = getChildPosition(child);
if (position != NO_POSITION) {
AlphabeticalAppsList.AdapterItem item = mApps.getAdapterItems().get(position);
if (!item.isSectionHeader) {
diff --git a/src/com/android/launcher3/AppsGridAdapter.java b/src/com/android/launcher3/AppsGridAdapter.java
index 96d971669..5b6967c26 100644
--- a/src/com/android/launcher3/AppsGridAdapter.java
+++ b/src/com/android/launcher3/AppsGridAdapter.java
@@ -79,10 +79,10 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
GridLayoutManager.LayoutParams lp = (GridLayoutManager.LayoutParams)
child.getLayoutParams();
if (!holder.mIsSectionRow && !holder.mIsEmptyRow && !lp.isItemRemoved()) {
- if (items.get(holder.getAdapterPosition() - 1).isSectionHeader) {
+ if (items.get(holder.getPosition() - 1).isSectionHeader) {
// Draw at the parent
AlphabeticalAppsList.AdapterItem item =
- items.get(holder.getAdapterPosition());
+ items.get(holder.getPosition());
String section = item.sectionName;
mSectionTextPaint.getTextBounds(section, 0, section.length(),
mTmpBounds);
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 73f54ab70..331695acc 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -429,7 +429,7 @@ public class DeviceProfile {
int availableAppsWidthPx = (appsContainerViewPx > 0) ? appsContainerViewPx :
availableWidthPx;
appsViewNumCols = (availableAppsWidthPx - appsViewLeftMarginPx) /
- (allAppsCellWidthPx + allAppsCellPaddingPx);
+ (allAppsCellWidthPx + 2 * allAppsCellPaddingPx);
}
void updateFromConfiguration(Context context, Resources resources, int wPx, int hPx,
diff --git a/src/com/android/launcher3/FocusIndicatorView.java b/src/com/android/launcher3/FocusIndicatorView.java
index ab21c90e6..ecf93e4b3 100644
--- a/src/com/android/launcher3/FocusIndicatorView.java
+++ b/src/com/android/launcher3/FocusIndicatorView.java
@@ -149,7 +149,7 @@ public class FocusIndicatorView extends View implements View.OnFocusChangeListen
}
/**
- * Computes the location of a view relative to {@link #mCommonParent}, off-setting
+ * Computes the location of a view relative to {@param parent}, off-setting
* any shift due to page view scroll.
* @param pos an array of two integers in which to hold the coordinates
*/
@@ -166,12 +166,12 @@ public class FocusIndicatorView extends View implements View.OnFocusChangeListen
private static void computeLocationRelativeToParentHelper(View child,
View commonParent, int[] shift) {
View parent = (View) child.getParent();
- if (parent instanceof PagedView) {
- child = ((PagedView) parent).getPageAt(0);
- }
-
shift[0] += child.getLeft();
shift[1] += child.getTop();
+ if (parent instanceof PagedView) {
+ PagedView page = (PagedView) parent;
+ shift[0] -= page.getScrollForPage(page.indexOfChild(child));
+ }
if (parent != commonParent) {
computeLocationRelativeToParentHelper(parent, commonParent, shift);
diff --git a/src/com/android/launcher3/PackageChangedReceiver.java b/src/com/android/launcher3/PackageChangedReceiver.java
deleted file mode 100644
index b98f47272..000000000
--- a/src/com/android/launcher3/PackageChangedReceiver.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.android.launcher3;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-// TODO: Remove this
-public class PackageChangedReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(final Context context, Intent intent) {
-
- }
-}
diff --git a/src/com/android/launcher3/UninstallShortcutReceiver.java b/src/com/android/launcher3/UninstallShortcutReceiver.java
deleted file mode 100644
index 59e4cb591..000000000
--- a/src/com/android/launcher3/UninstallShortcutReceiver.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.launcher3;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-//TODO: Remove this
-public class UninstallShortcutReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent data) { }
-}
diff --git a/src/com/android/launcher3/UserInitializeReceiver.java b/src/com/android/launcher3/UserInitializeReceiver.java
deleted file mode 100644
index d8e17b12f..000000000
--- a/src/com/android/launcher3/UserInitializeReceiver.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2012 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.launcher3;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-/**
- * Takes care of setting initial wallpaper for a user, by selecting the
- * first wallpaper that is not in use by another user.
- */
-public class UserInitializeReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- // TODO: initial wallpaper now that wallpapers are owned by another app
- }
-}