Пример #1
0
  @Override
  public void onClick(View item, View widget, final int position, int which) {
    // TODO Auto-generated method stub
    final FamilyMember myFamilyMember;
    myFamilyMember = familyMemberList.get(position);
    switch (which) {
      case R.id.edit_btn:
        final FamilyMemberDialog familyMemberDialog =
            new FamilyMemberDialog(
                true,
                myFamilyMember.getName(),
                myFamilyMember.getGender(),
                myFamilyMember.getBirthday(),
                myFamilyMember.getRelationship(),
                myFamilyMember.getEducation(),
                myFamilyMember.getJob(),
                myFamilyMember.getIdcard(),
                myFamilyMember.getMarriage(),
                myFamilyMember.getPersonalStatus(),
                myFamilyMember.getRemark());
        familyMemberDialog.show(getChildFragmentManager(), "familyMemberDialog");

        familyMemberDialog.setOnFamilyMemberDialog(
            new OnFamilyMemberDialog() {
              @Override
              public void onConfirmClick(FamilyMember familyMember) {
                if (familyMember != null) {
                  if (!familyMember.toString().equals(myFamilyMember.toString())) {
                    familyMemberList.set(position, familyMember);
                    familyMemberAdapter.notifyDataSetChanged();
                    familyMemberDialog.hide();
                  }
                }
              }
            });
        break;
      case R.id.delete_btn:
        familyMemberList.remove(position);
        familyMemberAdapter.notifyDataSetChanged();
        break;
      case R.id.detail_btn:
        final FamilyMemberDialog familyMemberDialog2 =
            new FamilyMemberDialog(
                false,
                myFamilyMember.getName(),
                myFamilyMember.getGender(),
                myFamilyMember.getBirthday(),
                myFamilyMember.getRelationship(),
                myFamilyMember.getEducation(),
                myFamilyMember.getJob(),
                myFamilyMember.getIdcard(),
                myFamilyMember.getMarriage(),
                myFamilyMember.getPersonalStatus(),
                myFamilyMember.getRemark());
        familyMemberDialog2.show(getChildFragmentManager(), "familyMemberDialog");

        familyMemberDialog2.setOnFamilyMemberDialog(
            new OnFamilyMemberDialog() {
              @Override
              public void onConfirmClick(FamilyMember familyMember) {
                familyMemberDialog2.hide();
              }
            });
        break;
      default:
        break;
    }
  }