Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 65 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 65 Rev 66
Línea 53... Línea 53...
53
 * Use the {@link WelcomeFragment#newInstance} factory method to
53
 * Use the {@link WelcomeFragment#newInstance} factory method to
54
 * create an instance of this fragment.
54
 * create an instance of this fragment.
55
 */
55
 */
56
public class WelcomeFragment extends Fragment implements TabsCapsulesAdapter.ClickListener, LifecycleOwner {
56
public class WelcomeFragment extends Fragment implements TabsCapsulesAdapter.ClickListener, LifecycleOwner {
Línea 57... Línea 57...
57
 
57
 
58
    TextView username, titulotarjeta, progresoporcentaje, empezar; ProgressBar progresotarjeta;
58
    TextView username, titulotarjeta, progresoporcentaje, empezar, ningunelemento; ProgressBar progresotarjeta;
59
    private ITwoGetSkills iTwoGetSkills; View card;
59
    private ITwoGetSkills iTwoGetSkills; View card;
60
    ArrayList<HashMap<String, String>> capsuleList;
60
    ArrayList<HashMap<String, String>> capsuleList;
61
    ImageView imagetarjeta;
61
    ImageView imagetarjeta;
62
    TabsCapsulesAdapter adapter2;
62
    TabsCapsulesAdapter adapter2;
Línea 87... Línea 87...
87
        iTwoGetSkills = (ITwoGetSkills) getActivity();
87
        iTwoGetSkills = (ITwoGetSkills) getActivity();
Línea 88... Línea 88...
88
 
88
 
Línea 89... Línea 89...
89
 
89
 
90
        View view= inflater.inflate(R.layout.fragment_welcome, container, false);
90
        View view= inflater.inflate(R.layout.fragment_welcome, container, false);
91
 
91
 
92
        username=view.findViewById(R.id.textView14);
92
        username=view.findViewById(R.id.textView14); ningunelemento=view.findViewById(R.id.textView25);
93
        textowelcome= view.findViewById(R.id.textView15);
93
        textowelcome= view.findViewById(R.id.textView15);
Línea 267... Línea 267...
267
                capsuleList.clear();
267
                capsuleList.clear();
Línea 268... Línea 268...
268
 
268
 
269
                loadContinuecard();
269
                loadContinuecard();
Línea -... Línea 270...
-
 
270
                loadData("pendientes","");
-
 
271
 
-
 
272
                if (capsuleList.size() == 0) //Si no tenemos capsulas pendientes nos vamos a en curso
-
 
273
                {
-
 
274
                    capsuleList.clear();
-
 
275
                    loadData("cursando","");
-
 
276
 
-
 
277
                    tabs.selectTab(tabs.getTabAt(1),true);
-
 
278
 
-
 
279
                }
-
 
280
                else
-
 
281
                {
-
 
282
                    tabs.selectTab(tabs.getTabAt(0),true);
270
                loadData("pendientes","");
283
 
Línea 271... Línea -...
271
 
-
 
Línea 272... Línea 284...
272
                adapter2.notifyDataSetChanged();
284
                }
Línea 273... Línea 285...
273
 
285
                adapter2.notifyDataSetChanged();
274
                tabs.getTabAt(0).select();
286
 
Línea 275... Línea 287...
275
 
287
 
Línea 276... Línea 288...
276
            });
288
            });
Línea 277... Línea 289...
277
 
289
 
278
 
290
 
279
        }
291
        }
280
    }
292
    }
Línea 294... Línea 306...
294
        for(Capsule dbCapsule : dbCapsules)
306
        for(Capsule dbCapsule : dbCapsules)
295
        {
307
        {
296
            progress = progressDao.selectByCapsuleUuid(dbCapsule.getUuid());
308
            progress = progressDao.selectByCapsuleUuid(dbCapsule.getUuid());
Línea 297... Línea 309...
297
 
309
 
-
 
310
            if (progress != null) {
-
 
311
              //  Log.e("Capsula para"," continuar "+dbCapsule.getUuid());
-
 
312
 
-
 
313
            if (progress.getProgress() <=100 && progress.getCompleted()==0)
-
 
314
                {
-
 
315
                    titulotarjeta.setText(dbCapsule.getName());
Línea -... Línea 316...
-
 
316
                    if (dbCapsule.getImage() != null && !dbCapsule.getImage().equals("")) {
-
 
317
 
-
 
318
                        TimeZone timeZone = TimeZone.getTimeZone("UTC");
-
 
319
                        Calendar calendar = Calendar.getInstance(timeZone);
-
 
320
                        TimeZone tz = calendar.getTimeZone();
-
 
321
                        int created = (int) (calendar.getTimeInMillis() / 1000);
-
 
322
 
-
 
323
                        Random random = new Random(created);
-
 
324
                        int rand = 1000 + random.nextInt(8999);
-
 
325
 
-
 
326
 
-
 
327
                        String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
-
 
328
                        String password = iTwoGetSkills.getPreference().getPassword();
-
 
329
 
-
 
330
 
-
 
331
                        String secret = MD5.generar(password + ':' + created + ':' + rand);
-
 
332
                        GlideUrl url = new GlideUrl(dbCapsule.getImage(), new LazyHeaders.Builder()
-
 
333
                                .addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
-
 
334
                                .addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
-
 
335
                                .addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
-
 
336
                                .addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
-
 
337
                                .addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
-
 
338
                                .build());
-
 
339
 
-
 
340
                        RequestOptions options = new RequestOptions()
-
 
341
                                .diskCacheStrategy(DiskCacheStrategy.ALL);
-
 
342
 
-
 
343
                        Glide.with(getContext()).load(url)
-
 
344
                                .thumbnail()
-
 
345
                                .apply(options)
-
 
346
                                .into(imagetarjeta);
-
 
347
                        iTwoGetSkills.setCapsulaActiva(dbCapsule.getUuid());
298
            if (progress != null) {
348
                    }
299
 
349
                }
300
                    if (progress.getProgress() < 100) {
350
                    if (progress.getProgress() < 100 && progress.getCompleted()==0) {
301
                       // Log.e("Es menor"," a 100");
351
                       // Log.e("Es menor"," a 100");
302
                        continues=true;
352
                        continues=true;
303
                        titulotarjeta.setText(dbCapsule.getName());
353
                        titulotarjeta.setText(dbCapsule.getName());
Línea 783... Línea 833...
783
           }
833
           }
784
    }
834
    }
785
                }}}
835
                }}}
Línea -... Línea 836...
-
 
836
 
-
 
837
 
-
 
838
       if(capsuleList.size() == 0)
-
 
839
       {
-
 
840
           ningunelemento.setVisibility(View.VISIBLE);
-
 
841
       }
-
 
842
       else
-
 
843
       {
-
 
844
           ningunelemento.setVisibility(View.GONE);
786
 
845
       }
Línea 787... Línea 846...
787
 
846
 
788
    }
847
    }