// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
// 
//     private static final String EXTRA_SESSION_ID = "session_id";
//     private static final String EXTRA_PARENT = "parent";
// 
//     private Class parentClass;
// 
//     public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
//         Intent intent = new Intent(context, SessionDetailActivity.class);
//         intent.putExtra(EXTRA_SESSION_ID, sessionId);
//         if (parentClass != null) {
//             intent.putExtra(EXTRA_PARENT, parentClass.getName());
//         }
//         return intent;
//     }
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
//         getComponent().inject(this);
// 
//         final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
//         String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
//         if (TextUtils.isEmpty(parentClassName)) {
//             parentClass = MainActivity.class;
//         } else {
//             try {
//                 parentClass = Class.forName(parentClassName);
//             } catch (ClassNotFoundException e) {
//                 Timber.e(e);
//             }
//         }
//         replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         switch (item.getItemId()) {
//             case android.R.id.home:
//                 upToParentActivity();
//                 return true;
//         }
//         return super.onOptionsItemSelected(item);
//     }
// 
//     private void upToParentActivity() {
//         Intent upIntent = new Intent(getApplicationContext(), parentClass);
//         upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//         startActivity(upIntent);
//         finish();
//     }
// 
// }


import android.app.Notification;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.content.ContextCompat;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.pref.DefaultPrefs;
import io.github.droidkaigi.confsched2017.view.activity.MainActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import timber.log.Timber;

    /**
     * Show group notification
     * @param context Context
     */
    private void showGroupNotification(Context context) {
        // Group notification is supported on Android N and Android Wear.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            Notification groupNotification = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.drawable.ic_notification)
                    .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
                    .setColor(ContextCompat.getColor(context, R.color.theme))
                    .setAutoCancel(true)
                    .setGroup(GROUP_NAME)
                    .setGroupSummary(true)
                    .build();
            NotificationManagerCompat.from(context).notify(GROUP_NOTIFICATION_ID, groupNotification);
        }
    }

    /**
     * Show child notification
     * @param context Context
     * @param intent Intent
     */
    private void showChildNotification(Context context, Intent intent, boolean headsUp) {
        int sessionId = intent.getIntExtra(KEY_SESSION_ID, 0);
        String title = intent.getStringExtra(KEY_TITLE);
        String text = intent.getStringExtra(KEY_TEXT);
        int priority = headsUp ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT;
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/activity/SessionDetailActivity.java
// public class SessionDetailActivity extends BaseActivity {
// 
//     private static final String EXTRA_SESSION_ID = "session_id";
//     private static final String EXTRA_PARENT = "parent";
// 
//     private Class parentClass;
// 
//     public static Intent createIntent(@NonNull Context context, int sessionId, @Nullable Class<? extends Activity> parentClass) {
//         Intent intent = new Intent(context, SessionDetailActivity.class);
//         intent.putExtra(EXTRA_SESSION_ID, sessionId);
//         if (parentClass != null) {
//             intent.putExtra(EXTRA_PARENT, parentClass.getName());
//         }
//         return intent;
//     }
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         DataBindingUtil.setContentView(this, R.layout.activity_session_detail);
//         getComponent().inject(this);
// 
//         final int sessionId = getIntent().getIntExtra(EXTRA_SESSION_ID, 0);
//         String parentClassName = getIntent().getStringExtra(EXTRA_PARENT);
//         if (TextUtils.isEmpty(parentClassName)) {
//             parentClass = MainActivity.class;
//         } else {
//             try {
//                 parentClass = Class.forName(parentClassName);
//             } catch (ClassNotFoundException e) {
//                 Timber.e(e);
//             }
//         }
//         replaceFragment(SessionDetailFragmentCreator.newBuilder(sessionId).build(), R.id.content_view);
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         switch (item.getItemId()) {
//             case android.R.id.home:
//                 upToParentActivity();
//                 return true;
//         }
//         return super.onOptionsItemSelected(item);
//     }
// 
//     private void upToParentActivity() {
//         Intent upIntent = new Intent(getApplicationContext(), parentClass);
//         upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//         startActivity(upIntent);
//         finish();
//     }
// 
// }


// Path: app/src/main/java/io/github/droidkaigi/confsched2017/receiver/NotificationReceiver.java
import android.app.Notification;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.content.ContextCompat;
import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.pref.DefaultPrefs;
import io.github.droidkaigi.confsched2017.view.activity.MainActivity;
import io.github.droidkaigi.confsched2017.view.activity.SessionDetailActivity;
import timber.log.Timber;


    /**
     * Show group notification
     * @param context Context
     */
    private void showGroupNotification(Context context) {
        // Group notification is supported on Android N and Android Wear.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            Notification groupNotification = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.drawable.ic_notification)
                    .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
                    .setColor(ContextCompat.getColor(context, R.color.theme))
                    .setAutoCancel(true)
                    .setGroup(GROUP_NAME)
                    .setGroupSummary(true)
                    .build();
            NotificationManagerCompat.from(context).notify(GROUP_NOTIFICATION_ID, groupNotification);
        }
    }

    /**
     * Show child notification
     * @param context Context
     * @param intent Intent
     */
    private void showChildNotification(Context context, Intent intent, boolean headsUp) {
        int sessionId = intent.getIntExtra(KEY_SESSION_ID, 0);
        String title = intent.getStringExtra(KEY_TITLE);
        String text = intent.getStringExtra(KEY_TEXT);
        int priority = headsUp ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT;
        Intent openIntent = SessionDetailActivity.createIntent(context, sessionId, MainActivity.class);