List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:pt.aptoide.backupapps.Aptoide.java
@Override public boolean onOptionsItemSelected(MenuItem item) { EnumOptionsMenu menuEntry = EnumOptionsMenu.reverseOrdinal(item.getItemId()); Log.d("Aptoide-OptionsMenu", "menuOption: " + menuEntry + " itemid: " + item.getItemId()); switch (menuEntry) { // case MANAGE_REPO: // availableAdapter.sleep(); // Intent manageRepo = new Intent(this, ManageRepos.class); // startActivity(manageRepo); // return true; case UNINSTALL: try {/* w w w .ja va 2 s . c om*/ serviceDataCaller.callUninstallApps(installedAdapter.getSelectedIds()); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; case DELETE: //TODO improve listIds as an extended parcelable array ;) then use it as a carrier for checked hashids list return true; case DISPLAY_OPTIONS: if (!loadingRepos.get()) { //TODO refactor extract dialog management class LayoutInflater displayOptionsInflater = LayoutInflater.from(this); View displayOptions = displayOptionsInflater.inflate(R.layout.dialog_display_options, null); Builder dialogBuilder = new AlertDialog.Builder(theme).setView(displayOptions); final AlertDialog sortDialog = dialogBuilder.create(); sortDialog.setIcon(android.R.drawable.ic_menu_sort_by_size); sortDialog.setTitle(getString(R.string.display_options)); // *********************************************************** // Categories // final RadioButton byCategory = (RadioButton) displayOptions.findViewById(R.id.by_category); // final RadioButton byAll = (RadioButton) displayOptions.findViewById(R.id.by_all); // if(availableByCategory){ // byCategory.setChecked(true); // }else{ // byAll.setChecked(true); // } // // final View spacer = displayOptions.findViewById(R.id.spacer); // // if(currentAppsList != EnumAppsLists.Available){ // spacer.setVisibility(View.GONE); // ((RadioGroup) displayOptions.findViewById(R.id.group_show)).setVisibility(View.GONE); // } // *********************************************************** // Sorting final View group_sort = displayOptions.findViewById(R.id.group_sort); final RadioButton byAlphabetic = (RadioButton) displayOptions.findViewById(R.id.by_alphabetic); final RadioButton byFreshness = (RadioButton) displayOptions.findViewById(R.id.by_freshness); final RadioButton bySize = (RadioButton) displayOptions.findViewById(R.id.by_size); // spacer.setVisibility(View.VISIBLE); group_sort.setVisibility(View.VISIBLE); switch (appsSortingPolicy) { case ALPHABETIC: byAlphabetic.setChecked(true); break; case FRESHNESS: byFreshness.setChecked(true); break; case SIZE: bySize.setChecked(true); break; default: break; } // *********************************************************** final CheckBox showSystemApps = (CheckBox) displayOptions.findViewById(R.id.show_system_apps); boolean showSystemAppsState = false; try { showSystemAppsState = serviceDataCaller.callGetShowSystemApps(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } showSystemApps.setChecked(showSystemAppsState); final boolean storedShowSystemAppsState = showSystemAppsState; sortDialog.setButton(getString(R.string.done), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // boolean byCategoryChanged = false; EnumAppsSorting newSortingPolicy = null; // if(byCategory.isChecked() != availableByCategory){ // byCategoryChanged = true; // availableByCategory = byCategory.isChecked(); // setAvailableListBy(availableByCategory); // } if (showSystemApps.isChecked() != storedShowSystemAppsState) { setShowSystemApps(showSystemApps.isChecked()); } if (byAlphabetic.isChecked()) { newSortingPolicy = EnumAppsSorting.ALPHABETIC; } else if (byFreshness.isChecked()) { newSortingPolicy = EnumAppsSorting.FRESHNESS; } else if (bySize.isChecked()) { newSortingPolicy = EnumAppsSorting.SIZE; } if (newSortingPolicy != null && newSortingPolicy != appsSortingPolicy) { // availableAdapter.sleep(); appsSortingPolicy = newSortingPolicy; setAppsSortingPolicy(appsSortingPolicy); } // if(byCategoryChanged){ // if(availableByCategory){ // availableAdapter.sleep(); // categoriesAdapter.resetDisplayCategories(); // }else{ // availableAdapter.resetDisplay(null); // } // } sortDialog.dismiss(); } }); sortDialog.show(); } else { Toast.makeText(Aptoide.this, getString(R.string.option_not_available_while_updating_repos), Toast.LENGTH_SHORT).show(); } return true; // case SEARCH_MENU: // onSearchRequested(); // return true; case UN_SELECT_ALL: switch (currentAppsList) { case RESTORE: if (availableAdapter.isDynamic()) { Toast.makeText(Aptoide.this, getString(R.string.too_many_apps_to_select_at_once), Toast.LENGTH_SHORT).show(); return true; } availableAdapter.toggleSelectAll(); break; case BACKUP: installedAdapter.toggleSelectAll(); break; default: break; } return true; case ABOUT: LayoutInflater aboutInflater = LayoutInflater.from(this); View about = aboutInflater.inflate(R.layout.about, null); TextView info = (TextView) about.findViewById(R.id.credits); info.setText(getString(R.string.credits, versionName)); Builder aboutCreator = new AlertDialog.Builder(theme).setView(about); final AlertDialog aboutDialog = aboutCreator.create(); aboutDialog.setIcon(R.drawable.icon); aboutDialog.setTitle(R.string.self_name); // aboutDialog.setButton(getText(R.string.changelog), new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, int whichButton) { // Uri uri = Uri.parse(getString(R.string.changelog_url)); // startActivity(new Intent( Intent.ACTION_VIEW, uri)); // } // }); aboutDialog.show(); return true; case SETTINGS: // availableAdapter.sleep(); Intent settings = new Intent(this, Settings.class); startActivity(settings); return true; case LOGIN: // boolean insertingRepo = false; // try { // insertingRepo = serviceDataCaller.callIsInsertingRepo(); // } catch (RemoteException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // } // if(insertingRepo){ // AptoideLog.d(Aptoide.this, getString(R.string.updating_repo_please_wait)); // Toast.makeText(getApplicationContext(), getResources().getString(R.string.updating_repo_please_wait), Toast.LENGTH_SHORT).show(); // } // else{ Log.d("Aptoide-Settings", "clicked set server login"); String token = null; try { token = serviceDataCaller.callGetServerToken(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (token == null) { Log.d("Aptoide-Settings", "No login set"); Intent login = new Intent(Aptoide.this, BazaarLogin.class); login.putExtra("InvoqueType", BazaarLogin.InvoqueType.NO_CREDENTIALS_SET.ordinal()); startActivity(login); // DialogLogin dialogLogin = new DialogLogin(Settings.this, serviceDataCaller, DialogLogin.InvoqueType.NO_CREDENTIALS_SET); // loginComments.setOnDismissListener(new OnDismissListener() { // @Override // public void onDismiss(DialogInterface dialog) { // addAppVersionComment(); // } // }); // dialogLogin.show(); } else { Log.d("Aptoide-Settings", "Login edit"); Intent login = new Intent(Aptoide.this, BazaarLogin.class); login.putExtra("InvoqueType", BazaarLogin.InvoqueType.OVERRIDE_CREDENTIALS.ordinal()); startActivity(login); // DialogLogin dialogLogin = new DialogLogin(Settings.this, serviceDataCaller, DialogLogin.InvoqueType.OVERRIDE_CREDENTIALS); // Toast.makeText(Settings.this, "Login already set", Toast.LENGTH_SHORT).show(); // dialogLogin.show(); } // } return true; case FOLLOW: new DialogFollowOnSocialNets(this, serviceDataCaller).show(); return true; // case SCHEDULED_DOWNLOADS: // availableAdapter.sleep(); // Intent manageScheduled = new Intent(this, ManageScheduled.class); // startActivity(manageScheduled); // return true; // case UPDATE_ALL: // if(!loadingRepos.get()){ // AptoideLog.d(this, "Update all"); // try { // serviceDataCaller.callUpdateAll(); // } catch (RemoteException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // }else{ // Toast.makeText(Aptoide.this, "Option not available while updating stores!", Toast.LENGTH_SHORT).show(); // } // return true; default: return super.onOptionsItemSelected(item); } }
From source file:it.unipr.ce.dsg.gamidroid.activities.NAM4JAndroidActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; isTablet = Utils.isTablet(this); // Setting the default network sharedPreferences = getSharedPreferences(Constants.PREFERENCES, Context.MODE_PRIVATE); Editor editor = sharedPreferences.edit(); editor.putString(Constants.NETWORK, Constants.DEFAULT_NETWORK); editor.commit();/*from w w w. jav a 2 s.c o m*/ // Starting the resources monitoring service startService(new Intent(this, DeviceMonitorService.class)); wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); // Settings menu elements ArrayList<MenuListElement> listElements = new ArrayList<MenuListElement>(); listElements.add(new MenuListElement(getResources().getString(R.string.connectMenuTitle), getResources().getString(R.string.connectMenuSubTitle))); listElements.add(new MenuListElement(getResources().getString(R.string.settingsMenuTitle), getResources().getString(R.string.settingsMenuSubTitle))); listElements.add(new MenuListElement(getResources().getString(R.string.exitMenuTitle), getResources().getString(R.string.exitMenuSubTitle))); listView = (ListView) findViewById(R.id.ListViewContent); MenuListAdapter adapter = new MenuListAdapter(this, R.layout.menu_list_view_row, listElements); listView.setAdapter(adapter); listView.setOnItemClickListener(new ListItemClickListener()); mainRL = (RelativeLayout) findViewById(R.id.rlContainer); listRL = (RelativeLayout) findViewById(R.id.listContainer); cpuBar = (LinearLayout) findViewById(R.id.CpuBar); memoryBar = (LinearLayout) findViewById(R.id.MemoryBar); titleBarRL = (RelativeLayout) findViewById(R.id.titleLl); // Adding swipe gesture listener to the top bar titleBarRL.setOnTouchListener(new SwipeAndClickListener()); menuButton = (Button) findViewById(R.id.menuButton); menuButton.setOnTouchListener(new SwipeAndClickListener()); infoButton = (Button) findViewById(R.id.infoButton); infoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog dialog = new AlertDialog(NAM4JAndroidActivity.this) { @Override public boolean dispatchTouchEvent(MotionEvent event) { dismiss(); return false; } }; String text = getResources().getString(R.string.aboutApp); String title = getResources().getString(R.string.nam4j); dialog.setMessage(text); dialog.setTitle(title); dialog.setCanceledOnTouchOutside(true); dialog.show(); } }); centerButton = (Button) findViewById(R.id.centerButton); centerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { centerMap(); } }); isTablet = Utils.isTablet(context); int[] screenSize = Utils.getScreenSize(context, getWindow()); screenWidth = screenSize[0]; screenHeight = screenSize[1]; // Updates the display orientation each time the device is rotated if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { screenOrientation = Orientation.LANDSCAPE; } else { screenOrientation = Orientation.PORTRAIT; } // If the device is portrait, the menu button is displayed, the menu is // hidden and the swipe listener is added to the menu bar if (screenOrientation == Orientation.PORTRAIT) { menuButton.setVisibility(View.VISIBLE); // Adding swipe gesture listener to the top bar titleBarRL.setOnTouchListener(new SwipeAndClickListener()); if (isTablet) { menuWidth = 0.35; } else { menuWidth = 0.6; } } else { // If the device is a tablet in landscape, the menu button is // hidden, the menu is displayed, the swipe listener is not added to // the menu bar and the mainRL width is set to the window's width // minus the menu's width if (isTablet) { menuWidth = 0.2; menuButton.setVisibility(View.INVISIBLE); RelativeLayout.LayoutParams menuListLP = (LayoutParams) mainRL.getLayoutParams(); // Setting the main view width as the container width without // the menu menuListLP.width = (int) (screenWidth * (1 - menuWidth)); mainRL.setLayoutParams(menuListLP); displaySideMenu(); } else { menuWidth = 0.4; menuButton.setVisibility(View.VISIBLE); // Adding swipe gesture listener to the top bar titleBarRL.setOnTouchListener(new SwipeAndClickListener()); } } // Check if the device has the Google Play Services installed and // updated. They are necessary to use Google Maps int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context); if (code != ConnectionResult.SUCCESS) { showErrorDialog(code); System.out.println("Google Play Services error"); FrameLayout fl = (FrameLayout) findViewById(R.id.frameId); fl.removeAllViews(); } else { // Create a new global location parameters object mLocationRequest = new LocationRequest(); // Set the update interval mLocationRequest.setInterval(LocationUtils.UPDATE_INTERVAL_IN_MILLISECONDS); // Use high accuracy mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); // Set the interval ceiling to one minute mLocationRequest.setFastestInterval(LocationUtils.FAST_INTERVAL_CEILING_IN_MILLISECONDS); bitmapDescriptorBlue = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE); blueCircle = BitmapDescriptorFactory .fromBitmap(BitmapFactory.decodeResource(context.getResources(), R.drawable.blue_circle)); bitmapDescriptorRed = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED); // Create a new location client, using the enclosing class to handle // callbacks mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(LocationServices.API).build(); map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapview)).getMap(); if (map != null) { // Set default map center and zoom on Parma double lat = 44.7950156; double lgt = 10.32547; map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lgt), 12.0f)); // Adding listeners to the map respectively for zoom level // change and onTap event map.setOnCameraChangeListener(getCameraChangeListener()); map.setOnMapClickListener(getOnMapClickListener()); // Set map type as normal (i.e. not the satellite view) map.setMapType(com.google.android.gms.maps.GoogleMap.MAP_TYPE_NORMAL); // Hide traffic layer map.setTrafficEnabled(false); // Enable the 'my-location' layer, which continuously draws an // indication of a user's current location and bearing, and // displays UI controls that allow the interaction with the // location itself // map.setMyLocationEnabled(true); ml = new HashMap<String, Marker>(); // Get file manager for config files fileManager = FileManager.getFileManager(); fileManager.createFiles(); map.setOnMarkerClickListener(this); } else { AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setMessage("The map cannot be initialized."); dialog.setCancelable(true); dialog.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); dialog.show(); } } }
From source file:com.plusot.senselib.SenseMain.java
private void showTweetWarning() { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(R.string.warn_tweet_cloud_title); alertDialog.setMessage(getString(R.string.warn_tweet_cloud_msg)); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.button_confirm), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; }//from w w w . j a v a2 s .co m }); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public static void UIAlert(String title, String body, Activity activity) { AlertDialog ad; ad = new AlertDialog.Builder(activity).create(); ad.setTitle(title); ad.setMessage(body);//from www. ja va 2s . c o m ad.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); ad.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public static void UIAlertHtml(String title, String html, Activity activity) { AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle(title); WebView webview = new WebView(activity); webview.setBackgroundColor(Color.BLACK); webview.loadData("<font color=\"FFFFFF\">" + html + " </font>", "text/html", "UTF-8"); alertDialog.setView(webview);// w w w. j a va2 s. co m alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public static void UIAlertLicense(String title, String html, final Activity activity) { AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle(title); WebView webview = new WebView(activity); webview.setBackgroundColor(Color.BLACK); webview.loadData("<font color=\"FFFFFF\">" + html + " </font>", "text/html", "UTF-8"); alertDialog.setView(webview);/*from www. j a va2 s .c o m*/ alertDialog.setButton("I Acknowledge", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (isFirstLaunch()) { install(); onHelp(); onChangeLog(); } setFirstLaunch(); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { if (isFirstLaunch()) { if (activity.getParent() != null) { activity.getParent().finish(); } else { activity.finish(); } } } }); alertDialog.show(); }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name : showDialog/*from w w w. j a v a2 s . co m*/ * * This function is used to show alert dialog * * @param String * message to show * * @return void * * */ public void showDialog(String data) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setMessage(data).setCancelable(false).setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // dialog.cancel(); dialog.cancel(); } }); AlertDialog alert = alertDialog.create(); // Title for AlertDialog alert.setTitle(" Info "); alert.show(); }
From source file:com.plusot.senselib.SenseMain.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override/*www .ja v a 2 s. c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); shouldFinish = 0; if (Build.VERSION.SDK_INT >= 11) requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); //.FEATURE_ACTION_BAR_OVERLAY); Log.d(Globals.TAG, CLASSTAG + ".onCreate:\n" + " ******************************************************\n" + " * *\n" + " * *\n" + " * SenseMain Started *\n" + " * *\n" + " * *\n" + " ******************************************************"); if (Build.VERSION.SDK_INT < 14 || ViewConfiguration.get(this).hasPermanentMenuKey()) requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); ActivityUtil.lockScreenOrientation(this); app = (SenseApp) getApplication(); app.activityCreated(SenseMain.this); init(getIntent(), true); watchId = Watchdog.addProcessS(CLASSTAG); String state = android.os.Environment.getExternalStorageState(); if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) { AlertDialog alertDialog = new AlertDialog.Builder(SenseMain.this).create(); alertDialog.setTitle(R.string.no_sd_title); alertDialog.setMessage(SenseMain.this.getString(R.string.no_sd_message)); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, SenseMain.this.getString(R.string.button_confirm), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.show(); } if (SenseGlobals.screenLock) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //ActivityUtil.lockScreenOrientation(SenseMain.this); updateSettings(); PreferenceHelper.getPrefs().registerOnSharedPreferenceChangeListener(this); LLog.i(Globals.TAG, CLASSTAG + ".onCreate. Wakelock acquired"); Device.setListener(SenseMain.this); HttpSender.checkSession(); if (System.currentTimeMillis() - Value.getSessionTime() > 3600000L * 12 && SenseGlobals.stopState.equals(SenseGlobals.StopState.PAUZE)) { closeValues(SenseGlobals.ActivityMode.STOP, false); PreferenceKey.setStopState(SenseGlobals.StopState.STOP); } if (SenseApp.firstActivity && SenseGlobals.loadSplash) { //creating = true; showSplashScreen(true); if (SenseGlobals.isBikeApp) { View view = this.findViewById(R.id.main_layout); if (view != null) view.setVisibility(View.INVISIBLE); } } SenseApp.firstActivity = false; Watchdog.getInstance().add(this, 1000); Watchdog.getInstance().add(this); //for (PreferenceKey prefKey : PreferenceKey.values()) updateSetting(prefs, prefKey); //if (PreferenceKey.HASMAP.isTrue()) addMap(); try { PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); setTitle(Globals.appName + " " + info.versionName); } catch (NameNotFoundException ignored) { } File file = new File(SenseGlobals.getGpxPath()); if (!file.isDirectory() && !file.mkdirs()) { Log.w(Globals.TAG, CLASSTAG + " Could not create: " + SenseGlobals.getGpxPath()); } }
From source file:group.pals.android.lib.ui.filechooser.FragmentFiles.java
/** * Confirms user to create new directory. *///from ww w . ja va 2 s. c o m private void showNewDirectoryCreationDialog() { final AlertDialog dialog = Dlg.newAlertDlg(getActivity()); View view = getLayoutInflater(null).inflate(R.layout.afc_simple_text_input_view, null); final EditText textFile = (EditText) view.findViewById(R.id.afc_text1); textFile.setHint(R.string.afc_hint_folder_name); textFile.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { Ui.showSoftKeyboard(v, false); dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick(); return true; } return false; } }); dialog.setView(view); dialog.setTitle(R.string.afc_cmd_new_folder); dialog.setIcon(android.R.drawable.ic_menu_add); dialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String name = textFile.getText().toString().trim(); if (!FileUtils.isFilenameValid(name)) { Dlg.toast(getActivity(), getString(R.string.afc_pmsg_filename_is_invalid, name), Dlg.LENGTH_SHORT); return; } new LoadingDialog<Void, Void, Uri>(getActivity(), false) { @Override protected Uri doInBackground(Void... params) { return getActivity().getContentResolver().insert( BaseFile.genContentUriBase(getCurrentLocation().getAuthority()).buildUpon() .appendPath(getCurrentLocation().getLastPathSegment()) .appendQueryParameter(BaseFile.PARAM_NAME, name) .appendQueryParameter(BaseFile.PARAM_FILE_TYPE, Integer.toString(BaseFile.FILE_TYPE_DIRECTORY)) .build(), null); }// doInBackground() @Override protected void onPostExecute(Uri result) { super.onPostExecute(result); if (result != null) { Dlg.toast(getActivity(), getString(R.string.afc_msg_done), Dlg.LENGTH_SHORT); } else Dlg.toast(getActivity(), getString(R.string.afc_pmsg_cannot_create_folder, name), Dlg.LENGTH_SHORT); }// onPostExecute() }.execute(); }// onClick() }); dialog.show(); Ui.showSoftKeyboard(textFile, true); final Button buttonOk = dialog.getButton(DialogInterface.BUTTON_POSITIVE); buttonOk.setEnabled(false); textFile.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { /* * Do nothing. */ }// onTextChanged() @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { /* * Do nothing. */ }// beforeTextChanged() @Override public void afterTextChanged(Editable s) { buttonOk.setEnabled(FileUtils.isFilenameValid(s.toString().trim())); }// afterTextChanged() }); }
From source file:cm.aptoide.pt.MainActivity.java
private void requestUpdateSelf() { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog updateSelfDialog = dialogBuilder.create(); updateSelfDialog.setTitle(getText(R.string.update_self_title)); updateSelfDialog.setIcon(R.drawable.icon_brand_aptoide); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getString(R.string.update_self_msg, ApplicationAptoide.MARKETNAME)); updateSelfDialog.setCancelable(false); updateSelfDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes), new Dialog.OnClickListener() { @Override/*from w ww. ja v a 2 s . c o m*/ public void onClick(DialogInterface arg0, int arg1) { new DownloadSelfUpdate().execute(); } }); updateSelfDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { dialog.dismiss(); } }); updateSelfDialog.show(); }