- Notifications
You must be signed in to change notification settings - Fork5
A simple library to add dynamic and pinned shortcuts
License
NotificationsYou must be signed in to change notification settings
mehdikhalifeh/Shortcut
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple library to add dynamic and pinned shortcuts
allprojects { repositories { maven { url"https://jitpack.io" } }}
<repositories><repository><id>jitpack.io</id><url>https://jitpack.io</url></repository></repositories>
dependencies { implementation'com.github.MehdiKh93:Shortcut:1.0.2'}
<dependency><groupId>com.github.MehdiKh93</groupId><artifactId>Shortcut</artifactId><version>1.0.2</version></dependency>
ShortcutUtilsshortcutUtils =newShortcutUtils(context);
ShortcutdynamicShortcut =newShortcut.ShortcutBuilder() .setShortcutIcon(R.drawable.icon) .setShortcutId("dynamicShortcutId") .setShortcutLongLabel("dynamicShortcutLongLable") .setShortcutShortLabel("dynamicShortcutShortLabel") .setIntentAction("dynamicShortcutIntentAction") .setIntentStringExtraKey("dynamicShortcutKey") .setIntentStringExtraValue("dynamicShortcutValue") .build();shortcutUtils.addDynamicShortCut(dynamicHomeShortcut,newIReceiveStringExtra() {@OverridepublicvoidonReceiveStringExtra(StringstringExtraKey,StringstringExtraValue) {Stringintent =getIntent().getStringExtra(stringExtraKey);if (intent !=null) {if (intent.equals("dynamicShortcutValue")) {//write any code here } } } });}
shortcutUtils.disableDynamicShortCut(dynamicShortcut);
shortcutUtils.removeDynamicShortCut(dynamicShortcut);
shortcutUtils.enableDynamicShortCut(dynamicShortcut);
ShortcutpinnedShortcut =newShortcut.ShortcutBuilder() .setShortcutIcon(R.drawable.icon) .setShortcutId("pinnedShortcutId") .setShortcutLongLabel("pinnedShortcutLongLabel") .setShortcutShortLabel("pinnedShortcutShortLabel") .setIntentAction("pinnedShortcutIntentAction") .setIntentStringExtraKey("pinnedShortcutKey") .setIntentStringExtraValue("pinnedShortcutValue") .build();shortcutUtils.initPinnedShortCut(pinnedShortcut,newIReceiveStringExtra() {@OverridepublicvoidonReceiveStringExtra(StringstringExtraKey,StringstringExtraValue) {Stringintent =getIntent().getStringExtra(stringExtraKey);if (intent !=null) {if (intent.equals("pinnedShortcutValue")) {//write any code here } } } });}
shortcutUtils.requestPinnedShortcut(pinnedShortcut);
shortcutUtils.disablePinnedShortCut(pinnedShortcut);
shortcutUtils.enablePinnedShortCut(pinnedShortcut);
Please send all issues and feedback tokhalifeh.mehdi@gmail.com or Telegram ID:https://t.me/mehdikhalifeh
Copyright 2019 Mehdi Khalifeh 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.
About
A simple library to add dynamic and pinned shortcuts
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published