Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

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

Rev 9 Rev 11
Línea 1... Línea 1...
1
package com.cesams.twogetskills.fragment;
1
package com.cesams.twogetskills.fragment;
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea 3...
3
import android.os.Bundle;
3
import android.os.Bundle;
-
 
4
 
-
 
5
import androidx.fragment.app.Fragment;
Línea -... Línea 6...
-
 
6
import androidx.recyclerview.widget.GridLayoutManager;
4
 
7
import androidx.recyclerview.widget.RecyclerView;
5
import androidx.fragment.app.Fragment;
8
 
6
 
9
import android.util.Log;
-
 
10
import android.view.LayoutInflater;
Línea 7... Línea 11...
7
import android.view.LayoutInflater;
11
import android.view.View;
-
 
12
import android.view.ViewGroup;
-
 
13
import android.widget.TextView;
-
 
14
 
-
 
15
import com.cesams.twogetskills.R;
-
 
16
import com.cesams.twogetskills.adapter.CardViewAdapter;
-
 
17
import com.cesams.twogetskills.dao.NotificationCenterDao;
-
 
18
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
Línea 8... Línea 19...
8
import android.view.View;
19
 
9
import android.view.ViewGroup;
20
import java.util.ArrayList;
10
 
21
import java.util.HashMap;
11
import com.cesams.twogetskills.R;
22
import java.util.List;
12
 
23
 
13
/**
24
/**
Línea 14... Línea 25...
14
 * A simple {@link Fragment} subclass.
25
 * A simple {@link Fragment} subclass.
15
 * Use the {@link NotificationCenter#newInstance} factory method to
26
 * Use the {@link NotificationCenter#newInstance} factory method to
16
 * create an instance of this fragment.
27
 * create an instance of this fragment.
17
 */
28
 */
18
public class NotificationCenter extends Fragment {
29
public class NotificationCenter extends Fragment {
19
 
30
 
20
    // TODO: Rename parameter arguments, choose names that match
-
 
21
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
-
 
-
 
31
   RecyclerView notificaciones;
Línea 22... Línea 32...
22
    private static final String ARG_PARAM1 = "param1";
32
   CardViewAdapter notificacionadapter;
23
    private static final String ARG_PARAM2 = "param2";
33
   private ITwoGetSkills iTwoGetSkills;
24
 
34
   TextView notienenuevas;
Línea 25... Línea -...
25
    // TODO: Rename and change types of parameters
-
 
26
    private String mParam1;
-
 
27
    private String mParam2;
-
 
28
 
-
 
29
    public NotificationCenter() {
-
 
30
        // Required empty public constructor
-
 
31
    }
-
 
32
 
-
 
33
    /**
-
 
34
     * Use this factory method to create a new instance of
35
 
35
     * this fragment using the provided parameters.
36
    ArrayList<HashMap<String, String>> notificacionList;
36
     *
-
 
37
     * @param param1 Parameter 1.
-
 
38
     * @param param2 Parameter 2.
-
 
39
     * @return A new instance of fragment NotificationCenter.
-
 
40
     */
37
 
41
    // TODO: Rename and change types and number of parameters
38
 
Línea 42... Línea 39...
42
    public static NotificationCenter newInstance(String param1, String param2) {
39
    public NotificationCenter() {
43
        NotificationCenter fragment = new NotificationCenter();
40
        // Required empty public constructor
44
        Bundle args = new Bundle();
41
    }
45
        args.putString(ARG_PARAM1, param1);
-
 
46
        args.putString(ARG_PARAM2, param2);
-
 
47
        fragment.setArguments(args);
-
 
48
        return fragment;
42
 
49
    }
43
    public static NotificationCenter newInstance() {
Línea 50... Línea 44...
50
 
44
        NotificationCenter fragment = new NotificationCenter();
51
    @Override
45
        return fragment;
52
    public void onCreate(Bundle savedInstanceState) {
46
    }
-
 
47
 
-
 
48
    @Override
-
 
49
    public void onCreate(Bundle savedInstanceState) {
-
 
50
        super.onCreate(savedInstanceState);
-
 
51
 
-
 
52
    }
-
 
53
 
-
 
54
    @Override
-
 
55
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-
 
56
                             Bundle savedInstanceState) {
-
 
57
        View view =inflater.inflate(R.layout.fragment_notification_center, container, false);
-
 
58
 
-
 
59
        iTwoGetSkills = (ITwoGetSkills) getActivity();
-
 
60
 
-
 
61
        notificaciones = view.findViewById(R.id.notificacioneslista);
-
 
62
 
-
 
63
        notificacionList= new ArrayList<>();
53
        super.onCreate(savedInstanceState);
64
        notienenuevas= view.findViewById(R.id.textView18);
-
 
65
        notienenuevas.setVisibility(View.VISIBLE);
-
 
66
 
-
 
67
        notificacionadapter = new CardViewAdapter(getContext(),notificacionList);
-
 
68
 
-
 
69
        GridLayoutManager layoutnotifi = new GridLayoutManager(getContext(),1,GridLayoutManager.VERTICAL, false);
-
 
70
        notificaciones.setLayoutManager(layoutnotifi);
-
 
71
        notificaciones.setAdapter(notificacionadapter);
-
 
72
 
-
 
73
 
-
 
74
        NotificationCenterDao notificacionDao;
54
        if (getArguments() != null) {
75
 
-
 
76
        notificacionDao =iTwoGetSkills.getDatabase().getNotificationCenterDao();
-
 
77
 
-
 
78
        Log.e("Notificaciones","estas:"+notificacionDao.selectAllNotification().toString());
-
 
79
 
-
 
80
        List<com.cesams.twogetskills.entity.NotificationCenter> lista;
-
 
81
        lista=notificacionDao.selectAllNotification();
-
 
82
 
-
 
83
        HashMap<String, String> m_li;
-
 
84
 
-
 
85
        for(com.cesams.twogetskills.entity.NotificationCenter notificacion: lista)
-
 
86
        {
-
 
87
            Log.e("Esto",""+notificacion.getTitle());
-
 
88
            m_li = new HashMap<>();
-
 
89
 
-
 
90
            m_li.put("titulo",notificacion.getTitle());
-
 
91
            m_li.put("date",notificacion.getDate());
-
 
92
            m_li.put("descripcion",notificacion.getDescription());
-
 
93
 
55
            mParam1 = getArguments().getString(ARG_PARAM1);
94
            notificacionList.add(m_li);
-
 
95
            notienenuevas.setVisibility(View.GONE);
-
 
96
 
56
            mParam2 = getArguments().getString(ARG_PARAM2);
97
 
57
        }
98
            notificacionadapter.notifyDataSetChanged();