diff --git a/app/res/drawable/ic_stat_github.png b/app/res/drawable/ic_stat_github.png new file mode 100755 index 000000000..e27f1c012 Binary files /dev/null and b/app/res/drawable/ic_stat_github.png differ diff --git a/app/res/drawable/icon.xml b/app/res/drawable/icon.xml new file mode 100644 index 000000000..a8b409b1d --- /dev/null +++ b/app/res/drawable/icon.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/accounts/GitHubAccount.java b/app/src/main/java/com/github/mobile/accounts/GitHubAccount.java index 03ebbef61..83af2fe9e 100644 --- a/app/src/main/java/com/github/mobile/accounts/GitHubAccount.java +++ b/app/src/main/java/com/github/mobile/accounts/GitHubAccount.java @@ -21,9 +21,14 @@ import android.accounts.AccountManager; import android.accounts.AccountManagerFuture; import android.accounts.AccountsException; +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; import android.os.Bundle; import android.util.Log; +import com.github.mobile.R; + import java.io.IOException; /** @@ -92,3 +97,30 @@ public String toString() { return getClass().getSimpleName() + '[' + account.name + ']'; } } + +// prepare intent which is triggered if the +// notification is selected + +Intent intent = new Intent(this, NotificationReceiver.class); +PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); + +// build notification +// the addAction re-use the same intent to keep the example short +Notification n = new Notification.Builder(this) + .setContentTitle("A pull request " + "has been merged") + .setContentText("Github") + .setSmallIcon(R.drawable.ic_stat_github) + .setContentIntent(pIntent) + .setAutoCancel(true) + .build(); + + +NotificationManager notificationManager = + (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + +private class Intent { + public Intent(GitHubAccount gitHubAccount, Class notificationReceiverClass) { + } +} + +notificationManager.notify(0, n); \ No newline at end of file diff --git a/app/src/main/java/com/github/mobile/accounts/NotificationReceiver.java b/app/src/main/java/com/github/mobile/accounts/NotificationReceiver.java new file mode 100644 index 000000000..454b3eb28 --- /dev/null +++ b/app/src/main/java/com/github/mobile/accounts/NotificationReceiver.java @@ -0,0 +1,7 @@ +package com.github.mobile.accounts; + +/** + * Created by c4q-joshelynvivas on 6/25/15. + */ +public class NotificationReceiver { +}