<commit_before>package com.nilhcem.droidcontn.receiver.reminder;

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 com.nilhcem.droidcontn.R;
import com.nilhcem.droidcontn.data.app.model.Session;
import com.nilhcem.droidcontn.ui.sessions.details.SessionDetailsActivity;
import com.nilhcem.droidcontn.utils.Preconditions;

import timber.log.Timber;

public class ReminderReceiver extends BroadcastReceiver {

    private static final String EXTRA_SESSION = "session";

    public static Intent createReceiverIntent(Context context, Session session) {
        Intent intent = new Intent(context, ReminderReceiver.class);
        intent.putExtra(EXTRA_SESSION, session);
        return intent;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        Timber.d("Received session reminder");
        Session session = intent.getParcelableExtra(EXTRA_SESSION);
        Preconditions.checkArgument(session != null);
        showNotification(context, session);
    }

    private void showNotification(Context context, Session session) {
        Intent sessionIntent = SessionDetailsActivity.createIntent(context, session);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, session.getId(), sessionIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        Notification notification = new NotificationCompat.Builder(context)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle(context.getString(R.string.app_name))
                .setContentText(context.getString(R.string.reminder_about_to_start, session.getTitle()))
                .setContentIntent(pendingIntent)
                .setDefaults(Notification.DEFAULT_ALL)
                .setAutoCancel(true)
                .build();

        NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(session.getId(), notification);
    }
}
<commit_msg>Add parent stack when starting SessionDetailsActivity from notification<commit_after>package com.nilhcem.droidcontn.receiver.reminder;

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.v4.app.TaskStackBuilder;
import android.support.v7.app.NotificationCompat;

import com.nilhcem.droidcontn.R;
import com.nilhcem.droidcontn.data.app.model.Session;
import com.nilhcem.droidcontn.ui.sessions.details.SessionDetailsActivity;
import com.nilhcem.droidcontn.utils.Preconditions;

import timber.log.Timber;

public class ReminderReceiver extends BroadcastReceiver {

    private static final String EXTRA_SESSION = "session";

    public static Intent createReceiverIntent(Context context, Session session) {
        Intent intent = new Intent(context, ReminderReceiver.class);
        intent.putExtra(EXTRA_SESSION, session);
        return intent;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        Timber.d("Received session reminder");
        Session session = intent.getParcelableExtra(EXTRA_SESSION);
        Preconditions.checkArgument(session != null);
        showNotification(context, session);
    }

    private void showNotification(Context context, Session session) {
        PendingIntent pendingIntent = TaskStackBuilder.create(context)
                .addParentStack(SessionDetailsActivity.class)
                .addNextIntent(SessionDetailsActivity.createIntent(context, session))
                .getPendingIntent(session.getId(), PendingIntent.FLAG_UPDATE_CURRENT);

        Notification notification = new NotificationCompat.Builder(context)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle(context.getString(R.string.app_name))
                .setContentText(context.getString(R.string.reminder_about_to_start, session.getTitle()))
                .setContentIntent(pendingIntent)
                .setDefaults(Notification.DEFAULT_ALL)
                .setAutoCancel(true)
                .build();

        NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(session.getId(), notification);
    }
}

{'fraction_non_alphanumeric': 0.08495304651670671, 'fraction_numerical': 0.0006551648831622625, 'mean_word_length': 3.8775292864749735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5662353', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1178, 'n_words': 215}