Merge "Nav bar: fix tablet density change issues" into nyc-dev am: 6c2bc3db95
am: 9734c229d9
* commit '9734c229d9e403a4d8de784e7919277e0255b455':
Nav bar: fix tablet density change issues
Change-Id: Idf7058dbd087419cb9c441f3ebdc1c5d13b46bc1
This commit is contained in:
@@ -27,12 +27,6 @@
|
|||||||
<com.android.systemui.statusbar.phone.NavigationBarInflaterView
|
<com.android.systemui.statusbar.phone.NavigationBarInflaterView
|
||||||
android:id="@+id/navigation_inflater"
|
android:id="@+id/navigation_inflater"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<include android:id="@+id/rot0" layout="@layout/navigation_layout" />
|
|
||||||
|
|
||||||
<include android:id="@+id/rot90" layout="@layout/navigation_layout_rot90" />
|
|
||||||
|
|
||||||
</com.android.systemui.statusbar.phone.NavigationBarInflaterView>
|
|
||||||
|
|
||||||
</com.android.systemui.statusbar.phone.NavigationBarView>
|
</com.android.systemui.statusbar.phone.NavigationBarView>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Space;
|
import android.widget.Space;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
@@ -90,6 +89,7 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
|
|||||||
if (mDensity != newConfig.densityDpi) {
|
if (mDensity != newConfig.densityDpi) {
|
||||||
mDensity = newConfig.densityDpi;
|
mDensity = newConfig.densityDpi;
|
||||||
createInflaters();
|
createInflaters();
|
||||||
|
inflateChildren();
|
||||||
clearViews();
|
clearViews();
|
||||||
inflateLayout(mCurrentLayout);
|
inflateLayout(mCurrentLayout);
|
||||||
}
|
}
|
||||||
@@ -98,12 +98,25 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
|
|||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
mRot0 = (FrameLayout) findViewById(R.id.rot0);
|
inflateChildren();
|
||||||
mRot90 = (FrameLayout) findViewById(R.id.rot90);
|
|
||||||
clearViews();
|
clearViews();
|
||||||
inflateLayout(getDefaultLayout());
|
inflateLayout(getDefaultLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void inflateChildren() {
|
||||||
|
removeAllViews();
|
||||||
|
mRot0 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout, this, false);
|
||||||
|
mRot0.setId(R.id.rot0);
|
||||||
|
addView(mRot0);
|
||||||
|
mRot90 = (FrameLayout) mLayoutInflater.inflate(R.layout.navigation_layout_rot90, this,
|
||||||
|
false);
|
||||||
|
mRot90.setId(R.id.rot90);
|
||||||
|
addView(mRot90);
|
||||||
|
if (getParent() instanceof NavigationBarView) {
|
||||||
|
((NavigationBarView) getParent()).updateRotatedViews();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected String getDefaultLayout() {
|
protected String getDefaultLayout() {
|
||||||
return mContext.getString(R.string.config_navBarLayout);
|
return mContext.getString(R.string.config_navBarLayout);
|
||||||
}
|
}
|
||||||
@@ -123,9 +136,6 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
|
|||||||
@Override
|
@Override
|
||||||
public void onTuningChanged(String key, String newValue) {
|
public void onTuningChanged(String key, String newValue) {
|
||||||
if (NAV_BAR_VIEWS.equals(key)) {
|
if (NAV_BAR_VIEWS.equals(key)) {
|
||||||
if (newValue == null) {
|
|
||||||
newValue = getDefaultLayout();
|
|
||||||
}
|
|
||||||
if (!Objects.equals(mCurrentLayout, newValue)) {
|
if (!Objects.equals(mCurrentLayout, newValue)) {
|
||||||
clearViews();
|
clearViews();
|
||||||
inflateLayout(newValue);
|
inflateLayout(newValue);
|
||||||
@@ -162,6 +172,9 @@ public class NavigationBarInflaterView extends FrameLayout implements TunerServi
|
|||||||
|
|
||||||
protected void inflateLayout(String newLayout) {
|
protected void inflateLayout(String newLayout) {
|
||||||
mCurrentLayout = newLayout;
|
mCurrentLayout = newLayout;
|
||||||
|
if (newLayout == null) {
|
||||||
|
newLayout = getDefaultLayout();
|
||||||
|
}
|
||||||
String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
|
String[] sets = newLayout.split(GRAVITY_SEPARATOR, 3);
|
||||||
String[] start = sets[0].split(BUTTON_SEPARATOR);
|
String[] start = sets[0].split(BUTTON_SEPARATOR);
|
||||||
String[] center = sets[1].split(BUTTON_SEPARATOR);
|
String[] center = sets[1].split(BUTTON_SEPARATOR);
|
||||||
|
|||||||
@@ -492,17 +492,7 @@ public class NavigationBarView extends LinearLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFinishInflate() {
|
public void onFinishInflate() {
|
||||||
mRotatedViews[Surface.ROTATION_0] =
|
updateRotatedViews();
|
||||||
mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
|
|
||||||
|
|
||||||
mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
|
|
||||||
|
|
||||||
mRotatedViews[Surface.ROTATION_270] = mRotatedViews[Surface.ROTATION_90];
|
|
||||||
|
|
||||||
mCurrentView = mRotatedViews[Surface.ROTATION_0];
|
|
||||||
for (int i = 0; i < mButtonDisatchers.size(); i++) {
|
|
||||||
mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView);
|
|
||||||
}
|
|
||||||
((NavigationBarInflaterView) findViewById(R.id.navigation_inflater)).setButtonDispatchers(
|
((NavigationBarInflaterView) findViewById(R.id.navigation_inflater)).setButtonDispatchers(
|
||||||
mButtonDisatchers);
|
mButtonDisatchers);
|
||||||
|
|
||||||
@@ -544,15 +534,16 @@ public class NavigationBarView extends LinearLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRecentsIcon() {
|
void updateRotatedViews() {
|
||||||
getRecentsButton().setImageDrawable(mDockedStackExists ? mDockedIcon : mRecentIcon);
|
mRotatedViews[Surface.ROTATION_0] =
|
||||||
|
mRotatedViews[Surface.ROTATION_180] = findViewById(R.id.rot0);
|
||||||
|
mRotatedViews[Surface.ROTATION_270] =
|
||||||
|
mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
|
||||||
|
|
||||||
|
updateCurrentView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVertical() {
|
private void updateCurrentView() {
|
||||||
return mVertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reorient() {
|
|
||||||
final int rot = mDisplay.getRotation();
|
final int rot = mDisplay.getRotation();
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
mRotatedViews[i].setVisibility(View.GONE);
|
mRotatedViews[i].setVisibility(View.GONE);
|
||||||
@@ -563,6 +554,18 @@ public class NavigationBarView extends LinearLayout {
|
|||||||
mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView);
|
mButtonDisatchers.valueAt(i).setCurrentView(mCurrentView);
|
||||||
}
|
}
|
||||||
updateLayoutTransitionsEnabled();
|
updateLayoutTransitionsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateRecentsIcon() {
|
||||||
|
getRecentsButton().setImageDrawable(mDockedStackExists ? mDockedIcon : mRecentIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVertical() {
|
||||||
|
return mVertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reorient() {
|
||||||
|
updateCurrentView();
|
||||||
|
|
||||||
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
|
getImeSwitchButton().setOnClickListener(mImeSwitcherClickListener);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user