List of usage examples for android.support.v4.app DialogFragment setCancelable
public void setCancelable(boolean cancelable)
From source file:piuk.blockchain.android.ui.WelcomeFragment.java
public static void show(final FragmentManager fm, WalletApplication application) { try {/*from ww w . j a v a2s .c o m*/ hide(); final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.welcome_dialog); final FragmentTransaction ft = fm.beginTransaction(); if (prev != null) { prev.dismiss(); ft.remove(prev); } ft.addToBackStack(null); final DialogFragment newFragment = instance(); newFragment.show(ft, FRAGMENT_TAG); if (application.getRemoteWallet().isNew()) { newFragment.setCancelable(false); } else { newFragment.setCancelable(!application.hasDecryptionError); } } catch (Exception e) { e.printStackTrace(); } }
From source file:piuk.blockchain.android.ui.dialogs.WelcomeDialog.java
public static void show(final FragmentManager fm, Activity activity, WalletApplication application) { try {// www . ja v a 2 s . com if (activity.isFinishing()) return; hide(); NewAccountDialog.hide(); final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.welcome_dialog); final FragmentTransaction ft = fm.beginTransaction(); if (prev != null) { prev.dismiss(); ft.remove(prev); } ft.addToBackStack(null); final DialogFragment newFragment = instance(); if (activity.isFinishing()) return; newFragment.show(ft, FRAGMENT_TAG); if (application.getRemoteWallet() == null) { newFragment.setCancelable(false); } else { newFragment.setCancelable(application.decryptionErrors == 0); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.mariotaku.twidere.task.ProgressSaveFileTask.java
@Override protected void showProgress() { final Context context = getContext(); if (context == null) return;/*ww w . j ava 2 s . c o m*/ ((IExtendedActivity) context).executeAfterFragmentResumed(new IExtendedActivity.Action() { @Override public void execute(IExtendedActivity activity) { final DialogFragment fragment = new ProgressDialogFragment(); fragment.setCancelable(false); fragment.show(((FragmentActivity) activity).getSupportFragmentManager(), PROGRESS_FRAGMENT_TAG); } }); }
From source file:org.mariotaku.twidere.util.SaveImageTask.java
@Override protected void onPreExecute() { final DialogFragment fragment = new ProgressDialogFragment(); fragment.setCancelable(false); fragment.show(activity.getSupportFragmentManager(), PROGRESS_FRAGMENT_TAG); super.onPreExecute(); }
From source file:com.secretparty.app.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences prefs = this.getPreferences(MODE_PRIVATE); thematicRepo = ((SecretPartyApplication) getApplication()).getThematicRepository(); api = ((SecretPartyApplication) getApplication()).getApiService(); //TODO : check if thematics are in the database. If so, launch a ThematicFragment. Otherwise, download them, save them to the db and launch TheamticFragment int userId = prefs.getInt(getString(R.string.SP_user_id), -1); int partyId = prefs.getInt(getString(R.string.SP_party_id), -1); long partyEnd = prefs.getLong(getString(R.string.SP_date_party_end), -1); Log.v("creation", new Date(partyEnd).toLocaleString() + ""); api.listThematics(new OnReceivedThematics()); if (userId == -1) { DialogFragment df = new UserCreationDialog(); df.setCancelable(false); df.show(getSupportFragmentManager(), "dialog"); }//from ww w .ja v a2 s .c o m }
From source file:name.gumartinm.weather.information.activity.MainTabsActivity.java
@Override public void onResume() { super.onResume(); final SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(this.getApplicationContext()); final String APPID = sharedPreferences.getString(this.getString(R.string.weather_preferences_app_id_key), "");/*w ww. j a va2s . c om*/ final String noticeKeyPreference = this.getString(R.string.api_id_key_notice_preference_key); final boolean notice = sharedPreferences.getBoolean(noticeKeyPreference, true); if (notice && APPID.isEmpty()) { final FragmentManager fm = this.getSupportFragmentManager(); final Fragment buttonsFragment = fm.findFragmentByTag("noticeDialog"); if (buttonsFragment == null) { final DialogFragment newFragment = APIKeyNoticeDialogFragment .newInstance(R.string.api_id_key_notice_title); newFragment.setRetainInstance(true); newFragment.setCancelable(false); newFragment.show(fm, "noticeDialog"); } } final ActionBar actionBar = this.getActionBar(); // 1. Update title. final DatabaseQueries query = new DatabaseQueries(this.getApplicationContext()); final WeatherLocation weatherLocation = query.queryDataBase(); if (weatherLocation != null) { final String[] array = new String[2]; array[0] = weatherLocation.getCity(); array[1] = weatherLocation.getCountry(); final MessageFormat message = new MessageFormat("{0},{1}", Locale.US); final String cityCountry = message.format(array); actionBar.setTitle(cityCountry); } else { actionBar.setTitle(this.getString(R.string.text_field_no_chosen_location)); } // 2. Update forecast tab text. final String keyPreference = this.getString(R.string.weather_preferences_day_forecast_key); final String value = sharedPreferences.getString(keyPreference, ""); String humanValue = ""; if (value.equals(this.getString(R.string.weather_preferences_day_forecast_five_day))) { humanValue = this.getString(R.string.text_tab_five_days_forecast); } else if (value.equals(this.getString(R.string.weather_preferences_day_forecast_ten_day))) { humanValue = this.getString(R.string.text_tab_ten_days_forecast); } else if (value.equals(this.getString(R.string.weather_preferences_day_forecast_fourteen_day))) { humanValue = this.getString(R.string.text_tab_fourteen_days_forecast); } actionBar.getTabAt(1).setText(humanValue); }
From source file:com.bonsai.wallet32.MainActivity.java
private void showStateProgressDialog(String details) { DialogFragment df = new StateProgressDialogFragment(); Bundle args = new Bundle(); args.putString("details", details); df.setArguments(args);/*w w w . j a v a 2s . com*/ df.setCancelable(false); df.show(getSupportFragmentManager(), "state_progress_dialog"); mStateProgressDialog = df; }
From source file:com.bonsai.wallet32.MainActivity.java
private void showSyncProgressDialog() { String details;//from ww w . j av a2 s. c om switch (mWalletService.getSyncState()) { case CREATED: details = mRes.getString(R.string.sync_details_created); break; case RESTORE: details = mRes.getString(R.string.sync_details_restore); break; case STARTUP: details = mRes.getString(R.string.sync_details_startup); break; case RESCAN: details = mRes.getString(R.string.sync_details_rescan); break; case RERESCAN: details = mRes.getString(R.string.sync_details_rerescan); break; default: details = "???"; // Shouldn't happen break; } DialogFragment df = new SyncProgressDialogFragment(); Bundle args = new Bundle(); args.putString("details", details); df.setArguments(args); df.setCancelable(false); df.show(getSupportFragmentManager(), "sync_progress_dialog"); mSyncProgressDialog = df; }
From source file:de.eidottermihi.rpicheck.activity.CustomCommandActivity.java
private void runCommand(long commandId) { ConnectivityManager connMgr = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { if (currentDevice.getAuthMethod().equals(NewRaspiAuthActivity.SPINNER_AUTH_METHODS[2]) && Strings.isNullOrEmpty(currentDevice.getKeyfilePass())) { // must ask for key passphrase first LOGGER.debug("Asking for key passphrase."); // dirty hack, saving commandId as "dialog type" final String dialogType = commandId + ""; final DialogFragment passphraseDialog = new PassphraseDialog(); final Bundle args = new Bundle(); args.putString(PassphraseDialog.KEY_TYPE, dialogType); passphraseDialog.setArguments(args); passphraseDialog.setCancelable(false); passphraseDialog.show(getSupportFragmentManager(), "passphrase"); } else {/*from w w w . j a va 2 s. c o m*/ LOGGER.debug("Opening command dialog."); openCommandDialog(commandId, currentDevice.getKeyfilePass()); } } else { Toast.makeText(this, R.string.no_connection, Toast.LENGTH_SHORT).show(); } }
From source file:com.bonsai.wallet32.PasscodeActivity.java
protected DialogFragment showModalDialog(String title, String msg) { DialogFragment df = new MyDialogFragment(); Bundle args = new Bundle(); args.putString("title", title); args.putString("msg", msg); args.putBoolean("hasOK", false); df.setArguments(args);/*from w w w .j a va2s . c o m*/ df.setCancelable(false); df.show(getSupportFragmentManager(), "note"); return df; }