| Línea 52... |
Línea 52... |
| 52 |
import com.cesams.twogetskills.dao.SyncDao;
|
52 |
import com.cesams.twogetskills.dao.SyncDao;
|
| 53 |
import com.cesams.twogetskills.dao.TopicDao;
|
53 |
import com.cesams.twogetskills.dao.TopicDao;
|
| 54 |
import com.cesams.twogetskills.dao.UserExtendedDao;
|
54 |
import com.cesams.twogetskills.dao.UserExtendedDao;
|
| 55 |
import com.cesams.twogetskills.dao.UserLogDao;
|
55 |
import com.cesams.twogetskills.dao.UserLogDao;
|
| 56 |
import com.cesams.twogetskills.entity.UserExtended;
|
56 |
import com.cesams.twogetskills.entity.UserExtended;
|
| - |
|
57 |
import com.cesams.twogetskills.fragment.CapsuleDetail;
|
| 57 |
import com.cesams.twogetskills.fragment.CapsuleFragment;
|
58 |
import com.cesams.twogetskills.fragment.CapsuleFragment;
|
| 58 |
import com.cesams.twogetskills.fragment.CompanyFragment;
|
59 |
import com.cesams.twogetskills.fragment.CompanyFragment;
|
| 59 |
import com.cesams.twogetskills.fragment.FinishCapsuleFragment;
|
60 |
import com.cesams.twogetskills.fragment.FinishCapsuleFragment;
|
| 60 |
import com.cesams.twogetskills.fragment.FinishTopicFragment;
|
61 |
import com.cesams.twogetskills.fragment.FinishTopicFragment;
|
| 61 |
import com.cesams.twogetskills.fragment.GalleryFragment;
|
62 |
import com.cesams.twogetskills.fragment.GalleryFragment;
|
| Línea 64... |
Línea 65... |
| 64 |
import com.cesams.twogetskills.fragment.SlideFragment;
|
65 |
import com.cesams.twogetskills.fragment.SlideFragment;
|
| 65 |
import com.cesams.twogetskills.fragment.TimelineFragment;
|
66 |
import com.cesams.twogetskills.fragment.TimelineFragment;
|
| 66 |
import com.cesams.twogetskills.fragment.TopicFragment;
|
67 |
import com.cesams.twogetskills.fragment.TopicFragment;
|
| 67 |
import com.cesams.twogetskills.fragment.UserProfileFragment;
|
68 |
import com.cesams.twogetskills.fragment.UserProfileFragment;
|
| 68 |
import com.cesams.twogetskills.fragment.WelcomeFragment;
|
69 |
import com.cesams.twogetskills.fragment.WelcomeFragment;
|
| - |
|
70 |
import com.cesams.twogetskills.library.AesCipher;
|
| 69 |
import com.cesams.twogetskills.library.Http;
|
71 |
import com.cesams.twogetskills.library.Http;
|
| 70 |
import com.cesams.twogetskills.library.MD5;
|
72 |
import com.cesams.twogetskills.library.MD5;
|
| 71 |
import com.cesams.twogetskills.library.UniqueID;
|
73 |
import com.cesams.twogetskills.library.UniqueID;
|
| 72 |
import com.cesams.twogetskills.entity.Answer;
|
74 |
import com.cesams.twogetskills.entity.Answer;
|
| 73 |
import com.cesams.twogetskills.entity.Capsule;
|
75 |
import com.cesams.twogetskills.entity.Capsule;
|
| Línea 565... |
Línea 567... |
| 565 |
}
|
567 |
}
|
| Línea 566... |
Línea 568... |
| 566 |
|
568 |
|
| 567 |
@Override
|
569 |
@Override
|
| 568 |
public void signout()
|
570 |
public void signout()
|
| - |
|
571 |
{
|
| - |
|
572 |
|
| - |
|
573 |
if(isConnectedInternet()) {
|
| - |
|
574 |
|
| - |
|
575 |
|
| - |
|
576 |
try {
|
| - |
|
577 |
|
| - |
|
578 |
Http http = new Http(getCacheDir());
|
| - |
|
579 |
OkHttpClient client = http.getHttpClient(false);
|
| - |
|
580 |
|
| - |
|
581 |
Request request = new Request.Builder()
|
| - |
|
582 |
.url(Configuration.URL_SIGNOUT)
|
| - |
|
583 |
//Que parametros se necesitan para un logout?
|
| - |
|
584 |
.build();
|
| - |
|
585 |
|
| - |
|
586 |
Call call = client.newCall(request);
|
| - |
|
587 |
|
| - |
|
588 |
call.enqueue(new Callback() {
|
| - |
|
589 |
public void onResponse(Call call, Response response)
|
| - |
|
590 |
throws IOException {
|
| - |
|
591 |
|
| - |
|
592 |
Log.e("Respuesta logout",""+response);
|
| - |
|
593 |
|
| - |
|
594 |
}
|
| - |
|
595 |
public void onFailure(Call call, IOException e) {
|
| - |
|
596 |
Log.e(TAG, "Error : " + e.getMessage());
|
| - |
|
597 |
|
| - |
|
598 |
}
|
| - |
|
599 |
});
|
| - |
|
600 |
|
| - |
|
601 |
} catch (Exception e) {
|
| - |
|
602 |
showMessageSnackBar(e.getMessage());
|
| - |
|
603 |
}
|
| - |
|
604 |
}
|
| 569 |
{
|
605 |
|
| 570 |
mAppDatabase.getAnswerDao().removeAll();
|
606 |
mAppDatabase.getAnswerDao().removeAll();
|
| 571 |
mAppDatabase.getQuestionDao().removeAll();
|
607 |
mAppDatabase.getQuestionDao().removeAll();
|
| 572 |
mAppDatabase.getQuizDao().removeAll();
|
608 |
mAppDatabase.getQuizDao().removeAll();
|
| 573 |
mAppDatabase.getSlideDao().removeAll();
|
609 |
mAppDatabase.getSlideDao().removeAll();
|
| Línea 1163... |
Línea 1199... |
| 1163 |
fragment = new WelcomeFragment();
|
1199 |
fragment = new WelcomeFragment();
|
| 1164 |
// Log.e("Vete"," a welcome");
|
1200 |
// Log.e("Vete"," a welcome");
|
| 1165 |
}
|
1201 |
}
|
| 1166 |
break;
|
1202 |
break;
|
| Línea -... |
Línea 1203... |
| - |
|
1203 |
|
| - |
|
1204 |
case Constants.IDX_FRAGMENT_DETAIL_CAPSULE:
|
| - |
|
1205 |
// badgenotification.setVisibility(View.VISIBLE);
|
| - |
|
1206 |
// getSupportActionBar().show();
|
| - |
|
1207 |
// mDrawerToggle.setDrawerIndicatorEnabled(true);
|
| - |
|
1208 |
if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
|
| - |
|
1209 |
fragment = fragmentHashMap.get(fragmentKeyNuevo);
|
| - |
|
1210 |
} else {
|
| - |
|
1211 |
add = true;
|
| - |
|
1212 |
fragment = new CapsuleDetail();
|
| - |
|
1213 |
// Log.e("Vete"," a welcome");
|
| - |
|
1214 |
}
|
| - |
|
1215 |
break;
|
| 1167 |
|
1216 |
|
| 1168 |
default :
|
1217 |
default :
|
| 1169 |
// getSupportActionBar().hide();
|
1218 |
// getSupportActionBar().hide();
|
| 1170 |
// badgenotification.setVisibility(View.GONE);
|
1219 |
// badgenotification.setVisibility(View.GONE);
|
| 1171 |
if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
|
1220 |
if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
|
| Línea 1219... |
Línea 1268... |
| 1219 |
|
1268 |
|
| 1220 |
preference.setCapsuleUuidActive(capsuleUuid);
|
1269 |
preference.setCapsuleUuidActive(capsuleUuid);
|
| 1221 |
preference.setSlideUuidActive("");
|
1270 |
preference.setSlideUuidActive("");
|
| Línea 1222... |
Línea 1271... |
| 1222 |
preference.save();
|
1271 |
preference.save();
|
| - |
|
1272 |
|
| 1223 |
|
1273 |
// invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
|
| Línea 1224... |
Línea 1274... |
| 1224 |
invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
|
1274 |
invokeFragment(Constants.IDX_FRAGMENT_DETAIL_CAPSULE);
|
| 1225 |
}
|
1275 |
}
|
| 1226 |
|
1276 |
|
| Línea 2170... |
Línea 2220... |
| 2170 |
arrayCapsules = objTopic.getJSONArray("capsules");
|
2220 |
arrayCapsules = objTopic.getJSONArray("capsules");
|
| 2171 |
// Log.e("Objeto:",""+objTopic.getJSONArray("capsules"));
|
2221 |
// Log.e("Objeto:",""+objTopic.getJSONArray("capsules"));
|
| Línea 2172... |
Línea 2222... |
| 2172 |
|
2222 |
|
| 2173 |
for (j = 0; j < arrayCapsules.length(); j++) {
|
2223 |
for (j = 0; j < arrayCapsules.length(); j++) {
|
| - |
|
2224 |
objCapsule = arrayCapsules.getJSONObject(j);
|
| 2174 |
objCapsule = arrayCapsules.getJSONObject(j);
|
2225 |
Log.e("Capsula:",""+objCapsule.toString());
|
| 2175 |
uuid = objCapsule.getString("uuid");
|
2226 |
uuid = objCapsule.getString("uuid");
|
| 2176 |
capsule = capsuleDao.selectByUuid(uuid);
|
2227 |
capsule = capsuleDao.selectByUuid(uuid);
|
| 2177 |
if(capsule == null) {
|
2228 |
if(capsule == null) {
|
| 2178 |
capsule = new Capsule();
|
2229 |
capsule = new Capsule();
|
| Línea 2182... |
Línea 2233... |
| 2182 |
capsule.setDescription(objCapsule.getString("description"));
|
2233 |
capsule.setDescription(objCapsule.getString("description"));
|
| 2183 |
capsule.setImage(objCapsule.getString("image"));
|
2234 |
capsule.setImage(objCapsule.getString("image"));
|
| 2184 |
capsule.setPosition(objCapsule.getInt("position"));
|
2235 |
capsule.setPosition(objCapsule.getInt("position"));
|
| 2185 |
capsule.setAddedOn(objCapsule.getString("added_on"));
|
2236 |
capsule.setAddedOn(objCapsule.getString("added_on"));
|
| 2186 |
capsule.setUpdatedOn(objCapsule.getString("updated_on"));
|
2237 |
capsule.setUpdatedOn(objCapsule.getString("updated_on"));
|
| - |
|
2238 |
capsule.setLink_comments(objCapsule.getString("link_comments"));
|
| - |
|
2239 |
capsule.setLink_comment_add(objCapsule.getString("link_comment_add"));
|
| - |
|
2240 |
capsule.setTotal_comments(objCapsule.getInt("total_comments"));
|
| - |
|
2241 |
capsule.setTotal_rating(objCapsule.getInt("total_rating"));
|
| - |
|
2242 |
|
| - |
|
2243 |
Log.e("link1",""+objCapsule.getString("link_comments"));
|
| - |
|
2244 |
Log.e("link2",""+objCapsule.getString("link_comment_add"));
|
| - |
|
2245 |
Log.e("totalcom",""+objCapsule.getInt("total_comments"));
|
| - |
|
2246 |
Log.e("totalta",""+objCapsule.getInt("total_rating"));
|
| - |
|
2247 |
|
| 2187 |
// Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
|
2248 |
// Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
|
| 2188 |
capsuleDao.insert(capsule);
|
2249 |
capsuleDao.insert(capsule);
|
| - |
|
2250 |
|
| 2189 |
} else {
|
2251 |
} else {
|
| 2190 |
capsule = new Capsule();
|
2252 |
capsule = new Capsule();
|
| 2191 |
capsule.setTopicUuid(topic.getUuid());
|
2253 |
capsule.setTopicUuid(topic.getUuid());
|
| 2192 |
capsule.setName(objCapsule.getString("name"));
|
2254 |
capsule.setName(objCapsule.getString("name"));
|
| 2193 |
capsule.setDescription(objCapsule.getString("description"));
|
2255 |
capsule.setDescription(objCapsule.getString("description"));
|
| 2194 |
capsule.setImage(objCapsule.getString("image"));
|
2256 |
capsule.setImage(objCapsule.getString("image"));
|
| 2195 |
capsule.setPosition(objCapsule.getInt("position"));
|
2257 |
capsule.setPosition(objCapsule.getInt("position"));
|
| 2196 |
capsule.setAddedOn(objCapsule.getString("added_on"));
|
2258 |
capsule.setAddedOn(objCapsule.getString("added_on"));
|
| 2197 |
capsule.setUpdatedOn(objCapsule.getString("updated_on"));
|
2259 |
capsule.setUpdatedOn(objCapsule.getString("updated_on"));
|
| - |
|
2260 |
capsule.setLink_comments(objCapsule.getString("link_comments"));
|
| - |
|
2261 |
capsule.setLink_comment_add(objCapsule.getString("link_comment_add"));
|
| - |
|
2262 |
capsule.setTotal_comments(objCapsule.getInt("total_comments"));
|
| - |
|
2263 |
capsule.setTotal_rating(objCapsule.getInt("total_rating"));
|
| 2198 |
// Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
|
2264 |
// Log.e("Capsula ","added on"+objCapsule.getString("added_on"));
|
| 2199 |
capsuleDao.update(capsule);
|
2265 |
capsuleDao.update(capsule);
|
| 2200 |
}
|
2266 |
}
|