Skip to content
Snippets Groups Projects
Commit b2121f6c authored by Peter Joseph De Jonckheere CESM2014's avatar Peter Joseph De Jonckheere CESM2014
Browse files

One more.

parent d3556d7b
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,23 @@ import android.widget.ProgressBar;
/**
* Created by Peter De Jonckheere on 22/01/2018.
* <p>
* The activity whihc is used when a notification is clicked on. This currently uses the main
* activity layout and is only a class on its own so that a notification click can be recorded
* in the logs.
* </p>
*/
public class NotificationClicked extends AppCompatActivity {
/**
* Called when a notification is clicked on. Sets up the layout using that which is defined in
* activity_main.xml and the delegates to further methods to set up the buttons for the page.
*
* @param savedInstanceState contains information pertaining to previous states of the activity
* if it has been used before
* @see android.support.v7.app.AppCompatActivity
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -22,15 +35,21 @@ public class NotificationClicked extends AppCompatActivity {
setUpButtons();
}
/**
* When this activity is started regardless of whether it has been created a clicked
* notification is recorded.
*/
@Override
protected void onStart(){
protected void onStart() {
super.onStart();
SaveFile.recordNotification(0,1,0,this);
SaveFile.recordNotification(0, 1, 0, this);
}
private void setUpButtons(){
Button settings = (Button)findViewById(R.id.settings);
/**
* Sets up the buttons for this page and also adds the current minute value to the progress bar.
*/
private void setUpButtons() {
Button settings = findViewById(R.id.settings);
settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......@@ -38,9 +57,10 @@ public class NotificationClicked extends AppCompatActivity {
startActivity(intent);
}
});
SharedPreferences shared = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar);
SharedPreferences shared =
this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE);
ProgressBar progress = 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));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment