summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-09-14 21:47:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-09-14 21:47:02 +0000
commit00e827c70cb4213ee05140157006a37d12662448 (patch)
tree791e8a024420d9fc398174c0a56fc1722d4c771c /src/com/android/launcher3/widget
parentc0d915deae318c4c30a55e001b01619203ad677d (diff)
parent5fcaab43e603ceabd1d71ec355c8a0b59aac8cf0 (diff)
downloadandroid_packages_apps_Trebuchet-00e827c70cb4213ee05140157006a37d12662448.tar.gz
android_packages_apps_Trebuchet-00e827c70cb4213ee05140157006a37d12662448.tar.bz2
android_packages_apps_Trebuchet-00e827c70cb4213ee05140157006a37d12662448.zip
am 5fcaab43: am ea9ad5ce: Merge remote-tracking branch \'origin/ub-launcher3-burnaby\' into mnc-dev
* commit '5fcaab43e603ceabd1d71ec355c8a0b59aac8cf0': (76 commits) Restoring provider behavior for reloading app on old devices > For older devices, launcher will only reload in case of inserts with specific query parameters > For older devices, launcehr will notify content observers of any internal inserts > Chaning TAG for Launcher provider as max logging tag is only 23 characters Removing items which are on invalid screen Preventing null pointer crash when opening a folder Revert workaround for move to default screen on home intent. Fixing NPE in recycler view scroll bar. Adding workaround for regression caused by ag/752175 Adding gradle script for Android Studio Override the overscroll color for the widget rows. Adding graphic for all apps empty search screen. Using GET_UNINSTALLED_PACKAGES flag when getting packageInfo for a managed profile app Revert "Adding viewId for the QSB" Adding viewId for the QSB Fixing issue with missing scroll bar after fast-scrolling and searching. Fixing an issue where you would inadvertently start fastscrolling. Pending bind callbacks should be cleared before starting the loader, similar to startBinding Fixing widgets container inactive scroll bar color. Making the detached scrollbar catch up faster to the actual scroll position. Updating theme to use the light theme by default, instead of wallpaper theme > This allows us to use all the goodness of material theme > Cursor in folder edit text is no longer 1px wide Updating the target sdk to launcher Using the usermanager api to get creation time ...
Diffstat (limited to 'src/com/android/launcher3/widget')
-rw-r--r--src/com/android/launcher3/widget/PendingAddWidgetInfo.java16
-rw-r--r--src/com/android/launcher3/widget/WidgetCell.java4
-rw-r--r--src/com/android/launcher3/widget/WidgetHostViewLoader.java3
-rw-r--r--src/com/android/launcher3/widget/WidgetsContainerView.java1
-rw-r--r--src/com/android/launcher3/widget/WidgetsListAdapter.java5
-rw-r--r--src/com/android/launcher3/widget/WidgetsRecyclerView.java36
6 files changed, 35 insertions, 30 deletions
diff --git a/src/com/android/launcher3/widget/PendingAddWidgetInfo.java b/src/com/android/launcher3/widget/PendingAddWidgetInfo.java
index 758287af3..fcb714ff1 100644
--- a/src/com/android/launcher3/widget/PendingAddWidgetInfo.java
+++ b/src/com/android/launcher3/widget/PendingAddWidgetInfo.java
@@ -31,10 +31,6 @@ import com.android.launcher3.compat.AppWidgetManagerCompat;
* @see {@link PendingAddItemInfo}
*/
public class PendingAddWidgetInfo extends PendingAddItemInfo {
- public int minWidth;
- public int minHeight;
- public int minResizeWidth;
- public int minResizeHeight;
public int previewImage;
public int icon;
public LauncherAppWidgetProviderInfo info;
@@ -50,17 +46,13 @@ public class PendingAddWidgetInfo extends PendingAddItemInfo {
this.info = i;
user = AppWidgetManagerCompat.getInstance(launcher).getUser(i);
componentName = i.provider;
- minWidth = i.minWidth;
- minHeight = i.minHeight;
- minResizeWidth = i.minResizeWidth;
- minResizeHeight = i.minResizeHeight;
previewImage = i.previewImage;
icon = i.icon;
- spanX = i.getSpanX(launcher);
- spanY = i.getSpanY(launcher);
- minSpanX = i.getMinSpanX(launcher);
- minSpanY = i.getMinSpanY(launcher);
+ spanX = i.spanX;
+ spanY = i.spanY;
+ minSpanX = i.minSpanX;
+ minSpanY = i.minSpanY;
}
public boolean isCustomWidget() {
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index 7496ea2ef..94bbd929f 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -146,8 +146,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
mInfo = info;
// TODO(hyunyoungs): setup a cache for these labels.
mWidgetName.setText(AppWidgetManagerCompat.getInstance(getContext()).loadLabel(info));
- int hSpan = Math.min(info.getSpanX(mLauncher), profile.numColumns);
- int vSpan = Math.min(info.getSpanY(mLauncher), profile.numRows);
+ int hSpan = Math.min(info.spanX, profile.numColumns);
+ int vSpan = Math.min(info.spanY, profile.numRows);
mWidgetDims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
mWidgetPreviewLoader = loader;
}
diff --git a/src/com/android/launcher3/widget/WidgetHostViewLoader.java b/src/com/android/launcher3/widget/WidgetHostViewLoader.java
index 30b3d581a..461aebb6b 100644
--- a/src/com/android/launcher3/widget/WidgetHostViewLoader.java
+++ b/src/com/android/launcher3/widget/WidgetHostViewLoader.java
@@ -15,6 +15,7 @@ import com.android.launcher3.DragLayer;
import com.android.launcher3.DragSource;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppWidgetProviderInfo;
+import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.util.Thunk;
@@ -131,7 +132,7 @@ public class WidgetHostViewLoader implements DragListener {
public static Bundle getDefaultOptionsForWidget(Launcher launcher, PendingAddWidgetInfo info) {
Bundle options = null;
Rect rect = new Rect();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ if (Utilities.ATLEAST_JB_MR1) {
AppWidgetResizeFrame.getWidgetSizeRanges(launcher, info.spanX, info.spanY, rect);
Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(launcher,
info.componentName, null);
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index 5afd7c493..0c6ea31bb 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -319,7 +319,6 @@ public class WidgetsContainerView extends BaseContainerView
CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen);
ItemInfo itemInfo = (ItemInfo) d.dragInfo;
if (layout != null) {
- layout.calculateSpans(itemInfo);
showOutOfSpaceMessage =
!layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY);
}
diff --git a/src/com/android/launcher3/widget/WidgetsListAdapter.java b/src/com/android/launcher3/widget/WidgetsListAdapter.java
index d2ea25230..f1cde299d 100644
--- a/src/com/android/launcher3/widget/WidgetsListAdapter.java
+++ b/src/com/android/launcher3/widget/WidgetsListAdapter.java
@@ -87,6 +87,9 @@ public class WidgetsListAdapter extends Adapter<WidgetsRowViewHolder> {
@Override
public int getItemCount() {
+ if (mWidgetsModel == null) {
+ return 0;
+ }
return mWidgetsModel.getPackageSize();
}
@@ -166,7 +169,7 @@ public class WidgetsListAdapter extends Adapter<WidgetsRowViewHolder> {
// if the end padding is 0, then container view (horizontal scroll view) doesn't respect
// the end of the linear layout width + the start padding and doesn't allow scrolling.
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ if (Utilities.ATLEAST_JB_MR1) {
cellList.setPaddingRelative(mIndent, 0, 1, 0);
} else {
cellList.setPadding(mIndent, 0, 1, 0);
diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
index 61e63cdb7..884bdc418 100644
--- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java
+++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
@@ -64,10 +64,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
return Color.WHITE;
}
- public int getFastScrollerThumbInactiveColor(int defaultInactiveThumbColor) {
- return getResources().getColor(R.color.widgets_view_fastscroll_thumb_inactive_color);
- }
-
/**
* Sets the widget model in this view, used to determine the fast scroll position.
*/
@@ -92,6 +88,12 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
*/
@Override
public String scrollToPositionAtProgress(float touchFraction) {
+ // Skip early if widgets are not bound.
+ if (mWidgets == null) {
+ return "";
+ }
+
+ // Skip early if there are no widgets.
int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
return "";
@@ -102,7 +104,7 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
getCurScrollState(mScrollPosState);
float pos = rowCount * touchFraction;
- int availableScrollHeight = getAvailableScrollHeight(rowCount, mScrollPosState.rowHeight, 0);
+ int availableScrollHeight = getAvailableScrollHeight(rowCount, mScrollPosState.rowHeight);
LinearLayoutManager layoutManager = ((LinearLayoutManager) getLayoutManager());
layoutManager.scrollToPositionWithOffset(0, (int) -(availableScrollHeight * touchFraction));
@@ -115,36 +117,44 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
* Updates the bounds for the scrollbar.
*/
@Override
- public void onUpdateScrollbar() {
- int rowCount = mWidgets.getPackageSize();
+ public void onUpdateScrollbar(int dy) {
+ // Skip early if widgets are not bound.
+ if (mWidgets == null) {
+ return;
+ }
- // Skip early if, there are no items.
+ // Skip early if there are no widgets.
+ int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
- mScrollbar.setScrollbarThumbOffset(-1, -1);
+ mScrollbar.setThumbOffset(-1, -1);
return;
}
// Skip early if, there no child laid out in the container.
getCurScrollState(mScrollPosState);
if (mScrollPosState.rowIndex < 0) {
- mScrollbar.setScrollbarThumbOffset(-1, -1);
+ mScrollbar.setThumbOffset(-1, -1);
return;
}
- synchronizeScrollBarThumbOffsetToViewScroll(mScrollPosState, rowCount, 0);
+ synchronizeScrollBarThumbOffsetToViewScroll(mScrollPosState, rowCount);
}
/**
* Returns the current scroll state.
*/
- private void getCurScrollState(ScrollPositionState stateOut) {
+ protected void getCurScrollState(ScrollPositionState stateOut) {
stateOut.rowIndex = -1;
stateOut.rowTopOffset = -1;
stateOut.rowHeight = -1;
- int rowCount = mWidgets.getPackageSize();
+ // Skip early if widgets are not bound.
+ if (mWidgets == null) {
+ return;
+ }
// Return early if there are no items
+ int rowCount = mWidgets.getPackageSize();
if (rowCount == 0) {
return;
}