Something went wrong on our end
-
Peter Joseph De Jonckheere CESM2014 authored
Changed some services to now use onStartCommand and to stop themselves. Intent not starting service from within sedstim however, may be to do with permissions or actual intent itself.
Peter Joseph De Jonckheere CESM2014 authoredChanged some services to now use onStartCommand and to stop themselves. Intent not starting service from within sedstim however, may be to do with permissions or actual intent itself.
MainActivity.java 1.71 KiB
package com.example.pharmacy.frontEnd;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import com.example.stimulus.Stimulus;
import com.example.stimulus.SedentaryStimulus;
import com.example.stimulusStrategy.Accelerometer;
import com.example.stimulusStrategy.Clock;
import com.example.stimulusStrategy.SigMotionDetect;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setUpButtons();
setUpStimulus();
}
private void setUpButtons(){
Button settings = (Button)findViewById(R.id.settings);
settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), Settings.class);
startActivity(intent);
}
});
SharedPreferences shared = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar);
progress.setMax((shared.getInt(getString(R.string.daily_goal_set), R.integer.daily_goal_minutes)));
progress.setProgress(shared.getInt(getString(R.string.daily_progress), 0));
}
private void setUpStimulus(){
Stimulus stimulus = new SedentaryStimulus(this, new Accelerometer());
}
}