summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-03-24 17:38:42 -0700
committerWinson Chung <winsonc@google.com>2015-03-24 18:02:01 -0700
commit3d9490ab9520ffe3798539ed1626463a7eb6c9e1 (patch)
treed6274e708b843370c168205c87018851655aa45f /src/com
parentd0930655e5670bb40ec70523c1c76ff86fab2538 (diff)
downloadandroid_packages_apps_Trebuchet-3d9490ab9520ffe3798539ed1626463a7eb6c9e1.tar.gz
android_packages_apps_Trebuchet-3d9490ab9520ffe3798539ed1626463a7eb6c9e1.tar.bz2
android_packages_apps_Trebuchet-3d9490ab9520ffe3798539ed1626463a7eb6c9e1.zip
Removing more code with API 21 dependencies.
Change-Id: I16c914334ce0694b84626269ae4bb5e83082c739
Diffstat (limited to 'src/com')
-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;