Add option to toggle the new overscan mode.

Change-Id: I552a1c8b36650c558fe6f4e3e1a9e40137d7274f
This commit is contained in:
Dianne Hackborn
2013-02-15 16:37:24 -08:00
parent d090a324e1
commit 1ee9d5ec61
2 changed files with 28 additions and 0 deletions

View File

@@ -162,6 +162,14 @@
android:textColor="#FFFFFFFF" android:textColor="#FFFFFFFF"
android:text="FULLSCREEN" android:text="FULLSCREEN"
/> />
<CheckBox
android:id="@+id/windowOverscan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:textColor="#FFFFFFFF"
android:text="OVERSCAN"
/>
<CheckBox <CheckBox
android:id="@+id/windowHideActionBar" android:id="@+id/windowHideActionBar"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@@ -126,6 +126,18 @@ public class OverscanActivity extends Activity
win.setAttributes(winParams); win.setAttributes(winParams);
} }
private void setOverscan(boolean on) {
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN;
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
win.setAttributes(winParams);
}
private String getDisplaySize() { private String getDisplaySize() {
DisplayMetrics dm = getResources().getDisplayMetrics(); DisplayMetrics dm = getResources().getDisplayMetrics();
return String.format("DisplayMetrics = (%d x %d)", dm.widthPixels, dm.heightPixels); return String.format("DisplayMetrics = (%d x %d)", dm.widthPixels, dm.heightPixels);
@@ -185,6 +197,14 @@ public class OverscanActivity extends Activity
} }
} }
); );
((CheckBox) findViewById(R.id.windowOverscan)).setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setOverscan(isChecked);
}
}
);
((CheckBox) findViewById(R.id.windowHideActionBar)).setOnCheckedChangeListener( ((CheckBox) findViewById(R.id.windowHideActionBar)).setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() { new CompoundButton.OnCheckedChangeListener() {
@Override @Override