Proyectos de Subversion Android Microlearning

Rev

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

Rev 1 Rev 4
Línea 5... Línea 5...
5
import androidx.annotation.NonNull;
5
import androidx.annotation.NonNull;
6
import androidx.appcompat.app.ActionBarDrawerToggle;
6
import androidx.appcompat.app.ActionBarDrawerToggle;
7
import androidx.appcompat.app.AlertDialog;
7
import androidx.appcompat.app.AlertDialog;
8
import androidx.appcompat.app.AppCompatActivity;
8
import androidx.appcompat.app.AppCompatActivity;
9
import androidx.core.app.NotificationCompat;
9
import androidx.core.app.NotificationCompat;
10
import androidx.core.app.NotificationManagerCompat;
-
 
11
import androidx.core.content.ContextCompat;
-
 
12
import androidx.core.view.GravityCompat;
10
import androidx.core.view.GravityCompat;
13
import androidx.fragment.app.Fragment;
11
import androidx.fragment.app.Fragment;
14
import androidx.fragment.app.FragmentTransaction;
12
import androidx.fragment.app.FragmentTransaction;
Línea 15... Línea -...
15
 
-
 
16
import android.Manifest;
13
 
17
import android.accounts.Account;
14
import android.accounts.Account;
18
import android.accounts.AccountManager;
15
import android.accounts.AccountManager;
19
import android.app.NotificationChannel;
16
import android.app.NotificationChannel;
20
import android.app.NotificationManager;
17
import android.app.NotificationManager;
21
import android.app.PendingIntent;
-
 
22
import android.app.TaskStackBuilder;
18
import android.app.PendingIntent;
23
import android.content.ContentResolver;
19
import android.content.ContentResolver;
24
import android.content.DialogInterface;
-
 
25
import android.content.pm.PackageManager;
20
import android.content.DialogInterface;
26
import android.net.ConnectivityManager;
-
 
27
import android.net.Uri;
21
import android.net.ConnectivityManager;
28
import android.os.Build;
22
import android.os.Build;
29
import android.text.TextUtils;
23
import android.text.TextUtils;
30
import android.util.Log;
24
import android.util.Log;
31
import android.content.Context;
25
import android.content.Context;
Línea 103... Línea 97...
103
import org.json.JSONException;
97
import org.json.JSONException;
104
import org.json.JSONObject;
98
import org.json.JSONObject;
Línea 105... Línea 99...
105
 
99
 
106
import java.io.IOException;
100
import java.io.IOException;
107
import java.text.SimpleDateFormat;
-
 
108
import java.util.ArrayList;
101
import java.text.SimpleDateFormat;
109
import java.util.Calendar;
102
import java.util.Calendar;
110
import java.util.Date;
103
import java.util.Date;
111
import java.util.HashMap;
104
import java.util.HashMap;
112
import java.util.List;
105
import java.util.List;
Línea 233... Línea 226...
233
        NavigationView navigationView = findViewById(R.id.navigation_view);
226
        NavigationView navigationView = findViewById(R.id.navigation_view);
234
        navigationView.setNavigationItemSelectedListener(this);
227
        navigationView.setNavigationItemSelectedListener(this);
Línea 235... Línea 228...
235
 
228
 
236
        View header = navigationView.getHeaderView(0);
229
        View header = navigationView.getHeaderView(0);
237
        //navHeaderUserImage = (CircleImageView) header.findViewById(R.id.nav_header_user_image);
230
        //navHeaderUserImage = (CircleImageView) header.findViewById(R.id.nav_header_user_image);
238
        navHeaderUserImage = (ImageView) header.findViewById(R.id.nav_header_user_image);
231
        navHeaderUserImage = header.findViewById(R.id.nav_header_user_image);
239
        navHeaderUserName = (TextView) header.findViewById(R.id.nav_header_user_name);
232
        navHeaderUserName = header.findViewById(R.id.nav_header_user_name);
Línea 240... Línea 233...
240
        navHeaderUserEmail = (TextView) header.findViewById(R.id.nav_header_user_email);
233
        navHeaderUserEmail =  header.findViewById(R.id.nav_header_user_email);
Línea 241... Línea 234...
241
 
234
 
242
        textViewMessageNotConnection = (TextView) findViewById(R.id.main_activity_text_view_message_not_connection);
235
        textViewMessageNotConnection = findViewById(R.id.main_activity_text_view_message_not_connection);
Línea 243... Línea 236...
243
 
236
 
Línea 362... Línea 355...
362
    }
355
    }
Línea 363... Línea 356...
363
 
356
 
364
    private void createNotificationChannel() {
357
    private void createNotificationChannel() {
365
        // Create the NotificationChannel, but only on API 26+ because
358
        // Create the NotificationChannel, but only on API 26+ because
366
        // the NotificationChannel class is new and not in the support library
-
 
367
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
359
        // the NotificationChannel class is new and not in the support library
368
            CharSequence name = getString(R.string.channel_name);
360
        CharSequence name = getString(R.string.channel_name);
369
            String description = getString(R.string.channel_description);
361
        String description = getString(R.string.channel_description);
370
            int importance = NotificationManager.IMPORTANCE_DEFAULT;
362
        int importance = NotificationManager.IMPORTANCE_DEFAULT;
371
            NotificationChannel channel = new NotificationChannel(Constants.NOTIFICATION_CHANNEL_ID, name, importance);
363
        NotificationChannel channel = new NotificationChannel(Constants.NOTIFICATION_CHANNEL_ID, name, importance);
372
            channel.setDescription(description);
364
        channel.setDescription(description);
Línea 373... Línea 365...
373
            channel.setShowBadge(true);
365
        channel.setShowBadge(true);
374
 
366
 
375
 
367
 
376
            // Register the channel with the system; you can't change the importance
368
        // Register the channel with the system; you can't change the importance
377
            // or other notification behaviors after this
-
 
378
            NotificationManager notificationManager = getSystemService(NotificationManager.class);
369
        // or other notification behaviors after this
Línea 379... Línea 370...
379
            notificationManager.createNotificationChannel(channel);
370
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
380
        }
371
        notificationManager.createNotificationChannel(channel);
Línea 729... Línea 720...
729
                    add = true;
720
                    add = true;
730
                    fragment = new TopicFragment();
721
                    fragment = new TopicFragment();
731
                }
722
                }
732
                break;
723
                break;
Línea -... Línea 724...
-
 
724
 
733
 
725
 
734
            case Constants.IDX_FRAGMENT_CAPSULES :
726
            case Constants.IDX_FRAGMENT_CAPSULES :
735
                getSupportActionBar().show();
727
                getSupportActionBar().show();
736
                getSupportActionBar().setDisplayHomeAsUpEnabled(true);
728
                getSupportActionBar().setDisplayHomeAsUpEnabled(true);
737
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
729
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
Línea 772... Línea 764...
772
                } else {
764
                } else {
773
                    add = true;
765
                    add = true;
774
                    fragment = new FinishCapsuleFragment();
766
                    fragment = new FinishCapsuleFragment();
775
                }
767
                }
776
                break;
768
                break;
-
 
769
 
777
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
770
            case Constants.IDX_FRAGMENT_FINISH_TOPIC :
778
                getSupportActionBar().hide();
771
                getSupportActionBar().hide();
779
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
772
                if(fragmentHashMap.containsKey(fragmentKeyNuevo)) {
780
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
773
                    fragment = fragmentHashMap.get(fragmentKeyNuevo);
781
                } else {
774
                } else {
Línea 1005... Línea 998...
1005
 
998
 
1006
            if (progressSlide.getCompleted() == 1) {
999
            if (progressSlide.getCompleted() == 1) {
1007
                progressSlide.setReturningAfterCompleted(progressSlide.getReturningAfterCompleted() + 1);
1000
                progressSlide.setReturningAfterCompleted(progressSlide.getReturningAfterCompleted() + 1);
1008
            } else {
1001
            } else {
-
 
1002
                if (completed) {
1009
                if (completed) {
1003
                    //0 y 1 para Boolean
1010
                    progressSlide.setCompleted(completed  ? 1 : 0);
1004
                    progressSlide.setCompleted(completed  ? 1 : 0);
1011
                } else {
1005
                } else {
1012
                    progressSlide.setReturning(progressSlide.getReturning() + 1);
1006
                    progressSlide.setReturning(progressSlide.getReturning() + 1);
1013
                }
1007
                }
Línea 1143... Línea 1137...
1143
 
1137
 
1144
                    Log.d(TAG, "Capsule NEW returningAfterCompleted = " + returningAfterCompleted);
1138
                    Log.d(TAG, "Capsule NEW returningAfterCompleted = " + returningAfterCompleted);
1145
                    progressCapsule.setReturningAfterCompleted(returningAfterCompleted);
1139
                    progressCapsule.setReturningAfterCompleted(returningAfterCompleted);
Línea 1146... Línea -...
1146
                }
-
 
1147
 
-
 
1148
 
1140
                }
1149
 
1141
 
Línea 1150... Línea 1142...
1150
                preference.setLastCapsuleUuidActive(capsule.getUuid());
1142
                preference.setLastCapsuleUuidActive(capsule.getUuid());
1151
                preference.save(this);
1143
                preference.save(this);