Removing tabWidth calculation and using DeviceProfile directly
This removes some dependency on FloatingHeaderView, making it
easier to replace
Bug: 234008165
Test: Verified that the UI does not change
Change-Id: I363c98c23f84fe570ea9cb1a40128359f5b67c9f
Merged-In: I363c98c23f84fe570ea9cb1a40128359f5b67c9f
(cherry picked from commit 42b640404a)
Merged-In: I363c98c23f84fe570ea9cb1a40128359f5b67c9f
This commit is contained in:
committed by
Android Build Coastguard Worker
parent
86a6cb0694
commit
b2b614e169
@@ -24,7 +24,6 @@ import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.MarginLayoutParams;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.Button;
|
||||
|
||||
@@ -54,7 +53,6 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
private boolean mWorkEnabled;
|
||||
private boolean mOnWorkTab;
|
||||
|
||||
|
||||
public WorkModeSwitch(Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
@@ -90,7 +88,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
@Override
|
||||
public void setInsets(Rect insets) {
|
||||
mInsets.set(insets);
|
||||
ViewGroup.MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
|
||||
MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
|
||||
if (lp != null) {
|
||||
int bottomMargin = getResources().getDimensionPixelSize(R.dimen.work_fab_margin_bottom);
|
||||
if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) {
|
||||
@@ -99,6 +97,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
}
|
||||
|
||||
DeviceProfile dp = ActivityContext.lookupContext(getContext()).getDeviceProfile();
|
||||
lp.rightMargin = lp.leftMargin = dp.allAppsLeftRightPadding;
|
||||
if (!dp.isGestureMode) {
|
||||
if (dp.isTaskbarPresent) {
|
||||
bottomMargin += dp.taskbarSize;
|
||||
@@ -111,7 +110,6 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
|
||||
Reference in New Issue
Block a user