Exemplo n.º 1
0
  private void showDeleteDialog() {
    Log.d(TAG, "showDeleteDialog() called");

    final Dialog deleteDialog = new Dialog(NoteActivity.this);
    LinearLayout dialogLayout =
        (LinearLayout) View.inflate(NoteActivity.this, R.layout.delete_note_dialog, null);
    deleteDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    deleteDialog.setContentView(dialogLayout);

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(deleteDialog.getWindow().getAttributes());
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;

    deleteDialog.show();
    deleteDialog.getWindow().setAttributes(lp);

    TextView noteTitleTextView =
        (TextView) dialogLayout.findViewById(R.id.delete_note_dialog_delete_note_title_textview);
    noteTitleTextView.setText(note.getTitle());

    Button confirmDeleteButton =
        (Button) dialogLayout.findViewById(R.id.delete_note_dialog_confirm_button);
    confirmDeleteButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "Delete dialog confirm button clicked");
            noteProvider.deleteNote(note);
            finish();
          }
        });

    Button cancelDeleteButton =
        (Button) dialogLayout.findViewById(R.id.delete_note_dialog_cancel_button);
    cancelDeleteButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "Delete dialog cancel button clicked");
            deleteDialog.dismiss();
          }
        });
  }
Exemplo n.º 2
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHodler holder = null;
   if (null == convertView) {
     convertView = View.inflate(context, R.layout.li_child_click_item, null);
     holder = new ViewHodler();
     holder.mCountry = (Button) convertView.findViewById(R.id.licc_btn_country);
     holder.mName = (TextView) convertView.findViewById(R.id.licc_tv_name);
     convertView.setTag(holder);
   } else {
     holder = (ViewHodler) convertView.getTag();
   }
   LiData data = list.get(position);
   holder.mCountry.setText(data.country);
   holder.mCountry.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_COUNTRY, position));
   holder.mName.setText(data.name);
   holder.mName.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_NAME, position));
   convertView.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_ITEM, position));
   return convertView;
 }