Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/res/drawable/ic_stat_github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/res/drawable/icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

</selector>
32 changes: 32 additions & 0 deletions app/src/main/java/com/github/mobile/accounts/GitHubAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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<NotificationReceiver> notificationReceiverClass) {
}
}

notificationManager.notify(0, n);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.github.mobile.accounts;

/**
* Created by c4q-joshelynvivas on 6/25/15.
*/
public class NotificationReceiver {
}