Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 45 | Rev 48 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 45 Rev 46
Línea 15... Línea 15...
15
import android.app.NotificationChannel;
15
import android.app.NotificationChannel;
16
import android.app.NotificationManager;
16
import android.app.NotificationManager;
17
import android.app.PendingIntent;
17
import android.app.PendingIntent;
18
import android.content.ContentResolver;
18
import android.content.ContentResolver;
19
import android.content.DialogInterface;
19
import android.content.DialogInterface;
20
import android.graphics.drawable.AnimationDrawable;
-
 
21
import android.net.ConnectivityManager;
20
import android.net.ConnectivityManager;
22
import android.os.Build;
21
import android.os.Build;
23
import android.os.Handler;
22
import android.os.Handler;
24
import android.os.Looper;
23
import android.os.Looper;
25
import android.text.TextUtils;
24
import android.text.TextUtils;
Línea 29... Línea 28...
29
import android.content.IntentFilter;
28
import android.content.IntentFilter;
30
import android.os.Bundle;
29
import android.os.Bundle;
31
import android.view.Menu;
30
import android.view.Menu;
32
import android.view.MenuItem;
31
import android.view.MenuItem;
33
import android.view.View;
32
import android.view.View;
34
import android.widget.ImageView;
-
 
35
import android.widget.PopupMenu;
33
import android.widget.PopupMenu;
36
import android.widget.ProgressBar;
34
import android.widget.ProgressBar;
37
import android.widget.TextView;
35
import android.widget.TextView;
38
import android.widget.Toast;
36
import android.widget.Toast;
Línea 133... Línea 131...
133
    private HashMap<String, Fragment> fragmentHashMap;
131
    private HashMap<String, Fragment> fragmentHashMap;
134
    private TextView textViewMessageNotConnection;
132
    private TextView textViewMessageNotConnection;
Línea 135... Línea 133...
135
 
133
 
Línea 136... Línea -...
136
    BottomNavigationView mNavigationView;
-
 
137
 
-
 
138
 
134
    BottomNavigationView mNavigationView;
139
 
135
 
140
    private Preference preference;
136
    private Preference preference;
141
    private boolean connected = false;
137
    private boolean connected = false;
142
    private ConnectivityReceiver mConnectivityReceiver;
138
    private ConnectivityReceiver mConnectivityReceiver;
Línea 194... Línea 190...
194
                sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, preference.getDeviceToken());
190
                sync = new Sync(Constants.SYNC_ADAPTER_TYPE_FCM, preference.getDeviceToken());
195
                mAppDatabase.getSyncDao().insert(sync);
191
                mAppDatabase.getSyncDao().insert(sync);
196
            }
192
            }
197
        }
193
        }
Línea 198... Línea -...
198
 
-
 
199
 
-
 
200
 
-
 
201
 
194
 
202
        /**** CANAL DE NOTIFICACIONES **/
195
        /**** CANAL DE NOTIFICACIONES **/
-
 
196
        createNotificationChannel();
-
 
197
       // badgenotification= findViewById(R.id.cart_badge);
Línea 203... Línea 198...
203
        createNotificationChannel();
198
 
204
 
199
 
Línea 205... Línea 200...
205
        /*** CUENTAS DE SINCRONIZACION **/
200
        /*** CUENTAS DE SINCRONIZACION **/
Línea 223... Línea 218...
223
 
218
 
Línea 224... Línea 219...
224
        fragmentHashMap = new HashMap<>();
219
        fragmentHashMap = new HashMap<>();
225
 
220
 
226
        mProgressBar = findViewById(R.id.progressBar);
221
        mProgressBar = findViewById(R.id.progressBar);
227
        mToolbar = findViewById(R.id.toolbar);
222
        mToolbar = findViewById(R.id.toolbar);
228
        mToolbar.setOverflowIcon(ContextCompat.getDrawable(getApplicationContext(), R.drawable.notifications));
223
        mToolbar.setOverflowIcon(ContextCompat.getDrawable(getApplicationContext(), R.drawable.toolbarnotifi));
Línea 229... Línea 224...
229
        setSupportActionBar(findViewById(R.id.toolbar));
224
        setSupportActionBar(findViewById(R.id.toolbar));
Línea 328... Línea 323...
328
                FirebaseMessaging.getInstance().setAutoInitEnabled(true);
323
                FirebaseMessaging.getInstance().setAutoInitEnabled(true);
329
            }
324
            }
330
        }, 10000);
325
        }, 10000);
Línea 331... Línea 326...
331
 
326
 
-
 
327
        if (getIntent().getExtras() != null) {
-
 
328
 
-
 
329
            for (String key : getIntent().getExtras().keySet()) {
-
 
330
                Object value = getIntent().getExtras().get(key);
-
 
331
                if(value.toString().equals("content-refresh"))
332
        if (getIntent().getExtras() != null) {
332
                    {
333
            //Vengo de notificacion, pero el app estaba cerrada, asi que muestro el cartel de content-refresh
333
                        //Vengo de notificacion, pero el app estaba cerrada, asi que muestro el cartel de content-refresh
334
            preference.setRefreshContentRequired(true);
334
                        preference.setRefreshContentRequired(true);
-
 
335
                        Cartelrefreshcontent();
-
 
336
 
-
 
337
                    }
-
 
338
 
-
 
339
            }
-
 
340
 
335
            Cartelrefreshcontent();
341
 
Línea 336... Línea 342...
336
        }
342
        }
Línea 478... Línea 484...
478
*/
484
*/
Línea 479... Línea 485...
479
 
485
 
Línea 480... Línea 486...
480
    }
486
    }
-
 
487
 
481
 
488
    public void saveNotificationCenterNew(String title,String url,String message){
482
    public void saveNotificationCenterNew(String title,String url,String message){
489
 
483
        Calendar calendar = Calendar.getInstance();
490
        Calendar calendar = Calendar.getInstance();
484
        Date date = calendar.getTime();
491
        Date date = calendar.getTime();
Línea 510... Línea 517...
510
                notificacionueva.setId(notificacion.getId());
517
                notificacionueva.setId(notificacion.getId());
511
                notificacionueva.setViewed("No");
518
                notificacionueva.setViewed("No");
512
                notificacionDao.update(notificacionueva);
519
                notificacionDao.update(notificacionueva);
513
                Log.e("Ya existia","la notificacion: "+notificacion.getDescription());
520
                Log.e("Ya existia","la notificacion: "+notificacion.getDescription());
514
            }
521
            }
-
 
522
 
515
        }
523
        }
516
        if(!registrada)
524
        if(!registrada)
517
        {
525
        {
518
            notificacionDao.insert(notificacionueva);
526
            notificacionDao.insert(notificacionueva);
-
 
527
 
519
            Log.e("No existe", "agregando.. "+ notificacionueva.getDescription());
528
            Log.e("No existe", "agregando.. "+ notificacionueva.getDescription());
520
        }
529
        }
Línea 521... Línea 530...
521
 
530
 
Línea 699... Línea 708...
699
 
708
 
Línea -... Línea 709...
-
 
709
 
700
 
710
    }
701
    }
711
 
702
 
712
 
703
 
713
 
704
    @Override
714
    @Override
705
    public boolean onCreateOptionsMenu(Menu menu) {
715
    public boolean onCreateOptionsMenu(Menu menu) {
Línea 706... Línea -...
706
        // Inflate the menu; this adds items to the action bar if it is present.
-
 
707
        getMenuInflater().inflate(R.menu.drawer, menu);
-
 
708
        return true;
716
        // Inflate the menu; this adds items to the action bar if it is present.
709
    }
717
        getMenuInflater().inflate(R.menu.drawer, menu);
710
 
718
        return true;
711
 
719
    }
712
 
720
 
Línea 905... Línea 913...
905
      //  mDrawerToggle.setDrawerIndicatorEnabled(false);
913
      //  mDrawerToggle.setDrawerIndicatorEnabled(false);
Línea 906... Línea 914...
906
 
914
 
907
 
915
 
-
 
916
        switch(fragmentIdxActiveNuevo) {
-
 
917
            case Constants.IDX_FRAGMENT_SIGNIN :
908
        switch(fragmentIdxActiveNuevo) {
918
               // badgenotification.setVisibility(View.GONE);
909
            case Constants.IDX_FRAGMENT_SIGNIN :
919
 
910
               // getSupportActionBar().hide();
920
                // getSupportActionBar().hide();
911
                 if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
921
                 if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
912
                     fragment = fragmentHashMap.get(fragmentKeyNuevo);
922
                     fragment = fragmentHashMap.get(fragmentKeyNuevo);
913
                 } else {
923
                 } else {
914
                     add = true;
924
                     add = true;
915
                     fragment = new SigninFragment();
925
                     fragment = new SigninFragment();
Línea 916... Línea 926...
916
                 }
926
                 }
-
 
927
                break;
Línea 917... Línea 928...
917
                break;
928
 
918
 
929
            case Constants.IDX_FRAGMENT_TOPICS :
919
            case Constants.IDX_FRAGMENT_TOPICS :
930
              //  badgenotification.setVisibility(View.GONE);
920
 
931
 
Línea 927... Línea 938...
927
                    fragment = new TopicFragment();
938
                    fragment = new TopicFragment();
928
                }
939
                }
929
                break;
940
                break;
Línea 930... Línea 941...
930
 
941
 
-
 
942
            case Constants.IDX_FRAGMENT_NOTIFICATION:
Línea 931... Línea 943...
931
            case Constants.IDX_FRAGMENT_NOTIFICATION:
943
               // badgenotification.setVisibility(View.VISIBLE);
932
 
944
 
933
                // getSupportActionBar().show();
945
                // getSupportActionBar().show();
934
                //   mDrawerToggle.setDrawerIndicatorEnabled(true);
946
                //   mDrawerToggle.setDrawerIndicatorEnabled(true);
Línea 940... Línea 952...
940
                }
952
                }
941
                break;
953
                break;
Línea 942... Línea 954...
942
 
954
 
-
 
955
 
-
 
956
            case Constants.IDX_FRAGMENT_CAPSULES :
943
 
957
              //  badgenotification.setVisibility(View.GONE);
944
            case Constants.IDX_FRAGMENT_CAPSULES :
958
 
945
              //  getSupportActionBar().show();
959
                //  getSupportActionBar().show();
946
              //  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
960
              //  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
947
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
961
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
948
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
962
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
949
                } else {
963
                } else {
950
                    add = true;
964
                    add = true;
951
                    fragment = new CapsuleFragment();
965
                    fragment = new CapsuleFragment();
Línea 952... Línea 966...
952
                }
966
                }
-
 
967
                break;
-
 
968
 
953
                break;
969
            case Constants.IDX_FRAGMENT_SLIDES :
954
 
970
               // badgenotification.setVisibility(View.GONE);
955
            case Constants.IDX_FRAGMENT_SLIDES :
971
 
956
             //   getSupportActionBar().show();
972
                //   getSupportActionBar().show();
957
             //   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
973
             //   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
958
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
974
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
959
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
975
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
960
                } else {
976
                } else {
961
                    add = true;
977
                    add = true;
Línea 962... Línea 978...
962
                    fragment = new SlideFragment();
978
                    fragment = new SlideFragment();
-
 
979
                }
-
 
980
                break;
963
                }
981
 
964
                break;
982
            case Constants.IDX_FRAGMENT_GALLERY :
965
 
983
               // badgenotification.setVisibility(View.GONE);
966
            case Constants.IDX_FRAGMENT_GALLERY :
984
 
967
             //   getSupportActionBar().show();
985
                //   getSupportActionBar().show();
968
             //   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
986
             //   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Línea 974... Línea 992...
974
                }
992
                }
Línea 975... Línea 993...
975
 
993
 
Línea 976... Línea 994...
976
                break;
994
                break;
-
 
995
 
-
 
996
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
977
 
997
               // badgenotification.setVisibility(View.GONE);
978
            case Constants.IDX_FRAGMENT_FINISH_CAPSULE :
998
 
979
              //  getSupportActionBar().hide();
999
                //  getSupportActionBar().hide();
980
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1000
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
981
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1001
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
982
                } else {
1002
                } else {
983
                    add = true;
1003
                    add = true;
984
                    fragment = new FinishCapsuleFragment();
1004
                    fragment = new FinishCapsuleFragment();
Línea 985... Línea 1005...
985
                }
1005
                }
-
 
1006
                break;
-
 
1007
 
986
                break;
1008
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
987
 
1009
               // badgenotification.setVisibility(View.GONE);
988
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
1010
 
989
              //  getSupportActionBar().hide();
1011
                //  getSupportActionBar().hide();
990
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1012
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
991
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1013
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
992
                } else {
1014
                } else {
993
                    add = true;
1015
                    add = true;
Línea 994... Línea 1016...
994
                    fragment = new FinishTopicFragment();
1016
                    fragment = new FinishTopicFragment();
-
 
1017
                }
-
 
1018
                break;
995
                }
1019
 
996
                break;
1020
            case Constants.IDX_FRAGMENT_TIMELINE :
997
 
1021
               // badgenotification.setVisibility(View.GONE);
998
            case Constants.IDX_FRAGMENT_TIMELINE :
1022
 
999
              //  getSupportActionBar().show();
1023
                //  getSupportActionBar().show();
1000
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1024
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1001
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1025
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1002
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1026
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1003
                } else {
1027
                } else {
Línea 1004... Línea 1028...
1004
                    add = true;
1028
                    add = true;
-
 
1029
                    fragment = new TimelineFragment();
-
 
1030
                }
1005
                    fragment = new TimelineFragment();
1031
                break;
1006
                }
1032
 
1007
                break;
1033
            case Constants.IDX_FRAGMENT_COMPANIES:
1008
 
1034
               // badgenotification.setVisibility(View.GONE);
1009
            case Constants.IDX_FRAGMENT_COMPANIES:
1035
 
1010
              //  getSupportActionBar().show();
1036
                //  getSupportActionBar().show();
1011
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1037
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1012
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1038
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1013
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1039
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
Línea 1014... Línea 1040...
1014
                } else {
1040
                } else {
-
 
1041
                    add = true;
-
 
1042
                    fragment = new CompanyFragment();
1015
                    add = true;
1043
                }
1016
                    fragment = new CompanyFragment();
1044
                break;
1017
                }
1045
 
1018
                break;
1046
            case Constants.IDX_FRAGMENT_PROGRESS :
1019
 
1047
               // badgenotification.setVisibility(View.GONE);
1020
            case Constants.IDX_FRAGMENT_PROGRESS :
1048
 
1021
               // getSupportActionBar().show();
1049
                // getSupportActionBar().show();
1022
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1050
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1023
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1051
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
Línea 1024... Línea 1052...
1024
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1052
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
-
 
1053
                } else {
-
 
1054
                    add = true;
1025
                } else {
1055
                    fragment = new ProgressFragment();
1026
                    add = true;
1056
                }
1027
                    fragment = new ProgressFragment();
1057
                break;
1028
                }
1058
 
1029
                break;
1059
            case Constants.IDX_FRAGMENT_USER_PROFILE:
1030
 
1060
               // badgenotification.setVisibility(View.GONE);
1031
            case Constants.IDX_FRAGMENT_USER_PROFILE:
1061
 
1032
               // getSupportActionBar().show();
1062
                // getSupportActionBar().show();
1033
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
1063
              //  mDrawerToggle.setDrawerIndicatorEnabled(true);
Línea 1034... Línea 1064...
1034
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1064
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
-
 
1065
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1035
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1066
                } else {
1036
                } else {
1067
                    add = true;
1037
                    add = true;
1068
                    fragment = new UserProfileFragment();
1038
                    fragment = new UserProfileFragment();
1069
                }
1039
                }
1070
                break;
Línea 1051... Línea 1082...
1051
                }
1082
                }
1052
                break;
1083
                break;
Línea 1053... Línea 1084...
1053
 
1084
 
1054
            default :
1085
            default :
-
 
1086
               // getSupportActionBar().hide();
1055
               // getSupportActionBar().hide();
1087
               // badgenotification.setVisibility(View.GONE);
1056
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1088
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
1057
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1089
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
1058
                } else {
1090
                } else {
1059
                    add = true;
1091
                    add = true;