Android Open Source - irma_android_management Card Missing Dialog Fragment






From Project

Back to project page irma_android_management.

License

The source code is released under:

GNU General Public License

If you think the Android project irma_android_management 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

/**
 * CardMissingDialogFragment.java//ww w .j  ava  2s  . co  m
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 * Copyright (C) Wouter Lueks, Radboud University Nijmegen, March 2013.
 */

package org.irmacard.androidmanagement.dialogs;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;

public class CardMissingDialogFragment extends DialogFragment {

  public interface CardMissingDialogListener {
    public void onCardMissingCancel();
        public void onCardMissingRetry();
  }

    CardMissingDialogListener mListener;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        // Use the Builder class for convenient dialog construction
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    builder.setTitle("Present Card")
        .setMessage("Cannot continue without it!")
        .setPositiveButton("Retry",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                mListener.onCardMissingRetry();
              }
            })
        .setNegativeButton("Cancel",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                mListener.onCardMissingCancel();
              }
            });

        // Create the AlertDialog object and return it
        Dialog dialog = builder.create();

        return dialog;
    }

    // Override the Fragment.onAttach() method to instantiate the PINDialogListener
    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        // Verify that the host activity implements the callback interface
        try {
            // Instantiate the PINDialogListener so we can send events to the host
            mListener = (CardMissingDialogListener) activity;
        } catch (ClassCastException e) {
            // The activity doesn't implement the interface, throw exception
            throw new ClassCastException(activity.toString()
                    + " must implement PINDialogListener");
        }
    }
}




Java Source Code List

org.irmacard.androidmanagement.CredentialDetailActivity.java
org.irmacard.androidmanagement.CredentialDetailFragment.java
org.irmacard.androidmanagement.CredentialListActivity.java
org.irmacard.androidmanagement.InitFragment.java
org.irmacard.androidmanagement.LogActivity.java
org.irmacard.androidmanagement.LogFragment.java
org.irmacard.androidmanagement.MenuFragment.java
org.irmacard.androidmanagement.SettingsActivity.java
org.irmacard.androidmanagement.SettingsFragment.java
org.irmacard.androidmanagement.WaitingForCardActivity.java
org.irmacard.androidmanagement.adapters.CredentialAttributeAdapter.java
org.irmacard.androidmanagement.adapters.CredentialListAdapter.java
org.irmacard.androidmanagement.adapters.LogListAdapter.java
org.irmacard.androidmanagement.dialogs.AlertDialogFragment.java
org.irmacard.androidmanagement.dialogs.CardMissingDialogFragment.java
org.irmacard.androidmanagement.dialogs.ChangePinDialogFragment.java
org.irmacard.androidmanagement.dialogs.ConfirmDeleteDialogFragment.java
org.irmacard.androidmanagement.util.TransmitResult.java