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();
}
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");
}
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;
}
Aggregations