Android Open Source - pokerCCF Send Invitation Dialog Fragment






From Project

Back to project page pokerCCF.

License

The source code is released under:

Copyright (c) 2011-2014, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redist...

If you think the Android project pokerCCF 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.intel.friend.invitation;
/* www .j ava  2  s  .c om*/
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

import com.intel.inproclib.R;
import com.intel.stc.utility.StcSession;

public class SendInvitationDialogFragment extends DialogFragment {
  @Override
  public void onDestroyView() {
    getActivity().finish();
    super.onDestroyView();
  }

  private Context mContext;
  private StcSession mSession;
  private FriendSendInvitationState mFriendSendInvitationState;

  public SendInvitationDialogFragment() {

  }

  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
        getContext());
    Drawable d = new BitmapDrawable(getResources(), mSession.getAvatar());
    alertDialogBuilder.setIcon(d);
    Resources res = getResources();
    alertDialogBuilder.setTitle(res
        .getString(R.string.friendsendinvitation_title));
    String message;
    switch (getFriendSendInvitationState()) {
    case ConnectedMakingFriendRequest:
      message = String
          .format(res
              .getString(R.string.friendsendinvitationmsg_makingfriendrequest),
              mSession.getUserName());

      alertDialogBuilder.setMessage(message);
      // set dialog message
      alertDialogBuilder.setNeutralButton(
          res.getString(R.string.cancel_button_label),
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
              getActivity().finish();
            }
          });

      break;
    case ServerRegistrationSucceededFriendsMade:
      message = String
          .format(res
              .getString(R.string.friendsendinvitationmsg_serverregistrationsucceededfriendsmade),
              mSession.getUserName());

      alertDialogBuilder.setMessage(message);
      // set dialog message
      alertDialogBuilder.setNeutralButton(res.getString(R.string.ok),
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
              getActivity().finish();
            }
          });

      break;
    case ServerRegistrationFailed:
    case FriendRequestNotAccepted:
    case InviteeNoInternetError:
    case ConnectionFailed:
    case FriendRequestTimedOut:
    case InviteeBusy:
      message = String
          .format(res
              .getString(R.string.friendreceiveinvitationmsg_errorafteracceptinginvitation),
              mSession.getUserName());
      alertDialogBuilder.setMessage(message);
      // set title
      alertDialogBuilder.setCancelable(false).setNegativeButton(
          res.getString(R.string.ok),
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
              getActivity().finish();
            }
          });

      break;
    default:
      break;
    }

    return alertDialogBuilder.create();
  }

  public void setSession(StcSession mSession) {
    this.mSession = mSession;
  }

  public FriendSendInvitationState getFriendSendInvitationState() {
    return mFriendSendInvitationState;
  }

  public void setFriendSendInvitationState(
      FriendSendInvitationState mFriendSendInvitationState) {
    this.mFriendSendInvitationState = mFriendSendInvitationState;
  }

  public Context getContext() {
    return mContext;
  }

  public void setContext(Context mContext) {
    this.mContext = mContext;
  }
}




Java Source Code List

com.intel.friend.invitation.FriendInvitationBase.java
com.intel.friend.invitation.FriendInvitationError.java
com.intel.friend.invitation.FriendInvitationMessage.java
com.intel.friend.invitation.FriendInvitationService.java
com.intel.friend.invitation.FriendReceiveInvitationActivity.java
com.intel.friend.invitation.FriendReceiveInvitationState.java
com.intel.friend.invitation.FriendSendInvitationActivity.java
com.intel.friend.invitation.FriendSendInvitationState.java
com.intel.friend.invitation.IDataStreamEventListener.java
com.intel.friend.invitation.IFriendInvitationEventListener.java
com.intel.friend.invitation.ReadEngine.java
com.intel.friend.invitation.SendInvitationDialogFragment.java
com.intel.friend.invitation.WriteEngine.java
com.intel.inproclib.user_details.UpdateUserDetailsActivity.java
com.intel.inproclib.user_details.UserSettingsFragment.java
com.intel.inproclib.utility.ImageViewNoLayoutRefresh.java
com.intel.inproclib.utility.InProcConstants.java
com.intel.inproclib.utility.InProc_ImageManager_Assets.java
com.intel.inproclib.utility.InProc_ListViewImageManager_FileSystem.java
com.intel.inproclib.utility.InProc_ListViewImageManager.java
com.intel.inproclib.utility.MaxLengthTextWatcher.java
com.intel.inproclib.utility.NoNewlineEditText.java
com.intel.startup.AvatarFragment.java
com.intel.startup.AvatarPickerFragment.java
com.intel.startup.CloudAuthorizationActivity.java
com.intel.startup.DeviceNameFragment.java
com.intel.startup.NewUnboxFragment.java
com.intel.startup.NewUnbox.java
com.intel.startup.StartupFragment.java
com.intel.startup.UserNameFragment.java
com.intel.ux.ImageUtilities.java
com.intel.ux.StcSessionListAdapter.java
lo.wolo.pokerccf.AbstractServiceUsingActivity.java
lo.wolo.pokerccf.CCFManager.java
lo.wolo.pokerccf.ChatAdapter.java
lo.wolo.pokerccf.Constants.java
lo.wolo.pokerccf.DiscoveryNodeActivity.java
lo.wolo.pokerccf.IServiceIOListener.java
lo.wolo.pokerccf.ISimpleDiscoveryListener.java
lo.wolo.pokerccf.MultiConnectRegisterApp.java
lo.wolo.pokerccf.NodeListAdapter.java
lo.wolo.pokerccf.NodeWrapper.java
lo.wolo.pokerccf.ReadEngine.java
lo.wolo.pokerccf.RemoteUser.java
lo.wolo.pokerccf.ServerController.java
lo.wolo.pokerccf.SessionAdapter.java
lo.wolo.pokerccf.WriteEngine.java
lo.wolo.pokerengine.Card.java
lo.wolo.pokerengine.ClientCCF.java
lo.wolo.pokerengine.Client.java
lo.wolo.pokerengine.Deck.java
lo.wolo.pokerengine.HandEvaluator.java
lo.wolo.pokerengine.HandValueType.java
lo.wolo.pokerengine.HandValue.java
lo.wolo.pokerengine.Hand.java
lo.wolo.pokerengine.Player.java
lo.wolo.pokerengine.Pot.java
lo.wolo.pokerengine.TableType.java
lo.wolo.pokerengine.Table.java
lo.wolo.pokerengine.actions.Action.java
lo.wolo.pokerengine.actions.AllInAction.java
lo.wolo.pokerengine.actions.BetAction.java
lo.wolo.pokerengine.actions.BigBlindAction.java
lo.wolo.pokerengine.actions.CallAction.java
lo.wolo.pokerengine.actions.CheckAction.java
lo.wolo.pokerengine.actions.ContinueAction.java
lo.wolo.pokerengine.actions.FoldAction.java
lo.wolo.pokerengine.actions.RaiseAction.java
lo.wolo.pokerengine.actions.SmallBlindAction.java
lo.wolo.pokerengine.bots.BasicBot.java
lo.wolo.pokerengine.bots.Bot.java
lo.wolo.pokerengine.bots.DummyBot.java
lo.wolo.pokerengine.util.PokerUtils.java