Using WidgetCell in the Pin Item confirmation prompt for a consistent UI

Also fixing some platform API changes in PinItemRequestCompat

Bug: 33584624
Change-Id: I255829f0079f1a3967bf8d6a337da12c890eb7ec
This commit is contained in:
Sunny Goyal
2017-01-20 11:54:25 -08:00
parent dbb28b2bf8
commit 65513ba58c
9 changed files with 139 additions and 76 deletions

View File

@@ -23,6 +23,7 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -60,7 +61,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
private static final float PREVIEW_SCALE = 0.8f;
private int mPresetPreviewSize;
int cellSize;
private int mCellSize;
private WidgetImageView mWidgetImage;
private TextView mWidgetName;
@@ -96,8 +97,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
private void setContainerWidth() {
DeviceProfile profile = mActivity.getDeviceProfile();
cellSize = (int) (profile.cellWidthPx * WIDTH_SCALE);
mPresetPreviewSize = (int) (cellSize * PREVIEW_SCALE);
mCellSize = (int) (profile.cellWidthPx * WIDTH_SCALE);
mPresetPreviewSize = (int) (mCellSize * PREVIEW_SCALE);
}
@Override
@@ -200,6 +201,12 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
return "";
}
@Override
public void setLayoutParams(ViewGroup.LayoutParams params) {
params.width = params.height = mCellSize;
super.setLayoutParams(params);
}
@Override
public CharSequence getAccessibilityClassName() {
return WidgetCell.class.getName();