List of usage examples for android.app AlertDialog show
public void show()
From source file:com.oasis.sdk.activity.OasisSdkPayEpinActivity.java
private void showResultDialog(final String res) { final AlertDialog d = new AlertDialog.Builder(this).create(); d.show(); d.setContentView(BaseUtils.getResourceValue("layout", "oasisgames_sdk_common_dialog_notitle")); d.setCanceledOnTouchOutside(false);//from ww w .ja v a2 s . co m TextView tv_content = (TextView) d .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_content")); String content = getResources().getString(BaseUtils.getResourceValue("string", TextUtils.isEmpty(res) ? "oasisgames_sdk_epin_notice_3" : "oasisgames_sdk_epin_notice_4")); content = content.replace("DIAMOND", res); tv_content.setText(content); TextView tv_sure = (TextView) d .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_sure")); tv_sure.setText( getResources().getString(BaseUtils.getResourceValue("string", "oasisgames_sdk_common_btn_sure"))); tv_sure.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (!TextUtils.isEmpty(res)) et_code.setText(""); d.dismiss(); } }); TextView tv_cancle = (TextView) d .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_cancle")); tv_cancle.setVisibility(View.GONE); TextView tv_text = (TextView) d .findViewById(BaseUtils.getResourceValue("id", "oasisgames_sdk_common_dialog_notitle_text")); tv_text.setVisibility(View.GONE); }
From source file:com.apptentive.android.sdk.Apptentive.java
private static void init(Activity activity) { ////from w ww . j av a2 s .c o m // First, initialize data relies on synchronous reads from local resources. // final Context appContext = activity.getApplicationContext(); if (!GlobalInfo.initialized) { SharedPreferences prefs = appContext.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); // First, Get the api key, and figure out if app is debuggable. GlobalInfo.isAppDebuggable = false; String apiKey = null; boolean apptentiveDebug = false; String logLevelOverride = null; try { ApplicationInfo ai = appContext.getPackageManager().getApplicationInfo(appContext.getPackageName(), PackageManager.GET_META_DATA); Bundle metaData = ai.metaData; if (metaData != null) { apiKey = metaData.getString(Constants.MANIFEST_KEY_APPTENTIVE_API_KEY); logLevelOverride = metaData.getString(Constants.MANIFEST_KEY_APPTENTIVE_LOG_LEVEL); apptentiveDebug = metaData.getBoolean(Constants.MANIFEST_KEY_APPTENTIVE_DEBUG); ApptentiveClient.useStagingServer = metaData .getBoolean(Constants.MANIFEST_KEY_USE_STAGING_SERVER); } if (apptentiveDebug) { Log.i("Apptentive debug logging set to VERBOSE."); ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); } else if (logLevelOverride != null) { Log.i("Overriding log level: %s", logLevelOverride); ApptentiveInternal.setMinimumLogLevel(Log.Level.parse(logLevelOverride)); } else { GlobalInfo.isAppDebuggable = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; if (GlobalInfo.isAppDebuggable) { ApptentiveInternal.setMinimumLogLevel(Log.Level.VERBOSE); } } } catch (Exception e) { Log.e("Unexpected error while reading application info.", e); } Log.i("Debug mode enabled? %b", GlobalInfo.isAppDebuggable); // If we are in debug mode, but no api key is found, throw an exception. Otherwise, just assert log. We don't want to crash a production app. String errorString = "No Apptentive api key specified. Please make sure you have specified your api key in your AndroidManifest.xml"; if ((Util.isEmpty(apiKey))) { if (GlobalInfo.isAppDebuggable) { AlertDialog alertDialog = new AlertDialog.Builder(activity).setTitle("Error") .setMessage(errorString).setPositiveButton("OK", null).create(); alertDialog.setCanceledOnTouchOutside(false); alertDialog.show(); } Log.e(errorString); } GlobalInfo.apiKey = apiKey; Log.i("API Key: %s", GlobalInfo.apiKey); // Grab app info we need to access later on. GlobalInfo.appPackage = appContext.getPackageName(); GlobalInfo.androidId = Settings.Secure.getString(appContext.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); // Check the host app version, and notify modules if it's changed. try { PackageManager packageManager = appContext.getPackageManager(); PackageInfo packageInfo = packageManager.getPackageInfo(appContext.getPackageName(), 0); Integer currentVersionCode = packageInfo.versionCode; String currentVersionName = packageInfo.versionName; VersionHistoryStore.VersionHistoryEntry lastVersionEntrySeen = VersionHistoryStore .getLastVersionSeen(appContext); if (lastVersionEntrySeen == null) { onVersionChanged(appContext, null, currentVersionCode, null, currentVersionName); } else { if (!currentVersionCode.equals(lastVersionEntrySeen.versionCode) || !currentVersionName.equals(lastVersionEntrySeen.versionName)) { onVersionChanged(appContext, lastVersionEntrySeen.versionCode, currentVersionCode, lastVersionEntrySeen.versionName, currentVersionName); } } GlobalInfo.appDisplayName = packageManager .getApplicationLabel(packageManager.getApplicationInfo(packageInfo.packageName, 0)) .toString(); } catch (PackageManager.NameNotFoundException e) { // Nothing we can do then. GlobalInfo.appDisplayName = "this app"; } // Grab the conversation token from shared preferences. if (prefs.contains(Constants.PREF_KEY_CONVERSATION_TOKEN) && prefs.contains(Constants.PREF_KEY_PERSON_ID)) { GlobalInfo.conversationToken = prefs.getString(Constants.PREF_KEY_CONVERSATION_TOKEN, null); GlobalInfo.personId = prefs.getString(Constants.PREF_KEY_PERSON_ID, null); } GlobalInfo.initialized = true; Log.v("Done initializing..."); } else { Log.v("Already initialized..."); } // Initialize the Conversation Token, or fetch if needed. Fetch config it the token is available. if (GlobalInfo.conversationToken == null || GlobalInfo.personId == null) { asyncFetchConversationToken(appContext.getApplicationContext()); } else { asyncFetchAppConfiguration(appContext.getApplicationContext()); InteractionManager.asyncFetchAndStoreInteractions(appContext.getApplicationContext()); } // TODO: Do this on a dedicated thread if it takes too long. Some devices are slow to read device data. syncDevice(appContext); syncSdk(appContext); syncPerson(appContext); Log.d("Default Locale: %s", Locale.getDefault().toString()); SharedPreferences prefs = appContext.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); Log.d("Conversation id: %s", prefs.getString(Constants.PREF_KEY_CONVERSATION_ID, "null")); }
From source file:itvector.wineguide.ui.wines.MainActivity.java
@Override public void onShowDescription(WineModel wineModels) { AlertDialog builder = new AlertDialog.Builder(this).setCancelable(true) .setTitle(R.string.dialog_title_description) .setMessage(StringUtils.capitalize(wineModels.getWine_type())) .setPositiveButton(R.string.button_ok, (dialog, id) -> dialog.dismiss()).create(); builder.show(); TextView textView = (TextView) builder.findViewById(android.R.id.message); textView.setTextSize(getResources().getDimension(R.dimen.dialog_message_description)); }
From source file:com.f16gaming.pathofexilestatistics.MainActivity.java
private void onStatsViewClick(int index) { if (poeEntries == null || index < 0) return;/*ww w . j av a 2 s .c o m*/ if (index >= poeEntries.size() && index == statsView.getCount() - 1) { updateList(showHardcore); } else { PoeEntry entry = poeEntries.get(index); AlertDialog dialog = entry.getInfoDialog(this, getResources()); dialog.show(); } }
From source file:net.hockeyapp.demo.android.MainActivity.java
private void checkForUpdatesCustom() { UpdateManager.register(this, Util.getAppIdentifier(this), new UpdateManagerListener() { @Override/*from ww w .j a v a 2 s . co m*/ public void onNoUpdateAvailable() { AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this) .setTitle(R.string.no_updates_title).setMessage(R.string.no_updates_message) .setPositiveButton(R.string.ok, null).create(); alertDialog.show(); } @Override public void onUpdateAvailable(JSONArray data, String url) { super.onUpdateAvailable(data, url); AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this) .setTitle(R.string.updates_title).setMessage(R.string.updates_message) .setPositiveButton(R.string.ok, null).create(); alertDialog.show(); } }); }
From source file:com.arantius.tivocommander.ShowList.java
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { if (position > mShowData.size()) { return false; }/*w w w. j a va 2s. c o m*/ if (mShowStatus.get(position) != ShowStatus.LOADED) { return false; } mLongPressIndex = position; mLongPressItem = mShowData.get(position); if (mLongPressItem.has("recordingForChildRecordingId") && !mLongPressItem.has("folderType")) { mLongPressItem = mLongPressItem.path("recordingForChildRecordingId"); } final Pair<ArrayList<String>, ArrayList<Integer>> choices = getLongPressChoices(mLongPressItem); if (choices == null) { return false; } final ArrayAdapter<String> choicesAdapter = new ArrayAdapter<String>(this, android.R.layout.select_dialog_item, choices.first); Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle("Operation?"); dialogBuilder.setAdapter(choicesAdapter, this); AlertDialog dialog = dialogBuilder.create(); dialog.show(); return true; }
From source file:com.cloudkick.NodeViewActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.do_connectbot: SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String user = prefs.getString("sshUser", "root"); Integer port = new Integer(prefs.getString("sshPort", "22")); String uri = "ssh://" + user + "@" + node.ipAddress + ":" + port + "/#" + user; Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); try {/* ww w .ja v a 2 s . co m*/ startActivity(i); } catch (ActivityNotFoundException e) { // Suggest ConnectBot AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("SSH Client Not Found"); String mfaMessage = ("The ConnectBot SSH Client is required to complete this operation. " + "Would you like to install ConnectBot from the Android Market now?"); builder.setMessage(mfaMessage); builder.setCancelable(true); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent marketActivity = new Intent(Intent.ACTION_VIEW); marketActivity.setData(Uri.parse("market://details?id=org.connectbot")); startActivity(marketActivity); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog mfaDialog = builder.create(); mfaDialog.show(); } return true; default: // If its not recognized, do nothing return super.onOptionsItemSelected(item); } }
From source file:com.cleanwiz.applock.ui.activity.SplashActivity.java
public void showUpdateDialog(String intro) { final AlertDialog updateDialogDlg = new AlertDialog.Builder(this).create(); updateDialogDlg.show(); Window win = updateDialogDlg.getWindow(); win.setContentView(R.layout.dialog_update); TextView tvMsg = (TextView) win.findViewById(R.id.tvMsg); tvMsg.setText(intro);//from w w w. ja v a 2 s . com Button btOk = (Button) win.findViewById(R.id.btOk); ImageView closeImageView = (ImageView) win.findViewById(R.id.updateclose); closeImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub updateDialogDlg.dismiss(); SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); btOk.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_DOWN; handler.sendMessage(msg); } }); updateDialogDlg.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { // TODO Auto-generated method stub List<UpdateVersionManafer> updateVersionManafers = updateVersionManagerService.getVersionManafers(); for (UpdateVersionManafer updateVersionManafer : updateVersionManafers) { updateVersionManafer.setLasttipdate(new Date().getTime()); updateVersionManagerService.modifyTipsDate(updateVersionManafer); break; } SplashHandler handler = new SplashHandler(); Message msg = new Message(); msg.what = CHECKVERSION_CANCEL; handler.sendMessage(msg); } }); }
From source file:com.fabernovel.alertevoirie.NewsActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.report_detail_new_report_ok).setCancelable(false).setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { NewsActivity.this.finish(); // Toast.makeText(this, R.string.report_detail_new_report_ok, Toast.LENGTH_SHORT).show(); NewsActivity.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); }//w w w. j a v a 2s . co m }); AlertDialog alert = builder.create(); alert.show(); } }
From source file:org.xbmc.android.remote.presentation.controller.AbstractController.java
protected void showDialog(final AlertDialog.Builder builder) { builder.setCancelable(true);//from w w w . j a va2 s . com builder.setNegativeButton("Close", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); mDialogShowing = false; // ConnectionManager.resetClient(); } }); mActivity.runOnUiThread(new Runnable() { public void run() { final AlertDialog alert = builder.create(); try { if (!mDialogShowing) { alert.show(); mDialogShowing = true; } } catch (Exception e) { e.printStackTrace(); } } }); }