use of com.yarolegovich.lovelydialog.LovelyCustomDialog in project easy by MehdiBenmesa.
the class StudentsFragmentAbsence method startDialog.
public void startDialog(final JSONArray response, final JSONArray pseances, List<String> modules) {
/* List<String> modules = new ArrayList<String>();
final JSONArray seances = new JSONArray();
try{
for (int i =0;i<response.length();i++) {
JSONObject seance = response.getJSONObject(i);
JSONObject idmodule = seance.getJSONObject("module");
if(idmodule.getString("_id").equals(module.getString("_id"))){
String type = "";
try{
type = seance.getString("type") + " de : ";
}catch (Exception e){
e.printStackTrace();
type = "heur de : ";
}
String seanceSpinner = type + seance.getString("starts") + " à "+seance.getString("ends");
modules.add(seanceSpinner);
seances.put(seance);
}
}} catch (JSONException e){
e.printStackTrace();
}*/
addDialog = getActivity().getLayoutInflater().inflate(R.layout.absence_dialog, null);
final TextView nom = (TextView) addDialog.findViewById(R.id.nomdialog);
final Spinner etat = (Spinner) addDialog.findViewById(R.id.okdialog);
ArrayAdapter<String> adap = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, modules);
adap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
etat.setAdapter(adap);
nom.setText("");
dialog = new LovelyCustomDialog(getContext(), R.style.EditTextTintTheme).setTopColorRes(R.color.darkRed).setView(addDialog).setTitle(R.string.text_input_title).setIcon(R.drawable.ic_add_alert_black_24dp).setCancelable(false);
dialog.show();
Button ok = (Button) addDialog.findViewById(R.id.ok);
Button annuler = (Button) addDialog.findViewById(R.id.cancel);
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
String module = etat.getSelectedItem().toString();
} catch (Exception e) {
System.out.println("NO MODULE ");
}
try {
int position = etat.getSelectedItemPosition();
AbsenceService.getAbsneceBySeance(getContext(), mReceiver, new JSONObject().put("idSeance", pseances.getJSONObject(position).getString("_id")).put("date", newDate));
} catch (JSONException e) {
e.printStackTrace();
}
dialog.dismiss();
}
});
annuler.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
}
use of com.yarolegovich.lovelydialog.LovelyCustomDialog in project easy by MehdiBenmesa.
the class RendezVousActivity method buttonPressed.
@Override
public void buttonPressed(final JSONObject module) {
addDialog = getLayoutInflater().inflate(R.layout.rdv_dialog, null);
final TextView nom = (TextView) addDialog.findViewById(R.id.nomdialog);
final TextView date = (TextView) addDialog.findViewById(R.id.date);
final EditText heur = (EditText) addDialog.findViewById(R.id.heur);
final EditText value = (EditText) addDialog.findViewById(R.id.value);
dialog = new LovelyCustomDialog(this, R.style.EditTextTintTheme).setTopColorRes(R.color.darkRed).setView(addDialog).setTitle(R.string.text_input_title).setIcon(R.drawable.ic_add_alert_black_24dp).setCancelable(false);
dialog.show();
Button ok = (Button) addDialog.findViewById(R.id.ok);
Button annuler = (Button) addDialog.findViewById(R.id.cancel);
date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showDatePicker();
}
});
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
ajouterRdv(module.getString("_id"), date.getText().toString(), value.getText().toString());
} catch (JSONException e) {
e.printStackTrace();
}
dialog.dismiss();
}
});
annuler.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
ondate = new DatePickerDialog.OnDateSetListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onDateSet(android.widget.DatePicker view, int year, int monthOfYear, int dayOfMonth) {
monthOfYear = monthOfYear + 1;
date.setText(year + "-" + monthOfYear + 1 + "-" + dayOfMonth);
calender.set(year, monthOfYear, dayOfMonth);
int dayOfWeek = 0;
dayOfWeek = calender.get(Calendar.DAY_OF_WEEK);
System.out.println("DAY_OF_WEEK : +======== " + dayOfWeek);
// studentsListAdapter.notifyDataSetChanged();
}
};
}
use of com.yarolegovich.lovelydialog.LovelyCustomDialog in project easy by MehdiBenmesa.
the class RendezVousFragment method buttonPressed.
@Override
public void buttonPressed(final JSONObject rdv) {
addDialog = getActivity().getLayoutInflater().inflate(R.layout.rdv_dialog, null);
final TextView nom = (TextView) addDialog.findViewById(R.id.nomdialog);
final TextView date = (TextView) addDialog.findViewById(R.id.date);
final EditText heur = (EditText) addDialog.findViewById(R.id.heur);
final EditText value = (EditText) addDialog.findViewById(R.id.value);
dialog = new LovelyCustomDialog(getContext(), R.style.EditTextTintTheme).setTopColorRes(R.color.darkRed).setView(addDialog).setTitle(R.string.text_input_title).setIcon(R.drawable.ic_add_alert_black_24dp).setCancelable(false);
dialog.show();
Button ok = (Button) addDialog.findViewById(R.id.ok);
Button annuler = (Button) addDialog.findViewById(R.id.cancel);
date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showDatePicker();
}
});
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
accept(rdv, date.getText().toString(), heur.getText().toString(), value.getText().toString());
dialog.dismiss();
}
});
annuler.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
refuse(rdv, value.getText().toString());
dialog.dismiss();
}
});
ondate = new DatePickerDialog.OnDateSetListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onDateSet(android.widget.DatePicker view, int year, int monthOfYear, int dayOfMonth) {
monthOfYear = monthOfYear + 1;
date.setText(year + "-" + monthOfYear + 1 + "-" + dayOfMonth);
calender.set(year, monthOfYear, dayOfMonth);
int dayOfWeek = 0;
dayOfWeek = calender.get(Calendar.DAY_OF_WEEK);
System.out.println("DAY_OF_WEEK : +======== " + dayOfWeek);
// studentsListAdapter.notifyDataSetChanged();
}
};
}
use of com.yarolegovich.lovelydialog.LovelyCustomDialog in project easy by MehdiBenmesa.
the class BaseActivity method showAlertDialog.
private void showAlertDialog(String message) {
LovelyCustomDialog dialog = new LovelyCustomDialog(this, R.style.EditTextTintTheme).setTopColorRes(R.color.colorPrimaryDark).setTitle("Message Received !").setMessage(message).setIcon(R.drawable.ic_add_alert_black_24dp).setCancelable(false);
dialog.show();
}
use of com.yarolegovich.lovelydialog.LovelyCustomDialog in project easy by MehdiBenmesa.
the class StudentsFragmentNote method buttonPressed.
@Override
public void buttonPressed(final JSONObject student, final JSONArray notes) throws JSONException {
addDialog = getActivity().getLayoutInflater().inflate(R.layout.adddialog, null);
final TextView nom = (TextView) addDialog.findViewById(R.id.nomdialog);
final Spinner etat = (Spinner) addDialog.findViewById(R.id.okdialog);
final EditText value = (EditText) addDialog.findViewById(R.id.value);
ArrayAdapter adap = ArrayAdapter.createFromResource(getContext(), R.array.snipperdialog, R.layout.item_spinner);
etat.setAdapter(adap);
nom.setText(student.getString("name") + " " + student.getString("lastname"));
dialog = new LovelyCustomDialog(getContext(), R.style.EditTextTintTheme).setTopColorRes(R.color.darkRed).setView(addDialog).setTitle(R.string.text_input_title).setIcon(R.drawable.ic_add_alert_black_24dp).setCancelable(false);
dialog.show();
Button ok = (Button) addDialog.findViewById(R.id.ok);
Button annuler = (Button) addDialog.findViewById(R.id.cancel);
etat.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
String item = adapterView.getItemAtPosition(position).toString();
value.setText("");
try {
for (int i = 0; i < notes.length(); i++) {
JSONObject note = notes.getJSONObject(i);
if (note.getString("module").equals(module.getString("_id")))
if (note.getString("reason").equals(item)) {
value.setText(note.getString("value"));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String valeur = value.getText().toString();
String reason = etat.getSelectedItem().toString();
try {
// putNoteStudent(valeur, student.getString("_id"), reason);
JSONObject dataToSend = new JSONObject();
dataToSend.put("reason", reason);
dataToSend.put("student", student.getString("_id"));
dataToSend.put("value", valeur);
dataToSend.put("module", module.getString("_id"));
dataToSend.put("modulename", module.getString("_name"));
NoteService.putNoteStudent(getContext(), mReceiver, dataToSend);
} catch (JSONException e) {
e.printStackTrace();
}
dialog.dismiss();
}
});
annuler.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
}
Aggregations