Code example for DialogFragment

Methods: getDialog, onStart

0
  private void syncOkButtonState() 
  { 
    if (this.mRating != null);
    for (boolean bool = true; ; bool = false)
    { 
      ((AlertDialog)getDialog()).getButton(-1).setEnabled(bool);
      return; 
    } 
  } 
 
  public Dialog onCreateDialog(Bundle paramBundle)
  { 
    ContextThemeWrapper localContextThemeWrapper = new ContextThemeWrapper(getActivity(), 2131623994);
    Bundle localBundle1 = getArguments();
    final String str1 = localBundle1.getString("rating_id");
    final String str2 = localBundle1.getString("doc_id");
    if (paramBundle != null);
    int i;
    CharSequence[] arrayOfCharSequence;
    for (Bundle localBundle2 = paramBundle; ; localBundle2 = localBundle1)
    { 
      i = localBundle2.getInt("previous_rating", -1);
      this.mRating = getRatingForIndex(i);
      arrayOfCharSequence = new CharSequence[CommentRating.values().length];
      for (CommentRating localCommentRating : CommentRating.values())
        arrayOfCharSequence[localCommentRating.getIndex()] = localContextThemeWrapper.getString(localCommentRating.getTextResourceId());
    } 
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(localContextThemeWrapper);
    localBuilder.setTitle(2131165578);
    localBuilder.setCancelable(true);
    localBuilder.setSingleChoiceItems(arrayOfCharSequence, i, new DialogInterface.OnClickListener()
    { 
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      { 
        RateReviewDialog.this.setRating(paramAnonymousInt);
        RateReviewDialog.this.syncOkButtonState();
      } 
    }); 
    localBuilder.setPositiveButton(17039370, new DialogInterface.OnClickListener()
    { 
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      { 
        RateReviewDialog.Listener localListener = RateReviewDialog.this.getListener();
        if ((localListener != null) && (RateReviewDialog.this.mRating != null))
          localListener.onRateReview(str2, str1, RateReviewDialog.this.mRating);
      } 
    }); 
    localBuilder.setNegativeButton(17039360, null);
    return localBuilder.create();
  } 
 
  public void onSaveInstanceState(Bundle paramBundle)
  { 
    if (this.mRating != null)
      paramBundle.putInt("previous_rating", this.mRating.getIndex());
  } 
 
  public void onStart() 
  { 
    super.onStart(); 
    syncOkButtonState(); 
  } 
 
  public static enum CommentRating 
  {