|
|
@@ -1,6 +1,10 @@
|
|
|
package com.xzjmyk.pm.activity.ui.erp.adapter.oa;
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
+import android.content.DialogInterface;
|
|
|
+import android.support.v7.app.AlertDialog;
|
|
|
import android.text.Editable;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
@@ -24,9 +28,11 @@ public class AddBusinessAdapter extends BaseAdapter {
|
|
|
|
|
|
|
|
|
private List<EmployeesModel> contacts;
|
|
|
+ private Activity activity;
|
|
|
|
|
|
- public AddBusinessAdapter(List<EmployeesModel> contacts) {
|
|
|
+ public AddBusinessAdapter(Activity activity, List<EmployeesModel> contacts) {
|
|
|
this.contacts = contacts;
|
|
|
+ this.activity = activity;
|
|
|
}
|
|
|
|
|
|
public List<EmployeesModel> getContacts() {
|
|
|
@@ -81,8 +87,27 @@ public class AddBusinessAdapter extends BaseAdapter {
|
|
|
holder.delete_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- contacts.remove(contact);
|
|
|
- notifyDataSetChanged();
|
|
|
+ if (!TextUtils.isEmpty(holder.name_et.getText()) || !TextUtils.isEmpty(holder.phone_et.getText())) {
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
+ builder.setTitle(R.string.prompt_title).setMessage(R.string.sure_delete_mission).setPositiveButton(R.string.sure, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ try {
|
|
|
+ contacts.remove(contact);
|
|
|
+ notifyDataSetChanged();
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
+ } else {
|
|
|
+ contacts.remove(contact);
|
|
|
+ notifyDataSetChanged();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
holder.delete_tv.setVisibility(position == 0 ? View.GONE : View.VISIBLE);
|