Search in sources :

Example 11 with FicheEmploye

use of ca.etsmtl.applets.etsmobile.model.FicheEmploye in project ETSMobile-Android2 by ApplETS.

the class ExpandableListAdapter method filterDataWithOneHeader.

public void filterDataWithOneHeader(String query) {
    query = query.toLowerCase();
    // Log.v("MyListAdapter", String.valueOf(_listDataHeader.size()));
    _listDataChild.clear();
    _listDataHeader.clear();
    // Si le contenu de la recherche est vide
    if (query.isEmpty()) {
        _listDataChild = (HashMap<String, List<FicheEmploye>>) _listDataChildOriginal.clone();
        _listDataHeader.addAll(_listDataHeaderOriginal);
    } else {
        _listDataHeader.add(query);
        List<FicheEmploye> newList = new ArrayList<FicheEmploye>();
        for (Entry<String, List<FicheEmploye>> entry : _listDataChildOriginal.entrySet()) {
            List<FicheEmploye> listeFicheEmploye = entry.getValue();
            for (FicheEmploye ficheEmploye : listeFicheEmploye) {
                String nom = ficheEmploye.Nom == null ? "" : ficheEmploye.Nom.toLowerCase();
                String prenom = ficheEmploye.Prenom == null ? "" : ficheEmploye.Prenom.toLowerCase();
                Boolean exists = true;
                Boolean nomUsed = false;
                Boolean prenomUsed = false;
                for (String theQuery : query.split(" ")) {
                    if (nom.startsWith(theQuery) && !nomUsed) {
                        nomUsed = true;
                    } else if (prenom.startsWith(theQuery) && !prenomUsed) {
                        prenomUsed = true;
                    } else {
                        exists = false;
                    }
                }
                if (exists) {
                    newList.add(ficheEmploye);
                }
            }
        }
        if (!newList.isEmpty()) {
            _listDataChild.put(query, newList);
            newList = new ArrayList<FicheEmploye>();
        }
        Collections.sort(_listDataHeader);
    }
    notifyDataSetChanged();
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) FicheEmploye(ca.etsmtl.applets.etsmobile.model.FicheEmploye)

Example 12 with FicheEmploye

use of ca.etsmtl.applets.etsmobile.model.FicheEmploye in project ETSMobile-Android2 by ApplETS.

the class WebServiceSoap method GetFicheData.

public FicheEmploye GetFicheData(final String Id) throws Exception {
    return (FicheEmploye) execute(new IWcfMethod() {

        @Override
        public ExtendedSoapSerializationEnvelope CreateSoapEnvelope() {
            ExtendedSoapSerializationEnvelope __envelope = createEnvelope();
            SoapObject __soapReq = new SoapObject("http://etsmtl.ca/", "GetFicheData");
            __envelope.setOutputSoapObject(__soapReq);
            PropertyInfo __info = null;
            __info = new PropertyInfo();
            __info.namespace = "http://etsmtl.ca/";
            __info.name = "Id";
            __info.type = PropertyInfo.STRING_CLASS;
            __info.setValue(Id);
            __soapReq.addProperty(__info);
            return __envelope;
        }

        @Override
        public Object ProcessResult(ExtendedSoapSerializationEnvelope __envelope, SoapObject __result) throws Exception {
            return (FicheEmploye) getResult(FicheEmploye.class, __result, "GetFicheDataResult", __envelope);
        }
    }, "http://etsmtl.ca/GetFicheData");
}
Also used : SoapObject(org.ksoap2.serialization.SoapObject) ArrayOfFicheEmploye(ca.etsmtl.applets.etsmobile.model.ArrayOfFicheEmploye) FicheEmploye(ca.etsmtl.applets.etsmobile.model.FicheEmploye) PropertyInfo(org.ksoap2.serialization.PropertyInfo)

Example 13 with FicheEmploye

use of ca.etsmtl.applets.etsmobile.model.FicheEmploye in project ETSMobile-Android2 by ApplETS.

the class BottinFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_bottin, container, false);
    mSwipeRefreshLayout = v.findViewById(R.id.swipe_refresh_layout);
    mSwipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(getContext(), R.color.ets_red));
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!Utility.isNetworkAvailable(getActivity())) {
                afficherMsgHorsLigne();
                mSwipeRefreshLayout.setRefreshing(false);
            } else {
                afficherRafraichissementEtRechargerBottin();
            }
        }
    });
    // get the listview
    expListView = v.findViewById(R.id.expandableListView_service_employe);
    // Ouverture du détail
    expListView.setOnChildClickListener(new OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            FicheEmploye ficheEmploye = (FicheEmploye) listAdapter.getChild(groupPosition, childPosition);
            Intent i = new Intent(getActivity(), BottinDetailsActivity.class);
            i.putExtra("nom", ficheEmploye.Nom);
            i.putExtra("prenom", ficheEmploye.Prenom);
            i.putExtra("telBureau", ficheEmploye.TelBureau);
            i.putExtra("emplacement", ficheEmploye.Emplacement);
            i.putExtra("courriel", ficheEmploye.Courriel);
            i.putExtra("service", ficheEmploye.Service);
            i.putExtra("titre", ficheEmploye.Titre);
            getActivity().startActivity(i);
            return true;
        }
    });
    // create empty data
    listDataChild = new HashMap<>();
    listDataHeader = new ArrayList<>();
    // create custom adapter
    listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
    // setting list adapter
    expListView.setAdapter(listAdapter);
    updateUI();
    return v;
}
Also used : ViewGroup(android.view.ViewGroup) Intent(android.content.Intent) ExpandableListAdapter(ca.etsmtl.applets.etsmobile.ui.adapter.ExpandableListAdapter) FicheEmploye(ca.etsmtl.applets.etsmobile.model.FicheEmploye) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) View(android.view.View) SearchView(androidx.appcompat.widget.SearchView) ExpandableListView(android.widget.ExpandableListView) BottinDetailsActivity(ca.etsmtl.applets.etsmobile.ui.activity.BottinDetailsActivity) OnChildClickListener(android.widget.ExpandableListView.OnChildClickListener) ExpandableListView(android.widget.ExpandableListView)

Aggregations

FicheEmploye (ca.etsmtl.applets.etsmobile.model.FicheEmploye)13 List (java.util.List)6 ArrayOfFicheEmploye (ca.etsmtl.applets.etsmobile.model.ArrayOfFicheEmploye)5 DatabaseHelper (ca.etsmtl.applets.etsmobile.db.DatabaseHelper)4 SQLException (java.sql.SQLException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 WebServiceSoap (ca.etsmtl.applets.etsmobile.http.soap.WebServiceSoap)3 ArrayOfService (ca.etsmtl.applets.etsmobile.model.ArrayOfService)3 Service (ca.etsmtl.applets.etsmobile.model.Service)3 ExpandableListAdapter (ca.etsmtl.applets.etsmobile.ui.adapter.ExpandableListAdapter)3 SignetsMobileSoap (ca.etsmtl.applets.etsmobile.http.soap.SignetsMobileSoap)2 Etudiant (ca.etsmtl.applets.etsmobile.model.Etudiant)2 ListeDeSessions (ca.etsmtl.applets.etsmobile.model.ListeDeSessions)2 Trimestre (ca.etsmtl.applets.etsmobile.model.Trimestre)2 ca.etsmtl.applets.etsmobile.model.listeHoraireExamensFinaux (ca.etsmtl.applets.etsmobile.model.listeHoraireExamensFinaux)2 ca.etsmtl.applets.etsmobile.model.listeJoursRemplaces (ca.etsmtl.applets.etsmobile.model.listeJoursRemplaces)2 ca.etsmtl.applets.etsmobile.model.listeSeances (ca.etsmtl.applets.etsmobile.model.listeSeances)2 QueryBuilder (com.j256.ormlite.stmt.QueryBuilder)2 SpiceException (com.octo.android.robospice.persistence.exception.SpiceException)2