Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean O'Neil SeanPONeil

View GitHub Profile
View displayNotification.java
public void displayNotification() {
mNotifyBuilder = new NotificationCompat.Builder(this)
.setContentTitle("New Message")
.setContentText("You've received new messages.")
.setSmallIcon(R.drawable.ic_notify_status)
mNotificationManager.notify(
notifyID, mNotifyBuilder.build());
}
@SeanPONeil
SeanPONeil / displayNotificationWithAction.java
Last active Aug 29, 2015
Display Notification with actions
View displayNotificationWithAction.java
public void displayNotificationWithActions() {
mNotifyBuilder = new NotificationCompat.Builder(this)
.setContentTitle("New Message")
.setContentText("You've received new messages.")
.setSmallIcon(R.drawable.ic_notify_status);
// Create Pending Intent that broadcasts an Intent
Intent intent = new Intent(context.getPackageName() + ".READ_MESSAGE");
PendingIntent pendingIntent =
PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@SeanPONeil
SeanPONeil / displayNotificationWithOneAction.java
Last active Aug 29, 2015
displayNotificationWithOneAction
View displayNotificationWithOneAction.java
public void displayNotification(String title, String message, int icon, int id) {
// Create PendingIntent that launches an activity
Intent intent = new Intent(getContext(), LoginRequestActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, PendingIntent.FLAG_ONE_SHOT);
// Build the notification
Notification notification = new NotificationCompat.Builder()
.setContentTitle(title)
.setContentText(message)
.setSmallIcon(icon)
View receiveNotification.java
public class NotificationActionReceiver extends WakefulBroadcastReceiver {
@Override public void onReceive(Context context, Intent intent) {
String action = intent.getStringExtra("action");
int id = intent.getIntExtra("id");
switch (action) {
case "Approve":
// Start service to approve transaction and hold wake lock
Intent approveIntent = new Intent("com.example.app.ApproveService");
intent.putExtra("id", id);
@SeanPONeil
SeanPONeil / displayNotification.java
Last active Aug 29, 2015
displayExpandedNotificationWithMultipleActions
View displayNotification.java
public void displayNotification(String title, String message, int smallIcon, int largeIcon) {
// Create PendingIntent that launches an activity
Intent intent = new Intent(getContext(), LoginRequestActivity.class);
PendingIntent activityIntent = PendingIntent.getActivity(getContext(), 0, intent, PendingIntent.FLAG_ONE_SHOT);
// Build the notification
Notification notification = new NotificationCompat.Builder()
.setContentTitle(title)
.setContentText(message)
.setSmallIcon(smallIcon)
View keybase.md

Keybase proof

I hereby claim:

  • I am seanponeil on github.
  • I am seanponeil (https://keybase.io/seanponeil) on keybase.
  • I have a public key whose fingerprint is 6C46 0325 A379 C763 EF36 C51B 32BE 39C5 558F 19A6

To claim this, I am signing this object:

View reverse.java
class Node {
char data;
Node next;
}
static Node reverse(Node root){
Node reverseRoot = null;
while(root != null) {
Node next = root.next;
root.next = reverseRoot;
@SeanPONeil
SeanPONeil / JP.java
Created Oct 23, 2011
Method to detect duplicates in array of integers in Java
View JP.java
boolean detectDuplicates( int [] x){
Set <Integer> intSet = new HashSet<Integer>();
for( int i: x){
if(intSet.contains(i)){
return true;
}
intSet.add(i);
}
return false;
}
@SeanPONeil
SeanPONeil / nodeBody.txt
Created Jan 11, 2012
Sample Node body HTML
View nodeBody.txt
<p>
<object height="315" width="560"><param name="movie" value="http://www.youtube.com/v/L3qnJdSVmSc?version=3&amp;hl=en_US" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed allowfullscreen="true" allowscriptaccess="always" height="315" src="http://www.youtube.com/v/L3qnJdSVmSc?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560"></embed></object></p>
<p>
As <a href="http://mgoblog.com/mgoboard/ace-michigan-offers-13-ol-logan-tuley-tillman" style="text-align: -webkit-auto; " target="_blank">reported here</a> earlier today, Michigan offered 2013 Peoria (IL) Manual OL Logan Tuley-Tillman today. He now holds offers from Michigan, Mizzou, Illinois, and Indiana, and the <a href="http://mgoblog.com/diaries/introducing-logan-tuley-tillman" style="text-align: -webkit-auto; " target="_blank">last time I talked to him</a> he said that a Michigan offer would put the Wolverines at the top of his list. What did he have to say today? We talked over
@SeanPONeil
SeanPONeil / node.html
Created Jan 20, 2012
Sample Node body
View node.html
<p style="line-height: normal" class="content"><span>NOTRE DAME IS BRIAN BOITANO TIME</span></p> <p style="line-height: normal" class="content"><span><object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/ZwgiGRmdFZ0?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ZwgiGRmdFZ0?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object></span></p> <h3><span>The Essentials&#160; <a href="http://mgoblog.com/sites/mgoblog.com/files/images/Puck-Preview-Notre-Dame_925/5576114507_117f9ef3d41.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="5576114507_117f9ef3d4[1]" border="0" alt="5576114507
You can’t perform that action at this time.