package com.wh.finaldemos.demos.system.notification;

import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.widget.Button;

import com.wh.finaldemos.BaseDemoActivity;
import com.wh.finaldemos.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static android.R.attr.id;

public class SendNotificationActivity extends BaseDemoActivity {

    @BindView(R.id.send_noti)
    Button sendBut;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_send_notification);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.send_noti)
    void onSendClick() {
        sendNotification();
    }

    private void sendNotification() {
        Intent resultIntent = new Intent(this, SendNotificationActivity.class);
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Adds the back stack
        stackBuilder.addParentStack(SendNotificationActivity.class);
// Adds the Intent to the top of the stack
        stackBuilder.addNextIntent(resultIntent);
// Gets a PendingIntent containing the entire back stack
        PendingIntent resultPendingIntent =
                stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
        builder.setSmallIcon(R.drawable.v2_loading)
                .setContentTitle("My notification")
                .setContentText("Hello World!")
                .setContentIntent(resultPendingIntent);
        NotificationManager mNotificationManager =
                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.notify(id, builder.build());

    }
}

@@ -176,32 +176,71 @@
 content.Intent;%0A
+import android.graphics.BitmapFactory;%0A
 import android.o
@@ -249,16 +249,16 @@
 Bundle;%0A
-
 import a
@@ -984,16 +984,26 @@
 fication
+WithBigImg
 ();%0A    
@@ -1800,16 +1800,16 @@
 orld!%22)%0A
-
         
@@ -2052,16 +2052,1558 @@
 ld());%0A%0A
+    %7D%0A%0A    private void sendNotificationWithBigImg() %7B%0A        Intent resultIntent = new Intent(this, SendNotificationActivity.class);%0A        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);%0A// Adds the back stack%0A        stackBuilder.addParentStack(SendNotificationActivity.class);%0A// Adds the Intent to the top of the stack%0A        stackBuilder.addNextIntent(resultIntent);%0A// Gets a PendingIntent containing the entire back stack%0A        PendingIntent resultPendingIntent =%0A                stackBuilder.getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT);%0A        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);%0A        NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle();%0A        style.setBigContentTitle(%22big title%22);%0A        style.setSummaryText(%22summery text%22);%0A        style.bigPicture(BitmapFactory.decodeResource(getResources(), R.drawable.lenna));%0A        builder.setSmallIcon(R.drawable.v2_loading).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.lenna))%0A                .setContentTitle(%22My notification%22)%0A                .setContentText(%22Hello World!%22).setDefaults(NotificationCompat.DEFAULT_ALL).setAutoCancel(true).setPriority(NotificationCompat.PRIORITY_MAX)%0A                .setContentIntent(resultPendingIntent).setStyle(style);%0A        NotificationManager mNotificationManager =%0A                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);%0A        mNotificationManager.notify(id, builder.build());%0A%0A
     %7D%0A%7D%0A

add big picture style notification