Java Code Examples for android.app.Dialog

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AASettings.java

  18 
vote

/** 
 * Creates a color chooser dialog based on the DisplayType that was selected
 */
@Override public Dialog onCreateDialog(int id,Bundle args){
  DisplayTypes[] types=DisplayTypes.values();
  int color=settings.getInt(types[id].toString(),this.getDefaultColor(id));
  Dialog dialog=new ColorPickerDialog(this,this,color);
  return dialog;
}
 

Example 2

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: PhotoSyncActivity.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onItemClick(final AdapterView<?> parent,final View view,final int position,final long id){
  final MobeelizerFile photo=((FileSyncEntity)parent.getItemAtPosition(position)).getPhoto();
  Dialog dialog=new Dialog(this,R.style.MobeelizerDialogTheme);
  dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.photo_dialog);
  dialog.setCancelable(true);
  dialog.setCanceledOnTouchOutside(true);
  ImageView photoView=(ImageView)dialog.findViewById(R.id.dialogPhoto);
  photoView.setImageDrawable(BitmapDrawable.createFromStream(photo.getInputStream(),photo.getName()));
  dialog.show();
}
 

Example 3

From project android-client_2, under directory /src/org/mifos/androidclient/main/.

Source file: PreCollectionSheetActivity.java

  18 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog dialog;
switch (id) {
case DATE_DIALOG_ID:
    Calendar today=Calendar.getInstance();
  return new DatePickerDialog(this,this,today.get(Calendar.YEAR),today.get(Calendar.MONTH),today.get(Calendar.DAY_OF_MONTH));
default :
dialog=null;
}
return dialog;
}
 

Example 4

From project android-context, under directory /defunct/.

Source file: PrefsActivity.java

  18 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog dialog;
switch (id) {
case DIALOG_ABOUT:
    dialog=getAboutBox();
  break;
default :
dialog=null;
}
return dialog;
}
 

Example 5

From project android-joedayz, under directory /Proyectos/TaxiLab1/src/com/mycompany/.

Source file: AddUser.java

  18 
vote

void CatchError(String Exception){
  Dialog diag=new Dialog(this);
  diag.setTitle("Registro de Datos");
  TextView txt=new TextView(this);
  txt.setText(Exception);
  diag.setContentView(txt);
  diag.show();
}
 

Example 6

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  18 
vote

/** 
 * Dismiss any AQuery dialogs.
 * @return self
 */
public T dismiss(){
  Iterator<Dialog> keys=dialogs.keySet().iterator();
  while (keys.hasNext()) {
    Dialog d=keys.next();
    try {
      d.dismiss();
    }
 catch (    Exception e) {
    }
    keys.remove();
  }
  return self();
}
 

Example 7

From project Android_1, under directory /FixedSizeTextColumns/src/com/novoda/.

Source file: HelloWebView.java

  18 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog dialog=null;
switch (id) {
case DIALOG_CHOOSE_VIEW_ID:
    dialog=getChooseViewDialog();
  break;
default :
dialog=super.onCreateDialog(id);
}
return dialog;
}
 

Example 8

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothNamePreference.java

  18 
vote

public void afterTextChanged(Editable s){
  Dialog d=getDialog();
  if (d instanceof AlertDialog) {
    ((AlertDialog)d).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(s.length() > 0);
  }
}
 

Example 9

From project android_packages_apps_FileManager, under directory /src/org/openintents/distribution/.

Source file: InfoActivity.java

  18 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog dialog=super.onCreateDialog(id);
  if (dialog != null) {
    return dialog;
  }
  if (id >= DIALOG_INFO && id < DIALOG_GET_FROM_MARKET) {
    dialog=buildInfoDialog(id - DIALOG_INFO);
  }
 else   if (id >= DIALOG_GET_FROM_MARKET && id < DIALOG_DISTRIBUTION_START) {
    dialog=buildGetFromMarketDialog(id - DIALOG_GET_FROM_MARKET);
  }
  return dialog;
}
 

Example 10

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: MainMenuActivity.java

  17 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.rules_menu:
    Dialog dialog=new Dialog(this);
  dialog.setContentView(R.layout.rules);
dialog.setTitle(getString(R.string.rules_title));
dialog.show();
break;
case R.id.preferences_menu:
Intent preferencesIntent=new Intent("com.bytopia.abalone.PREFERENCES");
startActivity(preferencesIntent);
break;
}
return true;
}
 

Example 11

From project agit, under directory /agit/src/main/java/com/madgag/agit/views/.

Source file: PersonIdentView.java

  17 
vote

public void setIdent(final String title,final PersonIdent ident){
  this.ident=ident;
  titleView.setText(title);
  Drawable avatar=avatarSession.get(gravatarIdFor(ident.getEmailAddress()));
  avatarView.setImageDrawable(avatar);
  nameView.setText(ident.getName() + ITALIC_CLIPPING_BUFFER);
  whenView.setText(timeSinceMS(ident.getWhen().getTime()) + ITALIC_CLIPPING_BUFFER);
  setClickable(true);
  setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Log.d(TAG,"Clicked " + v);
      final PersonIdentDetailView view=new PersonIdentDetailView(getContext());
      view.setIdent(title,ident);
      Dialog dialog=new AlertDialog.Builder(getContext()).setView(view).show();
      view.setClickable(true);
      view.setOnClickListener(close(dialog));
    }
  }
);
}
 

Example 12

From project alljoyn_java, under directory /samples/android/chat/src/org/alljoyn/bus/sample/chat/.

Source file: DialogBuilder.java

  17 
vote

public Dialog createUseJoinDialog(final Activity activity,final ChatApplication application){
  Log.i(TAG,"createUseJoinDialog()");
  final Dialog dialog=new Dialog(activity);
  dialog.requestWindowFeature(dialog.getWindow().FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.usejoindialog);
  ArrayAdapter<String> channelListAdapter=new ArrayAdapter<String>(activity,android.R.layout.test_list_item);
  final ListView channelList=(ListView)dialog.findViewById(R.id.useJoinChannelList);
  channelList.setAdapter(channelListAdapter);
  List<String> channels=application.getFoundChannels();
  for (  String channel : channels) {
    int lastDot=channel.lastIndexOf('.');
    if (lastDot < 0) {
      continue;
    }
    channelListAdapter.add(channel.substring(lastDot + 1));
  }
  channelListAdapter.notifyDataSetChanged();
  channelList.setOnItemClickListener(new ListView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      String name=channelList.getItemAtPosition(position).toString();
      application.useSetChannelName(name);
      application.useJoinChannel();
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  Button cancel=(Button)dialog.findViewById(R.id.useJoinCancel);
  cancel.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View view){
      activity.removeDialog(UseActivity.DIALOG_JOIN_ID);
    }
  }
);
  return dialog;
}
 

Example 13

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/.

Source file: StartupActivity.java

  17 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog superDlg=super.onCreateDialog(id);
  if (superDlg != null) {
    return superDlg;
  }
switch (id) {
case CAN_DOWNLOAD_DLG:
    return new AlertDialog.Builder(StartupActivity.this).setMessage(R.string.download_confirmation).setCancelable(false).setPositiveButton(R.string.okay,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        removeDialog(CAN_DOWNLOAD_DLG);
        doGotoDownloadActivity();
      }
    }
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        removeDialog(CAN_DOWNLOAD_DLG);
        StartupActivity.this.finish();
        System.exit(2);
      }
    }
).create();
}
return null;
}
 

Example 14

From project android-bankdroid, under directory /src/com/liato/bankdroid/.

Source file: MainActivity.java

  17 
vote

@Override protected Dialog onCreateDialog(final int id){
  super.onCreateDialog(id);
  final Dialog dialog=new Dialog(this);
  dialog.setContentView(R.layout.about);
  dialog.setTitle(getString(R.string.about));
  PackageInfo pInfo;
  String version="v1.x.x";
  try {
    pInfo=getPackageManager().getPackageInfo(getPackageName(),PackageManager.GET_META_DATA);
    version=pInfo.versionName;
  }
 catch (  final NameNotFoundException e) {
    e.printStackTrace();
  }
  ((TextView)dialog.findViewById(R.id.txtVersion)).setText(getText(R.string.version).toString().replace("$version",version));
  return dialog;
}
 

Example 15

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: EquipmentSetEditActivity.java

  17 
vote

@Override protected Dialog onCreateDialog(int id){
  Dialog dialog;
  AlertDialog.Builder builder;
switch (id) {
case R.string.EquipmentNotFound:
    builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
builder.setMessage(getString(R.string.EquipmentNotFound));
builder.setTitle(getString(R.string.app_name));
builder.setPositiveButton(R.string.OK,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
dismissDialog(R.string.EquipmentNotFound);
FragmentManager fm=getSupportFragmentManager();
EquipmentSetEditFragment fragment=(EquipmentSetEditFragment)fm.findFragmentById(R.id.CharacterEdit);
if (fragment != null) fragment.startReselect();
}
}
);
builder.setNegativeButton(R.string.Cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
dismissDialog(R.string.EquipmentNotFound);
FragmentManager fm=getSupportFragmentManager();
EquipmentSetEditFragment fragment=(EquipmentSetEditFragment)fm.findFragmentById(R.id.CharacterEdit);
if (fragment != null) fragment.cancelReselect();
}
}
);
dialog=builder.create();
return dialog;
}
return super.onCreateDialog(id);
}
 

Example 16

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: CloudActivity.java

  17 
vote

private void createCustomDialog(int id){
  final Dialog dialog=new Dialog(CloudActivity.this);
switch (id) {
case PASSWORD_PROMPT:
    dialog.setContentView(R.layout.passworddialog);
  dialog.setTitle("Enter your password:");
dialog.setCancelable(false);
Button button=(Button)dialog.findViewById(R.id.submit_password);
button.setOnClickListener(new OnClickListener(){
public void onClick(View v){
EditText passwordText=((EditText)dialog.findViewById(R.id.submit_password_text));
if (!rightPassword(passwordText.getText().toString())) {
  passwordText.setText("");
  showToast("Password was incorrect.");
  loggedIn=false;
}
 else {
  dialog.dismiss();
  loggedIn=true;
}
}
}
);
dialog.show();
}
}
 

Example 17

From project android-tether, under directory /src/og/android/tether/.

Source file: MainActivity.java

  17 
vote

public Dialog openLaunchedDialog(final boolean noroot){
  final long value=noroot ? 1 : 0;
  EasyTracker.getTracker().trackEvent("ui_action","create_dialog","meshclient",value);
  Dialog dialog=new AlertDialog.Builder(this).setMessage(noroot ? R.string.dialog_noroot_text : R.string.dialog_launched_text).setTitle(getString(R.string.dialog_launched_title)).setIcon(R.drawable.og_app_icon).setCancelable(false).setOnKeyListener(new DialogInterface.OnKeyListener(){
    public boolean onKey(    DialogInterface dialog,    int keyCode,    KeyEvent event){
      if (keyCode == KeyEvent.KEYCODE_BACK)       MainActivity.this.finish();
      if (keyCode < KeyEvent.KEYCODE_DPAD_UP || keyCode > KeyEvent.KEYCODE_DPAD_CENTER)       return true;
 else       return false;
    }
  }
).setPositiveButton(getString(R.string.main_activity_ok),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      EasyTracker.getTracker().trackEvent("ui_action","button_press","meshclient_positive",value);
      startGooglePlayMeshclient(noroot ? "fail_noroot" : "fail");
    }
  }
).setNegativeButton(getString(R.string.main_activity_cancel),new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      EasyTracker.getTracker().trackEvent("ui_action","button_press","meshclient_negative",value);
    }
  }
).create();
  dialog.show();
  return dialog;
}
 

Example 18

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: DialerActivity.java

  17 
vote

@Override protected Dialog onCreateDialog(int id){
  String from=LinphoneManager.getInstance().extractIncomingRemoteName();
  View incomingCallView=getLayoutInflater().inflate(R.layout.incoming_call,null);
  final Dialog dialog=new AlertDialog.Builder(this).setMessage(String.format(getString(R.string.incoming_call_dialog_title),from)).setCancelable(false).setView(incomingCallView).create();
  ((CallButton)incomingCallView.findViewById(R.id.Call)).setExternalClickListener(new OnClickListener(){
    public void onClick(    View v){
      dialog.dismiss();
      if (Version.isVideoCapable()) {
        LinphoneManager.getInstance().resetCameraFromPreferences();
        boolean prefVideoEnable=LinphoneManager.getInstance().isVideoEnabled();
        int key=R.string.pref_video_automatically_share_my_video_key;
        boolean prefAutoShareMyCamera=mPref.getBoolean(getString(key),false);
        boolean videoMuted=!(prefVideoEnable && prefAutoShareMyCamera);
        AndroidCameraRecordManager.getInstance().setMuted(videoMuted);
        LinphoneManager.getLc().getCurrentCall().enableCamera(prefAutoShareMyCamera);
      }
    }
  }
);
  ((HangCallButton)incomingCallView.findViewById(R.id.Decline)).setExternalClickListener(new OnClickListener(){
    public void onClick(    View v){
      dialog.dismiss();
    }
  }
);
  return dialog;
}
 

Example 19

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnSettings.java

  17 
vote

public synchronized void onClick(DialogInterface dialog,int which){
  if (which == CONNECT_BUTTON) {
    Dialog d=(Dialog)dialog;
    String error=mConnectingActor.validateInputs(d);
    if (error == null) {
      mConnectingActor.connect(d);
      removeDialog(DIALOG_CONNECT);
      return;
    }
 else {
      dismissDialog(DIALOG_CONNECT);
      mShowingDialog=new AlertDialog.Builder(this).setTitle(android.R.string.dialog_alert_title).setIcon(android.R.drawable.ic_dialog_alert).setMessage(String.format(getString(R.string.vpn_error_miss_entering),error)).setPositiveButton(R.string.vpn_back_button,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int which){
          showDialog(DIALOG_CONNECT);
        }
      }
).create();
      mShowingDialog.show();
    }
  }
 else {
    removeDialog(DIALOG_CONNECT);
    changeState(mActiveProfile,VpnState.IDLE);
  }
}
 

Example 20

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: RemoteController.java

  17 
vote

public Dialog onCreateDialog(int id,final Context context){
  Dialog dialog;
switch (id) {
case DIALOG_SENDTEXT:
    dialog=new Dialog(context);
  dialog.setContentView(R.layout.sendtext);
dialog.setTitle("Text Entry");
Button sendbutton=(Button)dialog.findViewById(R.id.sendtext_button_send);
sendbutton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
EditText text=(EditText)v.getRootView().findViewById(R.id.sendtext_text);
mControl.sendText(new DataResponse<Boolean>(),text.getText().toString(),context);
text.setText("");
}
}
);
Button donebutton=(Button)dialog.findViewById(R.id.sendtext_button_done);
donebutton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
EditText text=(EditText)v.getRootView().findViewById(R.id.sendtext_text);
mControl.sendText(new DataResponse<Boolean>(),text.getText().toString() + "\n",context);
dismissDialog(DIALOG_SENDTEXT);
}
}
);
Button cancelbutton=(Button)dialog.findViewById(R.id.sendtext_button_cancel);
cancelbutton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
dismissDialog(DIALOG_SENDTEXT);
}
}
);
break;
default :
dialog=null;
}
return dialog;
}
 

Example 21

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: SipCallOptionHandler.java

  17 
vote

protected Dialog onCreateDialog(int id){
  Dialog dialog;
switch (id) {
case DIALOG_SELECT_PHONE_TYPE:
    dialog=new AlertDialog.Builder(this).setTitle(R.string.pick_outgoing_call_phone_type).setIcon(android.R.drawable.ic_dialog_alert).setSingleChoiceItems(R.array.phone_type_values,-1,this).setNegativeButton(android.R.string.cancel,this).setOnCancelListener(this).create();
  break;
case DIALOG_SELECT_OUTGOING_SIP_PHONE:
dialog=new AlertDialog.Builder(this).setTitle(R.string.pick_outgoing_sip_phone).setIcon(android.R.drawable.ic_dialog_alert).setSingleChoiceItems(getProfileNameArray(),-1,this).setNegativeButton(android.R.string.cancel,this).setOnCancelListener(this).create();
addMakeDefaultCheckBox(dialog);
break;
case DIALOG_START_SIP_SETTINGS:
dialog=new AlertDialog.Builder(this).setTitle(R.string.no_sip_account_found_title).setMessage(R.string.no_sip_account_found).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(R.string.sip_menu_add,this).setNegativeButton(android.R.string.cancel,this).setOnCancelListener(this).create();
break;
case DIALOG_NO_INTERNET_ERROR:
boolean wifiOnly=SipManager.isSipWifiOnly(this);
dialog=new AlertDialog.Builder(this).setTitle(wifiOnly ? R.string.no_wifi_available_title : R.string.no_internet_available_title).setMessage(wifiOnly ? R.string.no_wifi_available : R.string.no_internet_available).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok,this).setOnCancelListener(this).create();
break;
case DIALOG_NO_VOIP:
dialog=new AlertDialog.Builder(this).setTitle(R.string.no_voip).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok,this).setOnCancelListener(this).create();
break;
default :
dialog=null;
}
if (dialog != null) {
mDialogs[id]=dialog;
}
return dialog;
}
 

Example 22

From project andstatus, under directory /src/org/andstatus/app/account/.

Source file: AccountSettings.java

  17 
vote

@Override protected Dialog onCreateDialog(int id){
  int titleId=0;
  int summaryId=0;
  Dialog dlg=null;
switch (id) {
case MSG_ACCOUNT_INVALID:
    if (titleId == 0) {
      titleId=R.string.dialog_title_authentication_failed;
      summaryId=R.string.dialog_summary_authentication_failed;
    }
case MSG_SERVICE_UNAVAILABLE_ERROR:
  if (titleId == 0) {
    titleId=R.string.dialog_title_service_unavailable;
    summaryId=R.string.dialog_summary_service_unavailable;
  }
case MSG_SOCKET_TIMEOUT_EXCEPTION:
if (titleId == 0) {
  titleId=R.string.dialog_title_connection_timeout;
  summaryId=R.string.dialog_summary_connection_timeout;
}
case MSG_CREDENTIALS_OF_OTHER_USER:
if (titleId == 0) {
titleId=R.string.dialog_title_authentication_failed;
summaryId=R.string.error_credentials_of_other_user;
}
dlg=new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(titleId).setMessage(summaryId).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface Dialog,int whichButton){
}
}
).create();
default :
dlg=super.onCreateDialog(id);
}
return dlg;
}
 

Example 23

From project android-client, under directory /xwiki-android-client/src/org/xwiki/android/client/blog/.

Source file: Blogger.java

  16 
vote

private void showRetreiveDialog(){
  ret_dialog=new Dialog(this);
  ret_dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
  ret_dialog.setTitle("Page to retreive");
  LayoutInflater li=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View dialogView=li.inflate(R.layout.blog_retreive_dialog,null);
  ret_dialog.setContentView(dialogView);
  ret_dialog.show();
  Button okBtn=(Button)dialogView.findViewById(R.id.blg_ret_btn_ok);
  etPageName=(EditText)dialogView.findViewById(R.id.blg_ret_et_pageName);
  okBtn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      DocumentReference dref=new DocumentReference("xwiki","Blog",etPageName.getText().toString());
      DocumentRemoteSvcCallbacks clbk=new DocumentRemoteSvcCallbacks(){
        @Override public void onFullyRetreived(        Document res,        boolean success,        RaoException ex){
          if (success) {
            ret_dialog.dismiss();
            progDialog.dismiss();
            Intent i=new Intent(Blogger.this,EditPostActivity.class);
            i.putExtra(EditPostActivity.ARG_UPDATE_DOC,res);
            startActivity(i);
          }
 else {
            progDialog.dismiss();
          }
        }
      }
;
      progDialog=ProgressDialog.show(Blogger.this,"Processing","Fetching document from server");
      dsvc.retreive(dref,clbk);
    }
  }
);
}
 

Example 24

From project 4308Cirrus, under directory /tendril-example/src/main/java/edu/colorado/cs/cirrus/android/.

Source file: CostAndConsumptionActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case START_DATE_DIALOG_ID:
    return new DatePickerDialog(this,startDateSetListener,startYear,startMonth,startDay);
case END_DATE_DIALOG_ID:
  return new DatePickerDialog(this,endDateSetListener,endYear,endMonth,endDay);
}
return null;
}
 

Example 25

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentAlertDialogSupport.java

  15 
vote

@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  int title=getArguments().getInt("title");
  return new AlertDialog.Builder(getActivity()).setIcon(R.drawable.alert_dialog_icon).setTitle(title).setPositiveButton(R.string.alert_dialog_ok,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      ((FragmentAlertDialogSupport)getActivity()).doPositiveClick();
    }
  }
).setNegativeButton(R.string.alert_dialog_cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int whichButton){
      ((FragmentAlertDialogSupport)getActivity()).doNegativeClick();
    }
  }
).create();
}
 

Example 26

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: AirCastingActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case SelectSensorHelper.DIALOG_ID:
    return selectSensorHelper.chooseSensor(this);
default :
  return super.onCreateDialog(id);
}
}
 

Example 27

From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.

Source file: ExistingIncidentsActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case DIALOG_PROGRESS:
    mPd=new ProgressDialog(this);
  mPd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mPd.setIndeterminate(true);
mPd.setOnDismissListener(new OnDismissListener(){
@Override public void onDismiss(DialogInterface dialog){
  removeDialog(DIALOG_PROGRESS);
}
}
);
mPd.setOnCancelListener(new OnCancelListener(){
@Override public void onCancel(DialogInterface dialog){
AVService.getInstance(ExistingIncidentsActivity.this).cancelTask();
finish();
}
}
);
mPd.setMessage(getString(R.string.ui_message_loading));
return mPd;
default :
return super.onCreateDialog(id);
}
}
 

Example 28

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.

Source file: AboutActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
  if (id == R.id.ign_loc_dialog_wait_for_fix) {
    return IgnitedLocationSupport.createWaitForLocationDialog(this);
  }
 else   if (id == R.id.ign_loc_dialog_no_providers_enabled) {
    return IgnitedLocationSupport.createNoProvidersEnabledDialog(this,true).create();
  }
  return super.onCreateDialog(id);
}
 

Example 29

From project andlytics, under directory /src/com/github/andlyticsproject/.

Source file: AdmobAuthenticatorActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
  ProgressDialog dialog=new ProgressDialog(this);
  dialog.setMessage("Authenticating...");
  dialog.setIndeterminate(true);
  dialog.setCancelable(true);
  dialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialog){
      if (mAuthThread != null) {
        mAuthThread.interrupt();
        finish();
      }
    }
  }
);
  return dialog;
}
 

Example 30

From project Android, under directory /app/src/main/java/com/github/mobile/ui/.

Source file: ConfirmDialogFragment.java

  15 
vote

public Dialog onCreateDialog(final Bundle savedInstanceState){
  AlertDialog dialog=LightAlertDialog.create(getActivity());
  dialog.setTitle(getTitle());
  dialog.setMessage(getMessage());
  dialog.setButton(BUTTON_POSITIVE,getResources().getString(android.R.string.yes),this);
  dialog.setButton(BUTTON_NEGATIVE,getResources().getString(android.R.string.no),this);
  dialog.setCancelable(true);
  dialog.setOnCancelListener(this);
  return dialog;
}
 

Example 31

From project android-client_1, under directory /src/com/googlecode/asmack/view/.

Source file: AuthenticatorActivity.java

  15 
vote

/** 
 * Create a wait dialog while the login thread is running.
 */
@Override protected Dialog onCreateDialog(int id){
  final ProgressDialog dialog=new ProgressDialog(this);
  dialog.setMessage("Login...");
  dialog.setIndeterminate(true);
  dialog.setCancelable(true);
  dialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
    public void onCancel(    DialogInterface dialog){
      Log.i(TAG,"dialog cancel has been invoked");
      try {
        loginTestThread.interrupt();
        try {
          loginTestThread.join();
        }
 catch (        InterruptedException e) {
        }
      }
  finally {
        finish();
      }
    }
  }
);
  return dialog;
}
 

Example 32

From project android-donations-lib, under directory /org_donations/src/org/donations/.

Source file: DonationsActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case DIALOG_BILLING_NOT_SUPPORTED_ID:
    return createDialog(getString(R.string.donations__google_android_market_not_supported_title),getString(R.string.donations__google_android_market_not_supported));
default :
  return null;
}
}
 

Example 33

From project android-service-arch, under directory /ServiceFramework/src/ru/evilduck/framework/ui/.

Source file: DemoActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
  ProgressDialog progressDialog=new ProgressDialog(this);
  progressDialog.setMessage("Processing");
  progressDialog.setCancelable(false);
  return progressDialog;
}
 

Example 34

From project Android-SyncAdapter-JSON-Server-Example, under directory /src/com/example/android/samplesync/authenticator/.

Source file: AuthenticatorActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
  final ProgressDialog dialog=new ProgressDialog(this);
  dialog.setMessage(getText(R.string.ui_activity_authenticating));
  dialog.setIndeterminate(true);
  dialog.setCancelable(true);
  dialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
    public void onCancel(    DialogInterface dialog){
      Log.i(TAG,"dialog cancel has been invoked");
      if (mAuthThread != null) {
        mAuthThread.interrupt();
        finish();
      }
    }
  }
);
  return dialog;
}
 

Example 35

From project android-thaiime, under directory /latinime/src/com/sugree/inputmethod/latin/.

Source file: Settings.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case VOICE_INPUT_CONFIRM_DIALOG:
    DialogInterface.OnClickListener listener=new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int whichButton){
        if (whichButton == DialogInterface.BUTTON_NEGATIVE) {
          mVoicePreference.setValue(mVoiceModeOff);
        }
 else         if (whichButton == DialogInterface.BUTTON_POSITIVE) {
          mOkClicked=true;
        }
      }
    }
;
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivityInternal()).setTitle(R.string.voice_warning_title).setPositiveButton(android.R.string.ok,listener).setNegativeButton(android.R.string.cancel,listener);
boolean localeSupported=SubtypeSwitcher.isVoiceSupported(this,Locale.getDefault().toString());
final CharSequence message;
if (localeSupported) {
message=TextUtils.concat(getText(R.string.voice_warning_may_not_understand),"\n\n",getText(R.string.voice_hint_dialog_message));
}
 else {
message=TextUtils.concat(getText(R.string.voice_warning_locale_not_supported),"\n\n",getText(R.string.voice_warning_may_not_understand),"\n\n",getText(R.string.voice_hint_dialog_message));
}
builder.setMessage(message);
AlertDialog dialog=builder.create();
mDialog=dialog;
dialog.setOnDismissListener(this);
return dialog;
default :
Log.e(TAG,"unknown dialog " + id);
return null;
}
}
 

Example 36

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/account/authenticator/.

Source file: AuthenticatorActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
  final ProgressDialog dialog=new ProgressDialog(this);
  dialog.setMessage(getText(R.string.addaccount_progress_checkingapiversion));
  dialog.setIndeterminate(true);
  dialog.setCancelable(true);
  dialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
    public void onCancel(    DialogInterface dialog){
      Log.i(TAG,"dialog cancel has been invoked");
      if (mAuthThread != null) {
        mAuthThread.interrupt();
        finish();
      }
    }
  }
);
  return dialog;
}
 

Example 37

From project AndroidBillingLibrary, under directory /DungeonsRedux/src/net/robotmedia/billing/example/.

Source file: Dungeons.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case DIALOG_BILLING_NOT_SUPPORTED_ID:
    return createDialog(R.string.billing_not_supported_title,R.string.billing_not_supported_message);
default :
  return null;
}
}
 

Example 38

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: AddBookActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case DIALOG_ADD:
    final AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(mBookToAdd != null ? mBookToAdd.getTitle() : " ");
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setMessage(R.string.dialog_add_message);
builder.setPositiveButton(R.string.dialog_add_ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
String bookId=mBookToAdd.getEan();
if (bookId == null) bookId=mBookToAdd.getIsbn();
if (bookId == null) bookId=mBookToAdd.getInternalIdNoPrefix();
onAdd(bookId);
mBookToAdd=null;
}
}
);
builder.setNegativeButton(R.string.dialog_add_cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int which){
mBookToAdd=null;
dismissDialog(DIALOG_ADD);
}
}
);
builder.setOnCancelListener(new DialogInterface.OnCancelListener(){
public void onCancel(DialogInterface dialog){
mBookToAdd=null;
dismissDialog(DIALOG_ADD);
}
}
);
builder.setCancelable(true);
return builder.create();
}
return super.onCreateDialog(id);
}
 

Example 39

From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.

Source file: TiledMapActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case C.DIALOG_CONFIRM_SAVE_MAP:
{
      AlertDialog.Builder bldr=new AlertDialog.Builder(TiledMapActivity.this);
      bldr.setIcon(android.R.drawable.ic_dialog_alert);
      bldr.setTitle(R.string.tiledMap_dlg_confirmSave_title);
      bldr.setPositiveButton(R.string.tiledMap_dlg_confirmSave_positive,this);
      bldr.setNegativeButton(R.string.tiledMap_dlg_confirmSave_negative,this);
      bldr.setMessage(R.string.tiledMap_dlg_confirmSave_message);
      confirmMapSaveDialog=bldr.create();
      return confirmMapSaveDialog;
    }
case C.DIALOG_RENAME_MAP:
{
    View content=getLayoutInflater().inflate(R.layout.tilemap_dlg_rename,null);
    final EditText input=(EditText)content.findViewById(R.id.tiledMap_dlg_rename_name);
    String mapName=view.getMapName();
    if (mapName == null || mapName.trim().length() == 0) {
      mapName=getString(R.string.tiledMap_dlg_renameMap_noName);
    }
    input.setText(mapName);
    input.setSelection(0,mapName.length());
    AlertDialog.Builder bldr=new AlertDialog.Builder(TiledMapActivity.this);
    bldr.setView(content);
    bldr.setCancelable(false);
    bldr.setPositiveButton(android.R.string.ok,this);
    bldr.setNegativeButton(android.R.string.cancel,this);
    renameDialog=bldr.create();
    return renameDialog;
  }
default :
{
  return super.onCreateDialog(id);
}
}
}
 

Example 40

From project android_7, under directory /src/org/immopoly/android/fragments/.

Source file: ItemActivateFragment.java

  15 
vote

@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  mTracker=GoogleAnalyticsTracker.getInstance();
  mTracker.startNewSession(TrackingManager.UA_ACCOUNT,Const.ANALYTICS_INTERVAL,getActivity().getApplicationContext());
  mTracker.trackPageView(TrackingManager.VIEW_ACTION_ITEM_SPY);
  ImmopolyActionItem item=ImmopolyUser.getInstance().getActionItems().get(mItemId);
  return new AlertDialog.Builder(getActivity()).setTitle(item.getText()).setMessage(item.getDescription()).setPositiveButton("Aktivieren",new OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      Fragment fragment=getFragmentManager().findFragmentByTag(ImmopolyActivity.FRAGMENT_MAP);
      if (fragment instanceof MapFragment) {
        ((MapFragment)fragment).filterFreeFlats();
      }
    }
  }
).setNegativeButton("Abbrechen",null).create();
}
 

Example 41

From project Android_NFC_FelicaEdit, under directory /src/jp/co/yumemi/rd/felicaedit/.

Source file: EditBlock.java

  15 
vote

/** 
 * ??????????????????elect??????????????????????????????????????????????
 */
@Override protected Dialog onCreateDialog(int id,Bundle args){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  LayoutInflater factory=LayoutInflater.from(this);
  final View inputView=factory.inflate(R.layout.edit_block_byte,null);
  builder.setView(inputView).setTitle("????????????").setPositiveButton("OK",this).setNegativeButton("CANCEL",this);
  return builder.create();
}
 

Example 42

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: PhoneGogglesAbstractActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id,Bundle bundle){
switch (id) {
case DIALOG_PHONE_GOGGLES_START:
    return createTimePicker(mStartKey);
case DIALOG_PHONE_GOGGLES_END:
  return createTimePicker(mEndKey);
}
return super.onCreateDialog(id,bundle);
}
 

Example 43

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: SearchSettings.java

  15 
vote

@Override protected Dialog onCreateDialog(int id,Bundle args){
switch (id) {
case CLEAR_SHORTCUTS_CONFIRM_DIALOG:
    return new AlertDialog.Builder(this).setTitle(R.string.clear_shortcuts).setMessage(R.string.clear_shortcuts_prompt).setPositiveButton(R.string.agree,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        if (DBG)         Log.d(TAG,"Clearing history...");
        getShortcuts().clearHistory();
        mClearShortcutsPreference.setEnabled(false);
      }
    }
).setNegativeButton(R.string.disagree,null).create();
default :
  Log.e(TAG,"unknown dialog" + id);
return null;
}
}
 

Example 44

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.

Source file: MyTagList.java

  15 
vote

@Override protected Dialog onCreateDialog(int id,Bundle args){
  Context lightTheme=new ContextThemeWrapper(this,android.R.style.Theme_Light);
  if (id == DIALOG_ID_SELECT_ACTIVE_TAG) {
    SelectActiveTagDialog dialog=new SelectActiveTagDialog(lightTheme,mAdapter.getCursor());
    dialog.setInverseBackgroundForced(true);
    mSelectActiveTagDialog=new WeakReference<SelectActiveTagDialog>(dialog);
    return dialog;
  }
 else   if (id == DIALOG_ID_ADD_NEW_TAG) {
    ContentSelectorAdapter adapter=new ContentSelectorAdapter(lightTheme,SUPPORTED_TYPES);
    AlertDialog dialog=new AlertDialog.Builder(lightTheme).setTitle(R.string.select_type).setIcon(0).setNegativeButton(android.R.string.cancel,this).setAdapter(adapter,this).create();
    adapter.setListView(dialog.getListView());
    dialog.setInverseBackgroundForced(true);
    return dialog;
  }
  return super.onCreateDialog(id,args);
}
 

Example 45

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/latin/.

Source file: Settings.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case VOICE_INPUT_CONFIRM_DIALOG:
    DialogInterface.OnClickListener listener=new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int whichButton){
        if (whichButton == DialogInterface.BUTTON_NEGATIVE) {
          mVoicePreference.setValue(mVoiceModeOff);
        }
 else         if (whichButton == DialogInterface.BUTTON_POSITIVE) {
          mOkClicked=true;
        }
      }
    }
;
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivityInternal()).setTitle(R.string.voice_warning_title).setPositiveButton(android.R.string.ok,listener).setNegativeButton(android.R.string.cancel,listener);
boolean localeSupported=SubtypeSwitcher.isVoiceSupported(this,Locale.getDefault().toString());
final CharSequence message;
if (localeSupported) {
message=TextUtils.concat(getText(R.string.voice_warning_may_not_understand),"\n\n",getText(R.string.voice_hint_dialog_message));
}
 else {
message=TextUtils.concat(getText(R.string.voice_warning_locale_not_supported),"\n\n",getText(R.string.voice_warning_may_not_understand),"\n\n",getText(R.string.voice_hint_dialog_message));
}
builder.setMessage(message);
AlertDialog dialog=builder.create();
mDialog=dialog;
dialog.setOnDismissListener(this);
return dialog;
default :
Log.e(TAG,"unknown dialog " + id);
return null;
}
}
 

Example 46

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: PreferencesActivity.java

  15 
vote

@Override protected Dialog onCreateDialog(int id){
  int titleId=0;
  int summaryId=0;
switch (id) {
case MSG_ACCOUNT_INVALID:
    if (titleId == 0) {
      titleId=R.string.dialog_title_authentication_failed;
      summaryId=R.string.dialog_summary_authentication_failed;
    }
case MSG_SERVICE_UNAVAILABLE_ERROR:
  if (titleId == 0) {
    titleId=R.string.dialog_title_service_unavailable;
    summaryId=R.string.dialog_summary_service_unavailable;
  }
case MSG_SOCKET_TIMEOUT_EXCEPTION:
if (titleId == 0) {
  titleId=R.string.dialog_title_connection_timeout;
  summaryId=R.string.dialog_summary_connection_timeout;
}
case MSG_CREDENTIALS_OF_OTHER_USER:
if (titleId == 0) {
titleId=R.string.dialog_title_authentication_failed;
summaryId=R.string.error_credentials_of_other_user;
}
return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(titleId).setMessage(summaryId).setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface Dialog,int whichButton){
}
}
).create();
default :
return super.onCreateDialog(id);
}
}