Proyectos de Subversion Android Microlearning

Rev

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

Rev 43 Rev 44
Línea 79... Línea 79...
79
import com.cesams.twogetskills.entity.UserLog;
79
import com.cesams.twogetskills.entity.UserLog;
80
import com.cesams.twogetskills.preference.Preference;
80
import com.cesams.twogetskills.preference.Preference;
81
import com.cesams.twogetskills.receiver.ConnectivityReceiver;
81
import com.cesams.twogetskills.receiver.ConnectivityReceiver;
82
import com.cesams.twogetskills.receiver.InternalReceiver;
82
import com.cesams.twogetskills.receiver.InternalReceiver;
83
import com.cesams.twogetskills.room.ResultCount;
83
import com.cesams.twogetskills.room.ResultCount;
84
import com.cesams.twogetskills.viewdata.SlideRefreshUIViewData;
-
 
85
import com.cesams.twogetskills.viewmodel.SlideRefreshUIViewModel;
-
 
86
import com.google.android.material.snackbar.Snackbar;
84
import com.google.android.material.snackbar.Snackbar;
87
import com.google.android.material.navigation.NavigationView;
85
import com.google.android.material.navigation.NavigationView;
Línea 88... Línea 86...
88
 
86
 
89
import androidx.drawerlayout.widget.DrawerLayout;
87
import androidx.drawerlayout.widget.DrawerLayout;
Línea 151... Línea 149...
151
    private ProgressBar mProgressBar;
149
    private ProgressBar mProgressBar;
Línea 152... Línea 150...
152
 
150
 
153
    private Account mAccount;
151
    private Account mAccount;
Línea 154... Línea -...
154
    private AppDatabase mAppDatabase;
-
 
155
 
-
 
156
    private SlideRefreshUIViewModel mSlideRefreshUIViewModel;
-
 
157
 
-
 
158
 
152
    private AppDatabase mAppDatabase;
159
 
153
 
160
    ActivityResultLauncher<Intent> mLauncher = registerForActivityResult(
154
    ActivityResultLauncher<Intent> mLauncher = registerForActivityResult(
161
            new ActivityResultContracts.StartActivityForResult(),
155
            new ActivityResultContracts.StartActivityForResult(),
162
            result -> {
156
            result -> {
Línea 193... Línea 187...
193
        //mResolver = getContentResolver();
187
        //mResolver = getContentResolver();
Línea 194... Línea 188...
194
 
188
 
Línea 195... Línea 189...
195
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
189
        mAppDatabase = DatabaseHelper.getInstance(getApplicationContext()).getAppDatabase();
-
 
190
 
-
 
191
        preference = Preference.getInstance(getApplicationContext());
196
 
192
 
Línea 197... Línea 193...
197
        preference = Preference.getInstance(getApplicationContext());
193
        Log.d("BUG 2PLANO", "MainActivity - onCreate");
198
        preference.load();
194
        preference.load();
199
 
195
 
Línea 236... Línea 232...
236
        navHeaderUserName = header.findViewById(R.id.nav_header_user_name);
232
        navHeaderUserName = header.findViewById(R.id.nav_header_user_name);
237
        navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
233
        navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
Línea 238... Línea 234...
238
 
234
 
Línea 239... Línea -...
239
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
-
 
240
 
-
 
241
        mSlideRefreshUIViewModel = new ViewModelProvider(this).get(SlideRefreshUIViewModel.class);
-
 
242
 
235
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
243
 
236
 
Línea 244... Línea 237...
244
        mConnectivityReceiver = new ConnectivityReceiver();
237
        mConnectivityReceiver = new ConnectivityReceiver();
245
        registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
238
        registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
Línea 271... Línea 264...
271
    @Override
264
    @Override
272
    protected void onResume() {
265
    protected void onResume() {
273
        super.onResume();
266
        super.onResume();
274
        isForeground = true;
267
        isForeground = true;
Línea -... Línea 268...
-
 
268
 
275
 
269
        Log.d("BUG 2PLANO", "MainActivity - onCreate");
276
        preference = Preference.getInstance(getApplicationContext());
270
        preference = Preference.getInstance(getApplicationContext());
Línea 277... Línea 271...
277
        preference.load();
271
        preference.load();
Línea 481... Línea 475...
481
        mAppDatabase.getCapsuleDao().removeAll();
475
        mAppDatabase.getCapsuleDao().removeAll();
482
        mAppDatabase.getTopicDao().removeAll();
476
        mAppDatabase.getTopicDao().removeAll();
483
        mAppDatabase.getUserExtendedDao().removeAll();
477
        mAppDatabase.getUserExtendedDao().removeAll();
Línea -... Línea 478...
-
 
478
 
-
 
479
 
-
 
480
        mAppDatabase.getUserLogDao().removeAll();
484
 
481
        mAppDatabase.getProgressDao().removeAll();
485
 
482
 
486
        preference.setUserUuid("");
483
        preference.setUserUuid("");
487
        preference.setFirstName("");
484
        preference.setFirstName("");
488
        preference.setLastName("");
485
        preference.setLastName("");
Línea 941... Línea 938...
941
        preference.setCompanyUuidActive(companyUuid);
938
        preference.setCompanyUuidActive(companyUuid);
942
        preference.save();
939
        preference.save();
943
    }
940
    }
Línea 944... Línea 941...
944
 
941
 
945
    @Override
942
    @Override
946
    public void changeSlideActive(String slideUuid, String type, boolean showGallery)
943
    public synchronized void changeSlideActive(String slideUuid, String type, boolean showGallery)
Línea 947... Línea 944...
947
    {
944
    {
Línea 948... Línea 945...
948
 
945
 
Línea 957... Línea 954...
957
        preference.save();
954
        preference.save();
Línea 958... Línea 955...
958
 
955
 
959
 
956
 
960
        if(showGallery) {
-
 
961
            invokeFragment(Constants.IDX_FRAGMENT_GALLERY);
-
 
962
            Log.e("Aqui","Es donde cambio el capsule");
-
 
963
 
-
 
964
            SlideRefreshUIViewData slideRefreshUIViewData = mSlideRefreshUIViewModel.getSlideRefreshUIViewData();
-
 
965
            slideRefreshUIViewData.setCambioSlide(true);
-
 
966
            mSlideRefreshUIViewModel.getSlideRefreshUIMutableLiveData().setValue(slideRefreshUIViewData);
-
 
967
 
957
        if(showGallery) {
968
            //DatabaseHelper.CambioSlide="SI";
958
            invokeFragment(Constants.IDX_FRAGMENT_GALLERY);
Línea 969... Línea 959...
969
        }
959
        }
970
    }
960
    }
Línea 1020... Línea 1010...
1020
        UserLogDao userLogDao = mAppDatabase.getUserLogDao();
1010
        UserLogDao userLogDao = mAppDatabase.getUserLogDao();
Línea 1021... Línea 1011...
1021
 
1011
 
1022
        SyncDao syncDao = mAppDatabase.getSyncDao();
1012
        SyncDao syncDao = mAppDatabase.getSyncDao();
Línea -... Línea 1013...
-
 
1013
        Sync sync;
-
 
1014
 
1023
        Sync sync;
1015
        String userUuid = preference.getUserUuid();
1024
 
1016
 
1025
        // Progreso y UserLog  del Slide
1017
        // Progreso y UserLog  del Slide
1026
        ProgressDao progressDao = mAppDatabase.getProgressDao();
1018
        ProgressDao progressDao = mAppDatabase.getProgressDao();
1027
        Progress progressSlide = progressDao.selectBySlideUuid(slide.getUuid());
1019
        Progress progressSlide = progressDao.selectBySlideUuidAndUserUuid(slide.getUuid(), userUuid);
Línea 1028... Línea 1020...
1028
        Progress progressCapsule =  progressDao.selectByCapsuleUuid(slide.getCapsuleUuid());
1020
        Progress progressCapsule =  progressDao.selectByCapsuleUuidAndUserUuid(slide.getCapsuleUuid(),userUuid);
1029
        Progress progressTopic =  progressDao.selectByTopicUuid(slide.getTopicUuid());
1021
        Progress progressTopic =  progressDao.selectByTopicUuidAndUserUuid(slide.getTopicUuid(),userUuid);
1030
 
1022
 
1031
        int totalSlides = 0;
1023
        int totalSlides = 0;
Línea 1080... Línea 1072...
1080
 
1072
 
1081
 
1073
 
Línea 1082... Línea 1074...
1082
        resultCount = slideDao.getCountByTopicUuid(slide.getTopicUuid());
1074
        resultCount = slideDao.getCountByTopicUuid(slide.getTopicUuid());
1083
        totalSlides = resultCount.getCount();
1075
        totalSlides = resultCount.getCount();
1084
 
1076
 
1085
        resultCount = progressDao.getCountSlidesCompletedByTopicUuid(slide.getTopicUuid());
1077
        resultCount = progressDao.getCountSlidesCompletedByTopicUuidAndUserUuid(slide.getTopicUuid(), userUuid);
1086
        viewSlides =  resultCount.getCount();
1078
        viewSlides =  resultCount.getCount();
1087
        if(totalSlides == 0) {
1079
        if(totalSlides == 0) {
Línea 1146... Línea 1138...
1146
 
1138
 
1147
 
1139
 
1148
        /*** INICIO PROCESO CAPSULA ***/
1140
        /*** INICIO PROCESO CAPSULA ***/
1149
        resultCount = slideDao.getCountByCapsuleUuid(slide.getCapsuleUuid());
1141
        resultCount = slideDao.getCountByCapsuleUuid(slide.getCapsuleUuid());
1150
        totalSlides = resultCount.getCount();
1142
        totalSlides = resultCount.getCount();
1151
        resultCount = progressDao.getCountSlidesCompletedByCapsuleUuid(slide.getCapsuleUuid());
1143
        resultCount = progressDao.getCountSlidesCompletedByCapsuleUuidAndUserUuid(slide.getCapsuleUuid(), userUuid);
1152
        viewSlides =  resultCount.getCount();
1144
        viewSlides =  resultCount.getCount();
1153
        if(totalSlides == 0) {
1145
        if(totalSlides == 0) {
1154
            percentaje = 0;
1146
            percentaje = 0;
Línea 1398... Línea 1390...
1398
    }
1390
    }
Línea 1399... Línea 1391...
1399
 
1391
 
1400
    @Override
1392
    @Override
1401
    public void launchQuizViewer(String quizUuid)
1393
    public void launchQuizViewer(String quizUuid)
-
 
1394
    {
1402
    {
1395
 
1403
        ProgressDao progressDao = mAppDatabase.getProgressDao();
1396
        ProgressDao progressDao = mAppDatabase.getProgressDao();
Línea 1404... Línea 1397...
1404
        Progress progress = progressDao.selectBySlideUuid(preference.getSlideUuidActive());
1397
        Progress progress = progressDao.selectBySlideUuidAndUserUuid(preference.getSlideUuidActive(), preference.getUserUuid());
1405
 
1398
 
Línea 1406... Línea 1399...
1406
        boolean launch = false;
1399
        boolean launch = false;