<commit_before>package org.literacyapp.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import org.literacyapp.facerecognition.StudentImageCollectionActivity;

import java.util.Calendar;

/**
 * If more than 30 minutes have passed since the last StudentImageCollection event, open iamge
 * collection activity.
 */
public class ScreenOnReceiver extends BroadcastReceiver {

    private static final String PREF_LAST_STUDENT_IMAGE_COLLECTION = "pref_last_student_image_collection";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(getClass().getName(), "onReceive");

        Calendar calendarLastCollectionEvent = null;
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        long timeOfLastCollectionInMillis = sharedPreferences.getLong(PREF_LAST_STUDENT_IMAGE_COLLECTION, 0);
        if (timeOfLastCollectionInMillis > 0) {
            calendarLastCollectionEvent = Calendar.getInstance();
            calendarLastCollectionEvent.setTimeInMillis(timeOfLastCollectionInMillis);
            Log.i(getClass().getName(), "calendarLastCollectionEvent.getTime(): " + calendarLastCollectionEvent.getTime());
        }
        Calendar calendar30MinutesAgo = Calendar.getInstance();
        calendar30MinutesAgo.add(Calendar.MINUTE, -30);
        Log.i(getClass().getName(), "calendar30MinutesAgo.getTime(): " + calendar30MinutesAgo.getTime());
        if ((calendarLastCollectionEvent == null) || (calendarLastCollectionEvent.before(calendar30MinutesAgo))) {
            Intent studentImageCollectionIntent = new Intent(context, StudentImageCollectionActivity.class);
            studentImageCollectionIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(studentImageCollectionIntent);

            sharedPreferences.edit().putLong(PREF_LAST_STUDENT_IMAGE_COLLECTION, Calendar.getInstance().getTimeInMillis()).commit();
        }
    }
}<commit_msg>#186 Skip StudentImageCollectionActivity until fixed<commit_after>package org.literacyapp.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import java.util.Calendar;

/**
 * If more than 30 minutes have passed since the last StudentImageCollection event, open iamge
 * collection activity.
 */
public class ScreenOnReceiver extends BroadcastReceiver {

    private static final String PREF_LAST_STUDENT_IMAGE_COLLECTION = "pref_last_student_image_collection";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(getClass().getName(), "onReceive");

        Calendar calendarLastCollectionEvent = null;
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        long timeOfLastCollectionInMillis = sharedPreferences.getLong(PREF_LAST_STUDENT_IMAGE_COLLECTION, 0);
        if (timeOfLastCollectionInMillis > 0) {
            calendarLastCollectionEvent = Calendar.getInstance();
            calendarLastCollectionEvent.setTimeInMillis(timeOfLastCollectionInMillis);
            Log.i(getClass().getName(), "calendarLastCollectionEvent.getTime(): " + calendarLastCollectionEvent.getTime());
        }
        Calendar calendar30MinutesAgo = Calendar.getInstance();
        calendar30MinutesAgo.add(Calendar.MINUTE, -30);
        Log.i(getClass().getName(), "calendar30MinutesAgo.getTime(): " + calendar30MinutesAgo.getTime());
        if ((calendarLastCollectionEvent == null) || (calendarLastCollectionEvent.before(calendar30MinutesAgo))) {
//            Intent studentImageCollectionIntent = new Intent(context, StudentImageCollectionActivity.class);
//            studentImageCollectionIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//            context.startActivity(studentImageCollectionIntent);
//
//            sharedPreferences.edit().putLong(PREF_LAST_STUDENT_IMAGE_COLLECTION, Calendar.getInstance().getTimeInMillis()).commit();
        }
    }
}
{'fraction_non_alphanumeric': 0.09061109810348865, 'fraction_numerical': 0.008194802154062281, 'mean_word_length': 4.734228187919463, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5628299', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1083, 'n_words': 190}