Merge "Removing more code with API 21 dependencies." into ub-launcher3-burnaby

This commit is contained in:
Winson Chung
2015-03-25 01:06:43 +00:00
committed by Android (Google) Code Review
7 changed files with 40 additions and 21 deletions
@@ -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);
+27 -8
View File
@@ -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);
+3 -1
View File
@@ -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;
}
@@ -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
@@ -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());
@@ -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
+3 -1
View File
@@ -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;