зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1107636 - Use MarginLayoutParams where applicable. r=sebastian
MarginLayoutParams is less specific than RelativeLayout.LayoutParams and is easier to make changes with. --HG-- extra : commitid : GY5tk9gY1Ji extra : rebase_source : 1cf8940e8d570339fd72f4835033113c48be04d2
This commit is contained in:
Родитель
5a4bcbfd7b
Коммит
3471c9e8c3
|
@ -1378,7 +1378,7 @@ public class BrowserApp extends GeckoApp
|
|||
}
|
||||
|
||||
private void setToolbarMargin(int margin) {
|
||||
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).topMargin = margin;
|
||||
((ViewGroup.MarginLayoutParams) mGeckoLayout.getLayoutParams()).topMargin = margin;
|
||||
mGeckoLayout.requestLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import org.mozilla.gecko.animation.ViewHelper;
|
||||
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
|
@ -19,7 +20,6 @@ import android.util.Log;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
/**
|
||||
* Text selection handles enable a user to change position of selected text in
|
||||
|
@ -57,7 +57,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener {
|
|||
private PointF mGeckoPoint;
|
||||
private PointF mTouchStart;
|
||||
|
||||
private RelativeLayout.LayoutParams mLayoutParams;
|
||||
private ViewGroup.MarginLayoutParams mLayoutParams;
|
||||
|
||||
private static final int IMAGE_LEVEL_LTR = 0;
|
||||
private static final int IMAGE_LEVEL_RTL = 1;
|
||||
|
@ -204,7 +204,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener {
|
|||
|
||||
private void setLayoutPosition() {
|
||||
if (mLayoutParams == null) {
|
||||
mLayoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
|
||||
mLayoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams();
|
||||
// Set negative right/bottom margins so that the handles can be dragged outside of
|
||||
// the content area (if they are dragged to the left/top, the dyanmic margins set
|
||||
// below will take care of that).
|
||||
|
|
|
@ -200,7 +200,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
|||
}
|
||||
|
||||
private boolean moveZoomedView(MotionEvent event) {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) ZoomedView.this.getLayoutParams();
|
||||
final MarginLayoutParams params = (MarginLayoutParams) ZoomedView.this.getLayoutParams();
|
||||
if ((!dragged) && (Math.abs((int) (event.getRawX() - originRawX)) < PanZoomController.CLICK_THRESHOLD)
|
||||
&& (Math.abs((int) (event.getRawY() - originRawY)) < PanZoomController.CLICK_THRESHOLD)) {
|
||||
// When the user just touches the screen ACTION_MOVE can be detected for a very small delta on position.
|
||||
|
@ -315,7 +315,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
|||
ImmutableViewportMetrics metrics = layerView.getViewportMetrics();
|
||||
final float parentWidth = metrics.getWidth();
|
||||
final float parentHeight = metrics.getHeight();
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
|
||||
final MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
|
||||
|
||||
// The number of unzoomed content pixels that can be displayed in the
|
||||
// zoomed area.
|
||||
|
@ -382,7 +382,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
|||
|
||||
private void moveZoomedView(ImmutableViewportMetrics metrics, float newLeftMargin, float newTopMargin,
|
||||
StartPointUpdate animateStartPoint) {
|
||||
RelativeLayout.LayoutParams newLayoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
|
||||
final MarginLayoutParams newLayoutParams = (MarginLayoutParams) getLayoutParams();
|
||||
newLayoutParams.leftMargin = (int) newLeftMargin;
|
||||
newLayoutParams.topMargin = (int) newTopMargin;
|
||||
int topMarginMin = (int)(layerView.getSurfaceTranslation() + dynamicToolbarOverlap);
|
||||
|
@ -478,7 +478,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
|||
return;
|
||||
}
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
|
||||
final MarginLayoutParams params = (MarginLayoutParams) getLayoutParams();
|
||||
setCapturedSize(viewport);
|
||||
moveZoomedView(viewport, params.leftMargin, params.topMargin, StartPointUpdate.NO_CHANGE);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче