diff options
author | Adnan Begovic <adnan@cyngn.com> | 2015-04-23 23:16:27 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-04-26 16:55:08 -0700 |
commit | aa8614e39b90c0d9cc2d86777d28c691773d9dae (patch) | |
tree | a6b998d9637dfc722c1dc16dfe66560673d675fb /src/java/org/cyanogenmod/internal/statusbar | |
parent | 42e54529ed9eec71d40c1bc6b8c2409766a95f64 (diff) | |
download | vendor_cmsdk-aa8614e39b90c0d9cc2d86777d28c691773d9dae.zip vendor_cmsdk-aa8614e39b90c0d9cc2d86777d28c691773d9dae.tar.gz vendor_cmsdk-aa8614e39b90c0d9cc2d86777d28c691773d9dae.tar.bz2 |
CMSDK: Create Quick Settings Tile API.
Create a simple CustomTile object with builder which lets a 3rd party
application publish a quick settings tile to the status bar panel.
An example CustomTile build:
CustomTile customTile = new CustomTile.Builder(mContext)
.setLabel("custom label")
.setContentDescription("custom description")
.setOnClickIntent(pendingIntent)
.setOnClickUri(Uri.parse("custom uri"))
.setIcon(R.drawable.ic_launcher)
.build();
Which can be published to the status bar panel via CMStatusBarManager#publishTile.
The CustomTile contains a click intent and click uri which can be
sent or broadcasted when the CustomQSTile's handleClick is fired.
This implementation closely mirrors that of NotificationManager#notify for
notifications. In that each CMStatusBarManager#publishTile can have an appended
id which can be kept by the 3rd party application to either update the tile with,
or to remove the tile via CMStatusBarManager#removeTile.
Change-Id: I4b8a50e4e53ef2ececc9c7fc9c8d0ec6acfd0c0e
Diffstat (limited to 'src/java/org/cyanogenmod/internal/statusbar')
-rw-r--r-- | src/java/org/cyanogenmod/internal/statusbar/ExternalQuickSettingsRecord.java | 53 | ||||
-rw-r--r-- | src/java/org/cyanogenmod/internal/statusbar/IStatusBarCustomTileHolder.aidl | 25 |
2 files changed, 78 insertions, 0 deletions
diff --git a/src/java/org/cyanogenmod/internal/statusbar/ExternalQuickSettingsRecord.java b/src/java/org/cyanogenmod/internal/statusbar/ExternalQuickSettingsRecord.java new file mode 100644 index 0000000..05f8edf --- /dev/null +++ b/src/java/org/cyanogenmod/internal/statusbar/ExternalQuickSettingsRecord.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2015, The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cyanogenmod.internal.statusbar; + +import android.os.UserHandle; +import com.android.internal.annotations.VisibleForTesting; + +import cyanogenmod.app.CustomTile; +import cyanogenmod.app.StatusBarPanelCustomTile; + +/** + * @hide + */ +public class ExternalQuickSettingsRecord { + public final StatusBarPanelCustomTile sbTile; + public boolean isUpdate; + public boolean isCanceled; + + @VisibleForTesting + public ExternalQuickSettingsRecord(StatusBarPanelCustomTile tile) { + sbTile = tile; + } + + public CustomTile getCustomTile() { + return sbTile.getCustomTile(); + } + + public UserHandle getUser() { + return sbTile.getUser(); + } + + public int getUserId() { + return sbTile.getUserId(); + } + + public String getKey() { + return sbTile.getKey(); + } +} diff --git a/src/java/org/cyanogenmod/internal/statusbar/IStatusBarCustomTileHolder.aidl b/src/java/org/cyanogenmod/internal/statusbar/IStatusBarCustomTileHolder.aidl new file mode 100644 index 0000000..90e04de --- /dev/null +++ b/src/java/org/cyanogenmod/internal/statusbar/IStatusBarCustomTileHolder.aidl @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2015, The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.cyanogenmod.internal.statusbar; + +import cyanogenmod.app.StatusBarPanelCustomTile; + +/** @hide */ +interface IStatusBarCustomTileHolder { + /** Fetch the held StatusBarPanelCustomTile. This method should only be called once per Holder */ + StatusBarPanelCustomTile get(); +}
\ No newline at end of file |