<commit_before>package com.reiyu.sleepin;
/**
 * Created by Satomi on 1/16/16.
 */

import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.NotificationCompat;
import android.util.Log;

import com.commonsware.cwac.wakeful.WakefulIntentService;

import java.util.Calendar;
import java.util.Random;

public class SessionReceiver extends BroadcastReceiver {
    private static final int alarm1 = 1;
    private static final int alarm2 = 2;
    private static final int alarm3 = 3;
    private static final int alarm4 = 4;
    private static final int alarm5 = 5;
    private static final int alarm6 = 6;
    private static final int alarm7 = 7;
    private static final int alarm8 = 8;

    private static final int alarm10 = 10;

    @Override
    public void onReceive(Context context, Intent intent) {
        int alarm_id = intent.getIntExtra("@string/alarm_id", 0);
        Intent intentNew;
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        if ((alarm_id > 0) && (alarm_id < 10)) {
            intentNew = new Intent(context, ReflectFragment.class);
            PendingIntent pendingIntent = PendingIntent.getActivity(context, alarm_id, intentNew, 0);

            Notification notification = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.mipmap.ic_launcher)
                    .setTicker("振り返りの時間です！")
                    .setWhen(System.currentTimeMillis())
                    .setContentTitle("振り返りの時間です！")
                    .setContentText("タップして振り返る")
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentIntent(pendingIntent)
                    .build();

            notificationManager.cancelAll();
            notificationManager.notify(R.string.app_name, notification);
        } else if (alarm_id == 10) {
            intentNew = new Intent(context, MainActivity.class);
            PendingIntent pendingIntent = PendingIntent.getActivity(context, alarm_id, intentNew, 0);

            Notification notification = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.mipmap.ic_launcher)
                    .setTicker("Session開始です！")
                    .setWhen(System.currentTimeMillis())
                    .setContentTitle("Session開始です！")
                    .setContentText("起床記録も忘れずにつけて下さい！")
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentIntent(pendingIntent)
                    .build();

            notificationManager.cancelAll();
            notificationManager.notify(R.string.app_name, notification);
        } else {
            if (intent.getAction() == null) {
                WakefulIntentService.sendWakefulWork(context, SessionService.class);
            } else {
                Log.e("SessionReceiver", "getAction() is not null");<commit_msg>fix request_code of alarm<commit_after>package com.reiyu.sleepin;
/**
 * Created by Satomi on 1/16/16.
 */

import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.NotificationCompat;
import android.util.Log;

import com.commonsware.cwac.wakeful.WakefulIntentService;

import java.util.Calendar;
import java.util.Random;

public class SessionReceiver extends BroadcastReceiver {
    private static final int alarm1 = 1;
    private static final int alarm2 = 2;
    private static final int alarm3 = 3;
    private static final int alarm4 = 4;
    private static final int alarm5 = 5;
    private static final int alarm6 = 6;
    private static final int alarm7 = 7;
    private static final int alarm8 = 8;

    private static final int alarm10 = 10;

    @Override
    public void onReceive(Context context, Intent intent) {
        int alarm_id = intent.getIntExtra("@string/alarm_id", 0);
        Intent intentNew;
        NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        if ((alarm_id > 0) && (alarm_id < 10)) {
            intentNew = new Intent(context, ReflectFragment.class);
            intentNew.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

            PendingIntent pendingIntent = PendingIntent.getActivity(context, alarm_id, intentNew, PendingIntent.FLAG_CANCEL_CURRENT);

            Notification notification = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.mipmap.icon)
                    .setTicker("振り返りの時間です！")
                    .setWhen(System.currentTimeMillis())
                    .setContentTitle("振り返りの時間です！")
                    .setContentText("タップして振り返る")
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentIntent(pendingIntent)
                    .build();

            notificationManager.cancelAll();
            notificationManager.notify(R.string.app_name, notification);
        } else if (alarm_id == 10) {
            intentNew = new Intent(context, MainActivity.class);
            PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intentNew, 0);

            Notification notification = new NotificationCompat.Builder(context)
                    .setSmallIcon(R.mipmap.icon)
                    .setTicker("Session開始です！")
                    .setWhen(System.currentTimeMillis())
                    .setContentTitle("Session開始です！")
                    .setContentText("起床記録も忘れずにつけて下さい！")
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentIntent(pendingIntent)
                    .build();

            notificationManager.cancelAll();
            notificationManager.notify(R.string.app_name, notification);
        } else {
            if (intent.getAction() == null) {
                WakefulIntentService.sendWakefulWork(context, SessionService.class);
            } else {
                Log.e("SessionReceiver", "getAction() is not null");
{'fraction_non_alphanumeric': 0.08949599623174753, 'fraction_numerical': 0.010676715339927775, 'mean_word_length': 2.5193370165745854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1794451', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1684, 'n_words': 360}