summaryrefslogtreecommitdiff
path: root/core/java/android/widget/GridView.java
diff options
context:
space:
mode:
authorAurimas Liutikas <aurimas@google.com>2016-10-11 16:48:32 -0700
committerAurimas Liutikas <aurimas@google.com>2016-10-11 17:00:17 -0700
commit99441c5d7da45c10b729185852be97cbb0bdc8d5 (patch)
treedfb0c7abbc7e1cb625f9434ef6d8289f041d5b33 /core/java/android/widget/GridView.java
parent97a6a0a11402bb83303aa8eada7a1b1abe490848 (diff)
Fix import statements in android.widget package.
Additionally this CL removes spaces at the end of the line. Test: code still compiles. Change-Id: I1ce98b4e70aa3ae614f87966c3bc6181fa4389a4
Diffstat (limited to 'core/java/android/widget/GridView.java')
-rw-r--r--core/java/android/widget/GridView.java154
1 files changed, 77 insertions, 77 deletions
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index b95aa52c11e9..20543fb9ae8a 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -36,9 +36,9 @@ import android.view.ViewHierarchyEncoder;
import android.view.ViewRootImpl;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
-import android.view.accessibility.AccessibilityNodeProvider;
import android.view.accessibility.AccessibilityNodeInfo.CollectionInfo;
import android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo;
+import android.view.accessibility.AccessibilityNodeProvider;
import android.view.animation.GridLayoutAnimationController;
import android.widget.RemoteViews.RemoteView;
@@ -54,7 +54,7 @@ import java.lang.annotation.RetentionPolicy;
*
* <p>See the <a href="{@docRoot}guide/topics/ui/layout/gridview.html">Grid
* View</a> guide.</p>
- *
+ *
* @attr ref android.R.styleable#GridView_horizontalSpacing
* @attr ref android.R.styleable#GridView_verticalSpacing
* @attr ref android.R.styleable#GridView_stretchMode
@@ -71,33 +71,33 @@ public class GridView extends AbsListView {
/**
* Disables stretching.
- *
- * @see #setStretchMode(int)
+ *
+ * @see #setStretchMode(int)
*/
public static final int NO_STRETCH = 0;
/**
* Stretches the spacing between columns.
- *
- * @see #setStretchMode(int)
+ *
+ * @see #setStretchMode(int)
*/
public static final int STRETCH_SPACING = 1;
/**
* Stretches columns.
- *
- * @see #setStretchMode(int)
+ *
+ * @see #setStretchMode(int)
*/
public static final int STRETCH_COLUMN_WIDTH = 2;
/**
* Stretches the spacing between columns. The spacing is uniform.
- *
- * @see #setStretchMode(int)
+ *
+ * @see #setStretchMode(int)
*/
public static final int STRETCH_SPACING_UNIFORM = 3;
/**
* Creates as many columns as can fit on screen.
- *
- * @see #setNumColumns(int)
+ *
+ * @see #setNumColumns(int)
*/
public static final int AUTO_FIT = -1;
@@ -161,7 +161,7 @@ public class GridView extends AbsListView {
if (index >= 0) {
setGravity(index);
}
-
+
a.recycle();
}
@@ -192,7 +192,7 @@ public class GridView extends AbsListView {
}
resetList();
- mRecycler.clear();
+ mRecycler.clear();
mAdapter = adapter;
mOldSelectedPosition = INVALID_POSITION;
@@ -222,7 +222,7 @@ public class GridView extends AbsListView {
setNextSelectedPositionInt(position);
checkSelectionChanged();
} else {
- checkFocus();
+ checkFocus();
// Nothing selected
checkSelectionChanged();
}
@@ -376,7 +376,7 @@ public class GridView extends AbsListView {
}
mReferenceView = child;
-
+
if (selectedView != null) {
mReferenceViewInSelectedRow = mReferenceView;
}
@@ -515,7 +515,7 @@ public class GridView extends AbsListView {
offsetChildrenTopAndBottom(offset);
}
}
- }
+ }
@Override
int findMotionRow(int y) {
@@ -624,7 +624,7 @@ public class GridView extends AbsListView {
// This is how far the bottom edge of the last view is from the bottom of the
// drawable area
- int bottomOffset = end - lastBottom;
+ int bottomOffset = end - lastBottom;
final View firstChild = getChildAt(0);
final int firstTop = firstChild.getTop();
@@ -636,7 +636,7 @@ public class GridView extends AbsListView {
// Don't pull the top too far down
bottomOffset = Math.min(bottomOffset, mListPadding.top - firstTop);
}
-
+
// Move everything down
offsetChildrenTopAndBottom(bottomOffset);
if (mFirstPosition > 0) {
@@ -679,7 +679,7 @@ public class GridView extends AbsListView {
// Don't pull the bottom too far up
topOffset = Math.min(topOffset, lastBottom - end);
}
-
+
// Move everything up
offsetChildrenTopAndBottom(-topOffset);
if (lastPosition < mItemCount - 1) {
@@ -965,7 +965,7 @@ public class GridView extends AbsListView {
final int stretchMode = mStretchMode;
final int requestedColumnWidth = mRequestedColumnWidth;
boolean didNotInitiallyFit = false;
-
+
if (mRequestedNumColumns == AUTO_FIT) {
if (requestedColumnWidth > 0) {
// Client told us to pick the number of columns
@@ -979,57 +979,57 @@ public class GridView extends AbsListView {
// We picked the columns
mNumColumns = mRequestedNumColumns;
}
-
+
if (mNumColumns <= 0) {
mNumColumns = 1;
}
switch (stretchMode) {
- case NO_STRETCH:
- // Nobody stretches
- mColumnWidth = requestedColumnWidth;
- mHorizontalSpacing = requestedHorizontalSpacing;
- break;
-
- default:
- int spaceLeftOver = availableSpace - (mNumColumns * requestedColumnWidth) -
- ((mNumColumns - 1) * requestedHorizontalSpacing);
-
- if (spaceLeftOver < 0) {
- didNotInitiallyFit = true;
- }
-
- switch (stretchMode) {
- case STRETCH_COLUMN_WIDTH:
- // Stretch the columns
- mColumnWidth = requestedColumnWidth + spaceLeftOver / mNumColumns;
+ case NO_STRETCH:
+ // Nobody stretches
+ mColumnWidth = requestedColumnWidth;
mHorizontalSpacing = requestedHorizontalSpacing;
break;
- case STRETCH_SPACING:
- // Stretch the spacing between columns
- mColumnWidth = requestedColumnWidth;
- if (mNumColumns > 1) {
- mHorizontalSpacing = requestedHorizontalSpacing +
- spaceLeftOver / (mNumColumns - 1);
- } else {
- mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;
+ default:
+ int spaceLeftOver = availableSpace - (mNumColumns * requestedColumnWidth)
+ - ((mNumColumns - 1) * requestedHorizontalSpacing);
+
+ if (spaceLeftOver < 0) {
+ didNotInitiallyFit = true;
}
- break;
- case STRETCH_SPACING_UNIFORM:
- // Stretch the spacing between columns
- mColumnWidth = requestedColumnWidth;
- if (mNumColumns > 1) {
- mHorizontalSpacing = requestedHorizontalSpacing +
- spaceLeftOver / (mNumColumns + 1);
- } else {
- mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;
+ switch (stretchMode) {
+ case STRETCH_COLUMN_WIDTH:
+ // Stretch the columns
+ mColumnWidth = requestedColumnWidth + spaceLeftOver / mNumColumns;
+ mHorizontalSpacing = requestedHorizontalSpacing;
+ break;
+
+ case STRETCH_SPACING:
+ // Stretch the spacing between columns
+ mColumnWidth = requestedColumnWidth;
+ if (mNumColumns > 1) {
+ mHorizontalSpacing = requestedHorizontalSpacing
+ + spaceLeftOver / (mNumColumns - 1);
+ } else {
+ mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;
+ }
+ break;
+
+ case STRETCH_SPACING_UNIFORM:
+ // Stretch the spacing between columns
+ mColumnWidth = requestedColumnWidth;
+ if (mNumColumns > 1) {
+ mHorizontalSpacing = requestedHorizontalSpacing
+ + spaceLeftOver / (mNumColumns + 1);
+ } else {
+ mHorizontalSpacing = requestedHorizontalSpacing + spaceLeftOver;
+ }
+ break;
}
- break;
- }
- break;
+ break;
}
return didNotInitiallyFit;
}
@@ -1052,7 +1052,7 @@ public class GridView extends AbsListView {
}
widthSize += getVerticalScrollbarWidth();
}
-
+
int childWidth = widthSize - mListPadding.left - mListPadding.right;
boolean didNotInitiallyFit = determineColumns(childWidth);
@@ -1087,7 +1087,7 @@ public class GridView extends AbsListView {
mRecycler.addScrapView(child, -1);
}
}
-
+
if (heightMode == MeasureSpec.UNSPECIFIED) {
heightSize = mListPadding.top + mListPadding.bottom + childHeight +
getVerticalFadingEdgeLength() * 2;
@@ -1095,7 +1095,7 @@ public class GridView extends AbsListView {
if (heightMode == MeasureSpec.AT_MOST) {
int ourSize = mListPadding.top + mListPadding.bottom;
-
+
final int numColumns = mNumColumns;
for (int i = 0; i < count; i += numColumns) {
ourSize += childHeight;
@@ -1574,9 +1574,9 @@ public class GridView extends AbsListView {
/**
* Sets the currently selected item
- *
+ *
* @param position Index (starting at 0) of the data item to be selected.
- *
+ *
* If in touch mode, the item will not be selected but it will still be positioned
* appropriately.
*/
@@ -1609,8 +1609,8 @@ public class GridView extends AbsListView {
setNextSelectedPositionInt(position);
layoutChildren();
-
- final int next = mStackFromBottom ? mItemCount - 1 - mNextSelectedPosition :
+
+ final int next = mStackFromBottom ? mItemCount - 1 - mNextSelectedPosition :
mNextSelectedPosition;
final int previous = mStackFromBottom ? mItemCount - 1
- previousSelectedPosition : previousSelectedPosition;
@@ -1802,7 +1802,7 @@ public class GridView extends AbsListView {
invokeOnItemScrollListener();
moved = true;
}
-
+
if (moved) {
awakenScrollBars();
}
@@ -1874,7 +1874,7 @@ public class GridView extends AbsListView {
if (moved) {
awakenScrollBars();
}
-
+
return moved;
}
@@ -2216,17 +2216,17 @@ public class GridView extends AbsListView {
requestLayoutIfNecessary();
}
}
-
+
/**
- * Get the number of columns in the grid.
+ * Get the number of columns in the grid.
* Returns {@link #AUTO_FIT} if the Grid has never been laid out.
*
* @attr ref android.R.styleable#GridView_numColumns
- *
+ *
* @see #setNumColumns(int)
*/
@ViewDebug.ExportedProperty
- public int getNumColumns() {
+ public int getNumColumns() {
return mNumColumns;
}
@@ -2259,13 +2259,13 @@ public class GridView extends AbsListView {
// we are too high, slide all views down to align with bottom
child = getChildAt(childCount - 1);
delta = child.getBottom() - (getHeight() - mListPadding.bottom);
-
+
if (mFirstPosition + childCount < mItemCount) {
// It's OK to have some space below the last item if it is
// part of the vertical spacing
delta += mVerticalSpacing;
}
-
+
if (delta > 0) {
// We only are looking to see if we are too high, not too low
delta = 0;
@@ -2277,14 +2277,14 @@ public class GridView extends AbsListView {
}
}
}
-
+
@Override
protected int computeVerticalScrollExtent() {
final int count = getChildCount();
if (count > 0) {
final int numColumns = mNumColumns;
final int rowCount = (count + numColumns - 1) / numColumns;
-
+
int extent = rowCount * 100;
View view = getChildAt(0);