Android Open Source - temaki Delete Confirmation Dialog






From Project

Back to project page temaki.

License

The source code is released under:

Apache License

If you think the Android project temaki listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jmartin.temaki.dialog;
/*  w w  w .  j a v  a 2s  .com*/
import android.app.DialogFragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.jmartin.temaki.MainListsFragment;
import com.jmartin.temaki.R;
import com.jmartin.temaki.model.Constants;

/**
 * Author: Jeff Martin, 2013
 */
public class DeleteConfirmationDialog extends DialogFragment {

    public interface GenericAlertDialogListener {
        void onFinishAlertDialog();
    }

    private String dialogTitle;

    public DeleteConfirmationDialog() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.delete_confirmation_dialog_fragment, container);

        Button cancelButton = (Button) rootView.findViewById(R.id.cancel_dialog_button);
        Button okButton = (Button) rootView.findViewById(R.id.ok_dialog_button);

        cancelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Fragment frag = getTargetFragment();
                if (frag != null) {
                    frag.onActivityResult(getTargetRequestCode(),
                            Constants.CANCEL_RESULT_CODE, null);
                }
                dismiss();
            }
        });

        okButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Fragment frag = getTargetFragment();
                if (frag == null) {
                    finishDialogWithResult();
                } else {
                    frag.onActivityResult(getTargetRequestCode(),
                                     Constants.DELETE_ITEM_ID, null);
                    dismiss();
                }
            }
        });
        getDialog().setTitle(dialogTitle);
        return rootView;
    }

    private void finishDialogWithResult() {
        GenericAlertDialogListener listener = (GenericAlertDialogListener) getActivity();
        listener.onFinishAlertDialog();
        this.dismiss();
    }

    public void setTitle(String dialogTitle) {
        this.dialogTitle = dialogTitle;
    }
}




Java Source Code List

com.jmartin.temaki.FocusActivity.java
com.jmartin.temaki.MainDrawerActivity.java
com.jmartin.temaki.MainListsFragment.java
com.jmartin.temaki.adapter.DrawerListAdapter.java
com.jmartin.temaki.adapter.ListItemsAdapter.java
com.jmartin.temaki.dialog.DeleteConfirmationDialog.java
com.jmartin.temaki.dialog.GenericInputDialog.java
com.jmartin.temaki.model.Constants.java
com.jmartin.temaki.model.TemakiItem.java
com.jmartin.temaki.settings.InformationDialogPreference.java
com.jmartin.temaki.settings.SettingsActivity.java
com.jmartin.temaki.settings.SettingsFragment.java