summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2011-12-30 14:05:22 +0000
committernebkat <nebkat@teamhacksung.org>2011-12-30 14:05:22 +0000
commit291324116b7ac4d4348643d93e432c20768125ea (patch)
tree8c2580d8f9cfce4f37adbb654997e52ec22489af /src
parent51480b8f3978c2c464c493ba39caec840228786c (diff)
downloadandroid_packages_apps_Trebuchet-291324116b7ac4d4348643d93e432c20768125ea.tar.gz
android_packages_apps_Trebuchet-291324116b7ac4d4348643d93e432c20768125ea.tar.bz2
android_packages_apps_Trebuchet-291324116b7ac4d4348643d93e432c20768125ea.zip
Cleanup
Change-Id: I24b6971f1ab1f26f5295d4a5647e8fb08fe558f7
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/trebuchet/AddAdapter.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/AllAppsList.java14
-rw-r--r--src/com/cyanogenmod/trebuchet/AllAppsView.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java95
-rw-r--r--src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java10
-rw-r--r--src/com/cyanogenmod/trebuchet/BubbleTextView.java11
-rw-r--r--src/com/cyanogenmod/trebuchet/ButtonDropTarget.java3
-rw-r--r--src/com/cyanogenmod/trebuchet/CellLayout.java19
-rw-r--r--src/com/cyanogenmod/trebuchet/Cling.java9
-rw-r--r--src/com/cyanogenmod/trebuchet/DeferredHandler.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/DeleteDropTarget.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/DragController.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/DragLayer.java38
-rw-r--r--src/com/cyanogenmod/trebuchet/DragSource.java1
-rw-r--r--src/com/cyanogenmod/trebuchet/DragView.java17
-rw-r--r--src/com/cyanogenmod/trebuchet/FastBitmapDrawable.java7
-rw-r--r--src/com/cyanogenmod/trebuchet/FocusHelper.java16
-rw-r--r--src/com/cyanogenmod/trebuchet/FocusOnlyTabWidget.java1
-rw-r--r--src/com/cyanogenmod/trebuchet/Folder.java44
-rw-r--r--src/com/cyanogenmod/trebuchet/FolderIcon.java16
-rw-r--r--src/com/cyanogenmod/trebuchet/FolderInfo.java20
-rw-r--r--src/com/cyanogenmod/trebuchet/HandleView.java77
-rw-r--r--src/com/cyanogenmod/trebuchet/HolographicLinearLayout.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/HolographicOutlineHelper.java9
-rw-r--r--src/com/cyanogenmod/trebuchet/Hotseat.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/InfoDropTarget.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java10
-rw-r--r--src/com/cyanogenmod/trebuchet/InstallWidgetReceiver.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/InterruptibleInOutAnimator.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/ItemInfo.java6
-rw-r--r--src/com/cyanogenmod/trebuchet/Launcher.java72
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherAppWidgetHostView.java8
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherModel.java23
-rw-r--r--src/com/cyanogenmod/trebuchet/LauncherProvider.java34
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedView.java46
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java17
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewIcon.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewIconCache.java133
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedViewWidget.java9
-rw-r--r--src/com/cyanogenmod/trebuchet/RocketLauncher.java21
-rw-r--r--src/com/cyanogenmod/trebuchet/SearchDropTargetBar.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/ShortcutInfo.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/SpringLoadedDragController.java1
-rw-r--r--src/com/cyanogenmod/trebuchet/StrokedTextView.java139
-rw-r--r--src/com/cyanogenmod/trebuchet/UninstallShortcutReceiver.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/Utilities.java71
-rw-r--r--src/com/cyanogenmod/trebuchet/WallpaperChooser.java2
-rw-r--r--src/com/cyanogenmod/trebuchet/WallpaperChooserDialogFragment.java9
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java53
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/NumberPickerPreference.java4
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/Preferences.java1
52 files changed, 167 insertions, 949 deletions
diff --git a/src/com/cyanogenmod/trebuchet/AddAdapter.java b/src/com/cyanogenmod/trebuchet/AddAdapter.java
index 5a3d43d05..28792267b 100644
--- a/src/com/cyanogenmod/trebuchet/AddAdapter.java
+++ b/src/com/cyanogenmod/trebuchet/AddAdapter.java
@@ -27,8 +27,6 @@ import android.widget.TextView;
import java.util.ArrayList;
-import com.cyanogenmod.trebuchet.R;
-
/**
* Adapter showing the types of items that can be added to a {@link Workspace}.
*/
diff --git a/src/com/cyanogenmod/trebuchet/AllAppsList.java b/src/com/cyanogenmod/trebuchet/AllAppsList.java
index cc0e8cfd5..f6c667e50 100644
--- a/src/com/cyanogenmod/trebuchet/AllAppsList.java
+++ b/src/com/cyanogenmod/trebuchet/AllAppsList.java
@@ -16,9 +16,6 @@
package com.cyanogenmod.trebuchet;
-import java.util.ArrayList;
-import java.util.List;
-
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -26,6 +23,9 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Stores the list of all applications for the all apps view.
@@ -135,9 +135,7 @@ class AllAppsList {
// Find enabled activities and add them to the adapter
// Also updates existing activities with new labels/icons
- int count = matches.size();
- for (int i = 0; i < count; i++) {
- final ResolveInfo info = matches.get(i);
+ for (final ResolveInfo info : matches) {
ApplicationInfo applicationInfo = findApplicationInfoLocked(
info.activityInfo.applicationInfo.packageName,
info.activityInfo.name);
@@ -195,9 +193,7 @@ class AllAppsList {
* Returns whether <em>apps</em> contains <em>component</em>.
*/
private static boolean findActivity(ArrayList<ApplicationInfo> apps, ComponentName component) {
- final int N = apps.size();
- for (int i=0; i<N; i++) {
- final ApplicationInfo info = apps.get(i);
+ for (final ApplicationInfo info : apps) {
if (info.componentName.equals(component)) {
return true;
}
diff --git a/src/com/cyanogenmod/trebuchet/AllAppsView.java b/src/com/cyanogenmod/trebuchet/AllAppsView.java
index ed2b36243..6065914e0 100644
--- a/src/com/cyanogenmod/trebuchet/AllAppsView.java
+++ b/src/com/cyanogenmod/trebuchet/AllAppsView.java
@@ -21,10 +21,6 @@ import java.util.ArrayList;
public interface AllAppsView {
public void setup(Launcher launcher, DragController dragController);
- public boolean isVisible();
-
- public boolean isAnimating();
-
public void setApps(ArrayList<ApplicationInfo> list);
public void addApps(ArrayList<ApplicationInfo> list);
diff --git a/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java b/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java
index c85081655..1edfbd9e8 100644
--- a/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java
+++ b/src/com/cyanogenmod/trebuchet/AppWidgetResizeFrame.java
@@ -12,8 +12,6 @@ import android.graphics.Rect;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.ImageView;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
public class AppWidgetResizeFrame extends FrameLayout {
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
index c4274bdd7..0eb48b9dd 100644
--- a/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
+++ b/src/com/cyanogenmod/trebuchet/AppsCustomizePagedView.java
@@ -29,33 +29,19 @@ import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.Bitmap;
+import android.graphics.*;
import android.graphics.Bitmap.Config;
-import android.graphics.Canvas;
-import android.graphics.MaskFilter;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.TableMaskFilter;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Process;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
+import android.view.*;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.Toast;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.DropTarget.DragObject;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
@@ -197,7 +183,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Save and Restore
private int mSaveInstanceStateItemIndex = -1;
- private int mRestorePage = -1;
// Content
private ContentType mContentType;
@@ -219,7 +204,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Dimens
private int mContentWidth;
private int mAppIconSize;
- private int mMaxWidgetSpan, mMinWidgetSpan;
private int mMaxAppCellCountX, mMaxAppCellCountY;
private int mWidgetCountX, mWidgetCountY;
private int mWidgetWidthGap, mWidgetHeightGap;
@@ -292,8 +276,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// The max widget span is the length N, such that NxN is the largest bounds that the widget
// preview can be before applying the widget scaling
- mMinWidgetSpan = 1;
- mMaxWidgetSpan = 3;
// The padding on the non-matched dimension for the default widget preview icons
// (top + bottom)
@@ -467,7 +449,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mWidgetSpacingLayout.measure(widthSpec, heightSpec);
mContentWidth = mWidgetSpacingLayout.getContentWidth();
- AppsCustomizeTabHost host = (AppsCustomizeTabHost) getTabHost();
+ AppsCustomizeTabHost host = getTabHost();
final boolean hostIsTransitioning = host.isTransitioning();
// Restore the page
@@ -644,7 +626,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
// We use a custom alpha clip table for the default widget previews
- Paint alphaClipPaint = null;
+ Paint alphaClipPaint;
if (createItemInfo instanceof PendingAddWidgetInfo) {
if (((PendingAddWidgetInfo) createItemInfo).previewImage != 0) {
MaskFilter alphaClipTable = TableMaskFilter.CreateClipTable(0, 255);
@@ -745,7 +727,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Clean up all the async tasks
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
while (iter.hasNext()) {
- AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ AppsCustomizeAsyncTask task = iter.next();
task.cancel(false);
iter.remove();
}
@@ -772,12 +754,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
// Update the thread priorities given the direction lookahead
- Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
- while (iter.hasNext()) {
- AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ for (AppsCustomizeAsyncTask task : mRunningTasks) {
int pageIndex = task.page + mNumAppsPages;
if ((mNextPage > mCurrentPage && pageIndex >= mCurrentPage) ||
- (mNextPage < mCurrentPage && pageIndex <= mCurrentPage)) {
+ (mNextPage < mCurrentPage && pageIndex <= mCurrentPage)) {
task.setThreadPriority(getThreadPriorityForPage(pageIndex));
} else {
task.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);
@@ -855,13 +835,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
PagedViewCellLayout layout = (PagedViewCellLayout) getPageAt(page);
layout.removeAllViewsOnPage();
- ArrayList<Object> items = new ArrayList<Object>();
- ArrayList<Bitmap> images = new ArrayList<Bitmap>();
for (int i = startIndex; i < endIndex; ++i) {
ApplicationInfo info = mApps.get(i);
PagedViewIcon icon = (PagedViewIcon) mLayoutInflater.inflate(
R.layout.apps_customize_application, layout, false);
- icon.applyFromApplicationInfo(info, true, mHolographicOutlineHelper);
+ icon.applyFromApplicationInfo(info, mHolographicOutlineHelper);
icon.setOnClickListener(this);
icon.setOnLongClickListener(this);
icon.setOnTouchListener(this);
@@ -870,19 +848,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int index = i - startIndex;
int x = index % mCellCountX;
int y = index / mCellCountX;
- layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1));
-
- items.add(info);
- images.add(info.iconBitmap);
+ layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x, y, 1, 1));
}
layout.createHardwareLayers();
-
- /* TEMPORARILY DISABLE HOLOGRAPHIC ICONS
- if (mFadeInAdjacentScreens) {
- prepareGenerateHoloOutlinesTask(page, items, images);
- }
- */
}
/**
@@ -901,7 +870,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
int minPageDiff = Integer.MAX_VALUE;
while (iter.hasNext()) {
- AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ AppsCustomizeAsyncTask task = iter.next();
minPageDiff = Math.abs(task.page + mNumAppsPages - toPage);
}
@@ -930,12 +899,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
* Creates and executes a new AsyncTask to load a page of widget previews.
*/
private void prepareLoadWidgetPreviewsTask(int page, ArrayList<Object> widgets,
- int cellWidth, int cellHeight, int cellCountX) {
+ int cellWidth, int cellHeight) {
// Prune all tasks that are no longer needed
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
while (iter.hasNext()) {
- AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ AppsCustomizeAsyncTask task = iter.next();
int taskPage = task.page + mNumAppsPages;
if (taskPage < getAssociatedLowerPageBound(mCurrentPage) ||
taskPage > getAssociatedUpperPageBound(mCurrentPage)) {
@@ -996,7 +965,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Prune old tasks for this page
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
while (iter.hasNext()) {
- AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ AppsCustomizeAsyncTask task = iter.next();
int taskPage = task.page;
if ((taskPage == page) &&
(task.dataType == AsyncTaskPageData.Type.LoadHolographicIconsData)) {
@@ -1236,7 +1205,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
layout.setColumnCount(layout.getCellCountX());
for (int i = 0; i < items.size(); ++i) {
Object rawInfo = items.get(i);
- PendingAddItemInfo createItemInfo = null;
+ PendingAddItemInfo createItemInfo;
PagedViewWidget widget = (PagedViewWidget) mLayoutInflater.inflate(
R.layout.apps_customize_widget, layout, false);
if (rawInfo instanceof AppWidgetProviderInfo) {
@@ -1297,7 +1266,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
onSyncWidgetPageItems(data);
} else {
prepareLoadWidgetPreviewsTask(page, items,
- maxPreviewWidth, maxPreviewHeight, mWidgetCountX);
+ maxPreviewWidth, maxPreviewHeight);
}
}
});
@@ -1314,8 +1283,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Load each of the widget/shortcut previews
ArrayList<Object> items = data.items;
ArrayList<Bitmap> images = data.generatedImages;
- int count = items.size();
- for (int i = 0; i < count; ++i) {
+ for (Object item : items) {
if (task != null) {
// Ensure we haven't been cancelled yet
if (task.isCancelled()) break;
@@ -1324,16 +1292,15 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
task.syncThreadPriority();
}
- Object rawInfo = items.get(i);
- if (rawInfo instanceof AppWidgetProviderInfo) {
- AppWidgetProviderInfo info = (AppWidgetProviderInfo) rawInfo;
+ if (item instanceof AppWidgetProviderInfo) {
+ AppWidgetProviderInfo info = (AppWidgetProviderInfo) item;
int[] cellSpans = mLauncher.getSpanForWidget(info, null);
Bitmap b = getWidgetPreview(info.provider, info.previewImage, info.icon,
cellSpans[0], cellSpans[1], data.maxImageWidth, data.maxImageHeight);
images.add(b);
- } else if (rawInfo instanceof ResolveInfo) {
+ } else if (item instanceof ResolveInfo) {
// Fill in the shortcuts information
- ResolveInfo info = (ResolveInfo) rawInfo;
+ ResolveInfo info = (ResolveInfo) item;
images.add(getShortcutPreview(info));
}
}
@@ -1348,7 +1315,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
PagedViewWidget widget = (PagedViewWidget) layout.getChildAt(i);
if (widget != null) {
Bitmap preview = data.generatedImages.get(i);
- widget.applyPreview(new FastBitmapDrawable(preview), i);
+ widget.applyPreview(new FastBitmapDrawable(preview));
}
}
@@ -1362,9 +1329,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
*/
// Update all thread priorities
- Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
- while (iter.hasNext()) {
- AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ for (AppsCustomizeAsyncTask task : mRunningTasks) {
int pageIndex = task.page + mNumAppsPages;
task.setThreadPriority(getThreadPriorityForPage(pageIndex));
}
@@ -1566,14 +1531,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mLauncher = launcher;
mDragController = dragController;
}
- @Override
- public boolean isVisible() {
- return (getVisibility() == VISIBLE);
- }
- @Override
- public boolean isAnimating() {
- return false;
- }
public SortMode getSortMode() {
return mSortMode;
@@ -1621,9 +1578,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> 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);
+ for (ApplicationInfo info : list) {
int index = 0;
if (mSortMode == SortMode.Title) {
index = Collections.binarySearch(mApps, info, LauncherModel.APP_NAME_COMPARATOR);
@@ -1654,9 +1609,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> 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);
+ for (ApplicationInfo info : list) {
int removeIndex = findAppByComponent(mApps, info);
if (removeIndex > -1) {
mApps.remove(removeIndex);
diff --git a/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java b/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java
index 6a97ea052..99bcff9df 100644
--- a/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java
+++ b/src/com/cyanogenmod/trebuchet/AppsCustomizeTabHost.java
@@ -27,13 +27,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-import android.widget.TabHost;
-import android.widget.TabWidget;
-import android.widget.TextView;
-
-import com.cyanogenmod.trebuchet.R;
+import android.widget.*;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
import java.util.ArrayList;
@@ -266,7 +260,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
mAnimationBuffer.setVisibility(View.VISIBLE);
LayoutParams p = new FrameLayout.LayoutParams(child.getWidth(),
child.getHeight());
- p.setMargins((int) child.getLeft(), (int) child.getTop(), 0, 0);
+ p.setMargins(child.getLeft(), child.getTop(), 0, 0);
mAnimationBuffer.addView(child, p);
}
diff --git a/src/com/cyanogenmod/trebuchet/BubbleTextView.java b/src/com/cyanogenmod/trebuchet/BubbleTextView.java
index a8a99a329..a3eb3b65b 100644
--- a/src/com/cyanogenmod/trebuchet/BubbleTextView.java
+++ b/src/com/cyanogenmod/trebuchet/BubbleTextView.java
@@ -18,33 +18,24 @@ package com.cyanogenmod.trebuchet;
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.Region;
+import android.graphics.*;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
-
/**
* TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
* because we want to make the bubble taller than the text and TextView's clip is
* too aggressive.
*/
public class BubbleTextView extends TextView {
- static final float CORNER_RADIUS = 4.0f;
static final float SHADOW_LARGE_RADIUS = 4.0f;
static final float SHADOW_SMALL_RADIUS = 1.75f;
static final float SHADOW_Y_OFFSET = 2.0f;
static final int SHADOW_LARGE_COLOUR = 0xDD000000;
static final int SHADOW_SMALL_COLOUR = 0xCC000000;
- static final float PADDING_H = 8.0f;
static final float PADDING_V = 3.0f;
private Paint mPaint;
diff --git a/src/com/cyanogenmod/trebuchet/ButtonDropTarget.java b/src/com/cyanogenmod/trebuchet/ButtonDropTarget.java
index 1b27763f3..a2205a86e 100644
--- a/src/com/cyanogenmod/trebuchet/ButtonDropTarget.java
+++ b/src/com/cyanogenmod/trebuchet/ButtonDropTarget.java
@@ -22,8 +22,6 @@ import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
-
/**
* Implements a DropTarget.
@@ -34,7 +32,6 @@ public class ButtonDropTarget extends TextView implements DropTarget, DragContro
protected Launcher mLauncher;
private int mBottomDragPadding;
- protected TextView mText;
protected SearchDropTargetBar mSearchDropTargetBar;
/** Whether this drop target is active for the current drag */
diff --git a/src/com/cyanogenmod/trebuchet/CellLayout.java b/src/com/cyanogenmod/trebuchet/CellLayout.java
index 509e09ff9..8d275c29c 100644
--- a/src/com/cyanogenmod/trebuchet/CellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/CellLayout.java
@@ -16,25 +16,12 @@
package com.cyanogenmod.trebuchet;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
+import android.animation.*;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.PointF;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.RectF;
+import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.util.AttributeSet;
@@ -46,8 +33,6 @@ import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LayoutAnimationController;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.FolderIcon.FolderRingAnimator;
import java.util.ArrayList;
diff --git a/src/com/cyanogenmod/trebuchet/Cling.java b/src/com/cyanogenmod/trebuchet/Cling.java
index dc6dd086c..9d13ad85c 100644
--- a/src/com/cyanogenmod/trebuchet/Cling.java
+++ b/src/com/cyanogenmod/trebuchet/Cling.java
@@ -19,19 +19,12 @@ package com.cyanogenmod.trebuchet;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
+import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.FrameLayout;
-import com.cyanogenmod.trebuchet.R;
-
public class Cling extends FrameLayout {
static final String WORKSPACE_CLING_DISMISSED_KEY = "cling.workspace.dismissed";
diff --git a/src/com/cyanogenmod/trebuchet/DeferredHandler.java b/src/com/cyanogenmod/trebuchet/DeferredHandler.java
index 48582f0ec..b1c26a38b 100644
--- a/src/com/cyanogenmod/trebuchet/DeferredHandler.java
+++ b/src/com/cyanogenmod/trebuchet/DeferredHandler.java
@@ -16,13 +16,13 @@
package com.cyanogenmod.trebuchet;
-import java.util.LinkedList;
-
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue;
+import java.util.LinkedList;
+
/**
* Queue of things to run on a looper thread. Items posted with {@link #post} will not
* be actually enqued on the handler until after the last one has run, to keep from
@@ -31,7 +31,7 @@ import android.os.MessageQueue;
* This class is fifo.
*/
public class DeferredHandler {
- private LinkedList<Runnable> mQueue = new LinkedList<Runnable>();
+ private final LinkedList<Runnable> mQueue = new LinkedList<Runnable>();
private MessageQueue mMessageQueue = Looper.myQueue();
private Impl mHandler = new Impl();
diff --git a/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java b/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java
index 82fccb791..1699c94e9 100644
--- a/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java
+++ b/src/com/cyanogenmod/trebuchet/DeleteDropTarget.java
@@ -29,8 +29,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
-import com.cyanogenmod.trebuchet.R;
-
public class DeleteDropTarget extends ButtonDropTarget {
private static int DELETE_ANIMATION_DURATION = 250;
@@ -178,8 +176,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
to.left + getPaddingLeft() + width, to.bottom);
// Center the destination rect about the trash icon
- int xOffset = (int) -(d.dragView.getMeasuredWidth() - width) / 2;
- int yOffset = (int) -(d.dragView.getMeasuredHeight() - height) / 2;
+ int xOffset = -(d.dragView.getMeasuredWidth() - width) / 2;
+ int yOffset = -(d.dragView.getMeasuredHeight() - height) / 2;
to.offset(xOffset, yOffset);
mSearchDropTargetBar.deferOnDragEnd();
diff --git a/src/com/cyanogenmod/trebuchet/DragController.java b/src/com/cyanogenmod/trebuchet/DragController.java
index be79aeebc..ec505c15a 100644
--- a/src/com/cyanogenmod/trebuchet/DragController.java
+++ b/src/com/cyanogenmod/trebuchet/DragController.java
@@ -30,8 +30,6 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.inputmethod.InputMethodManager;
-import com.cyanogenmod.trebuchet.R;
-
import java.util.ArrayList;
/**
diff --git a/src/com/cyanogenmod/trebuchet/DragLayer.java b/src/com/cyanogenmod/trebuchet/DragLayer.java
index 20e94018d..ccbcedd0f 100644
--- a/src/com/cyanogenmod/trebuchet/DragLayer.java
+++ b/src/com/cyanogenmod/trebuchet/DragLayer.java
@@ -16,11 +16,7 @@
package com.cyanogenmod.trebuchet;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
+import android.animation.*;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
@@ -39,8 +35,6 @@ import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
-
import java.util.ArrayList;
/**
@@ -98,18 +92,12 @@ public class DragLayer extends FrameLayout {
private boolean isEventOverFolderTextRegion(Folder folder, MotionEvent ev) {
getDescendantRectRelativeToSelf(folder.getEditTextRegion(), mHitRect);
- if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) {
- return true;
- }
- return false;
+ return mHitRect.contains((int) ev.getX(), (int) ev.getY());
}
private boolean isEventOverFolder(Folder folder, MotionEvent ev) {
getDescendantRectRelativeToSelf(folder, mHitRect);
- if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) {
- return true;
- }
- return false;
+ return mHitRect.contains((int) ev.getX(), (int) ev.getY());
}
private boolean handleTouchDown(MotionEvent ev, boolean intercept) {
@@ -175,10 +163,8 @@ public class DragLayer extends FrameLayout {
sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
mHoverPointClosesFolder = true;
return true;
- } else if (isOverFolder) {
- mHoverPointClosesFolder = false;
} else {
- return true;
+ mHoverPointClosesFolder = false;
}
case MotionEvent.ACTION_HOVER_MOVE:
isOverFolder = isEventOverFolder(currentFolder, ev);
@@ -293,8 +279,8 @@ public class DragLayer extends FrameLayout {
pt[1] += view.getTop() - view.getScrollY();
viewParent = view.getParent();
}
- coord[0] = (int) Math.round(pt[0]);
- coord[1] = (int) Math.round(pt[1]);
+ coord[0] = Math.round(pt[0]);
+ coord[1] = Math.round(pt[1]);
return scale;
}
@@ -420,7 +406,7 @@ public class DragLayer extends FrameLayout {
final int fromY = r.top;
animateViewIntoPosition(dragView, fromX, fromY, pos[0], pos[1], scale,
- onFinishRunnable, true, -1);
+ onFinishRunnable, -1);
}
public void animateViewIntoPosition(DragView dragView, final View child,
@@ -450,7 +436,7 @@ public class DragLayer extends FrameLayout {
// Center in the y coordinate about the target's drawable
toY += Math.round(scale * tv.getPaddingTop());
- toY -= (dragView.getHeight() - (int) Math.round(scale * d.getIntrinsicHeight())) / 2;
+ toY -= (dragView.getHeight() - Math.round(scale * d.getIntrinsicHeight())) / 2;
// Center in the x coordinate about the target's drawable
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
} else if (child instanceof FolderIcon) {
@@ -485,12 +471,12 @@ public class DragLayer extends FrameLayout {
}
};
animateViewIntoPosition(dragView, fromX, fromY, toX, toY, scale,
- onCompleteRunnable, true, duration);
+ onCompleteRunnable, duration);
}
private void animateViewIntoPosition(final View view, final int fromX, final int fromY,
final int toX, final int toY, float finalScale, Runnable onCompleteRunnable,
- boolean fadeOut, int duration) {
+ int duration) {
Rect from = new Rect(fromX, fromY, fromX +
view.getMeasuredWidth(), fromY + view.getMeasuredHeight());
Rect to = new Rect(toX, toY, toX + view.getMeasuredWidth(), toY + view.getMeasuredHeight());
@@ -565,8 +551,8 @@ public class DragLayer extends FrameLayout {
float motionPercent = motionInterpolator == null ? percent :
motionInterpolator.getInterpolation(percent);
- mDropViewPos[0] = from.left + (int) Math.round(((to.left - from.left) * motionPercent));
- mDropViewPos[1] = from.top + (int) Math.round(((to.top - from.top) * motionPercent));
+ mDropViewPos[0] = from.left + Math.round(((to.left - from.left) * motionPercent));
+ mDropViewPos[1] = from.top + Math.round(((to.top - from.top) * motionPercent));
mDropViewScale = percent * finalScale + (1 - percent);
mDropViewAlpha = alphaPercent * finalAlpha + (1 - alphaPercent) * initialAlpha;
invalidate(mDropViewPos[0], mDropViewPos[1],
diff --git a/src/com/cyanogenmod/trebuchet/DragSource.java b/src/com/cyanogenmod/trebuchet/DragSource.java
index 4016da7fc..7a3836e82 100644
--- a/src/com/cyanogenmod/trebuchet/DragSource.java
+++ b/src/com/cyanogenmod/trebuchet/DragSource.java
@@ -17,7 +17,6 @@
package com.cyanogenmod.trebuchet;
import android.view.View;
-
import com.cyanogenmod.trebuchet.DropTarget.DragObject;
/**
diff --git a/src/com/cyanogenmod/trebuchet/DragView.java b/src/com/cyanogenmod/trebuchet/DragView.java
index 6e64b8313..81f92d48a 100644
--- a/src/com/cyanogenmod/trebuchet/DragView.java
+++ b/src/com/cyanogenmod/trebuchet/DragView.java
@@ -20,17 +20,10 @@ package com.cyanogenmod.trebuchet;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.Rect;
+import android.graphics.*;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
-import com.cyanogenmod.trebuchet.R;
-
public class DragView extends View {
private Bitmap mBitmap;
private Paint mPaint;
@@ -157,14 +150,6 @@ public class DragView extends View {
@Override
protected void onDraw(Canvas canvas) {
- if (false) {
- // for debugging
- Paint p = new Paint();
- p.setStyle(Paint.Style.FILL);
- p.setColor(0xaaffffff);
- canvas.drawRect(0, 0, getWidth(), getHeight(), p);
- }
-
mHasDrawn = true;
canvas.drawBitmap(mBitmap, 0.0f, 0.0f, mPaint);
}
diff --git a/src/com/cyanogenmod/trebuchet/FastBitmapDrawable.java b/src/com/cyanogenmod/trebuchet/FastBitmapDrawable.java
index 54b7f7c27..ef8cae0af 100644
--- a/src/com/cyanogenmod/trebuchet/FastBitmapDrawable.java
+++ b/src/com/cyanogenmod/trebuchet/FastBitmapDrawable.java
@@ -16,12 +16,7 @@
package com.cyanogenmod.trebuchet;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.Rect;
+import android.graphics.*;
import android.graphics.drawable.Drawable;
class FastBitmapDrawable extends Drawable {
diff --git a/src/com/cyanogenmod/trebuchet/FocusHelper.java b/src/com/cyanogenmod/trebuchet/FocusHelper.java
index 2f3d21f1d..59aadb401 100644
--- a/src/com/cyanogenmod/trebuchet/FocusHelper.java
+++ b/src/com/cyanogenmod/trebuchet/FocusHelper.java
@@ -24,8 +24,6 @@ import android.view.ViewParent;
import android.widget.TabHost;
import android.widget.TabWidget;
-import com.cyanogenmod.trebuchet.R;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -54,7 +52,7 @@ class FolderKeyEventListener implements View.OnKeyListener {
class HotseatIconKeyEventListener implements View.OnKeyListener {
public boolean onKey(View v, int keyCode, KeyEvent event) {
final Configuration configuration = v.getResources().getConfiguration();
- return FocusHelper.handleHotseatButtonKeyEvent(v, keyCode, event, configuration.orientation);
+ return FocusHelper.handleHotseatButtonKeyEvent(v, keyCode, event);
}
}
@@ -145,7 +143,7 @@ public class FocusHelper {
final TabWidget tabs = (TabWidget) tabHost.findViewById(com.android.internal.R.id.tabs);
final int widgetIndex = parent.indexOfChild(w);
final int widgetCount = parent.getChildCount();
- final int pageIndex = ((PagedView) container).indexToPage(container.indexOfChild(parent));
+ final int pageIndex = container.indexToPage(container.indexOfChild(parent));
final int pageCount = container.getChildCount();
final int cellCountX = parent.getCellCountX();
final int cellCountY = parent.getCellCountY();
@@ -154,7 +152,7 @@ public class FocusHelper {
final int action = e.getAction();
final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP);
- ViewGroup newParent = null;
+ ViewGroup newParent;
// Now that we load items in the bg asynchronously, we can't just focus
// child siblings willy-nilly
View child = null;
@@ -305,7 +303,7 @@ public class FocusHelper {
final TabWidget tabs = (TabWidget) tabHost.findViewById(com.android.internal.R.id.tabs);
final int iconIndex = itemContainer.indexOfChild(v);
final int itemCount = itemContainer.getChildCount();
- final int pageIndex = ((PagedView) container).indexToPage(container.indexOfChild(parentLayout));
+ final int pageIndex = container.indexToPage(container.indexOfChild(parentLayout));
final int pageCount = container.getChildCount();
final int x = iconIndex % countX;
@@ -313,10 +311,10 @@ public class FocusHelper {
final int action = e.getAction();
final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP);
- ViewGroup newParent = null;
+ ViewGroup newParent;
// Side pages do not always load synchronously, so check before focusing child siblings
// willy-nilly
- View child = null;
+ View child;
boolean wasHandled = false;
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
@@ -497,7 +495,7 @@ public class FocusHelper {
/**
* Handles key events in the workspace hotseat (bottom of the screen).
*/
- static boolean handleHotseatButtonKeyEvent(View v, int keyCode, KeyEvent e, int orientation) {
+ static boolean handleHotseatButtonKeyEvent(View v, int keyCode, KeyEvent e) {
final ViewGroup parent = (ViewGroup) v.getParent();
final ViewGroup launcher = (ViewGroup) parent.getParent();
final Workspace workspace = (Workspace) launcher.findViewById(R.id.workspace);
diff --git a/src/com/cyanogenmod/trebuchet/FocusOnlyTabWidget.java b/src/com/cyanogenmod/trebuchet/FocusOnlyTabWidget.java
index 795b621e6..bb3cbc59b 100644
--- a/src/com/cyanogenmod/trebuchet/FocusOnlyTabWidget.java
+++ b/src/com/cyanogenmod/trebuchet/FocusOnlyTabWidget.java
@@ -80,7 +80,6 @@ public class FocusOnlyTabWidget extends TabWidget {
public void onFocusChange(android.view.View v, boolean hasFocus) {
if (v == this && hasFocus && getTabCount() > 0) {
getSelectedTab().requestFocus();
- return;
}
}
}
diff --git a/src/com/cyanogenmod/trebuchet/Folder.java b/src/com/cyanogenmod/trebuchet/Folder.java
index 5983524f1..6ce748430 100644
--- a/src/com/cyanogenmod/trebuchet/Folder.java
+++ b/src/com/cyanogenmod/trebuchet/Folder.java
@@ -16,11 +16,7 @@
package com.cyanogenmod.trebuchet;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.animation.ValueAnimator;
+import android.animation.*;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Resources;
@@ -28,15 +24,8 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.InputType;
import android.text.Selection;
-import android.text.Spannable;
import android.util.AttributeSet;
-import android.view.ActionMode;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
+import android.view.*;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AccelerateInterpolator;
@@ -45,8 +34,6 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.TextView;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.FolderInfo.FolderListener;
import java.util.ArrayList;
@@ -262,7 +249,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
// ensures that every time the field is clicked, focus is gained, giving reliable behavior.
requestFocus();
- Selection.setSelection((Spannable) mFolderName.getText(), 0, 0);
+ Selection.setSelection(mFolderName.getText(), 0, 0);
mIsEditingName = false;
}
@@ -317,8 +304,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
ArrayList<ShortcutInfo> overflow = new ArrayList<ShortcutInfo>();
setupContentForNumItems(children.size());
int count = 0;
- for (int i = 0; i < children.size(); i++) {
- ShortcutInfo child = (ShortcutInfo) children.get(i);
+ for (ShortcutInfo child : children) {
if (!createAndAddShortcut(child)) {
overflow.add(child);
} else {
@@ -552,9 +538,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
CellLayout.LayoutParams lp =
new CellLayout.LayoutParams(item.cellX, item.cellY, item.spanX, item.spanY);
- boolean insert = false;
textView.setOnKeyListener(new FolderKeyEventListener());
- mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int)item.id, lp, true);
+ mContent.addViewToCellLayout(textView, -1, (int)item.id, lp, true);
return true;
}
@@ -571,11 +556,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
};
boolean readingOrderGreaterThan(int[] v1, int[] v2) {
- if (v1[1] > v2[1] || (v1[1] == v2[1] && v1[0] > v2[0])) {
- return true;
- } else {
- return false;
- }
+ return v1[1] > v2[1] || (v1[1] == v2[1] && v1[0] > v2[0]);
}
private void realTimeReorder(int[] empty, int[] target) {
@@ -721,11 +702,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private void updateItemLocationsInDatabase() {
ArrayList<View> list = getItemsInReadingOrder();
- for (int i = 0; i < list.size(); i++) {
- View v = list.get(i);
+ for (View v : list) {
ItemInfo info = (ItemInfo) v.getTag();
LauncherModel.moveItemInDatabase(mLauncher, info, mInfo.id, 0,
- info.cellX, info.cellY);
+ info.cellX, info.cellY);
}
}
@@ -866,8 +846,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
mContent.removeAllViews();
- for (int i = 0; i < list.size(); i++) {
- View v = list.get(i);
+ for (View v : list) {
mContent.getVacantCell(vacant, 1, 1);
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) v.getLayoutParams();
lp.cellX = vacant[0];
@@ -879,8 +858,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
LauncherModel.addOrMoveItemInDatabase(mLauncher, info, mInfo.id, 0,
info.cellX, info.cellY);
}
- boolean insert = false;
- mContent.addViewToCellLayout(v, insert ? 0 : -1, (int)info.id, lp, true);
+ mContent.addViewToCellLayout(v, -1, (int) info.id, lp, true);
}
mItemsInvalidated = true;
}
@@ -896,7 +874,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private void onCloseComplete() {
DragLayer parent = (DragLayer) getParent();
parent.removeView(this);
- mDragController.removeDropTarget((DropTarget) this);
+ mDragController.removeDropTarget(this);
clearFocus();
mFolderIcon.requestFocus();
diff --git a/src/com/cyanogenmod/trebuchet/FolderIcon.java b/src/com/cyanogenmod/trebuchet/FolderIcon.java
index 85a337598..4042f4c88 100644
--- a/src/com/cyanogenmod/trebuchet/FolderIcon.java
+++ b/src/com/cyanogenmod/trebuchet/FolderIcon.java
@@ -37,8 +37,6 @@ import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.DropTarget.DragObject;
import com.cyanogenmod.trebuchet.FolderInfo.FolderListener;
@@ -111,12 +109,6 @@ public class FolderIcon extends LinearLayout implements FolderListener {
static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
FolderInfo folderInfo, IconCache iconCache) {
- if (INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION) {
- throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " +
- "INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
- "is dependent on this");
- }
-
FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);
icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
@@ -352,8 +344,8 @@ public class FolderIcon extends LinearLayout implements FolderListener {
int[] center = new int[2];
float scale = getLocalCenterForIndex(index, center);
- center[0] = (int) Math.round(scaleRelativeToDragLayer * center[0]);
- center[1] = (int) Math.round(scaleRelativeToDragLayer * center[1]);
+ center[0] = Math.round(scaleRelativeToDragLayer * center[0]);
+ center[1] = Math.round(scaleRelativeToDragLayer * center[1]);
to.offset(center[0] - animateView.getMeasuredWidth() / 2,
center[1] - animateView.getMeasuredHeight() / 2);
@@ -448,8 +440,8 @@ public class FolderIcon extends LinearLayout implements FolderListener {
float offsetX = mParams.transX + (mParams.scale * mIntrinsicIconSize) / 2;
float offsetY = mParams.transY + (mParams.scale * mIntrinsicIconSize) / 2;
- center[0] = (int) Math.round(offsetX);
- center[1] = (int) Math.round(offsetY);
+ center[0] = Math.round(offsetX);
+ center[1] = Math.round(offsetY);
return mParams.scale;
}
diff --git a/src/com/cyanogenmod/trebuchet/FolderInfo.java b/src/com/cyanogenmod/trebuchet/FolderInfo.java
index dd896fd34..f11ba30e8 100644
--- a/src/com/cyanogenmod/trebuchet/FolderInfo.java
+++ b/src/com/cyanogenmod/trebuchet/FolderInfo.java
@@ -16,10 +16,10 @@
package com.cyanogenmod.trebuchet;
-import java.util.ArrayList;
-
import android.content.ContentValues;
+import java.util.ArrayList;
+
/**
* Represents a folder containing shortcuts or apps.
*/
@@ -53,8 +53,8 @@ class FolderInfo extends ItemInfo {
*/
public void add(ShortcutInfo item) {
contents.add(item);
- for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).onAdd(item);
+ for (FolderListener listener : listeners) {
+ listener.onAdd(item);
}
itemsChanged();
}
@@ -66,16 +66,16 @@ class FolderInfo extends ItemInfo {
*/
public void remove(ShortcutInfo item) {
contents.remove(item);
- for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).onRemove(item);
+ for (FolderListener listener : listeners) {
+ listener.onRemove(item);
}
itemsChanged();
}
public void setTitle(CharSequence title) {
this.title = title;
- for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).onTitleChanged(title);
+ for (FolderListener listener : listeners) {
+ listener.onTitleChanged(title);
}
}
@@ -96,8 +96,8 @@ class FolderInfo extends ItemInfo {
}
void itemsChanged() {
- for (int i = 0; i < listeners.size(); i++) {
- listeners.get(i).onItemsChanged();
+ for (FolderListener listener : listeners) {
+ listener.onItemsChanged();
}
}
diff --git a/src/com/cyanogenmod/trebuchet/HandleView.java b/src/com/cyanogenmod/trebuchet/HandleView.java
deleted file mode 100644
index a8493fc98..000000000
--- a/src/com/cyanogenmod/trebuchet/HandleView.java
+++ /dev/null
@@ -1,77 +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.cyanogenmod.trebuchet;
-
-import android.widget.ImageView;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.util.AttributeSet;
-import android.view.MotionEvent;
-import android.view.KeyEvent;
-import android.view.View;
-
-import com.cyanogenmod.trebuchet.R;
-
-public class HandleView extends ImageView {
- private static final int ORIENTATION_HORIZONTAL = 1;
-
- private Launcher mLauncher;
- private int mOrientation = ORIENTATION_HORIZONTAL;
-
- public HandleView(Context context) {
- super(context);
- }
-
- public HandleView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public HandleView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HandleView, defStyle, 0);
- mOrientation = a.getInt(R.styleable.HandleView_direction, ORIENTATION_HORIZONTAL);
- a.recycle();
-
- setContentDescription(context.getString(R.string.all_apps_button_label));
- }
-
- @Override
- public View focusSearch(int direction) {
- View newFocus = super.focusSearch(direction);
- if (newFocus == null && !mLauncher.isAllAppsVisible()) {
- final Workspace workspace = mLauncher.getWorkspace();
- workspace.dispatchUnhandledMove(null, direction);
- return (mOrientation == ORIENTATION_HORIZONTAL && direction == FOCUS_DOWN) ?
- this : workspace;
- }
- return newFocus;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN && mLauncher.isAllAppsVisible()) {
- return false;
- }
- return super.onTouchEvent(ev);
- }
-
- void setLauncher(Launcher launcher) {
- mLauncher = launcher;
- }
-}
diff --git a/src/com/cyanogenmod/trebuchet/HolographicLinearLayout.java b/src/com/cyanogenmod/trebuchet/HolographicLinearLayout.java
index 7a02e9e6e..072b58732 100644
--- a/src/com/cyanogenmod/trebuchet/HolographicLinearLayout.java
+++ b/src/com/cyanogenmod/trebuchet/HolographicLinearLayout.java
@@ -25,8 +25,6 @@ import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
-import com.cyanogenmod.trebuchet.R;
-
public class HolographicLinearLayout extends LinearLayout {
private final HolographicViewHelper mHolographicHelper;
diff --git a/src/com/cyanogenmod/trebuchet/HolographicOutlineHelper.java b/src/com/cyanogenmod/trebuchet/HolographicOutlineHelper.java
index 7181ee844..2b1a85683 100644
--- a/src/com/cyanogenmod/trebuchet/HolographicOutlineHelper.java
+++ b/src/com/cyanogenmod/trebuchet/HolographicOutlineHelper.java
@@ -16,14 +16,7 @@
package com.cyanogenmod.trebuchet;
-import android.graphics.Bitmap;
-import android.graphics.BlurMaskFilter;
-import android.graphics.Canvas;
-import android.graphics.MaskFilter;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.TableMaskFilter;
+import android.graphics.*;
public class HolographicOutlineHelper {
private final Paint mHolographicPaint = new Paint();
diff --git a/src/com/cyanogenmod/trebuchet/Hotseat.java b/src/com/cyanogenmod/trebuchet/Hotseat.java
index bb2f32b84..f75333ccc 100644
--- a/src/com/cyanogenmod/trebuchet/Hotseat.java
+++ b/src/com/cyanogenmod/trebuchet/Hotseat.java
@@ -25,10 +25,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
-import com.cyanogenmod.trebuchet.R;
-
public class Hotseat extends FrameLayout {
- private static final String TAG = "Hotseat";
private static final int sAllAppsButtonRank = 2; // In the middle of the dock
private Launcher mLauncher;
@@ -102,7 +99,6 @@ public class Hotseat extends FrameLayout {
inflater.inflate(R.layout.application, mContent, false);
allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,
context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null);
- // allAppsButton.setText(context.getString(R.string.all_apps_button_label));
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
allAppsButton.setOnTouchListener(new View.OnTouchListener() {
@Override
diff --git a/src/com/cyanogenmod/trebuchet/InfoDropTarget.java b/src/com/cyanogenmod/trebuchet/InfoDropTarget.java
index 73e7aea9a..0213f8c63 100644
--- a/src/com/cyanogenmod/trebuchet/InfoDropTarget.java
+++ b/src/com/cyanogenmod/trebuchet/InfoDropTarget.java
@@ -28,8 +28,6 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
-import com.cyanogenmod.trebuchet.R;
-
public class InfoDropTarget extends ButtonDropTarget {
private ColorStateList mOriginalTextColor;
diff --git a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
index 26a92e0d9..dc5006ce0 100644
--- a/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
+++ b/src/com/cyanogenmod/trebuchet/InstallShortcutReceiver.java
@@ -16,14 +16,12 @@
package com.cyanogenmod.trebuchet;
-import java.util.ArrayList;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
-import com.cyanogenmod.trebuchet.R;
+import java.util.ArrayList;
public class InstallShortcutReceiver extends BroadcastReceiver {
public static final String ACTION_INSTALL_SHORTCUT =
@@ -95,10 +93,10 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
boolean[][] occupied = new boolean[xCount][yCount];
ArrayList<ItemInfo> items = LauncherModel.getItemsInLocalCoordinates(context);
- ItemInfo item = null;
+ ItemInfo item;
int cellX, cellY, spanX, spanY;
- for (int i = 0; i < items.size(); ++i) {
- item = items.get(i);
+ for (ItemInfo item1 : items) {
+ item = item1;
if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
if (item.screen == screen) {
cellX = item.cellX;
diff --git a/src/com/cyanogenmod/trebuchet/InstallWidgetReceiver.java b/src/com/cyanogenmod/trebuchet/InstallWidgetReceiver.java
index fecc3c6d4..4d8dea898 100644
--- a/src/com/cyanogenmod/trebuchet/InstallWidgetReceiver.java
+++ b/src/com/cyanogenmod/trebuchet/InstallWidgetReceiver.java
@@ -16,8 +16,6 @@
package com.cyanogenmod.trebuchet;
-import java.util.List;
-
import android.appwidget.AppWidgetProviderInfo;
import android.content.ClipData;
import android.content.Context;
@@ -33,7 +31,7 @@ import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
+import java.util.List;
/**
diff --git a/src/com/cyanogenmod/trebuchet/InterruptibleInOutAnimator.java b/src/com/cyanogenmod/trebuchet/InterruptibleInOutAnimator.java
index 82ec2d8f3..caa120b57 100644
--- a/src/com/cyanogenmod/trebuchet/InterruptibleInOutAnimator.java
+++ b/src/com/cyanogenmod/trebuchet/InterruptibleInOutAnimator.java
@@ -62,7 +62,7 @@ public class InterruptibleInOutAnimator {
final long currentPlayTime = mAnimator.getCurrentPlayTime();
final float toValue = (direction == IN) ? mOriginalToValue : mOriginalFromValue;
final float startValue = mFirstRun ? mOriginalFromValue :
- ((Float) mAnimator.getAnimatedValue()).floatValue();
+ (Float) mAnimator.getAnimatedValue();
// Make sure it's stopped before we modify any values
cancel();
diff --git a/src/com/cyanogenmod/trebuchet/ItemInfo.java b/src/com/cyanogenmod/trebuchet/ItemInfo.java
index 369848664..46374cb56 100644
--- a/src/com/cyanogenmod/trebuchet/ItemInfo.java
+++ b/src/com/cyanogenmod/trebuchet/ItemInfo.java
@@ -16,13 +16,13 @@
package com.cyanogenmod.trebuchet;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
import android.content.ContentValues;
import android.graphics.Bitmap;
import android.util.Log;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
/**
* Represents an item in the launcher.
*/
diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java
index 0df98045e..0a137dafc 100644
--- a/src/com/cyanogenmod/trebuchet/Launcher.java
+++ b/src/com/cyanogenmod/trebuchet/Launcher.java
@@ -17,34 +17,12 @@
package com.cyanogenmod.trebuchet;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.animation.ValueAnimator;
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.SearchManager;
-import android.app.StatusBarManager;
-import android.app.UiModeManager;
+import android.animation.*;
+import android.app.*;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
-import android.content.ActivityNotFoundException;
-import android.content.BroadcastReceiver;
-import android.content.ClipData;
-import android.content.ClipDescription;
-import android.content.ComponentCallbacks2;
-import android.content.ComponentName;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SharedPreferences;
+import android.content.*;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -54,14 +32,7 @@ import android.database.ContentObserver;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.Message;
-import android.os.SystemClock;
-import android.os.SystemProperties;
+import android.os.*;
import android.provider.Settings;
import android.speech.RecognizerIntent;
import android.text.Selection;
@@ -69,43 +40,20 @@ import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.TextKeyListener;
import android.util.Log;
-import android.view.Display;
-import android.view.HapticFeedbackConstants;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.Surface;
-import android.view.View;
+import android.view.*;
import android.view.View.OnLongClickListener;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
-import android.widget.Advanceable;
-import android.widget.EditText;
-import android.widget.ImageView;
-import android.widget.PopupMenu;
-import android.widget.TextView;
-import android.widget.Toast;
-
+import android.widget.*;
import com.android.common.Search;
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.DropTarget.DragObject;
-import com.cyanogenmod.trebuchet.preference.*;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.FileDescriptor;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
+import com.cyanogenmod.trebuchet.preference.Preferences;
+import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
+
+import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/src/com/cyanogenmod/trebuchet/LauncherAppWidgetHostView.java b/src/com/cyanogenmod/trebuchet/LauncherAppWidgetHostView.java
index d9585395a..5e33706c2 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherAppWidgetHostView.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherAppWidgetHostView.java
@@ -18,13 +18,7 @@ package com.cyanogenmod.trebuchet;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-
-import com.cyanogenmod.trebuchet.R;
+import android.view.*;
/**
* {@inheritDoc}
diff --git a/src/com/cyanogenmod/trebuchet/LauncherModel.java b/src/com/cyanogenmod/trebuchet/LauncherModel.java
index aeb96d408..2ef1a0b3a 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherModel.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherModel.java
@@ -19,13 +19,7 @@ package com.cyanogenmod.trebuchet;
import android.app.SearchManager;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.ContentProviderClient;
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
+import android.content.*;
import android.content.Intent.ShortcutIconResource;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
@@ -38,26 +32,15 @@ import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Parcelable;
+import android.os.*;
import android.os.Process;
-import android.os.RemoteException;
-import android.os.SystemClock;
import android.util.Log;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
import java.lang.ref.WeakReference;
import java.net.URISyntaxException;
import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
/**
* Maintains in-memory state of the Launcher. It is expected that there should be only one
diff --git a/src/com/cyanogenmod/trebuchet/LauncherProvider.java b/src/com/cyanogenmod/trebuchet/LauncherProvider.java
index 5bcd6eaf9..2579649e5 100644
--- a/src/com/cyanogenmod/trebuchet/LauncherProvider.java
+++ b/src/com/cyanogenmod/trebuchet/LauncherProvider.java
@@ -20,13 +20,7 @@ import android.app.SearchManager;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
-import android.content.ComponentName;
-import android.content.ContentProvider;
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
+import android.content.*;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
@@ -46,11 +40,8 @@ import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
-
import com.android.internal.util.XmlUtils;
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.LauncherSettings.Favorites;
-
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -114,8 +105,8 @@ public class LauncherProvider extends ContentProvider {
return result;
}
- private static long dbInsertAndCheck(DatabaseHelper helper,
- SQLiteDatabase db, String table, String nullColumnHack, ContentValues values) {
+ private static long dbInsertAndCheck(SQLiteDatabase db, String table,
+ String nullColumnHack, ContentValues values) {
if (!values.containsKey(LauncherSettings.Favorites._ID)) {
throw new RuntimeException("Error: attempting to add item without specifying an id");
}
@@ -133,7 +124,7 @@ public class LauncherProvider extends ContentProvider {
SqlArguments args = new SqlArguments(uri);
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- final long rowId = dbInsertAndCheck(mOpenHelper, db, args.table, null, initialValues);
+ final long rowId = dbInsertAndCheck(db, args.table, null, initialValues);
if (rowId <= 0) return null;
uri = ContentUris.withAppendedId(uri, rowId);
@@ -151,7 +142,7 @@ public class LauncherProvider extends ContentProvider {
try {
int numValues = values.length;
for (int i = 0; i < numValues; i++) {
- if (dbInsertAndCheck(mOpenHelper, db, args.table, null, values[i]) < 0) {
+ if (dbInsertAndCheck(db, args.table, null, values[i]) < 0) {
return 0;
}
}
@@ -352,7 +343,7 @@ public class LauncherProvider extends ContentProvider {
try {
int numValues = rows.length;
for (i = 0; i < numValues; i++) {
- if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, rows[i]) < 0) {
+ if (dbInsertAndCheck(db, TABLE_FAVORITES, null, rows[i]) < 0) {
return 0;
} else {
total++;
@@ -859,7 +850,7 @@ public class LauncherProvider extends ContentProvider {
values.put(Favorites.SPANX, 1);
values.put(Favorites.SPANY, 1);
values.put(Favorites._ID, generateNewId());
- if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values) < 0) {
+ if (dbInsertAndCheck(db, TABLE_FAVORITES, null, values) < 0) {
return -1;
}
} catch (PackageManager.NameNotFoundException e) {
@@ -875,7 +866,7 @@ public class LauncherProvider extends ContentProvider {
values.put(Favorites.SPANY, 1);
long id = generateNewId();
values.put(Favorites._ID, id);
- if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values) <= 0) {
+ if (dbInsertAndCheck(db, TABLE_FAVORITES, null, values) <= 0) {
return -1;
} else {
return id;
@@ -898,9 +889,8 @@ public class LauncherProvider extends ContentProvider {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
List<AppWidgetProviderInfo> providers = appWidgetManager.getInstalledProviders();
if (providers == null) return null;
- final int providerCount = providers.size();
- for (int i = 0; i < providerCount; i++) {
- ComponentName provider = providers.get(i).provider;
+ for (AppWidgetProviderInfo provider1 : providers) {
+ ComponentName provider = provider1.provider;
if (provider != null && provider.getPackageName().equals(packageName)) {
return provider;
}
@@ -966,7 +956,7 @@ public class LauncherProvider extends ContentProvider {
values.put(Favorites.SPANY, spanY);
values.put(Favorites.APPWIDGET_ID, appWidgetId);
values.put(Favorites._ID, generateNewId());
- dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values);
+ dbInsertAndCheck(db, TABLE_FAVORITES, null, values);
allocatedAppWidgets = true;
@@ -1012,7 +1002,7 @@ public class LauncherProvider extends ContentProvider {
values.put(Favorites.ICON_RESOURCE, r.getResourceName(iconResId));
values.put(Favorites._ID, id);
- if (dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values) < 0) {
+ if (dbInsertAndCheck(db, TABLE_FAVORITES, null, values) < 0) {
return -1;
}
return id;
diff --git a/src/com/cyanogenmod/trebuchet/PagedView.java b/src/com/cyanogenmod/trebuchet/PagedView.java
index cbe4c438a..8d2f18239 100644
--- a/src/com/cyanogenmod/trebuchet/PagedView.java
+++ b/src/com/cyanogenmod/trebuchet/PagedView.java
@@ -16,11 +16,7 @@
package com.cyanogenmod.trebuchet;
-import android.animation.Animator;
-import android.animation.AnimatorInflater;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
+import android.animation.*;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -29,15 +25,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.ActionMode;
-import android.view.InputDevice;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.VelocityTracker;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.ViewParent;
+import android.view.*;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -46,8 +34,6 @@ import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.Scroller;
-import com.cyanogenmod.trebuchet.R;
-
import java.util.ArrayList;
/**
@@ -100,7 +86,6 @@ public abstract class PagedView extends ViewGroup {
protected final static int TOUCH_STATE_SCROLLING = 1;
protected final static int TOUCH_STATE_PREV_PAGE = 2;
protected final static int TOUCH_STATE_NEXT_PAGE = 3;
- protected final static float ALPHA_QUANTIZE_LEVEL = 0.0001f;
protected int mTouchState = TOUCH_STATE_REST;
protected boolean mForceScreenScrolled = false;
@@ -458,7 +443,7 @@ public abstract class PagedView extends ViewGroup {
for (int i = 0; i < childCount; i++) {
// disallowing padding in paged view (just pass 0)
final View child = getPageAt(i);
- final LayoutParams lp = (LayoutParams) child.getLayoutParams();
+ final LayoutParams lp = child.getLayoutParams();
int childWidthMode;
if (lp.width == LayoutParams.WRAP_CONTENT) {
@@ -510,7 +495,7 @@ public abstract class PagedView extends ViewGroup {
final int pageCount = getChildCount();
for (int i = 0; i < pageCount; i++) {
- View page = (View) getPageAt(i);
+ View page = getPageAt(i);
page.setX(page.getX() + delta);
}
setCurrentPage(newCurrentPage);
@@ -1076,7 +1061,7 @@ public abstract class PagedView extends ViewGroup {
f /= Math.abs(f);
}
- int overScrollAmount = (int) Math.round(f * screenSize);
+ int overScrollAmount = Math.round(f * screenSize);
if (amount < 0) {
mOverScrollX = overScrollAmount;
mScrollX = 0;
@@ -1100,7 +1085,7 @@ public abstract class PagedView extends ViewGroup {
f /= Math.abs(f);
}
- int overScrollAmount = (int) Math.round(OVERSCROLL_DAMP_FACTOR * f * screenSize);
+ int overScrollAmount = Math.round(OVERSCROLL_DAMP_FACTOR * f * screenSize);
if (amount < 0) {
mOverScrollX = overScrollAmount;
mScrollX = 0;
@@ -1115,14 +1100,6 @@ public abstract class PagedView extends ViewGroup {
dampedOverScroll(amount);
}
- protected float maxOverScroll() {
- // Using the formula in overScroll, assuming that f = 1.0 (which it should generally not
- // exceed). Used to find out how much extra wallpaper we need for the over scroll effect
- float f = 1.0f;
- f = f / (Math.abs(f)) * (overScrollInfluenceCurve(Math.abs(f)));
- return OVERSCROLL_DAMP_FACTOR * f;
- }
-
@Override
public boolean onTouchEvent(MotionEvent ev) {
// Skip touch handling if there are no pages to swipe
@@ -1372,7 +1349,7 @@ public abstract class PagedView extends ViewGroup {
int screenCenter = mScrollX + (getMeasuredWidth() / 2);
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
- View layout = (View) getPageAt(i);
+ View layout = getPageAt(i);
int childWidth = getScaledMeasuredWidth(layout);
int halfChildWidth = (childWidth / 2);
int childCenter = getChildOffset(i) + halfChildWidth;
@@ -1667,8 +1644,7 @@ public abstract class PagedView extends ViewGroup {
protected void resetCheckedGrandchildren() {
// loop through children, and set all of their children to _not_ be checked
final ArrayList<Checkable> checked = getCheckedGrandchildren();
- for (int i = 0; i < checked.size(); ++i) {
- final Checkable c = checked.get(i);
+ for (final Checkable c : checked) {
c.setChecked(false);
}
}
@@ -1887,12 +1863,6 @@ public abstract class PagedView extends ViewGroup {
mScrollIndicator.invalidate();
}
- public void showScrollIndicatorTrack() {
- }
-
- public void hideScrollIndicatorTrack() {
- }
-
/* Accessibility */
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java b/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java
index 25a9a6016..158488e10 100644
--- a/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/PagedViewCellLayout.java
@@ -24,8 +24,6 @@ import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
-import com.cyanogenmod.trebuchet.R;
-
/**
* An abstraction of the original CellLayout which supports laying out items
* which span multiple cells into a grid-like layout. Also supports dimming
@@ -317,16 +315,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
}
/**
- * Start dragging the specified child
- *
- * @param child The child that is being dragged
- */
- void onDragChild(View child) {
- PagedViewCellLayout.LayoutParams lp = (PagedViewCellLayout.LayoutParams) child.getLayoutParams();
- lp.isDragging = true;
- }
-
- /**
* Estimates the number of cells that the specified width would take up.
*/
public int estimateCellHSpan(int width) {
@@ -426,11 +414,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
@ViewDebug.ExportedProperty
public int cellVSpan;
- /**
- * Is this item currently being dragged
- */
- public boolean isDragging;
-
// a data object that you can bind to this layout params
private Object mTag;
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewIcon.java b/src/com/cyanogenmod/trebuchet/PagedViewIcon.java
index 11de20550..0f16ed47d 100644
--- a/src/com/cyanogenmod/trebuchet/PagedViewIcon.java
+++ b/src/com/cyanogenmod/trebuchet/PagedViewIcon.java
@@ -26,8 +26,6 @@ import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
-
/**
* An icon on a PagedView, specifically for items in the launcher's paged view (with compound
@@ -87,7 +85,7 @@ public class PagedViewIcon extends TextView implements Checkable {
return mHolographicOutline;
}
- public void applyFromApplicationInfo(ApplicationInfo info, boolean scaleUp,
+ public void applyFromApplicationInfo(ApplicationInfo info,
HolographicOutlineHelper holoOutlineHelper) {
mHolographicOutlineHelper = holoOutlineHelper;
mIcon = info.iconBitmap;
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewIconCache.java b/src/com/cyanogenmod/trebuchet/PagedViewIconCache.java
deleted file mode 100644
index 8086fa709..000000000
--- a/src/com/cyanogenmod/trebuchet/PagedViewIconCache.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.cyanogenmod.trebuchet;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-
-import android.appwidget.AppWidgetProviderInfo;
-import android.content.ComponentName;
-import android.content.pm.ComponentInfo;
-import android.content.pm.ResolveInfo;
-import android.graphics.Bitmap;
-
-/**
- * Simple cache mechanism for PagedView outlines.
- */
-public class PagedViewIconCache {
- public static class Key {
- public enum Type {
- ApplicationInfoKey,
- AppWidgetProviderInfoKey,
- ResolveInfoKey
- }
- private final ComponentName mComponentName;
- private final Type mType;
-
- public Key(ApplicationInfo info) {
- mComponentName = info.componentName;
- mType = Type.ApplicationInfoKey;
- }
- public Key(ResolveInfo info) {
- final ComponentInfo ci = info.activityInfo != null ? info.activityInfo :
- info.serviceInfo;
- mComponentName = new ComponentName(ci.packageName, ci.name);
- mType = Type.ResolveInfoKey;
- }
- public Key(AppWidgetProviderInfo info) {
- mComponentName = info.provider;
- mType = Type.AppWidgetProviderInfoKey;
- }
-
- private ComponentName getComponentName() {
- return mComponentName;
- }
- public boolean isKeyType(Type t) {
- return (mType == t);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Key) {
- Key k = (Key) o;
- return mComponentName.equals(k.mComponentName);
- }
- return super.equals(o);
- }
- @Override
- public int hashCode() {
- return getComponentName().hashCode();
- }
- }
-
- private final HashMap<Key, Bitmap> mIconOutlineCache = new HashMap<Key, Bitmap>();
-
- public void clear() {
- for (Key key : mIconOutlineCache.keySet()) {
- mIconOutlineCache.get(key).recycle();
- }
- mIconOutlineCache.clear();
- }
- private void retainAll(HashSet<Key> keysToKeep, Key.Type t) {
- HashSet<Key> keysToRemove = new HashSet<Key>(mIconOutlineCache.keySet());
- keysToRemove.removeAll(keysToKeep);
- for (Key key : keysToRemove) {
- if (key.isKeyType(t)) {
- mIconOutlineCache.get(key).recycle();
- mIconOutlineCache.remove(key);
- }
- }
- }
- /** Removes all the keys to applications that aren't in the passed in collection */
- public void retainAllApps(ArrayList<ApplicationInfo> keys) {
- HashSet<Key> keysSet = new HashSet<Key>();
- for (ApplicationInfo info : keys) {
- keysSet.add(new Key(info));
- }
- retainAll(keysSet, Key.Type.ApplicationInfoKey);
- }
- /** Removes all the keys to shortcuts that aren't in the passed in collection */
- public void retainAllShortcuts(List<ResolveInfo> keys) {
- HashSet<Key> keysSet = new HashSet<Key>();
- for (ResolveInfo info : keys) {
- keysSet.add(new Key(info));
- }
- retainAll(keysSet, Key.Type.ResolveInfoKey);
- }
- /** Removes all the keys to widgets that aren't in the passed in collection */
- public void retainAllAppWidgets(List<AppWidgetProviderInfo> keys) {
- HashSet<Key> keysSet = new HashSet<Key>();
- for (AppWidgetProviderInfo info : keys) {
- keysSet.add(new Key(info));
- }
- retainAll(keysSet, Key.Type.AppWidgetProviderInfoKey);
- }
- public void addOutline(Key key, Bitmap b) {
- mIconOutlineCache.put(key, b);
- }
- public void removeOutline(Key key) {
- if (mIconOutlineCache.containsKey(key)) {
- mIconOutlineCache.get(key).recycle();
- mIconOutlineCache.remove(key);
- }
- }
- public Bitmap getOutline(Key key) {
- return mIconOutlineCache.get(key);
- }
-}
diff --git a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
index 513c02355..833c3ed5c 100644
--- a/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
+++ b/src/com/cyanogenmod/trebuchet/PagedViewWidget.java
@@ -27,15 +27,12 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
-import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.cyanogenmod.trebuchet.R;
-
/**
* The linear layout used strictly for the widget/wallpaper tab of the customization tray
*/
@@ -148,7 +145,7 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
return maxSize;
}
- void applyPreview(FastBitmapDrawable preview, int index) {
+ void applyPreview(FastBitmapDrawable preview) {
final PagedViewWidgetImageView image =
(PagedViewWidgetImageView) findViewById(R.id.widget_preview);
if (preview != null) {
@@ -210,8 +207,8 @@ public class PagedViewWidget extends LinearLayout implements Checkable {
}
@Override
public void setAlpha(float alpha) {
- final float viewAlpha = mHolographicOutlineHelper.viewAlphaInterpolator(alpha);
- final float holographicAlpha = mHolographicOutlineHelper.highlightAlphaInterpolator(alpha);
+ final float viewAlpha = HolographicOutlineHelper.viewAlphaInterpolator(alpha);
+ final float holographicAlpha = HolographicOutlineHelper.highlightAlphaInterpolator(alpha);
int newViewAlpha = (int) (viewAlpha * 255);
int newHolographicAlpha = (int) (holographicAlpha * 255);
if ((mAlpha != newViewAlpha) || (mHolographicAlpha != newHolographicAlpha)) {
diff --git a/src/com/cyanogenmod/trebuchet/RocketLauncher.java b/src/com/cyanogenmod/trebuchet/RocketLauncher.java
index 87dbe6c60..c0b313e95 100644
--- a/src/com/cyanogenmod/trebuchet/RocketLauncher.java
+++ b/src/com/cyanogenmod/trebuchet/RocketLauncher.java
@@ -30,17 +30,14 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
+import android.os.Bundle;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
+import android.view.*;
import android.widget.FrameLayout;
import android.widget.ImageView;
-import com.cyanogenmod.trebuchet.R;
-
import java.util.HashMap;
import java.util.Random;
@@ -194,7 +191,7 @@ public class RocketLauncher extends Activity {
boardCenterY = (Board.this.getHeight() - getHeight()) / 2;
setX(boardCenterX);
setY(boardCenterY);
- fuse = (float) Math.max(boardCenterX, boardCenterY);
+ fuse = Math.max(boardCenterX, boardCenterY);
setRotation(180-angle);
setScaleX(0f);
setScaleY(0f);
@@ -332,7 +329,6 @@ public class RocketLauncher extends Activity {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
setLayerType(View.LAYER_TYPE_HARDWARE, null);
- setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
reset();
mAnim.start();
@@ -393,6 +389,17 @@ public class RocketLauncher extends Activity {
}
}
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Hide the window title.
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+
@Override
public void onStart() {
super.onStart();
diff --git a/src/com/cyanogenmod/trebuchet/SearchDropTargetBar.java b/src/com/cyanogenmod/trebuchet/SearchDropTargetBar.java
index d0007affb..49c263357 100644
--- a/src/com/cyanogenmod/trebuchet/SearchDropTargetBar.java
+++ b/src/com/cyanogenmod/trebuchet/SearchDropTargetBar.java
@@ -28,8 +28,6 @@ import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
/*
diff --git a/src/com/cyanogenmod/trebuchet/ShortcutInfo.java b/src/com/cyanogenmod/trebuchet/ShortcutInfo.java
index 859dee040..91410d729 100644
--- a/src/com/cyanogenmod/trebuchet/ShortcutInfo.java
+++ b/src/com/cyanogenmod/trebuchet/ShortcutInfo.java
@@ -16,14 +16,14 @@
package com.cyanogenmod.trebuchet;
-import java.util.ArrayList;
-
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
import android.util.Log;
+import java.util.ArrayList;
+
/**
* Represents a launchable icon on the workspaces and in folders.
*/
diff --git a/src/com/cyanogenmod/trebuchet/SpringLoadedDragController.java b/src/com/cyanogenmod/trebuchet/SpringLoadedDragController.java
index efe90ea2e..aae2033e4 100644
--- a/src/com/cyanogenmod/trebuchet/SpringLoadedDragController.java
+++ b/src/com/cyanogenmod/trebuchet/SpringLoadedDragController.java
@@ -20,7 +20,6 @@ public class SpringLoadedDragController implements OnAlarmListener {
// how long the user must hover over a mini-screen before it unshrinks
final long ENTER_SPRING_LOAD_HOVER_TIME = 550;
final long ENTER_SPRING_LOAD_CANCEL_HOVER_TIME = 950;
- final long EXIT_SPRING_LOAD_HOVER_TIME = 200;
Alarm mAlarm;
diff --git a/src/com/cyanogenmod/trebuchet/StrokedTextView.java b/src/com/cyanogenmod/trebuchet/StrokedTextView.java
deleted file mode 100644
index 8f94bdd04..000000000
--- a/src/com/cyanogenmod/trebuchet/StrokedTextView.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.cyanogenmod.trebuchet;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.widget.TextView;
-
-import com.cyanogenmod.trebuchet.R;
-
-/**
- * This class adds a stroke to the generic TextView allowing the text to stand out better against
- * the background (ie. in the AllApps button).
- */
-public class StrokedTextView extends TextView {
- private final Canvas mCanvas = new Canvas();
- private final Paint mPaint = new Paint();
- private Bitmap mCache;
- private boolean mUpdateCachedBitmap;
- private int mStrokeColor;
- private float mStrokeWidth;
- private int mTextColor;
-
- public StrokedTextView(Context context) {
- super(context);
- init(context, null, 0);
- }
-
- public StrokedTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs, 0);
- }
-
- public StrokedTextView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- init(context, attrs, defStyle);
- }
-
- private void init(Context context, AttributeSet attrs, int defStyle) {
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StrokedTextView,
- defStyle, 0);
- mStrokeColor = a.getColor(R.styleable.StrokedTextView_strokeColor, 0xFF000000);
- mStrokeWidth = a.getFloat(R.styleable.StrokedTextView_strokeWidth, 0.0f);
- mTextColor = a.getColor(R.styleable.StrokedTextView_strokeTextColor, 0xFFFFFFFF);
- a.recycle();
- mUpdateCachedBitmap = true;
-
- // Setup the text paint
- mPaint.setAntiAlias(true);
- mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
- }
-
- protected void onTextChanged(CharSequence text, int start, int before, int after) {
- super.onTextChanged(text, start, before, after);
- mUpdateCachedBitmap = true;
- }
-
- protected void onSizeChanged(int w, int h, int oldw, int oldh) {
- super.onSizeChanged(w, h, oldw, oldh);
- if (w > 0 && h > 0) {
- mUpdateCachedBitmap = true;
- mCache = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- } else {
- mCache = null;
- }
- }
-
- protected void onDraw(Canvas canvas) {
- if (mCache != null) {
- if (mUpdateCachedBitmap) {
- final int gap = getCompoundDrawablePadding();
- final int w = getMeasuredWidth();
- final int h = getMeasuredHeight();
- final String text = getText().toString();
- final Rect textBounds = new Rect();
- final Paint textPaint = getPaint();
- final int textWidth = (int) textPaint.measureText(text);
- textPaint.getTextBounds("x", 0, 1, textBounds);
-
- // Clear the old cached image
- mCanvas.setBitmap(mCache);
- mCanvas.drawColor(0, PorterDuff.Mode.CLEAR);
-
- // Draw the drawable
- final int drawableLeft = getPaddingLeft();
- final int drawableTop = getPaddingTop();
- final Drawable[] drawables = getCompoundDrawables();
- for (int i = 0; i < drawables.length; ++i) {
- if (drawables[i] != null) {
- drawables[i].setBounds(drawableLeft, drawableTop,
- drawableLeft + drawables[i].getIntrinsicWidth(),
- drawableTop + drawables[i].getIntrinsicHeight());
- drawables[i].draw(mCanvas);
- }
- }
-
- final int left = w - getPaddingRight() - textWidth;
- final int bottom = (h + textBounds.height()) / 2;
-
- // Draw the outline of the text
- mPaint.setStrokeWidth(mStrokeWidth);
- mPaint.setColor(mStrokeColor);
- mPaint.setTextSize(getTextSize());
- mCanvas.drawText(text, left, bottom, mPaint);
-
- // Draw the text itself
- mPaint.setStrokeWidth(0);
- mPaint.setColor(mTextColor);
- mCanvas.drawText(text, left, bottom, mPaint);
-
- mUpdateCachedBitmap = false;
- }
- canvas.drawBitmap(mCache, 0, 0, mPaint);
- } else {
- super.onDraw(canvas);
- }
- }
-}
diff --git a/src/com/cyanogenmod/trebuchet/UninstallShortcutReceiver.java b/src/com/cyanogenmod/trebuchet/UninstallShortcutReceiver.java
index 064693b0c..60fdd7fea 100644
--- a/src/com/cyanogenmod/trebuchet/UninstallShortcutReceiver.java
+++ b/src/com/cyanogenmod/trebuchet/UninstallShortcutReceiver.java
@@ -17,17 +17,15 @@
package com.cyanogenmod.trebuchet;
import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
-import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.widget.Toast;
import java.net.URISyntaxException;
-import com.cyanogenmod.trebuchet.R;
-
public class UninstallShortcutReceiver extends BroadcastReceiver {
private static final String ACTION_UNINSTALL_SHORTCUT =
"com.android.launcher.action.UNINSTALL_SHORTCUT";
diff --git a/src/com/cyanogenmod/trebuchet/Utilities.java b/src/com/cyanogenmod/trebuchet/Utilities.java
index 2a363883f..7f46b685d 100644
--- a/src/com/cyanogenmod/trebuchet/Utilities.java
+++ b/src/com/cyanogenmod/trebuchet/Utilities.java
@@ -16,27 +16,14 @@
package com.cyanogenmod.trebuchet;
-import java.util.Random;
-
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BlurMaskFilter;
-import android.graphics.Canvas;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.graphics.Paint;
-import android.graphics.PaintFlagsDrawFilter;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.TableMaskFilter;
+import android.graphics.*;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.util.DisplayMetrics;
-import com.cyanogenmod.trebuchet.R;
-
/**
* Various utilities shared amongst the Launcher's classes.
*/
@@ -143,15 +130,6 @@ final class Utilities {
final int left = (textureWidth-width) / 2;
final int top = (textureHeight-height) / 2;
- if (false) {
- // draw a big box for the icon for debugging
- canvas.drawColor(sColors[sColorIndex]);
- if (++sColorIndex >= sColors.length) sColorIndex = 0;
- Paint debugPaint = new Paint();
- debugPaint.setColor(0xffcccc00);
- canvas.drawRect(left, top, left+width, top+height, debugPaint);
- }
-
sOldBounds.set(icon.getBounds());
icon.setBounds(left, top, left+width, top+height);
icon.draw(canvas);
@@ -162,30 +140,6 @@ final class Utilities {
}
}
- static void drawSelectedAllAppsBitmap(Canvas dest, int destWidth, int destHeight,
- boolean pressed, Bitmap src) {
- synchronized (sCanvas) { // we share the statics :-(
- if (sIconWidth == -1) {
- // We can't have gotten to here without src being initialized, which
- // comes from this file already. So just assert.
- //initStatics(context);
- throw new RuntimeException("Assertion failed: Utilities not initialized");
- }
-
- dest.drawColor(0, PorterDuff.Mode.CLEAR);
-
- int[] xy = new int[2];
- Bitmap mask = src.extractAlpha(sBlurPaint, xy);
-
- float px = (destWidth - src.getWidth()) / 2;
- float py = (destHeight - src.getHeight()) / 2;
- dest.drawBitmap(mask, px + xy[0], py + xy[1],
- pressed ? sGlowColorPressedPaint : sGlowColorFocusedPaint);
-
- mask.recycle();
- }
- }
-
/**
* Returns a Bitmap representing the thumbnail of the specified Bitmap.
* The size of the thumbnail is defined by the dimension
@@ -248,27 +202,4 @@ final class Utilities {
sDisabledPaint.setColorFilter(new ColorMatrixColorFilter(cm));
sDisabledPaint.setAlpha(0x88);
}
-
- /** Only works for positive numbers. */
- static int roundToPow2(int n) {
- int orig = n;
- n >>= 1;
- int mask = 0x8000000;
- while (mask != 0 && (n & mask) == 0) {
- mask >>= 1;
- }
- while (mask != 0) {
- n |= mask;
- mask >>= 1;
- }
- n += 1;
- if (n != orig) {
- n <<= 1;
- }
- return n;
- }
-
- static int generateRandomId() {
- return new Random(System.currentTimeMillis()).nextInt(1 << 24);
- }
}
diff --git a/src/com/cyanogenmod/trebuchet/WallpaperChooser.java b/src/com/cyanogenmod/trebuchet/WallpaperChooser.java
index ccc39e6d4..ccc435437 100644
--- a/src/com/cyanogenmod/trebuchet/WallpaperChooser.java
+++ b/src/com/cyanogenmod/trebuchet/WallpaperChooser.java
@@ -16,8 +16,6 @@
package com.cyanogenmod.trebuchet;
-import com.cyanogenmod.trebuchet.R;
-
import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
diff --git a/src/com/cyanogenmod/trebuchet/WallpaperChooserDialogFragment.java b/src/com/cyanogenmod/trebuchet/WallpaperChooserDialogFragment.java
index a38738a6c..5622a9046 100644
--- a/src/com/cyanogenmod/trebuchet/WallpaperChooserDialogFragment.java
+++ b/src/com/cyanogenmod/trebuchet/WallpaperChooserDialogFragment.java
@@ -34,14 +34,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.Gallery;
-import android.widget.ImageView;
-import android.widget.ListAdapter;
-import android.widget.SpinnerAdapter;
-
-import com.cyanogenmod.trebuchet.R;
+import android.widget.*;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java
index 662a8b7db..3d3fb7052 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -17,36 +17,19 @@
package com.cyanogenmod.trebuchet;
-import android.animation.Animator;
+import android.animation.*;
import android.animation.Animator.AnimatorListener;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.AlertDialog;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
-import android.content.ClipData;
-import android.content.ClipDescription;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
+import android.content.*;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.Camera;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Point;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.RectF;
+import android.graphics.*;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
@@ -55,19 +38,11 @@ import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
-import android.view.Display;
-import android.view.DragEvent;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
+import android.view.*;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
-
-import com.cyanogenmod.trebuchet.R;
import com.cyanogenmod.trebuchet.FolderIcon.FolderRingAnimator;
import com.cyanogenmod.trebuchet.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
import com.cyanogenmod.trebuchet.preference.PreferencesProvider;
@@ -2956,7 +2931,7 @@ public class Workspace extends PagedView
*/
public boolean addExternalItemToScreen(ItemInfo dragInfo, CellLayout layout) {
if (layout.findCellForSpan(mTempEstimate, dragInfo.spanX, dragInfo.spanY)) {
- onDropExternal(dragInfo.dropPos, (ItemInfo) dragInfo, (CellLayout) layout, false);
+ onDropExternal(dragInfo.dropPos, dragInfo, layout, false);
return true;
}
mLauncher.showOutOfSpaceMessage();
@@ -3065,7 +3040,7 @@ public class Workspace extends PagedView
dragViewScale * cellLayoutScale, onAnimationCompleteRunnable);
} else {
// This is for other drag/drop cases, like dragging from All Apps
- View view = null;
+ View view;
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
@@ -3438,8 +3413,8 @@ public class Workspace extends PagedView
final HashSet<String> packageNames = new HashSet<String>();
final int appCount = apps.size();
- for (int i = 0; i < appCount; i++) {
- packageNames.add(apps.get(i).componentName.getPackageName());
+ for (ApplicationInfo app : apps) {
+ packageNames.add(app.componentName.getPackageName());
}
ArrayList<CellLayout> cellLayouts = getWorkspaceAndHotseatCellLayouts();
@@ -3477,13 +3452,12 @@ public class Workspace extends PagedView
final ArrayList<ShortcutInfo> appsToRemoveFromFolder =
new ArrayList<ShortcutInfo>();
- for (int k = 0; k < contentsCount; k++) {
- final ShortcutInfo appInfo = contents.get(k);
+ for (final ShortcutInfo appInfo : contents) {
final Intent intent = appInfo.intent;
final ComponentName name = intent.getComponent();
if (Intent.ACTION_MAIN.equals(intent.getAction()) && name != null) {
- for (String packageName: packageNames) {
+ for (String packageName : packageNames) {
if (packageName.equals(name.getPackageName())) {
appsToRemoveFromFolder.add(appInfo);
}
@@ -3546,14 +3520,13 @@ public class Workspace extends PagedView
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
Intent.ACTION_MAIN.equals(intent.getAction()) && name != null) {
final int appCount = apps.size();
- for (int k = 0; k < appCount; k++) {
- ApplicationInfo app = apps.get(k);
+ for (ApplicationInfo app : apps) {
if (app.componentName.equals(name)) {
info.setIcon(mIconCache.getIcon(info.intent));
- ((TextView)view).setCompoundDrawablesWithIntrinsicBounds(null,
+ ((TextView) view).setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(info.getIcon(mIconCache)),
null, null);
- }
+ }
}
}
}
diff --git a/src/com/cyanogenmod/trebuchet/preference/NumberPickerPreference.java b/src/com/cyanogenmod/trebuchet/preference/NumberPickerPreference.java
index c7ea4fbd7..bc858fdcb 100644
--- a/src/com/cyanogenmod/trebuchet/preference/NumberPickerPreference.java
+++ b/src/com/cyanogenmod/trebuchet/preference/NumberPickerPreference.java
@@ -18,15 +18,13 @@ package com.cyanogenmod.trebuchet.preference;
import android.content.Context;
import android.content.res.TypedArray;
-import android.preference.Preference;
import android.preference.DialogPreference;
+import android.preference.Preference;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
-import android.widget.LinearLayout;
import android.widget.NumberPicker;
-
import com.cyanogenmod.trebuchet.R;
/*
diff --git a/src/com/cyanogenmod/trebuchet/preference/Preferences.java b/src/com/cyanogenmod/trebuchet/preference/Preferences.java
index 147308d63..f50852472 100644
--- a/src/com/cyanogenmod/trebuchet/preference/Preferences.java
+++ b/src/com/cyanogenmod/trebuchet/preference/Preferences.java
@@ -21,7 +21,6 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
-
import com.cyanogenmod.trebuchet.R;
public class Preferences extends PreferenceActivity {