use of ca.etsmtl.applets.etsmobile.model.Programme in project ETSMobile-Android2 by ApplETS.
the class ProfileAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
if (position == 0) {
convertView = LayoutInflater.from(context).inflate(R.layout.row_profile_info_etudiant, parent, false);
InfoEtudiantViewHolder infoEtudiantViewHolder = new InfoEtudiantViewHolder();
infoEtudiantViewHolder.tvNomPrenom = (TextView) convertView.findViewById(R.id.profil_nom_prenom_item);
infoEtudiantViewHolder.tvCodePermanent = (TextView) convertView.findViewById(R.id.profil_code_permanent_item);
infoEtudiantViewHolder.tvSolde = (TextView) convertView.findViewById(R.id.profil_solde_item);
infoEtudiantViewHolder.tvCodeUniversel = (TextView) convertView.findViewById(R.id.profil_code_universel_item);
convertView.setTag(infoEtudiantViewHolder);
} else if (position == 1) {
convertView = LayoutInflater.from(context).inflate(R.layout.row_profile_liste_programmes, parent, false);
ListProgramViewHolder listProgramViewHolder = new ListProgramViewHolder();
listProgramViewHolder.spinnerProgram = (Spinner) convertView.findViewById(R.id.spinner_programmes);
listProgramViewHolder.tvCoursEchoues = (TextView) convertView.findViewById(R.id.profil_credit_echoue_item);
listProgramViewHolder.tvCoursEquivalents = (TextView) convertView.findViewById(R.id.profil_cours_equivalent_item);
listProgramViewHolder.tvCoursReussis = (TextView) convertView.findViewById(R.id.profil_cours_reussis_item);
listProgramViewHolder.tvCreditsInscrits = (TextView) convertView.findViewById(R.id.profil_credit_inscrit_item);
listProgramViewHolder.tvCreditsReussis = (TextView) convertView.findViewById(R.id.profil_credit_reussis_item);
listProgramViewHolder.tvMoyenne = (TextView) convertView.findViewById(R.id.profil_moyenne_item);
convertView.setTag(listProgramViewHolder);
}
}
if (position == 0) {
InfoEtudiantViewHolder infoEtudiantViewHolder = (InfoEtudiantViewHolder) convertView.getTag();
String nom = etudiant.nom != null ? etudiant.nom.trim() : "";
String prenom = etudiant.prenom != null ? etudiant.prenom.trim() : "";
infoEtudiantViewHolder.tvNomPrenom.setText(nom + ", " + prenom);
infoEtudiantViewHolder.tvCodePermanent.setText(etudiant.codePerm);
infoEtudiantViewHolder.tvSolde.setText(etudiant.soldeTotal);
infoEtudiantViewHolder.tvCodeUniversel.setText((ApplicationManager.userCredentials.getUsername()).toUpperCase());
} else if (position == 1) {
final ListProgramViewHolder listProgramViewHolder = (ListProgramViewHolder) convertView.getTag();
listProgramViewHolder.spinnerProgram.setAdapter(profileSpinnerAdapter);
Programme programme = (Programme) listProgramViewHolder.spinnerProgram.getSelectedItem();
listProgramViewHolder.tvMoyenne.setText(programme.moyenne);
listProgramViewHolder.tvCreditsReussis.setText(programme.nbCreditsCompletes);
listProgramViewHolder.tvCreditsInscrits.setText(programme.nbCreditsInscrits);
listProgramViewHolder.tvCoursReussis.setText(programme.nbCrsReussis);
listProgramViewHolder.tvCoursEquivalents.setText(programme.nbEquivalences);
listProgramViewHolder.tvCoursEchoues.setText(programme.nbCrsEchoues);
listProgramViewHolder.spinnerProgram.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// notifyDataSetChanged();
Programme selectedProgramme = profileSpinnerAdapter.getItem(position);
listProgramViewHolder.tvMoyenne.setText(selectedProgramme.moyenne);
listProgramViewHolder.tvCreditsReussis.setText(selectedProgramme.nbCreditsCompletes);
listProgramViewHolder.tvCreditsInscrits.setText(selectedProgramme.nbCreditsInscrits);
listProgramViewHolder.tvCoursReussis.setText(selectedProgramme.nbCrsReussis);
listProgramViewHolder.tvCoursEquivalents.setText(selectedProgramme.nbEquivalences);
listProgramViewHolder.tvCoursEchoues.setText(selectedProgramme.nbCrsEchoues);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
return convertView;
}
use of ca.etsmtl.applets.etsmobile.model.Programme in project ETSMobile-Android2 by ApplETS.
the class ProfileSpinnerAdapter method getCustomView.
public View getCustomView(int position, View convertView, ViewGroup parent, int layoutId) {
ViewHolder holder;
if (convertView != null) {
holder = (ViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(getContext()).inflate(layoutId, parent, false);
holder = new ViewHolder();
holder.tvProgramName = (TextView) convertView.findViewById(R.id.tv_program);
holder.tvProgramStatus = (TextView) convertView.findViewById(R.id.tv_program_status);
convertView.setTag(holder);
}
Programme item = getItem(position);
holder.tvProgramName.setText(item.libelle);
holder.tvProgramStatus.setText(item.statut);
return convertView;
}
use of ca.etsmtl.applets.etsmobile.model.Programme in project ETSMobile-Android2 by ApplETS.
the class ProfilFragment method onRequestSuccess.
@Override
public void onRequestSuccess(Object o) {
super.onRequestSuccess(o);
if (o != null) {
if (o instanceof Etudiant) {
Etudiant etudiant = (Etudiant) o;
profileAdapter.updateEtudiant(etudiant);
if (etudiant.erreur == null) {
// Save Etudiant class in DB
profilManager.updateEtudiant(etudiant);
}
} else if (o instanceof listeDesProgrammes) {
listeDesProgrammes listeDesProgrammes = (listeDesProgrammes) o;
if (listeDesProgrammes.erreur == null) {
for (Programme p : listeDesProgrammes.liste) {
profilManager.updateProgramme(p);
}
}
}
updateUI();
}
}
use of ca.etsmtl.applets.etsmobile.model.Programme in project ETSMobile-Android2 by ApplETS.
the class ProfileSpinnerAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView != null) {
holder = (ViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_profile_spinner, parent, false);
holder = new ViewHolder();
holder.tvProgramName = (TextView) convertView.findViewById(R.id.tv_program);
// holder.tvProgramStatus = (TextView) convertView.findViewById(R.id.tv_program_status);
convertView.setTag(holder);
}
Programme item = getItem(position);
holder.tvProgramName.setText(item.libelle);
return convertView;
}
use of ca.etsmtl.applets.etsmobile.model.Programme in project ETSMobile-Android2 by ApplETS.
the class ProfileSpinnerAdapter method getDropDownView.
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView != null) {
holder = (ViewHolder) convertView.getTag();
} else {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_profile_spinner_dropdown, parent, false);
holder = new ViewHolder();
holder.tvProgramName = (TextView) convertView.findViewById(R.id.tv_program);
holder.tvProgramStatus = (TextView) convertView.findViewById(R.id.tv_program_status);
convertView.setTag(holder);
}
Programme item = getItem(position);
holder.tvProgramName.setText(item.libelle);
holder.tvProgramStatus.setText(item.statut);
return convertView;
}
Aggregations