Skip to content

Instantly share code, notes, and snippets.

@mlagerberg
Last active September 10, 2017 22:56
Show Gist options
  • Save mlagerberg/80008edd31541fa720b2 to your computer and use it in GitHub Desktop.
Save mlagerberg/80008edd31541fa720b2 to your computer and use it in GitHub Desktop.
[Google Now shortcut] Add Android app as a replacement for the Google Now shortcut (swipe up on home button) #android
<activity ... >
<intent-filter>
<action android:name="android.intent.action.ASSIST"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@drawable/ic_assist"
/>
</activity>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="true"
android:state_active="false"
android:state_focused="false"
android:drawable="@drawable/ic_assist_normal"
/>
<item
android:state_enabled="true"
android:state_active="true"
android:state_focused="false"
android:drawable="@drawable/ic_assist_active"
/>
<item
android:state_enabled="true"
android:state_active="false"
android:state_focused="true"
android:drawable="@drawable/ic_assist_active"
/>
</selector>
@mlagerberg
Copy link
Author

ic_assist_normal and ic_assist_active should be 75x75 dp large.

It looks best to have an all-white icon on a transparent background for 'normal' and a transparent icon on a circular white background for 'active'. Be sure to add a shadow to both images in case they appear on a white background. On Lollipop there's always a white (circular) background behind the icon and only the 'normal' is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment