Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TimeKillerApp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Graf Jonas Till
TimeKillerApp
Commits
0bda1858
Commit
0bda1858
authored
7 years ago
by
Käppler Johannes Maximilian
Browse files
Options
Downloads
Patches
Plain Diff
Persistent storage of dates in EvalActivity
parent
9a4ab9cf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ChronoPhage_GUI/app/src/main/java/de/hdm/dp/bd/chronophage/EvalActivity.java
+34
-23
34 additions, 23 deletions
.../src/main/java/de/hdm/dp/bd/chronophage/EvalActivity.java
with
34 additions
and
23 deletions
ChronoPhage_GUI/app/src/main/java/de/hdm/dp/bd/chronophage/EvalActivity.java
+
34
−
23
View file @
0bda1858
...
...
@@ -2,6 +2,7 @@ package de.hdm.dp.bd.chronophage;
import
android.app.DatePickerDialog
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.text.InputType
;
...
...
@@ -17,7 +18,6 @@ import com.github.mikephil.charting.utils.ColorTemplate;
import
de.hdm.dp.bd.chronophage.model.Task
;
import
de.hdm.dp.bd.chronophage.model.TaskList
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
...
...
@@ -30,6 +30,7 @@ public class EvalActivity extends CommonActivity {
private
DatePickerDialog
datePickerDialogFrom
;
private
DatePickerDialog
datePickerDialogTo
;
private
PieChart
pieChart
;
private
EditText
editTextFrom
;
private
EditText
editTextTo
;
private
TaskList
taskList
;
...
...
@@ -38,7 +39,9 @@ public class EvalActivity extends CommonActivity {
private
Date
dateTo
;
private
boolean
setFrom
;
private
boolean
setTo
;
private
PieChart
pieChart
;
private
static
final
String
KEY_DATEFROM
=
"dateFrom"
;
private
static
final
String
KEY_DATETO
=
"dateTo"
;
/**
* diese Methode muss nicht verändert werden, sie baut das Kuchendiagramm auf
...
...
@@ -49,26 +52,34 @@ public class EvalActivity extends CommonActivity {
setContentView
(
R
.
layout
.
activity_eval
);
createNavigationBars
();
//Content of the pie chart
this
.
pieChart
=
(
PieChart
)
findViewById
(
R
.
id
.
chart
);
this
.
taskDatasets
=
new
ArrayList
<
TaskDataset
>();
this
.
editTextFrom
=
(
EditText
)
findViewById
(
R
.
id
.
editTextDateFrom
);
this
.
editTextTo
=
(
EditText
)
findViewById
(
R
.
id
.
editTextDateTo
);
this
.
editTextFrom
.
setInputType
(
InputType
.
TYPE_NULL
);
this
.
editTextTo
.
setInputType
(
InputType
.
TYPE_NULL
);
this
.
taskList
=
MainActivity
.
exchangeTaskList
;
this
.
taskDatasets
=
new
ArrayList
<
TaskDataset
>();
this
.
dateFrom
=
new
Date
();
this
.
dateTo
=
new
Date
();
this
.
setFrom
=
false
;
this
.
setTo
=
false
;
createTempDataset
();
PieDataSet
dataset
=
new
PieDataSet
(
getEntries
(
taskDatasets
),
"Time spent"
);
//Set the data
PieData
data
=
new
PieData
(
getLabels
(
taskDatasets
),
dataset
);
// initialize PieData
this
.
pieChart
.
setData
(
data
);
//set data into chart
dataset
.
setColors
(
ColorTemplate
.
COLORFUL_COLORS
);
// set the color
dataset
.
setValueTextSize
(
16
);
SharedPreferences
settings
=
getPreferences
(
0
);
long
tmpDateFrom
=
settings
.
getLong
(
KEY_DATEFROM
,
-
1
);
long
tmpDateTo
=
settings
.
getLong
(
KEY_DATETO
,
-
1
);
if
(
tmpDateFrom
>
0
)
{
this
.
dateFrom
.
setTime
(
tmpDateFrom
);
this
.
setFrom
=
true
;
editTextFrom
.
setText
(
dateFrom
.
toString
());
}
if
(
tmpDateTo
>
0
)
{
this
.
dateTo
.
setTime
(
tmpDateTo
);
this
.
setTo
=
true
;
editTextTo
.
setText
(
dateTo
.
toString
());
}
this
.
initDatePickerDialog
();
this
.
updateDataset
();
}
/**
...
...
@@ -142,17 +153,14 @@ public class EvalActivity extends CommonActivity {
}
else
{
tmpTaskList
=
this
.
taskList
.
getAllTasks
();
}
this
.
taskDatasets
.
clear
();
for
(
int
i
=
0
;
i
<
tmpTaskList
.
size
();
i
++)
{
Task
task
=
tmpTaskList
.
get
(
i
);
for
(
Task
task:
tmpTaskList
)
{
if
(
task
.
getDuration
()
>
0
)
{
this
.
taskDatasets
.
add
(
new
TaskDataset
(
task
.
getName
(),
task
.
getDuration
()));
}
}
PieDataSet
dataset
=
new
PieDataSet
(
getEntries
(
taskDatasets
),
"Time spent"
);
dataset
.
setColors
(
ColorTemplate
.
COLORFUL_COLORS
);
// set the color
dataset
.
setColors
(
ColorTemplate
.
COLORFUL_COLORS
);
dataset
.
setValueTextSize
(
16
);
PieData
data
=
new
PieData
(
getLabels
(
taskDatasets
),
dataset
);
this
.
pieChart
.
setData
(
data
);
...
...
@@ -168,6 +176,10 @@ public class EvalActivity extends CommonActivity {
dateFrom
=
calendar
.
getTime
();
setFrom
=
true
;
editTextFrom
.
setText
(
dateFrom
.
toString
());
SharedPreferences
settings
=
getPreferences
(
0
);
SharedPreferences
.
Editor
editor
=
settings
.
edit
();
editor
.
putLong
(
KEY_DATEFROM
,
dateFrom
.
getTime
());
editor
.
apply
();
updateDataset
();
}
},
calendar
.
get
(
Calendar
.
YEAR
),
calendar
.
get
(
Calendar
.
MONTH
),
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
));
...
...
@@ -179,15 +191,14 @@ public class EvalActivity extends CommonActivity {
dateTo
=
calendar
.
getTime
();
setTo
=
true
;
editTextTo
.
setText
(
dateTo
.
toString
());
SharedPreferences
settings
=
getPreferences
(
0
);
SharedPreferences
.
Editor
editor
=
settings
.
edit
();
editor
.
putLong
(
KEY_DATETO
,
dateTo
.
getTime
());
editor
.
apply
();
updateDataset
();
}
},
calendar
.
get
(
Calendar
.
YEAR
),
calendar
.
get
(
Calendar
.
MONTH
),
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
));
this
.
editTextFrom
=
(
EditText
)
findViewById
(
R
.
id
.
editTextDateFrom
);
this
.
editTextTo
=
(
EditText
)
findViewById
(
R
.
id
.
editTextDateTo
);
this
.
editTextFrom
.
setInputType
(
InputType
.
TYPE_NULL
);
this
.
editTextTo
.
setInputType
(
InputType
.
TYPE_NULL
);
this
.
editTextFrom
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment