Methods Summary |
---|
public static com.android.systemui.qs.QSTile | create(Host host, java.lang.String spec)
if (spec == null || !spec.startsWith(PREFIX) || !spec.endsWith(")")) {
throw new IllegalArgumentException("Bad intent tile spec: " + spec);
}
final String action = spec.substring(PREFIX.length(), spec.length() - 1);
if (action.isEmpty()) {
throw new IllegalArgumentException("Empty intent tile spec action");
}
return new IntentTile(host, action);
|
protected void | handleClick()
sendIntent("click", mOnClick, mOnClickUri);
|
protected void | handleDestroy()
super.handleDestroy();
mContext.unregisterReceiver(mReceiver);
|
protected void | handleLongClick()
sendIntent("long-click", mOnLongClick, mOnLongClickUri);
|
protected void | handleUpdateState(State state, java.lang.Object arg)
if (!(arg instanceof Intent)) return;
final Intent intent = (Intent) arg;
state.visible = intent.getBooleanExtra("visible", true);
state.contentDescription = intent.getStringExtra("contentDescription");
state.label = intent.getStringExtra("label");
state.icon = null;
final byte[] iconBitmap = intent.getByteArrayExtra("iconBitmap");
if (iconBitmap != null) {
try {
state.icon = new BytesIcon(iconBitmap);
} catch (Throwable t) {
Log.w(TAG, "Error loading icon bitmap, length " + iconBitmap.length, t);
}
} else {
final int iconId = intent.getIntExtra("iconId", 0);
if (iconId != 0) {
final String iconPackage = intent.getStringExtra("iconPackage");
if (!TextUtils.isEmpty(iconPackage)) {
state.icon = new PackageDrawableIcon(iconPackage, iconId);
} else {
state.icon = ResourceIcon.get(iconId);
}
}
}
mOnClick = intent.getParcelableExtra("onClick");
mOnClickUri = intent.getStringExtra("onClickUri");
mOnLongClick = intent.getParcelableExtra("onLongClick");
mOnLongClickUri = intent.getStringExtra("onLongClickUri");
|
protected void | handleUserSwitch(int newUserId)
super.handleUserSwitch(newUserId);
mCurrentUserId = newUserId;
|
protected State | newTileState()
return new State();
|
private void | sendIntent(java.lang.String type, android.app.PendingIntent pi, java.lang.String uri)
try {
if (pi != null) {
pi.send();
} else if (uri != null) {
final Intent intent = Intent.parseUri(uri, Intent.URI_INTENT_SCHEME);
mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId));
}
} catch (Throwable t) {
Log.w(TAG, "Error sending " + type + " intent", t);
}
|
public void | setListening(boolean listening)
|