forked from leolin310148/ShortcutBadger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request leolin310148#7 from mysms/add-more-launchers
Add more launchers
- Loading branch information
Showing
5 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/AdwHomeBadger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package me.leolin.shortcutbadger.impl; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
import me.leolin.shortcutbadger.ShortcutBadgeException; | ||
import me.leolin.shortcutbadger.ShortcutBadger; | ||
|
||
/** | ||
* @author Gernot Pansy | ||
*/ | ||
public class AdwHomeBadger extends ShortcutBadger { | ||
|
||
public static final String INTENT_UPDATE_COUNTER = "org.adw.launcher.counter.SEND"; | ||
public static final String PACKAGENAME = "PNAME"; | ||
public static final String COUNT = "COUNT"; | ||
|
||
public AdwHomeBadger(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
protected void executeBadge(int badgeCount) throws ShortcutBadgeException { | ||
|
||
Intent intent = new Intent(INTENT_UPDATE_COUNTER); | ||
intent.putExtra(PACKAGENAME, getContextPackageName()); | ||
intent.putExtra(COUNT, badgeCount); | ||
mContext.sendBroadcast(intent); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/ApexHomeBadger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package me.leolin.shortcutbadger.impl; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
|
||
import me.leolin.shortcutbadger.ShortcutBadgeException; | ||
import me.leolin.shortcutbadger.ShortcutBadger; | ||
|
||
/** | ||
* @author Gernot Pansy | ||
*/ | ||
public class ApexHomeBadger extends ShortcutBadger { | ||
|
||
private static final String INTENT_UPDATE_COUNTER = "com.anddoes.launcher.COUNTER_CHANGED"; | ||
private static final String PACKAGENAME = "package"; | ||
private static final String COUNT = "count"; | ||
private static final String CLASS = "class"; | ||
|
||
public ApexHomeBadger(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
protected void executeBadge(int badgeCount) throws ShortcutBadgeException { | ||
|
||
Intent intent = new Intent(INTENT_UPDATE_COUNTER); | ||
intent.putExtra(PACKAGENAME, getContextPackageName()); | ||
intent.putExtra(COUNT, badgeCount); | ||
intent.putExtra(CLASS, getEntryActivityName()); | ||
mContext.sendBroadcast(intent); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/NovaHomeBadger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package me.leolin.shortcutbadger.impl; | ||
|
||
import android.content.ContentResolver; | ||
import android.content.ContentValues; | ||
import android.content.Context; | ||
import android.database.Cursor; | ||
import android.net.Uri; | ||
|
||
import me.leolin.shortcutbadger.ShortcutBadgeException; | ||
import me.leolin.shortcutbadger.ShortcutBadger; | ||
|
||
/** | ||
* Shortcut Badger support for Nova Launcher. | ||
* | ||
* TeslaUnread must be installed. | ||
* | ||
* User: Gernot Pansy | ||
* Date: 2014/11/03 | ||
* Time: 7:15 | ||
*/ | ||
public class NovaHomeBadger extends ShortcutBadger { | ||
|
||
private static final String CONTENT_URI = "content://com.teslacoilsw.notifier/unread_count"; | ||
private static final String COUNT = "count"; | ||
private static final String TAG = "tag"; | ||
|
||
public NovaHomeBadger(final Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
protected void executeBadge(final int badgeCount) throws ShortcutBadgeException { | ||
try { | ||
ContentValues contentValues = new ContentValues(); | ||
contentValues.put(TAG, getContextPackageName() + "/" + getEntryActivityName()); | ||
contentValues.put(COUNT, badgeCount); | ||
mContext.getContentResolver().insert(Uri.parse(CONTENT_URI), contentValues); | ||
} catch (IllegalArgumentException ex) { | ||
/* Fine, TeslaUnread is not installed. */ | ||
} catch (Exception ex) { | ||
|
||
/* Some other error, possibly because the format | ||
of the ContentValues are incorrect. */ | ||
|
||
throw new ShortcutBadgeException(ex.getMessage()); | ||
} | ||
} | ||
} |