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

Added graph code to other screen

parent 76209379
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,12 @@ import android.view.View; ...@@ -9,6 +9,12 @@ import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import java.util.List;
/** /**
* Created by Peter De Jonckheere on 22/01/2018. * Created by Peter De Jonckheere on 22/01/2018.
* <p> * <p>
...@@ -62,5 +68,26 @@ public class NotificationClicked extends AppCompatActivity { ...@@ -62,5 +68,26 @@ public class NotificationClicked extends AppCompatActivity {
ProgressBar progress = findViewById(R.id.progressBar); ProgressBar progress = findViewById(R.id.progressBar);
progress.setMax((shared.getInt(getString(R.string.daily_goal_set), R.integer.daily_goal_minutes))); 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)); progress.setProgress(shared.getInt(getString(R.string.daily_progress), 0));
setUpGraph();
}
private void setUpGraph(){
GraphView graph = (GraphView) findViewById(R.id.graph);
List<Integer> acks = SaveFile.getWeeklyAcks(this.getApplicationContext());
DataPoint[] dataPoints = new DataPoint[7];
int j = 0;
for(int i = 0; i < acks.size(); i =+ 2){
DataPoint dp = new DataPoint(acks.get(i), acks.get(i+1));
dataPoints[j] = dp;
j++;
}
for(int i = 0; i < 7; i++){
if(dataPoints[i] == null){
dataPoints[i] = new DataPoint(0, 0);
}
}
LineGraphSeries<DataPoint> series = new LineGraphSeries<>(dataPoints);
graph.addSeries(series);
graph.setTitle(getString(R.string.your_progress));
} }
} }
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