App Shortcuts for Android on Pre Nougat 7.1!
The Android App Shortcuts Library have features of Android 7.1 Nougat, you can implement in your launcher shortcuts starting from API 14! With new communication all developers will only implement shortcuts layout (this library), then it's up to developer to implement their own shortcuts, like Google!!! In version 1.4.0 library can get shortcuts from app which have API 25 and Static or Dynamic shortcuts implementation I have also implemented Force Touch and YOU CAN USE ON CUSTOM LAUNCHER WITH SHORTCUTS!!
This project needs you! If you would like to support this project's further development, the creator of this project or the continuous maintenance of this project, feel free to donate. Your donation is highly appreciated (and I love food, coffee and beer). Thank you!
PayPal
Donate $5: Thank's for creating this project, here's a coffee (or some beer) for you!
Donate $10: Wow, I am stunned. Let me take you to the movies!ù
Donate $15: I really appreciate your work, let's grab some lunch!
Donate $25: That's some awesome stuff you did right there, dinner is on me!
Donate $50: I really really want to support this project, great job!
Donate $100: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!
Donate $2799: Go buddy, buy Macbook Pro for yourself!
Of course, you can also choose what you want to donate, all donations are awesome!! Follow this link Donate!!
If you want to contribute you may download Donation App from Google Play
# v2.0.0 PreviewAdd this to build.gradle
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
Than add this dependencies
compile 'com.github.michelelacorte:AndroidAppShortcuts:2.0.0'
Coming soon with Force Touch implementation
Android API 14+
v2.0.0
ShortcutsBuilder
for create shortcuts with builder constructor.Utils
static Bitmap getRoundedBitmapForLauncher3
to get circular icon (shortcuts on launcher) static int getScreenXDimension
to get screen X.StyleOption
NONE
option for delete menù at right of shortcuts.OnLongClickListener
on shortcuts to create shortcuts icon on launcher.v1.4.0
onShortcutsOptionClickListener
, now remove view parent on click.RemoteShortcuts
ArrayList<Shortcuts> getRemoteShortcutsOnAPI25(Activity activity, String targetPackageName, int uid) throws Exception
this method get shortcuts defined in API 25, with Google SDK.saveRemoteShortcuts(Activity activity, ArrayList<Shortcuts> listOfShortcuts)
removed unecessary packageName string from method.Shortcuts
Shortcuts(Bitmap shortcutsImage, Bitmap shortcutsImageBadge, String shortcutsText, String targetClass, String targetPackage, int rank)
.Bitmap getShortcutsImageBadgeBitmap()
.int getRank()
.MAX_CHAR_SHORTCUTS
from 16 to 20.Utils
static Bitmap getRoundedBitmapForAPI25(Bitmap bitmap, Drawable packageImage)
for get launcher icon with badge and shadow.buildToolsVersion
and dependencies
v1.3.0
ShortcutsCreation
class, introduced:
static void setPackageImage(Drawable packageImage)
to set package image and create bitmap on launcher shortcuts icon like image above.v1.2.0
ShortcutsCreation
layout bug fixed, now support device screen resolution:
Bitmap
(remote shortcuts).mShortcutsOptions
click listener, now auto-convert resource into bitmap and create launcher shortcuts with icon.StyleOption
, contains static int for menù option layout.OnShortcutsOptionClickListener
isn't defined (local shortcuts mode).v1.1.0
RemoteShortcuts
static void saveRemoteShortcuts(Activity activity, String packageName, ArrayList<Shortcuts> listOfShortcuts)
for save shortcuts and make accessible on library.static ArrayList<Shortcuts> getRemoteShortcuts(Activity activity, String packageName)
to get shortcuts from library.static void checkPermission(Activity activity)
for check WRITE_EXTERNAL_STORAGE permission on Android M and above.static void requestPermission(Activity activity)
for request permission to user.Shortcuts
Shortcuts(Bitmap shortcutsImage, String shortcutsText)
Shortcuts(int shortcutsImage, String shortcutsText, String targetClass, String targetPackage)
only for remote use.Shortcuts(Bitmap shortcutsImage, String shortcutsText, String targetClass, String targetPackage)
only for remote use.Shortcuts(int shortcutsImage, String shortcutsText, View.OnClickListener onShortcutsClickListener, View.OnClickListener onShortcutsOptionClickListener)
View.OnClickListener getOnShortcutsOptionClickListener()
Bitmap getShortcutsImageBitmap()
String getTargetPackage()
String getTargetClass()
Utils
static void createShortcutsOnLauncher(Activity activity, Bitmap shortcutsImage, String shortcutsText, String className, String packageName)
for create shortcuts when user click on right menù (option menù)v1.0.0
ShortcutsService
that create remote connection and use AIDL to communicate with launcher, soon all developers will only implement shortcuts layout, then it's up to developer to implement their own shortcuts, like google!!!IRemoteShortcutClickListener
void onShortcutsClickListener()
when user click on shortcutsvoid onShortcutsOptionClickListener()
when user click on right menùIRemoteShortcutService
void addShortcutsWithRemoteClickListener(int shortcutsImage, String shortcutsText, IRemoteShortcutClickListener onShortcutsClickListener)
void addShortcuts(int shortcutsImage, String shortcutsText)
List<Shortcuts> getShortcuts()
Shortcuts
provide parcelable ShortcutsRemoteServiceConnection
RemoteServiceConnection(Activity activity, List<Shortcuts> shortcuts)
RemoteServiceConnection(Activity activity, Shortcuts... shortcuts)
boolean connectServiceAndVerifyConnection(RemoteServiceConnection serviceConnection)
to bind service and return boolean to check if is connected.void connectService(RemoteServiceConnection serviceConnection)
to bind service.IRemoteShortcutService getService()
to retreive service.ShortcutsService
to create serviceShortcuts
Shortcuts(int shortcutsImage, String shortcutsText, final IRemoteShortcutClickListener onIRemoteShortcutsClickListener)
int getShortcutsImage()
String getShortcutsText()
IRemoteShortcutClickListener getOnIRemoteShortcutsClickListener()
View.OnClickListener getOnShortcutsClickListener()
Parcelable
for AIDL communication.ShortcutsCreation
void createShortcutsBasedOnGridSize(int currentXPosition, int currentYPosition, int rowHeight, GridSize gridSize, List<Shortcuts> shortcuts)
void createShortcutsBasedOnGridSize(int currentXPosition, int currentYPosition, int rowHeight, GridSize gridSize, int optionLayoutStyle, List<Shortcuts> shortcuts)
void createShortcutsBasedOnGridSize(int currentXPosition, int currentYPosition, int rowHeight, GridSize gridSize, int optionLayoutStyle, final Shortcuts... shortcuts)
getPositionInGrid()
v0.2.0
ShortcutsCreation
class, now support all grid size!! (Tested major grid size Column x Row: 4x5, 4x4, 5x5, 5x4)Utils
GridSize getGridSize(AdapterView gridView)
int getToolbarHeight(Activity activity)
moved from ShortcutsCreation
GridSize
GridSize(int nColumn, int nRow)
int getRowCount()
int getColumnCount()
ShortcutsCreation
, added param int rowHeight
to constructorShortcutsCreation
class
ShortcutsCreation(Activity activity, ViewGroup masterLayout, GridView gridView)
isClickOnItem(int currentXPosition, int currentYPosition, GridSize gridSize)
ResizeAnimation
classv0.1.0
ShorcutsCreation
class for initialize gridView
and parentLayout
ShortcutsCreation(Activity activity, ViewGroup masterLayout, AdapterView gridView)
void createShortcuts(int currentXPosition, int currentYPosition, Shortcuts... shortcuts)
void clearAllLayout()
int getToolbarHeight(Context context)
void getScreenDimension()
int getPositionInGrid(int currentXPosition, int currentYPosition, AdapterView gridView)
Shortcuts
class for create your custom shortcuts!!
Shortcuts(int shortcutsImage, String shortcutsText, View.OnClickListener onShortcutsClickListener)
Shortcuts(int shortcutsImage, String shortcutsText)
void init(View layout)
do not use this, it's just to initialize shortcuts in ShortcutsCreation
classResizeAnimation
class to make transition
ResizeAnimation(View v, float fromWidth, float fromHeight, float toWidth, float toHeight)
applyTransformation(float interpolatedTime, Transformation t)
Author: Michele Lacorte ([email protected])
Follow my Google+
If you want to contribute to the project fork it and open Pull Request, or contact me by e-mail.
Each proposal will be accepted!
Copyright 2016 Michele Lacorte
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.
Hey dude! Help me out for a couple of :beers:!