summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-03-25 01:12:41 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-25 01:12:41 +0000
commitbdddea24a2353a395ca3103bf1af6315c511b538 (patch)
treedd7b2ba02247262e9a0337ece3df170838592dbe
parent7aef07f92b440fe1145c082a7e88fe377f7d9be7 (diff)
parent28f4188bacad6a1e72cbed04ff3af1597d234cad (diff)
downloadandroid_packages_apps_Trebuchet-bdddea24a2353a395ca3103bf1af6315c511b538.tar.gz
android_packages_apps_Trebuchet-bdddea24a2353a395ca3103bf1af6315c511b538.tar.bz2
android_packages_apps_Trebuchet-bdddea24a2353a395ca3103bf1af6315c511b538.zip
am 28f4188b: Merge "Removing more code with API 21 dependencies." into ub-launcher3-burnaby
* commit '28f4188bacad6a1e72cbed04ff3af1597d234cad': Removing more code with API 21 dependencies.
-rw-r--r--src/com/android/launcher3/AppsContainerRecyclerView.java4
-rw-r--r--src/com/android/launcher3/CellLayout.java35
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetProviderInfo.java2
-rw-r--r--src/com/android/launcher3/LauncherStateTransitionAnimation.java6
-rw-r--r--src/com/android/launcher3/WidgetsContainerView.java6
-rw-r--r--src/com/android/launcher3/Workspace.java4
7 files changed, 40 insertions, 21 deletions
diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java
index 4d6b9d412..0cc651417 100644
--- a/src/com/android/launcher3/AppsContainerRecyclerView.java
+++ b/src/com/android/launcher3/AppsContainerRecyclerView.java
@@ -77,8 +77,8 @@ public class AppsContainerRecyclerView extends RecyclerView
Resources res = context.getResources();
int fastScrollerSize = res.getDimensionPixelSize(R.dimen.apps_view_fast_scroll_popup_size);
- mScrollbar = context.getDrawable(R.drawable.apps_list_scrollbar_thumb);
- mFastScrollerBg = context.getDrawable(R.drawable.apps_list_fastscroll_bg);
+ mScrollbar = res.getDrawable(R.drawable.apps_list_scrollbar_thumb);
+ mFastScrollerBg = res.getDrawable(R.drawable.apps_list_fastscroll_bg);
mFastScrollerBg.setBounds(0, 0, fastScrollerSize, fastScrollerSize);
mFastScrollTextPaint = new Paint();
mFastScrollTextPaint.setColor(Color.WHITE);
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index eb2aa547d..63afa3091 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -417,10 +417,13 @@ public class CellLayout extends ViewGroup {
protected int intersectsValidDropTarget(int id) {
LauncherAccessibilityDelegate delegate =
LauncherAppState.getInstance().getAccessibilityDelegate();
- LauncherAccessibilityDelegate.DragInfo dragInfo = delegate.getDragInfo();
+ if (delegate == null) {
+ return -1;
+ }
int y = id % mCountY;
int x = id / mCountY;
+ LauncherAccessibilityDelegate.DragInfo dragInfo = delegate.getDragInfo();
if (dragInfo.dragType == DragType.WIDGET) {
// For a widget, every cell must be vacant. In addition, we will return any valid
@@ -489,10 +492,15 @@ public class CellLayout extends ViewGroup {
@Override
protected boolean onPerformActionForVirtualView(int viewId, int action, Bundle args) {
+ LauncherAccessibilityDelegate delegate =
+ LauncherAppState.getInstance().getAccessibilityDelegate();
+ if (delegate == null) {
+ return false;
+ }
+
if (action == AccessibilityNodeInfoCompat.ACTION_CLICK) {
String confirmation = getConfirmationForIconDrop(viewId);
- LauncherAppState.getInstance().getAccessibilityDelegate()
- .handleAccessibleDrop(CellLayout.this, getItemBounds(viewId), confirmation);
+ delegate.handleAccessibleDrop(CellLayout.this, getItemBounds(viewId), confirmation);
return true;
}
return false;
@@ -500,11 +508,16 @@ public class CellLayout extends ViewGroup {
@Override
public void onClick(View arg0) {
+ LauncherAccessibilityDelegate delegate =
+ LauncherAppState.getInstance().getAccessibilityDelegate();
+ if (delegate == null) {
+ return;
+ }
+
int viewId = getViewIdAt(mDownX, mDownY);
String confirmation = getConfirmationForIconDrop(viewId);
- LauncherAppState.getInstance().getAccessibilityDelegate()
- .handleAccessibleDrop(CellLayout.this, getItemBounds(viewId), confirmation);
+ delegate.handleAccessibleDrop(CellLayout.this, getItemBounds(viewId), confirmation);
}
@Override
@@ -533,10 +546,13 @@ public class CellLayout extends ViewGroup {
private String getLocationDescriptionForIconDrop(int id) {
LauncherAccessibilityDelegate delegate =
LauncherAppState.getInstance().getAccessibilityDelegate();
- LauncherAccessibilityDelegate.DragInfo dragInfo = delegate.getDragInfo();
+ if (delegate == null) {
+ return "";
+ }
int y = id % mCountY;
int x = id / mCountY;
+ LauncherAccessibilityDelegate.DragInfo dragInfo = delegate.getDragInfo();
Resources res = getContext().getResources();
View child = getChildAt(x, y);
@@ -555,11 +571,14 @@ public class CellLayout extends ViewGroup {
private String getConfirmationForIconDrop(int id) {
LauncherAccessibilityDelegate delegate =
- LauncherAppState.getInstance().getAccessibilityDelegate();
- LauncherAccessibilityDelegate.DragInfo dragInfo = delegate.getDragInfo();
+ LauncherAppState.getInstance().getAccessibilityDelegate();
+ if (delegate == null) {
+ return "";
+ }
int y = id % mCountY;
int x = id / mCountY;
+ LauncherAccessibilityDelegate.DragInfo dragInfo = delegate.getDragInfo();
Resources res = getContext().getResources();
View child = getChildAt(x, y);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 58c4cf7c2..4c5bba9e3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2448,7 +2448,9 @@ public class Launcher extends Activity
return;
}
- if (LauncherAppState.getInstance().getAccessibilityDelegate().onBackPressed()) {
+ LauncherAccessibilityDelegate delegate =
+ LauncherAppState.getInstance().getAccessibilityDelegate();
+ if (delegate != null && delegate.onBackPressed()) {
return;
}
diff --git a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
index e7f49b2ce..aeef0daeb 100644
--- a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
@@ -7,8 +7,6 @@ import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
-import java.lang.reflect.Field;
-
/**
* This class is a thin wrapper around the framework AppWidgetProviderInfo class. This class affords
* a common object for describing both framework provided AppWidgets as well as custom widgets
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index 4a0aaf3f4..eacf3415e 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -186,7 +186,8 @@ public class LauncherStateTransitionAnimation {
View allAppsButtonView) {
// Hide the real page background, and swap in the fake one
((AppsCustomizePagedView) contentView).setPageBackgroundsVisible(false);
- revealView.setBackground(mLauncher.getDrawable(R.drawable.quantum_panel_dark));
+ revealView.setBackground(
+ mLauncher.getResources().getDrawable(R.drawable.quantum_panel_dark));
}
@Override
public void onAnimationComplete(View revealView, View contentView, View allAppsButtonView) {
@@ -508,7 +509,8 @@ public class LauncherStateTransitionAnimation {
// Hide the real page background, and swap in the fake one
pagedView.stopScrolling();
pagedView.setPageBackgroundsVisible(false);
- revealView.setBackground(mLauncher.getDrawable(R.drawable.quantum_panel_dark));
+ revealView.setBackground(
+ mLauncher.getResources().getDrawable(R.drawable.quantum_panel_dark));
// Hide the side pages of the Widget tray to avoid some ugly edge cases
final View currentPage = pagedView.getPageAt(pagedView.getNextPage());
diff --git a/src/com/android/launcher3/WidgetsContainerView.java b/src/com/android/launcher3/WidgetsContainerView.java
index d0dd733a6..7004d8b29 100644
--- a/src/com/android/launcher3/WidgetsContainerView.java
+++ b/src/com/android/launcher3/WidgetsContainerView.java
@@ -75,11 +75,7 @@ public class WidgetsContainerView extends FrameLayout {
}
public WidgetsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public WidgetsContainerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
+ super(context, attrs, defStyleAttr);
}
@Override
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 7d6f59b45..92e01324f 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -576,7 +576,9 @@ public class Workspace extends SmoothPagedView
mScreenOrder.add(insertIndex, screenId);
addView(newScreen, insertIndex);
- if (LauncherAppState.getInstance().getAccessibilityDelegate().isInAccessibleDrag()) {
+ LauncherAccessibilityDelegate delegate =
+ LauncherAppState.getInstance().getAccessibilityDelegate();
+ if (delegate != null && delegate.isInAccessibleDrag()) {
newScreen.enableAccessibleDrag(true);
}
return screenId;