Clean up of system UI flag demo, doc markup for overscan demo.

Change-Id: Iaef99a4c1aeebbd327bcbc42b27d20c8065f8d27
This commit is contained in:
Dianne Hackborn
2013-02-25 16:48:06 -08:00
parent 843ea83d9c
commit 168241ee8e
4 changed files with 22 additions and 9 deletions

View File

@@ -2298,7 +2298,7 @@
</intent-filter>
</activity>
<activity android:name=".view.OverscanActivity"
<activity android:name=".view.SystemUIModes"
android:label="Views/System UI Visibility/System UI Modes"
android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>

View File

@@ -14,11 +14,18 @@
limitations under the License.
-->
<!-- BEGIN_INCLUDE(complete) -->
<!-- This layout is designed for use with FLAG_LAYOUT_IN_OVERSCAN, so its window will
be placed into the overscan region of the display (if there is one). Thus the contents
of the top-level view may be obscured around the edges by the display, leaving the
edge of the box background used here invisible. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/box_white">
<!-- This is still in the same position as the top-level FrameLayout, so the contentx
of this TextView may also be obscured. -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -27,10 +34,16 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Overscan" />
<!-- This FrameLayout uses android:fitsSystemWindows to have its padding adjusted so
that within that space its content is offset to not be obscured by the overscan
region (or also system decors that are covering its UI. -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- Now that we are within the padding region of the parent FrameLayout, we can
safely place content that will be visible to the user. -->
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -47,6 +60,8 @@
android:layout_marginLeft="3dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Content" />
</FrameLayout>
</FrameLayout>
<!-- END_INCLUDE(complete) -->

View File

@@ -17,7 +17,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
>
<view class="com.example.android.apis.view.OverscanActivity$IV"
<view class="com.example.android.apis.view.SystemUIModes$IV"
android:id="@+id/image"
android:src="@drawable/frantic"
android:layout_width="match_parent"

View File

@@ -27,12 +27,10 @@ import android.os.Bundle;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
@@ -51,10 +49,10 @@ import com.example.android.apis.R;
* the system decor, in order to better focus the user's attention or use available screen real
* estate on the task at hand.
*/
public class OverscanActivity extends Activity
public class SystemUIModes extends Activity
implements OnQueryTextListener, ActionBar.TabListener {
public static class IV extends ImageView implements View.OnSystemUiVisibilityChangeListener {
private OverscanActivity mActivity;
private SystemUIModes mActivity;
private ActionMode mActionMode;
public IV(Context context) {
super(context);
@@ -62,7 +60,7 @@ public class OverscanActivity extends Activity
public IV(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setActivity(OverscanActivity act) {
public void setActivity(SystemUIModes act) {
setOnSystemUiVisibilityChangeListener(this);
mActivity = act;
}
@@ -161,7 +159,7 @@ public class OverscanActivity extends Activity
};
TextView mMetricsText;
public OverscanActivity() {
public SystemUIModes() {
}
@Override
@@ -170,7 +168,7 @@ public class OverscanActivity extends Activity
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.overscan);
setContentView(R.layout.system_ui_modes);
mImage = (IV) findViewById(R.id.image);
mImage.setActivity(this);