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.
Change package from com.shortcutbadger to me.leolin
Add sample project
- Loading branch information
1 parent
7d87ab3
commit 4d7bd88
Showing
48 changed files
with
358 additions
and
226 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,26 +19,24 @@ LG Launcher<br/> | |
|
||
|
||
|
||
HOW TO ASSEMBLE | ||
=================================== | ||
Run 'gradlew assemble' to get ShortcutBadger.aar in directory ./build/outputs/aar | ||
|
||
Run 'gradlew jarRelease' to get ShortcutBadger.jar in directory ./build/libs | ||
|
||
|
||
HOW TO USE | ||
=================================== | ||
<br/>1. Download the jar file named ShortcutBadger-X.X.jar in the target folder. | ||
<br/>2. Add the jar file into the folder "lib" in your Android project. | ||
<br/>3. Do not forget to add these permissions to your Androidmanifest.xml. | ||
<br/>1. Download the ShortcutBadger-aar.zip and put it into your project. | ||
<br/>2. Add the repositories path in your build.gradle "lib" in your Android project. | ||
|
||
repositories { | ||
jcenter() | ||
maven { | ||
url 'file://'+project.rootDir+"/ShortcutBadger-aar" | ||
} | ||
} | ||
<br/>3. Add dependencies for Shortcutbadger | ||
|
||
dependencies { | ||
compile 'me.leolin:ShortcutBadger:1.0.1' | ||
} | ||
|
||
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/> | ||
<uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS"/> | ||
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/> | ||
<uses-permission android:name="com.htc.launcher.permission.WRITE_SETTINGS"/> | ||
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/> | ||
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/> | ||
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/> | ||
<br/>4. Add the codes below: | ||
|
||
int badgeCount = 1; | ||
|
@@ -69,5 +67,4 @@ LICENSE | |
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. | ||
<br/> | ||
Email: [email protected] | ||
<br/> |
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 @@ | ||
/build |
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,33 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
repositories { | ||
jcenter() | ||
maven { | ||
url 'file://'+project.rootDir+"/ShortcutBadger-aar" | ||
} | ||
} | ||
|
||
android { | ||
compileSdkVersion 19 | ||
buildToolsVersion "20.0.0" | ||
|
||
defaultConfig { | ||
applicationId "me.leolin.shortcutbadger.example" | ||
minSdkVersion 14 | ||
targetSdkVersion 19 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
runProguard false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
dependencies { | ||
compile 'me.leolin:ShortcutBadger:1.0.1' | ||
} |
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,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/leolin/sdk/android-sdk-macosx/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
13 changes: 13 additions & 0 deletions
13
SampleApp/src/androidTest/java/me/leolin/shortcutbadger/example/ApplicationTest.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,13 @@ | ||
package me.leolin.shortcutbadger.example; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
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,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="me.leolin.shortcutbadger.example" > | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" > | ||
<intent-filter> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
<action android:name="android.intent.action.MAIN"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
47 changes: 47 additions & 0 deletions
47
SampleApp/src/main/java/me/leolin/shortcutbadger/example/MainActivity.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,47 @@ | ||
package me.leolin.shortcutbadger.example; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.Toast; | ||
import me.leolin.shortcutbadger.ShortcutBadgeException; | ||
import me.leolin.shortcutbadger.ShortcutBadger; | ||
|
||
|
||
public class MainActivity extends Activity { | ||
|
||
private EditText numInput; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
numInput = (EditText) findViewById(R.id.numInput); | ||
|
||
Button button = (Button) findViewById(R.id.btnSetBadge); | ||
button.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
try { | ||
int badgeCount = 0; | ||
try { | ||
badgeCount = Integer.parseInt(numInput.getText().toString()); | ||
} catch (NumberFormatException e) { | ||
Toast.makeText(getApplicationContext(), "Error input", Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
ShortcutBadger.setBadge(getApplicationContext(), badgeCount); | ||
|
||
Toast.makeText(getApplicationContext(), "Set count=" + badgeCount, Toast.LENGTH_SHORT).show(); | ||
} catch (ShortcutBadgeException e) { | ||
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,23 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
tools:context=".MainActivity"> | ||
|
||
<EditText | ||
android:id="@+id/numInput" | ||
android:inputType="numberDecimal" | ||
android:layout_width="match_parent" android:layout_height="wrap_content" | ||
/> | ||
|
||
<Button android:id="@+id/btnSetBadge" | ||
android:layout_width="wrap_content" android:layout_height="wrap_content" | ||
android:text="Set badge" | ||
android:layout_centerVertical="true" android:layout_centerHorizontal="true"/> | ||
|
||
|
||
</RelativeLayout> |
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,6 @@ | ||
<resources> | ||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml | ||
(such as screen margins) for screens with more than 820dp of available width. This | ||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> | ||
<dimen name="activity_horizontal_margin">64dp</dimen> | ||
</resources> |
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,5 @@ | ||
<resources> | ||
<!-- Default screen margins, per the Android Design guidelines. --> | ||
<dimen name="activity_horizontal_margin">16dp</dimen> | ||
<dimen name="activity_vertical_margin">16dp</dimen> | ||
</resources> |
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">ShortcutBadger</string> | ||
</resources> |
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,8 @@ | ||
<resources> | ||
|
||
<!-- Base application theme. --> | ||
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> | ||
<!-- Customize your theme here. --> | ||
</style> | ||
|
||
</resources> |
Binary file not shown.
Binary file added
BIN
+12.5 KB
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.aar
Binary file not shown.
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.aar.md5
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 @@ | ||
956f2fd7993112d4ae4141f9b2b9788d |
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.aar.sha1
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 @@ | ||
97cadb848d188f24f9c69583d47b60facb5ad4c1 |
Binary file added
BIN
+13.6 KB
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.jar
Binary file not shown.
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.jar.md5
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 @@ | ||
56a1f63ad114900f8e53045989cf01f9 |
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.jar.sha1
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 @@ | ||
febd3f6b399c0250391f4281ff43bcd8773a89e8 |
8 changes: 8 additions & 0 deletions
8
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.pom
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>me.leolin</groupId> | ||
<artifactId>ShortcutBadger</artifactId> | ||
<version>1.0.1</version> | ||
</project> |
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.pom.md5
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 @@ | ||
c199c317eed25c5fb28491555493b5c1 |
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/1.0.1/ShortcutBadger-1.0.1.pom.sha1
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 @@ | ||
cc93eb1117b1390bf3218d7f72060562a26205fe |
12 changes: 12 additions & 0 deletions
12
ShortcutBadger-aar/me/leolin/ShortcutBadger/maven-metadata.xml
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<metadata> | ||
<groupId>me.leolin</groupId> | ||
<artifactId>ShortcutBadger</artifactId> | ||
<version>1.0.1</version> | ||
<versioning> | ||
<versions> | ||
<version>1.0.1</version> | ||
</versions> | ||
<lastUpdated>20141012010240</lastUpdated> | ||
</versioning> | ||
</metadata> |
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/maven-metadata.xml.md5
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 @@ | ||
3847cc70a19e1aed86a2533097910691 |
1 change: 1 addition & 0 deletions
1
ShortcutBadger-aar/me/leolin/ShortcutBadger/maven-metadata.xml.sha1
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 @@ | ||
ce1ccb6ba0abcbf8e321a5a6b1453d5872db62f2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea/* | ||
*.iml | ||
build | ||
.gradle |
Oops, something went wrong.