Skip to content
Snippets Groups Projects
SedentaryStimulus.java 1.61 KiB
Newer Older
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.example.notification.Notification;
import com.example.notification.SedentaryNotification;
import com.example.stimulusStrategy.StimulusStrategy;

import java.util.Observable;

/**
 * Created by pharmacy on 09/01/2018.
 */

class SedentaryStimulus extends BroadcastReceiver implements Stimulus {
        chooseStrategy(null);
    }

    public SedentaryStimulus(StimulusStrategy s){
        chooseStrategy(s);
    }

    public Notification createNotification() {
        Notification notification = new SedentaryNotification();
        //Either further define this notification here or change to one line;
        return notification;
    }

    public void chooseStrategy(StimulusStrategy s) {
        if(s != null){
            strategy = s;
        } else{
           // strategy = defaultStrategy;
            //can no longer have default strategy in interface as strategies require context
        //Should be context.startService('selectedstrategy') but require context here first? 
    public void onReceive(Context context, Intent intent) {
        //If a condition - such as time elapsed since last notification or not night time
        //Intent data used here to configure notification?? Intent would need to be configured properly for this.