Merge "If there is only 1 simple global action, autolaunch it" into klp-modular-dev

This commit is contained in:
Justin Koh
2014-05-15 17:17:13 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 8 deletions

View File

@@ -21,9 +21,8 @@
for watch products. Do not translate. --> for watch products. Do not translate. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Only show power and settings items due to smaller real estate. --> <!-- Only show settings item due to smaller real estate. -->
<string-array translatable="false" name="config_globalActionsList"> <string-array translatable="false" name="config_globalActionsList">
<item>power</item>
<item>settings</item> <item>settings</item>
</string-array> </string-array>

View File

@@ -182,11 +182,17 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
mDialog = createDialog(); mDialog = createDialog();
prepareDialog(); prepareDialog();
WindowManager.LayoutParams attrs = mDialog.getWindow().getAttributes(); // If we only have 1 item and it's a simple press action, just do this action.
attrs.setTitle("GlobalActions"); if (mAdapter.getCount() == 1
mDialog.getWindow().setAttributes(attrs); && mAdapter.getItem(0) instanceof SinglePressAction) {
mDialog.show(); ((SinglePressAction) mAdapter.getItem(0)).onPress();
mDialog.getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_DISABLE_EXPAND); } else {
WindowManager.LayoutParams attrs = mDialog.getWindow().getAttributes();
attrs.setTitle("GlobalActions");
mDialog.getWindow().setAttributes(attrs);
mDialog.show();
mDialog.getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_DISABLE_EXPAND);
}
} }
/** /**
@@ -397,7 +403,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
@Override @Override
public boolean showBeforeProvisioning() { public boolean showBeforeProvisioning() {
return false; return true;
} }
}; };
} }
@@ -1021,6 +1027,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
mEnableAccessibilityController = null; mEnableAccessibilityController = null;
super.setCanceledOnTouchOutside(true); super.setCanceledOnTouchOutside(true);
} }
super.onStart(); super.onStart();
} }