Improvements to system UI demos.
- Content browser now lets you long press to go into selection mode. - Overscan demo has more options for controlling more window state. Change-Id: I04cfb58f515882cc6dccd65cb68bc073e53dcad5
This commit is contained in:
@@ -66,26 +66,22 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="#FFFFFFFF"
|
android:textColor="#FFFFFFFF"
|
||||||
android:textSize="16dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="LOW_PROFILE"
|
android:text="LOW_PROFILE"
|
||||||
/>
|
/>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/modeFullscreen"
|
android:id="@+id/modeFullscreen"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
android:textColor="#FFFFFFFF"
|
android:textColor="#FFFFFFFF"
|
||||||
android:textSize="16dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="FULLSCREEN"
|
android:text="FULLSCREEN"
|
||||||
/>
|
/>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/modeHideNavigation"
|
android:id="@+id/modeHideNavigation"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
android:textColor="#FFFFFFFF"
|
android:textColor="#FFFFFFFF"
|
||||||
android:textSize="16dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="HIDE_NAVIGATION"
|
android:text="HIDE_NAVIGATION"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -93,7 +89,6 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:baselineAligned="true"
|
android:baselineAligned="true"
|
||||||
>
|
>
|
||||||
@@ -118,26 +113,77 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="#FFFFFFFF"
|
android:textColor="#FFFFFFFF"
|
||||||
android:textSize="16dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="STABLE"
|
android:text="STABLE"
|
||||||
/>
|
/>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/layoutFullscreen"
|
android:id="@+id/layoutFullscreen"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
android:textColor="#FFFFFFFF"
|
android:textColor="#FFFFFFFF"
|
||||||
android:textSize="16dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="FULLSCREEN"
|
android:text="FULLSCREEN"
|
||||||
/>
|
/>
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/layoutHideNavigation"
|
android:id="@+id/layoutHideNavigation"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
android:text="HIDE_NAVIGATION"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:baselineAligned="true"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
android:textSize="16dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:gravity="left"
|
||||||
|
android:text="Window:"
|
||||||
|
/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:baselineAlignedChildIndex="0"
|
||||||
|
>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/windowFullscreen"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
android:text="FULLSCREEN"
|
||||||
|
/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/windowHideActionBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
android:text="Hide ActionBar"
|
||||||
|
/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/windowActionMode"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-10dp"
|
||||||
|
android:textColor="#FFFFFFFF"
|
||||||
|
android:text="Action Mode"
|
||||||
|
/>
|
||||||
|
<!-- Crappy hack to make these the same size as the
|
||||||
|
above groups. You'd never do this in real code. -->
|
||||||
|
<CheckBox
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
android:textColor="#FFFFFFFF"
|
android:textColor="#FFFFFFFF"
|
||||||
android:textSize="16dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="HIDE_NAVIGATION"
|
android:text="HIDE_NAVIGATION"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ public class ContentBrowserActivity extends Activity
|
|||||||
mText = new TextView(context);
|
mText = new TextView(context);
|
||||||
mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
|
mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
|
||||||
mText.setClickable(false);
|
mText.setClickable(false);
|
||||||
mText.setLongClickable(false);
|
|
||||||
mText.setOnClickListener(this);
|
mText.setOnClickListener(this);
|
||||||
|
mText.setTextIsSelectable(true);
|
||||||
addView(mText, new ViewGroup.LayoutParams(
|
addView(mText, new ViewGroup.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.ActionMode;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -54,6 +55,7 @@ public class OverscanActivity extends Activity
|
|||||||
implements OnQueryTextListener, ActionBar.TabListener {
|
implements OnQueryTextListener, ActionBar.TabListener {
|
||||||
public static class IV extends ImageView implements View.OnSystemUiVisibilityChangeListener {
|
public static class IV extends ImageView implements View.OnSystemUiVisibilityChangeListener {
|
||||||
private OverscanActivity mActivity;
|
private OverscanActivity mActivity;
|
||||||
|
private ActionMode mActionMode;
|
||||||
public IV(Context context) {
|
public IV(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@@ -71,6 +73,44 @@ public class OverscanActivity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public void onSystemUiVisibilityChange(int visibility) {
|
public void onSystemUiVisibilityChange(int visibility) {
|
||||||
mActivity.updateCheckControls();
|
mActivity.updateCheckControls();
|
||||||
|
mActivity.refreshSizes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MyActionModeCallback implements ActionMode.Callback {
|
||||||
|
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||||
|
mode.setTitle("My Action Mode!");
|
||||||
|
mode.setSubtitle(null);
|
||||||
|
mode.setTitleOptionalHint(false);
|
||||||
|
menu.add("Sort By Size").setIcon(android.R.drawable.ic_menu_sort_by_size);
|
||||||
|
menu.add("Sort By Alpha").setIcon(android.R.drawable.ic_menu_sort_alphabetically);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void onDestroyActionMode(ActionMode mode) {
|
||||||
|
mActionMode = null;
|
||||||
|
mActivity.clearActionMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startActionMode() {
|
||||||
|
if (mActionMode == null) {
|
||||||
|
ActionMode.Callback cb = new MyActionModeCallback();
|
||||||
|
mActionMode = startActionMode(cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopActionMode() {
|
||||||
|
if (mActionMode != null) {
|
||||||
|
mActionMode.finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +177,38 @@ public class OverscanActivity extends Activity
|
|||||||
for (int i=0; i<mCheckControls.length; i++) {
|
for (int i=0; i<mCheckControls.length; i++) {
|
||||||
mCheckControls[i].setOnCheckedChangeListener(checkChangeListener);
|
mCheckControls[i].setOnCheckedChangeListener(checkChangeListener);
|
||||||
}
|
}
|
||||||
|
((CheckBox) findViewById(R.id.windowFullscreen)).setOnCheckedChangeListener(
|
||||||
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
setFullscreen(isChecked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
((CheckBox) findViewById(R.id.windowHideActionBar)).setOnCheckedChangeListener(
|
||||||
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isChecked) {
|
||||||
|
getActionBar().hide();
|
||||||
|
} else {
|
||||||
|
getActionBar().show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
((CheckBox) findViewById(R.id.windowActionMode)).setOnCheckedChangeListener(
|
||||||
|
new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isChecked) {
|
||||||
|
mImage.startActionMode();
|
||||||
|
} else {
|
||||||
|
mImage.stopActionMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
mMetricsText = (TextView) findViewById(R.id.metricsText);
|
mMetricsText = (TextView) findViewById(R.id.metricsText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,4 +300,8 @@ public class OverscanActivity extends Activity
|
|||||||
}
|
}
|
||||||
mImage.setSystemUiVisibility(visibility);
|
mImage.setSystemUiVisibility(visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearActionMode() {
|
||||||
|
((CheckBox) findViewById(R.id.windowActionMode)).setChecked(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user