Stop using a several deprecated methods/constants.
- Swap FILL_PARENT with MATCH_PARENT
- Stop using ViewCompat#getOverScrollMode and related constants
- Clean up some unused import statements.
Bug: 30074170
Change-Id: Iaafd5415ee69181cc900a7fa971cdd6f5a20c6ce
diff --git a/api/current.txt b/api/current.txt
index bd59a65..aa64e15 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6398,9 +6398,9 @@
field public static final int MEASURED_SIZE_MASK = 16777215; // 0xffffff
field public static final int MEASURED_STATE_MASK = -16777216; // 0xff000000
field public static final int MEASURED_STATE_TOO_SMALL = 16777216; // 0x1000000
- field public static final int OVER_SCROLL_ALWAYS = 0; // 0x0
- field public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1; // 0x1
- field public static final int OVER_SCROLL_NEVER = 2; // 0x2
+ field public static final deprecated int OVER_SCROLL_ALWAYS = 0; // 0x0
+ field public static final deprecated int OVER_SCROLL_IF_CONTENT_SCROLLS = 1; // 0x1
+ field public static final deprecated int OVER_SCROLL_NEVER = 2; // 0x2
field public static final int SCROLL_AXIS_HORIZONTAL = 1; // 0x1
field public static final int SCROLL_AXIS_NONE = 0; // 0x0
field public static final int SCROLL_AXIS_VERTICAL = 2; // 0x2
diff --git a/compat/java/android/support/v4/view/ViewCompat.java b/compat/java/android/support/v4/view/ViewCompat.java
index a6cdff4..4e14ec0 100644
--- a/compat/java/android/support/v4/view/ViewCompat.java
+++ b/compat/java/android/support/v4/view/ViewCompat.java
@@ -77,18 +77,27 @@
/**
* Always allow a user to over-scroll this view, provided it is a
* view that can scroll.
+ * @deprecated Use {@link View#OVER_SCROLL_ALWAYS} directly. This constant will be removed in
+ * a future release.
*/
+ @Deprecated
public static final int OVER_SCROLL_ALWAYS = 0;
/**
* Allow a user to over-scroll this view only if the content is large
* enough to meaningfully scroll, provided it is a view that can scroll.
+ * @deprecated Use {@link View#OVER_SCROLL_IF_CONTENT_SCROLLS} directly. This constant will be
+ * removed in a future release.
*/
+ @Deprecated
public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1;
/**
* Never allow a user to over-scroll this view.
+ * @deprecated Use {@link View#OVER_SCROLL_NEVER} directly. This constant will be removed in
+ * a future release.
*/
+ @Deprecated
public static final int OVER_SCROLL_NEVER = 2;
private static final long FAKE_FRAME_TIME = 10;
diff --git a/core-ui/java/android/support/v4/view/ViewPager.java b/core-ui/java/android/support/v4/view/ViewPager.java
index d9b484f..14f604f 100644
--- a/core-ui/java/android/support/v4/view/ViewPager.java
+++ b/core-ui/java/android/support/v4/view/ViewPager.java
@@ -1582,13 +1582,13 @@
int heightSize = childHeightSize;
if (lp.width != LayoutParams.WRAP_CONTENT) {
widthMode = MeasureSpec.EXACTLY;
- if (lp.width != LayoutParams.FILL_PARENT) {
+ if (lp.width != LayoutParams.MATCH_PARENT) {
widthSize = lp.width;
}
}
if (lp.height != LayoutParams.WRAP_CONTENT) {
heightMode = MeasureSpec.EXACTLY;
- if (lp.height != LayoutParams.FILL_PARENT) {
+ if (lp.height != LayoutParams.MATCH_PARENT) {
heightSize = lp.height;
}
}
@@ -2406,10 +2406,10 @@
super.draw(canvas);
boolean needsInvalidate = false;
- final int overScrollMode = ViewCompat.getOverScrollMode(this);
- if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS ||
- (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS &&
- mAdapter != null && mAdapter.getCount() > 1)) {
+ final int overScrollMode = getOverScrollMode();
+ if (overScrollMode == View.OVER_SCROLL_ALWAYS
+ || (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS
+ && mAdapter != null && mAdapter.getCount() > 1)) {
if (!mLeftEdge.isFinished()) {
final int restoreCount = canvas.save();
final int height = getHeight() - getPaddingTop() - getPaddingBottom();
@@ -3120,7 +3120,7 @@
int childIndex;
public LayoutParams() {
- super(FILL_PARENT, FILL_PARENT);
+ super(MATCH_PARENT, MATCH_PARENT);
}
public LayoutParams(Context context, AttributeSet attrs) {
diff --git a/core-ui/java/android/support/v4/widget/DrawerLayout.java b/core-ui/java/android/support/v4/widget/DrawerLayout.java
index 452d570..864ea13 100644
--- a/core-ui/java/android/support/v4/widget/DrawerLayout.java
+++ b/core-ui/java/android/support/v4/widget/DrawerLayout.java
@@ -41,7 +41,6 @@
import android.support.v4.view.AbsSavedState;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.GravityCompat;
-import android.support.v4.view.KeyEventCompat;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewGroupCompat;
@@ -1805,7 +1804,7 @@
@Override
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
- return new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+ return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
@Override
diff --git a/core-ui/java/android/support/v4/widget/NestedScrollView.java b/core-ui/java/android/support/v4/widget/NestedScrollView.java
index fb978ae..e6ca0d7 100644
--- a/core-ui/java/android/support/v4/widget/NestedScrollView.java
+++ b/core-ui/java/android/support/v4/widget/NestedScrollView.java
@@ -785,10 +785,9 @@
final int oldY = getScrollY();
final int range = getScrollRange();
- final int overscrollMode = ViewCompat.getOverScrollMode(this);
- boolean canOverscroll = overscrollMode == ViewCompat.OVER_SCROLL_ALWAYS ||
- (overscrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS &&
- range > 0);
+ final int overscrollMode = getOverScrollMode();
+ boolean canOverscroll = overscrollMode == View.OVER_SCROLL_ALWAYS
+ || (overscrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
// Calling overScrollByCompat will call onOverScrolled, which
// calls onScrollChanged if applicable.
@@ -946,15 +945,15 @@
int scrollRangeX, int scrollRangeY,
int maxOverScrollX, int maxOverScrollY,
boolean isTouchEvent) {
- final int overScrollMode = ViewCompat.getOverScrollMode(this);
+ final int overScrollMode = getOverScrollMode();
final boolean canScrollHorizontal =
computeHorizontalScrollRange() > computeHorizontalScrollExtent();
final boolean canScrollVertical =
computeVerticalScrollRange() > computeVerticalScrollExtent();
- final boolean overScrollHorizontal = overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS ||
- (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal);
- final boolean overScrollVertical = overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS ||
- (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollVertical);
+ final boolean overScrollHorizontal = overScrollMode == View.OVER_SCROLL_ALWAYS
+ || (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollHorizontal);
+ final boolean overScrollVertical = overScrollMode == View.OVER_SCROLL_ALWAYS
+ || (overScrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && canScrollVertical);
int newScrollX = scrollX + deltaX;
if (!overScrollHorizontal) {
@@ -1423,9 +1422,9 @@
if (oldX != x || oldY != y) {
final int range = getScrollRange();
- final int overscrollMode = ViewCompat.getOverScrollMode(this);
- final boolean canOverscroll = overscrollMode == ViewCompat.OVER_SCROLL_ALWAYS ||
- (overscrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
+ final int overscrollMode = getOverScrollMode();
+ final boolean canOverscroll = overscrollMode == View.OVER_SCROLL_ALWAYS
+ || (overscrollMode == View.OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
overScrollByCompat(x - oldX, y - oldY, oldX, oldY, 0, range,
0, 0, false);
@@ -1743,7 +1742,7 @@
}
private void ensureGlows() {
- if (ViewCompat.getOverScrollMode(this) != ViewCompat.OVER_SCROLL_NEVER) {
+ if (getOverScrollMode() != View.OVER_SCROLL_NEVER) {
if (mEdgeGlowTop == null) {
Context context = getContext();
mEdgeGlowTop = new EdgeEffectCompat(context);
diff --git a/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java b/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
index 1acdf84..86230a9 100644
--- a/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
+++ b/core-ui/java/android/support/v4/widget/SlidingPaneLayout.java
@@ -533,7 +533,7 @@
if (lp.width == LayoutParams.WRAP_CONTENT) {
childWidthSpec = MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin,
MeasureSpec.AT_MOST);
- } else if (lp.width == LayoutParams.FILL_PARENT) {
+ } else if (lp.width == LayoutParams.MATCH_PARENT) {
childWidthSpec = MeasureSpec.makeMeasureSpec(widthAvailable - horizontalMargin,
MeasureSpec.EXACTLY);
} else {
@@ -543,7 +543,7 @@
int childHeightSpec;
if (lp.height == LayoutParams.WRAP_CONTENT) {
childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.AT_MOST);
- } else if (lp.height == LayoutParams.FILL_PARENT) {
+ } else if (lp.height == LayoutParams.MATCH_PARENT) {
childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight, MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY);
@@ -594,7 +594,7 @@
if (lp.height == LayoutParams.WRAP_CONTENT) {
childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,
MeasureSpec.AT_MOST);
- } else if (lp.height == LayoutParams.FILL_PARENT) {
+ } else if (lp.height == LayoutParams.MATCH_PARENT) {
childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,
MeasureSpec.EXACTLY);
} else {
@@ -616,7 +616,7 @@
if (lp.height == LayoutParams.WRAP_CONTENT) {
childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,
MeasureSpec.AT_MOST);
- } else if (lp.height == LayoutParams.FILL_PARENT) {
+ } else if (lp.height == LayoutParams.MATCH_PARENT) {
childHeightSpec = MeasureSpec.makeMeasureSpec(maxLayoutHeight,
MeasureSpec.EXACTLY);
} else {
@@ -1433,7 +1433,7 @@
Paint dimPaint;
public LayoutParams() {
- super(FILL_PARENT, FILL_PARENT);
+ super(MATCH_PARENT, MATCH_PARENT);
}
public LayoutParams(int width, int height) {
diff --git a/fragment/java/android/support/v4/app/FragmentTabHost.java b/fragment/java/android/support/v4/app/FragmentTabHost.java
index d1931d0..2faf5e9 100644
--- a/fragment/java/android/support/v4/app/FragmentTabHost.java
+++ b/fragment/java/android/support/v4/app/FragmentTabHost.java
@@ -154,14 +154,14 @@
LinearLayout ll = new LinearLayout(context);
ll.setOrientation(LinearLayout.VERTICAL);
addView(ll, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT,
- ViewGroup.LayoutParams.FILL_PARENT));
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
TabWidget tw = new TabWidget(context);
tw.setId(android.R.id.tabs);
tw.setOrientation(TabWidget.HORIZONTAL);
ll.addView(tw, new LinearLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT, 0));
FrameLayout fl = new FrameLayout(context);
@@ -171,7 +171,7 @@
mRealTabContent = fl = new FrameLayout(context);
mRealTabContent.setId(mContainerId);
ll.addView(fl, new LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.FILL_PARENT, 0, 1));
+ LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
}
}
diff --git a/fragment/java/android/support/v4/app/ListFragment.java b/fragment/java/android/support/v4/app/ListFragment.java
index ead7b4a..21617ad 100644
--- a/fragment/java/android/support/v4/app/ListFragment.java
+++ b/fragment/java/android/support/v4/app/ListFragment.java
@@ -108,33 +108,33 @@
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
root.addView(pframe, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
// ------------------------------------------------------------------
FrameLayout lframe = new FrameLayout(context);
lframe.setId(INTERNAL_LIST_CONTAINER_ID);
-
+
TextView tv = new TextView(context);
tv.setId(INTERNAL_EMPTY_ID);
tv.setGravity(Gravity.CENTER);
lframe.addView(tv, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
-
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
ListView lv = new ListView(context);
lv.setId(android.R.id.list);
lv.setDrawSelectorOnTop(false);
lframe.addView(lv, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
root.addView(lframe, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
-
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
// ------------------------------------------------------------------
root.setLayoutParams(new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
-
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+
return root;
}
diff --git a/fragment/java/android/support/v4/app/NoSaveStateFrameLayout.java b/fragment/java/android/support/v4/app/NoSaveStateFrameLayout.java
index d0ebb96..74cb319 100644
--- a/fragment/java/android/support/v4/app/NoSaveStateFrameLayout.java
+++ b/fragment/java/android/support/v4/app/NoSaveStateFrameLayout.java
@@ -35,16 +35,16 @@
wrapper.setLayoutParams(childParams);
}
NoSaveStateFrameLayout.LayoutParams lp = new NoSaveStateFrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
child.setLayoutParams(lp);
wrapper.addView(child);
return wrapper;
}
-
+
public NoSaveStateFrameLayout(Context context) {
super(context);
}
-
+
/**
* Override to prevent freezing of any child views.
*/
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java
index 9e2effe..4a8e3a3 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java
@@ -16,17 +16,13 @@
package com.example.android.supportv4.app;
-import com.example.android.supportv4.app.SendResult;
-import com.example.android.supportv4.R;
-
import android.app.PendingIntent;
+import android.content.Intent;
import android.content.IntentSender;
+import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
-
-import android.content.Intent;
-import android.os.Bundle;
import android.text.Editable;
import android.view.LayoutInflater;
import android.view.View;
@@ -36,14 +32,16 @@
import android.widget.FrameLayout;
import android.widget.TextView;
+import com.example.android.supportv4.R;
+
public class FragmentReceiveResultSupport extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT,
- ViewGroup.LayoutParams.FILL_PARENT);
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT);
FrameLayout frame = new FrameLayout(this);
frame.setId(R.id.simple_fragment);
setContentView(frame, lp);
diff --git a/v13/java/android/support/v13/app/FragmentTabHost.java b/v13/java/android/support/v13/app/FragmentTabHost.java
index e4578b4..c010b4f 100644
--- a/v13/java/android/support/v13/app/FragmentTabHost.java
+++ b/v13/java/android/support/v13/app/FragmentTabHost.java
@@ -16,8 +16,6 @@
package android.support.v13.app;
-import java.util.ArrayList;
-
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
@@ -34,6 +32,8 @@
import android.widget.TabHost;
import android.widget.TabWidget;
+import java.util.ArrayList;
+
/**
* Version of {@link android.support.v4.app.FragmentTabHost} that can be
* used with the platform {@link android.app.Fragment} APIs. You will not
@@ -146,14 +146,14 @@
LinearLayout ll = new LinearLayout(context);
ll.setOrientation(LinearLayout.VERTICAL);
addView(ll, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT,
- ViewGroup.LayoutParams.FILL_PARENT));
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
TabWidget tw = new TabWidget(context);
tw.setId(android.R.id.tabs);
tw.setOrientation(TabWidget.HORIZONTAL);
ll.addView(tw, new LinearLayout.LayoutParams(
- ViewGroup.LayoutParams.FILL_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT, 0));
FrameLayout fl = new FrameLayout(context);
@@ -163,7 +163,7 @@
mRealTabContent = fl = new FrameLayout(context);
mRealTabContent.setId(mContainerId);
ll.addView(fl, new LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.FILL_PARENT, 0, 1));
+ LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
}
}
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteActionProvider.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteActionProvider.java
index afbdc72..79fad1f 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteActionProvider.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteActionProvider.java
@@ -20,8 +20,8 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.ActionProvider;
-import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouteSelector;
+import android.support.v7.media.MediaRouter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -256,7 +256,7 @@
mButton.setDialogFactory(mDialogFactory);
mButton.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.FILL_PARENT));
+ ViewGroup.LayoutParams.MATCH_PARENT));
return mButton;
}
diff --git a/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java b/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
index 3fb69c7..93aca10 100644
--- a/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
+++ b/v7/mediarouter/src/android/support/v7/app/MediaRouteControllerDialog.java
@@ -591,7 +591,7 @@
private void updateLayoutHeightInternal(boolean animate) {
// Measure the size of widgets and get the height of main components.
int oldHeight = getLayoutHeight(mMediaMainControlLayout);
- setLayoutHeight(mMediaMainControlLayout, ViewGroup.LayoutParams.FILL_PARENT);
+ setLayoutHeight(mMediaMainControlLayout, ViewGroup.LayoutParams.MATCH_PARENT);
updateMediaControlVisibility(canShowPlaybackControlLayout());
View decorView = getWindow().getDecorView();
decorView.measure(
diff --git a/v7/recyclerview/src/android/support/v7/widget/GridLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/GridLayoutManager.java
index ee00be3..2c9fcc8 100644
--- a/v7/recyclerview/src/android/support/v7/widget/GridLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/GridLayoutManager.java
@@ -225,9 +225,9 @@
public RecyclerView.LayoutParams generateDefaultLayoutParams() {
if (mOrientation == HORIZONTAL) {
return new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.FILL_PARENT);
+ ViewGroup.LayoutParams.MATCH_PARENT);
} else {
- return new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
+ return new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
@@ -713,7 +713,7 @@
* RecyclerView does not have exact measurement specs.
* <p>
* Here we try to assign a best guess width or height and re-do the layout to update other
- * views that wanted to FILL_PARENT in the non-scroll orientation.
+ * views that wanted to MATCH_PARENT in the non-scroll orientation.
*
* @param maxSizeInOther The maximum size per span ratio from the measurement of the children.
* @param currentOtherDirSize The size before this layout chunk. There is no reason to go below.
diff --git a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
index 931a916..d7fe793 100644
--- a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
+++ b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
@@ -498,7 +498,7 @@
mTouchSlop = vc.getScaledTouchSlop();
mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
- setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER);
+ setWillNotDraw(getOverScrollMode() == View.OVER_SCROLL_NEVER);
mItemAnimator.setListener(mItemAnimatorListener);
initAdapterManager();
@@ -1310,7 +1310,7 @@
}
mItemDecorations.remove(decor);
if (mItemDecorations.isEmpty()) {
- setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER);
+ setWillNotDraw(getOverScrollMode() == View.OVER_SCROLL_NEVER);
}
markItemDecorInsetsDirty();
requestLayout();
@@ -1571,7 +1571,7 @@
}
mNestedOffsets[0] += mScrollOffset[0];
mNestedOffsets[1] += mScrollOffset[1];
- } else if (ViewCompat.getOverScrollMode(this) != ViewCompat.OVER_SCROLL_NEVER) {
+ } else if (getOverScrollMode() != View.OVER_SCROLL_NEVER) {
if (ev != null) {
pullGlows(ev.getX(), unconsumedX, ev.getY(), unconsumedY);
}
@@ -4380,8 +4380,7 @@
if (!mItemDecorations.isEmpty()) {
invalidate();
}
- if (ViewCompat.getOverScrollMode(RecyclerView.this) !=
- ViewCompat.OVER_SCROLL_NEVER) {
+ if (getOverScrollMode() != View.OVER_SCROLL_NEVER) {
considerReleasingGlowsOnScroll(dx, dy);
}
if (overscrollX != 0 || overscrollY != 0) {
@@ -4397,8 +4396,7 @@
velY = overscrollY < 0 ? -vel : overscrollY > 0 ? vel : 0;
}
- if (ViewCompat.getOverScrollMode(RecyclerView.this) !=
- ViewCompat.OVER_SCROLL_NEVER) {
+ if (getOverScrollMode() != View.OVER_SCROLL_NEVER) {
absorbGlows(velX, velY);
}
if ((velX != 0 || overscrollX == x || scroller.getFinalX() == 0) &&
@@ -7820,7 +7818,7 @@
*
* @param parentSize Size of the parent view where the child will be placed
* @param padding Total space currently consumed by other elements of the parent
- * @param childDimension Desired size of the child view, or FILL_PARENT/WRAP_CONTENT.
+ * @param childDimension Desired size of the child view, or MATCH_PARENT/WRAP_CONTENT.
* Generally obtained from the child view's LayoutParams
* @param canScroll true if the parent RecyclerView can scroll in this dimension
*
@@ -7838,7 +7836,7 @@
resultSize = childDimension;
resultMode = MeasureSpec.EXACTLY;
} else {
- // FILL_PARENT can't be applied since we can scroll in this dimension, wrap
+ // MATCH_PARENT can't be applied since we can scroll in this dimension, wrap
// instead using UNSPECIFIED.
resultSize = 0;
resultMode = MeasureSpec.UNSPECIFIED;
@@ -7847,7 +7845,7 @@
if (childDimension >= 0) {
resultSize = childDimension;
resultMode = MeasureSpec.EXACTLY;
- } else if (childDimension == LayoutParams.FILL_PARENT) {
+ } else if (childDimension == LayoutParams.MATCH_PARENT) {
resultSize = size;
// TODO this should be my spec.
resultMode = MeasureSpec.EXACTLY;
@@ -7865,7 +7863,7 @@
* @param parentSize Size of the parent view where the child will be placed
* @param parentMode The measurement spec mode of the parent
* @param padding Total space currently consumed by other elements of parent
- * @param childDimension Desired size of the child view, or FILL_PARENT/WRAP_CONTENT.
+ * @param childDimension Desired size of the child view, or MATCH_PARENT/WRAP_CONTENT.
* Generally obtained from the child view's LayoutParams
* @param canScroll true if the parent RecyclerView can scroll in this dimension
*
@@ -7880,7 +7878,7 @@
resultSize = childDimension;
resultMode = MeasureSpec.EXACTLY;
} else if (canScroll) {
- if (childDimension == LayoutParams.FILL_PARENT){
+ if (childDimension == LayoutParams.MATCH_PARENT){
switch (parentMode) {
case MeasureSpec.AT_MOST:
case MeasureSpec.EXACTLY:
@@ -7897,7 +7895,7 @@
resultMode = MeasureSpec.UNSPECIFIED;
}
} else {
- if (childDimension == LayoutParams.FILL_PARENT) {
+ if (childDimension == LayoutParams.MATCH_PARENT) {
resultSize = size;
resultMode = parentMode;
} else if (childDimension == LayoutParams.WRAP_CONTENT) {
diff --git a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
index 67780a8..380c2ab 100644
--- a/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
+++ b/v7/recyclerview/src/android/support/v7/widget/StaggeredGridLayoutManager.java
@@ -2131,9 +2131,9 @@
public RecyclerView.LayoutParams generateDefaultLayoutParams() {
if (mOrientation == HORIZONTAL) {
return new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
- ViewGroup.LayoutParams.FILL_PARENT);
+ ViewGroup.LayoutParams.MATCH_PARENT);
} else {
- return new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
+ return new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/BaseLinearLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/BaseLinearLayoutManagerTest.java
index 305fa66..d2c4702 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/BaseLinearLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/BaseLinearLayoutManagerTest.java
@@ -15,12 +15,25 @@
*/
package android.support.v7.widget;
+import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
+import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
import android.content.Context;
import android.graphics.Rect;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
+
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -29,17 +42,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
-import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
-import static android.view.ViewGroup.LayoutParams.FILL_PARENT;
-import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import static org.junit.Assert.*;
-
-import static java.util.concurrent.TimeUnit.SECONDS;
-
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-
public class BaseLinearLayoutManagerTest extends BaseRecyclerViewInstrumentationTest {
protected static final boolean DEBUG = false;
@@ -94,8 +96,8 @@
if (config.mWrap) {
mRecyclerView.setLayoutParams(
new ViewGroup.LayoutParams(
- config.mOrientation == HORIZONTAL ? WRAP_CONTENT : FILL_PARENT,
- config.mOrientation == VERTICAL ? WRAP_CONTENT : FILL_PARENT
+ config.mOrientation == HORIZONTAL ? WRAP_CONTENT : MATCH_PARENT,
+ config.mOrientation == VERTICAL ? WRAP_CONTENT : MATCH_PARENT
)
);
}
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java
index b38c551..2b33828 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/GridLayoutManagerTest.java
@@ -16,12 +16,17 @@
package android.support.v7.widget;
-import org.hamcrest.CoreMatchers;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
+import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import android.graphics.Color;
-import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.StateListDrawable;
import android.support.test.runner.AndroidJUnit4;
@@ -34,21 +39,16 @@
import android.view.View;
import android.view.ViewGroup;
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
-import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
-import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
@MediumTest
@RunWith(AndroidJUnit4.class)
public class GridLayoutManagerTest extends BaseGridLayoutManagerTest {
@@ -358,7 +358,7 @@
val = GridLayoutManager.LayoutParams.WRAP_CONTENT;
break;
case 3:
- val = GridLayoutManager.LayoutParams.FILL_PARENT;
+ val = GridLayoutManager.LayoutParams.MATCH_PARENT;
break;
case 4:
val = 200;
@@ -584,10 +584,10 @@
final int maxSize;
if (config.mOrientation == HORIZONTAL) {
maxSize = mRecyclerView.getWidth();
- mlp.height = ViewGroup.MarginLayoutParams.FILL_PARENT;
+ mlp.height = ViewGroup.MarginLayoutParams.MATCH_PARENT;
} else {
maxSize = mRecyclerView.getHeight();
- mlp.width = ViewGroup.MarginLayoutParams.FILL_PARENT;
+ mlp.width = ViewGroup.MarginLayoutParams.MATCH_PARENT;
}
final int desiredSize;
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerBaseConfigSetTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerBaseConfigSetTest.java
index 9ee7958..34600e9 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerBaseConfigSetTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerBaseConfigSetTest.java
@@ -16,27 +16,9 @@
package android.support.v7.widget;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import android.graphics.Rect;
-import android.support.v4.view.ViewCompat;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
import static android.support.v7.widget.LayoutState.LAYOUT_END;
import static android.support.v7.widget.LayoutState.LAYOUT_START;
import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
-import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.is;
@@ -46,8 +28,20 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import static android.view.ViewGroup.LayoutParams.FILL_PARENT;
+import android.graphics.Rect;
+import android.support.v4.view.ViewCompat;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewParent;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
* Tests that rely on the basic configuration and does not do any additions / removals
diff --git a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
index 2d6bee7..1474a0a 100644
--- a/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
+++ b/v7/recyclerview/tests/src/android/support/v7/widget/LinearLayoutManagerTest.java
@@ -16,12 +16,14 @@
package android.support.v7.widget;
-import org.junit.Test;
+import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
+import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
-import android.content.Context;
-import android.graphics.Rect;
-import android.os.Parcel;
-import android.os.Parcelable;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat;
import android.support.v4.view.accessibility.AccessibilityRecordCompat;
@@ -30,22 +32,12 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
-import android.widget.FrameLayout;
-import static android.support.v7.widget.LayoutState.LAYOUT_END;
-import static android.support.v7.widget.LayoutState.LAYOUT_START;
-import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
-import static android.support.v7.widget.LinearLayoutManager.VERTICAL;
-import java.lang.reflect.Field;
+import org.junit.Test;
+
import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import static org.junit.Assert.*;
/**
* Includes tests for {@link LinearLayoutManager}.
@@ -134,10 +126,10 @@
final int maxSize;
if (config.mOrientation == HORIZONTAL) {
maxSize = mRecyclerView.getWidth();
- mlp.height = ViewGroup.MarginLayoutParams.FILL_PARENT;
+ mlp.height = ViewGroup.MarginLayoutParams.MATCH_PARENT;
} else {
maxSize = mRecyclerView.getHeight();
- mlp.width = ViewGroup.MarginLayoutParams.FILL_PARENT;
+ mlp.width = ViewGroup.MarginLayoutParams.MATCH_PARENT;
}
final int desiredSize;