1 |
|
|
2 |
|
package pl.magot.vetch.ancal; |
3 |
|
|
4 |
|
|
5 |
|
import java.util.Calendar; |
6 |
|
import android.content.*; |
7 |
|
|
8 |
|
|
|
|
| 95,8% |
Uncovered Elements: 1 (24) |
Complexity: 4 |
Complexity Density: 0,19 |
|
9 |
|
public class Prefs |
10 |
|
{ |
11 |
|
|
12 |
|
private final String sPrefsName = "AnCalPrefs"; |
13 |
|
private SharedPreferences prefs = null; |
14 |
|
|
15 |
|
|
16 |
|
private int iMinutesOffset; |
17 |
|
public int iMinutesDuration; |
18 |
|
public boolean b24HourMode; |
19 |
|
public int iFirstDayOfWeek; |
20 |
|
public boolean bShowAllTasks; |
21 |
|
public int iSnoozeCount; |
22 |
|
public int iSnoozeMinutesOverdue; |
23 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
24 |
32
|
public Prefs(Context ctx)... |
25 |
|
{ |
26 |
32
|
prefs = ctx.getSharedPreferences(sPrefsName, Context.MODE_WORLD_WRITEABLE); |
27 |
32
|
Load(); |
28 |
|
} |
29 |
|
|
|
|
| 91,7% |
Uncovered Elements: 1 (12) |
Complexity: 2 |
Complexity Density: 0,17 |
|
30 |
4
|
public boolean Save()... |
31 |
|
{ |
32 |
4
|
try |
33 |
|
{ |
34 |
4
|
SharedPreferences.Editor ed = prefs.edit(); |
35 |
|
|
36 |
4
|
ed.putInt("iMinutesOffset", iMinutesOffset); |
37 |
4
|
ed.putInt("iMinutesDuration", iMinutesDuration); |
38 |
4
|
ed.putBoolean("b24HourMode", b24HourMode); |
39 |
4
|
ed.putInt("iFirstDayOfWeek", iFirstDayOfWeek); |
40 |
4
|
ed.putBoolean("bShowAllTasks", bShowAllTasks); |
41 |
4
|
ed.putInt("iSnoozeCount", iSnoozeCount); |
42 |
4
|
ed.putInt("iSnoozeMinutesOverdue", iSnoozeMinutesOverdue); |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
4
|
ed.commit(); |
47 |
|
|
48 |
4
|
return true; |
49 |
|
} catch (Exception e) { |
50 |
0
|
return false; |
51 |
|
} |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0,14 |
|
54 |
33
|
public void Load()... |
55 |
|
{ |
56 |
33
|
iMinutesOffset = prefs.getInt("iMinutesOffset", 30); |
57 |
33
|
iMinutesDuration = prefs.getInt("iMinutesDuration", 15); |
58 |
33
|
b24HourMode = prefs.getBoolean("b24HourMode", false); |
59 |
33
|
iFirstDayOfWeek = prefs.getInt("iFirstDayOfWeek", Calendar.MONDAY); |
60 |
33
|
bShowAllTasks = prefs.getBoolean("bShowAllTasks", false); |
61 |
33
|
iSnoozeCount = prefs.getInt("iSnoozeCount", 5); |
62 |
33
|
iSnoozeMinutesOverdue = prefs.getInt("iSnoozeMinutesOverdue", 5); |
63 |
|
} |
64 |
|
} |