Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 9 | Rev 25 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
9 gabriel 1
package com.cesams.twogetskills.fragment;
2
 
3
import android.os.Bundle;
4
 
5
import androidx.fragment.app.Fragment;
11 gabriel 6
import androidx.recyclerview.widget.GridLayoutManager;
7
import androidx.recyclerview.widget.RecyclerView;
9 gabriel 8
 
11 gabriel 9
import android.util.Log;
9 gabriel 10
import android.view.LayoutInflater;
11
import android.view.View;
12
import android.view.ViewGroup;
11 gabriel 13
import android.widget.TextView;
9 gabriel 14
 
15
import com.cesams.twogetskills.R;
11 gabriel 16
import com.cesams.twogetskills.adapter.CardViewAdapter;
17
import com.cesams.twogetskills.dao.NotificationCenterDao;
18
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
9 gabriel 19
 
11 gabriel 20
import java.util.ArrayList;
21
import java.util.HashMap;
22
import java.util.List;
23
 
9 gabriel 24
/**
25
 * A simple {@link Fragment} subclass.
26
 * Use the {@link NotificationCenter#newInstance} factory method to
27
 * create an instance of this fragment.
28
 */
29
public class NotificationCenter extends Fragment {
30
 
11 gabriel 31
   RecyclerView notificaciones;
32
   CardViewAdapter notificacionadapter;
33
   private ITwoGetSkills iTwoGetSkills;
34
   TextView notienenuevas;
9 gabriel 35
 
11 gabriel 36
    ArrayList<HashMap<String, String>> notificacionList;
9 gabriel 37
 
11 gabriel 38
 
9 gabriel 39
    public NotificationCenter() {
40
        // Required empty public constructor
41
    }
42
 
11 gabriel 43
    public static NotificationCenter newInstance() {
9 gabriel 44
        NotificationCenter fragment = new NotificationCenter();
45
        return fragment;
46
    }
47
 
48
    @Override
49
    public void onCreate(Bundle savedInstanceState) {
50
        super.onCreate(savedInstanceState);
11 gabriel 51
 
9 gabriel 52
    }
53
 
54
    @Override
55
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
56
                             Bundle savedInstanceState) {
11 gabriel 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<>();
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;
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
 
94
            notificacionList.add(m_li);
95
            notienenuevas.setVisibility(View.GONE);
96
 
97
 
98
            notificacionadapter.notifyDataSetChanged();
99
 
100
        }
101
 
102
 
103
        return view;
9 gabriel 104
    }
11 gabriel 105
 
106
 
9 gabriel 107
}