@Override
 public void onClick(DialogInterface arg0, int arg1) {
   // Casting to ControllableActivity will crash if it fails. This is the expected
   // behavior, since the cast should always succeed. Cast failures only occur during
   // development.
   final AlertDialog.OnClickListener listener =
       ((ControllableActivity) getActivity()).getConversationUpdater().getListener();
   if (listener != null) {
     listener.onClick(arg0, arg1);
   }
 }
예제 #2
0
 protected void showNotOurResults(int index, AlertDialog.OnClickListener proceedListener) {
   SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
   if (prefs.getBoolean(PreferencesActivity.KEY_NOT_OUR_RESULTS_SHOWN, false)) {
     // already seen it, just proceed
     proceedListener.onClick(null, index);
   } else {
     // note the user has seen it
     prefs.edit().putBoolean(PreferencesActivity.KEY_NOT_OUR_RESULTS_SHOWN, true).commit();
     AlertDialog.Builder builder = new AlertDialog.Builder(activity);
     builder.setMessage(R.string.msg_not_our_results);
     builder.setPositiveButton(R.string.button_ok, proceedListener);
     builder.show();
   }
 }