Proyectos de Subversion Android Microlearning

Rev

Rev 1 | Rev 22 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
package com.cesams.twogetskills.preference;
2
 
3
import android.content.Context;
4
import android.content.SharedPreferences;
5
import com.cesams.twogetskills.Constants;
6
 
7
public class Preference {
8
    private String userUuid;
9
 
10
    private String email;
11
    private String firstName;
12
    private String lastName;
13
    private String maxDateChanges;
14
    private String lastDataRefresh;
15
    private String image;
16
    private String password;
17
    private String aes;
18
    private int fragmentIdxActive;
19
    private String topicUuidActive;
20
    private String capsuleUuidActive;
21
    private String lastCapsuleUuidActive;
20 gabriel 22
    private String slideNameActive;
1 efrain 23
    private String slideUuidActive;
24
    private String companyUuidActive;
25
 
26
    private int companyCount;
27
 
28
    //Device
29
    private String deviceUuid;
30
    private String deviceToken;
31
 
32
    public String getUserUuid() {
33
        return userUuid;
34
    }
35
    public void setUserUuid(String userUuid) {
36
        this.userUuid = userUuid;
37
    }
38
 
20 gabriel 39
    public String getSlideName() {
40
        return slideNameActive;
41
    }
42
 
43
    public void setSlideName(String slideNameActive) {
44
        this.slideNameActive = slideNameActive;
45
    }
46
 
1 efrain 47
    public String getEmail() {
48
        return email;
49
    }
50
 
51
    public void setEmail(String email) {
52
        this.email = email;
53
    }
54
 
55
    public String getFirstName() {
56
        return firstName;
57
    }
58
 
59
    public void setFirstName(String firstName) {
60
        this.firstName = firstName;
61
    }
62
 
63
    public String getLastName() {
64
        return lastName;
65
    }
66
 
67
    public void setLastName(String lastName) {
68
        this.lastName = lastName;
69
    }
70
 
71
    public String getMaxDateChanges() {
72
        return maxDateChanges;
73
    }
74
 
75
    public void setMaxDateChanges(String maxDateChanges) {
76
        this.maxDateChanges = maxDateChanges;
77
    }
78
 
79
    public String getLastDataRefresh() {
80
        return lastDataRefresh;
81
    }
82
 
83
    public void setLastDataRefresh(String lastDataRefresh) {
84
        this.lastDataRefresh = lastDataRefresh;
85
    }
86
 
87
    public String getImage() {
88
        return image;
89
    }
90
 
91
    public void setImage(String image) {
92
        this.image = image;
93
    }
94
 
95
    public String getPassword() {
96
        return password;
97
    }
98
 
99
    public void setPassword(String password) {
100
        this.password = password;
101
    }
102
 
103
    public String getAes() {
104
        return aes;
105
    }
106
 
107
    public void setAes(String aes) {
108
        this.aes = aes;
109
    }
110
 
111
    public int getFragmentIdxActive() {
112
        return fragmentIdxActive;
113
    }
114
 
115
    public void setFragmentIdxActive(int fragmentIdxActive) {
116
        this.fragmentIdxActive = fragmentIdxActive;
117
    }
118
 
119
    public String getTopicUuidActive() {
120
        return topicUuidActive;
121
    }
122
 
123
    public void setTopicUuidActive(String topicUuidActive) {
124
        this.topicUuidActive = topicUuidActive;
125
    }
126
 
127
    public String getCapsuleUuidActive() {
128
        return capsuleUuidActive;
129
    }
130
 
131
    public void setCapsuleUuidActive(String capsuleUuidActive) {
132
        this.capsuleUuidActive = capsuleUuidActive;
133
    }
134
 
135
    public String getSlideUuidActive() {
136
        return slideUuidActive;
137
    }
138
 
139
    public void setSlideUuidActive(String slideUuidActive) {
140
        this.slideUuidActive = slideUuidActive;
141
    }
142
 
143
    public String getCompanyUuidActive() {
144
        return companyUuidActive;
145
    }
146
 
147
    public void setCompanyUuidActive(String companyUuidActive) {
148
        this.companyUuidActive = companyUuidActive;
149
    }
150
 
151
    public String getLastCapsuleUuidActive() {
152
        return lastCapsuleUuidActive;
153
    }
154
 
155
    public void setLastCapsuleUuidActive(String lastCapsuleUuidActive) {
156
        this.lastCapsuleUuidActive = lastCapsuleUuidActive;
157
    }
158
 
159
    public int getCompanyCount() {
160
        return companyCount;
161
    }
162
 
163
    public void setCompanyCount(int companyCount) {
164
        this.companyCount = companyCount;
165
    }
166
 
167
    public String getDeviceUuid() {
168
        return deviceUuid;
169
    }
170
 
171
    public void setDeviceUuid(String deviceUuid) {
172
        this.deviceUuid = deviceUuid;
173
    }
174
 
175
    public String getDeviceToken() {
176
        return deviceToken;
177
    }
178
 
179
    public void setDeviceToken(String deviceToken) {
180
        this.deviceToken = deviceToken;
181
    }
182
 
183
    public Preference(Context context) {
184
        SharedPreferences sharedPreferences = context.getSharedPreferences(
185
                Constants.PREFERENCE_FILENAME, Context.MODE_PRIVATE);
186
 
187
        deviceUuid = sharedPreferences.getString("device_uuid" , "");
188
        deviceToken = sharedPreferences.getString("device_token" , "");
189
        userUuid = sharedPreferences.getString("user_uuid", "");
190
        email = sharedPreferences.getString("email", "");
191
        firstName = sharedPreferences.getString("first_name", "");
192
        lastName = sharedPreferences.getString("last_name", "");
193
        image = sharedPreferences.getString("image", "");
194
 
195
        maxDateChanges = sharedPreferences.getString("max_date_changes", "");
196
        lastDataRefresh = sharedPreferences.getString("last_date_refresh", "");
197
 
198
        password = sharedPreferences.getString("password", "");
199
        aes = sharedPreferences.getString("aes", "");
200
 
201
        fragmentIdxActive = sharedPreferences.getInt("fragment_idx_active", Constants.IDX_FRAGMENT_INTRO);
202
        topicUuidActive = sharedPreferences.getString("topic_uuid_active", "");
203
        capsuleUuidActive = sharedPreferences.getString("capsule_uuid_active", "");
204
        slideUuidActive = sharedPreferences.getString("slide_uuid_active", "");
205
        companyUuidActive = sharedPreferences.getString("company_uuid_active", "");
206
        companyCount = sharedPreferences.getInt("company_count", 0);
207
        lastCapsuleUuidActive = sharedPreferences.getString("last_capsule_uuid_active", "");
20 gabriel 208
        slideNameActive = sharedPreferences.getString("last_slidename","");
1 efrain 209
 
210
    }
211
 
212
    public void save(Context context)
213
    {
214
        SharedPreferences sharedPreferences = context.getSharedPreferences(
215
                Constants.PREFERENCE_FILENAME, Context.MODE_PRIVATE);
216
 
217
        SharedPreferences.Editor editor = sharedPreferences.edit();
218
        editor.putString("device_uuid" , deviceUuid);
219
        editor.putString("device_token" , deviceToken);
220
        editor.putString("user_uuid", userUuid);
221
        editor.putString("email", email);
222
        editor.putString("first_name", firstName);
223
        editor.putString("last_name", lastName);
224
        editor.putString("image", image);
225
        editor.putString("max_date_changes", maxDateChanges);
226
        editor.putString("last_date_refresh", lastDataRefresh);
20 gabriel 227
        editor.putString("last_slidename",slideNameActive);
1 efrain 228
        editor.putString("password", password);
229
        editor.putString("aes", aes);
230
 
231
 
232
        editor.putInt("fragment_idx_active", fragmentIdxActive);
233
        editor.putString("topic_uuid_active", topicUuidActive);
234
        editor.putString("capsule_uuid_active", capsuleUuidActive);
235
        editor.putString("slide_uuid_active", slideUuidActive);
236
        editor.putString("company_uuid_active", companyUuidActive);
237
        editor.putInt("company_count", companyCount);
238
        editor.putString("last_capsule_uuid_active", lastCapsuleUuidActive);
239
 
240
        editor.commit();
241
    }
242
}