<commit_before>package com.monstarlab.servicedroid.service;

import java.text.ParseException;
import java.util.Date;

import com.monstarlab.servicedroid.receiver.NotificationReceiver;
import com.monstarlab.servicedroid.util.TimeUtil;

import android.app.AlarmManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;

public class ReminderService extends Service {
	
	private TimeUtil mTimeHelper;
	
	/*@Override
	public void onStart(Intent intent, int startId) {
	    handleCommand(intent);
	}*/

	public int onStartCommand(Intent intent, int flags, int startId) {
	    return 2; // START_NOT_STICKY
	}
	
	public void onCreate() {
		mTimeHelper = new TimeUtil(this);
		scheduleReminderNotification();
		
	}
	
	private void scheduleReminderNotification() {
		Intent intent = new Intent(this, NotificationReceiver.class);
		intent.setType(Integer.toString(NotificationReceiver.TYPE_REMINDER));
		intent.setAction(Integer.toString(NotificationReceiver.TYPE_REMINDER));

		
		AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
		PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
		
		//first day of the month, around noonish
		long time = getFirstDayOfMonth();
		
		am.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);
	}
	
	private long getFirstDayOfMonth() {
		int month = TimeUtil.getCurrentMonth();
		int day = TimeUtil.getCurrentDay();
		int year = TimeUtil.getCurrentYear();
		
		if(day > 1) {
			month++;
			day = 1;
		}
		
		if(month > 12) {
			month = 1;
			year++;
		}
		
		Date d = null;
		long time = 0;
		try {
			d = mTimeHelper.parseDateText(""+year+"-"+TimeUtil.pad(month)+"-"+TimeUtil.pad(day));
			time = d.getTime();
		} catch (ParseException ex) {
			time = TimeUtil.getCurrentTime();
		}
		
		return time;
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return null;
	}

}
<commit_msg>reminder changed from showing at midnight to noon<commit_after>package com.monstarlab.servicedroid.service;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;

import com.monstarlab.servicedroid.receiver.NotificationReceiver;
import com.monstarlab.servicedroid.util.TimeUtil;

import android.app.AlarmManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;

public class ReminderService extends Service {
	
	private TimeUtil mTimeHelper;
	
	/*@Override
	public void onStart(Intent intent, int startId) {
	    handleCommand(intent);
	}*/

	public int onStartCommand(Intent intent, int flags, int startId) {
	    return 2; // START_NOT_STICKY
	}
	
	public void onCreate() {
		mTimeHelper = new TimeUtil(this);
		scheduleReminderNotification();
		
	}
	
	private void scheduleReminderNotification() {
		Intent intent = new Intent(this, NotificationReceiver.class);
		intent.setType(Integer.toString(NotificationReceiver.TYPE_REMINDER));
		intent.setAction(Integer.toString(NotificationReceiver.TYPE_REMINDER));

		
		AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
		PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
		
		//first day of the month, around noonish
		long time = getFirstDayOfMonth();
		
		am.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);
	}
	
	private long getFirstDayOfMonth() {
		long time = 0L;
		
		Calendar c = Calendar.getInstance();
		c.set(Calendar.DATE, 1); //beginning of month
		c.add(Calendar.MONTH, 1); //next month
		c.set(Calendar.HOUR_OF_DAY, 12); //at 12 noon?
		c.set(Calendar.MINUTE, 0);
		
		time = c.getTimeInMillis();
		
		return time;
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return null;
	}

}

{'fraction_non_alphanumeric': 0.1072628586197984, 'fraction_numerical': 0.005686223830447144, 'mean_word_length': 4.576368876080692, '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': '6200805', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1204, 'n_words': 274}