Java Code Examples for android.app.DialogFragment#show()

The following examples show how to use android.app.DialogFragment#show() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncableActivity.java    From moVirt with Apache License 2.0 6 votes vote down vote up
@OptionsItem(R.id.menu_connection)
public void onConnectionInfo() {
    AllAccounts allAccounts = rxStore.getAllAccountsWrapped();

    ArrayList<String> names = new ArrayList<>();
    ArrayList<String> errors = new ArrayList<>();

    for (ConnectionInfo info : failedInfos) {
        final MovirtAccount account = allAccounts.getAccountById(info.getAccountId());
        if (account == null) {
            continue;
        }

        names.add(account.getName());
        errors.add(info.getMessage(this));
    }

    DialogFragment dialogFragment = ConnInfoDialogFragment.newInstance(names, errors);
    dialogFragment.show(getFragmentManager(), "connection_info");
}
 
Example 2
Source File: RTProxyImpl.java    From memoir with Apache License 2.0 5 votes vote down vote up
@Override
/* @inheritDoc */
   public void openDialogFragment(String fragmentTag, DialogFragment fragment) {
       Activity activity = getActivity();
       if (activity != null) {
           FragmentManager fragmentMgr = activity.getFragmentManager();
           FragmentTransaction ft = fragmentMgr.beginTransaction();
           DialogFragment oldFragment = (DialogFragment) fragmentMgr
                   .findFragmentByTag(fragmentTag);
           if (oldFragment == null) {
               fragment.show(ft, fragmentTag);
           }
       }
   }
 
Example 3
Source File: GenericAlertDialogFragment.java    From United4 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Factory for an alert dialog
 * @param s the title and message of the new dialog
 * @param manager the fragment manager used to show the dialog
 */
public static void newInstance(String s, FragmentManager manager) {
    DialogFragment f = new GenericAlertDialogFragment();
    Bundle args = new Bundle();
    args.putString("text", s);
    f.setArguments(args);
    f.show(manager, "dialog");
}
 
Example 4
Source File: CheckNewsTask.java    From open-rmbt with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(final JSONArray newsList)
{
    
    if (newsList != null && newsList.length() > 0 && !serverConn.hasError())
        for (int i = 0; i < newsList.length(); i++)
            if (!isCancelled() && !Thread.interrupted())
                try
                {
                    
                    final JSONObject newsItem = newsList.getJSONObject(i);
                    
                    final DialogFragment newFragment = RMBTAlertDialogFragment.newInstance(
                            newsItem.optString("title", activity.getString(R.string.news_title)),
                            newsItem.optString("text", activity.getString(R.string.news_no_message)), null);
                    
                    newFragment.show(activity.getFragmentManager(), "dialog");
                    
                    if (newsItem.has("uid"))
                    {
                        if (lastNewsUid < newsItem.getLong("uid"))
                            lastNewsUid = newsItem.getLong("uid");
                    }
                }
                catch (final JSONException e)
                {
                    e.printStackTrace();
                }
    
    ConfigHelper.setLastNewsUid(activity.getApplicationContext(), lastNewsUid);
}
 
Example 5
Source File: RatingDialogHelper.java    From GameOfLife with MIT License 5 votes vote down vote up
private void show(DialogFragment dialogFragment, String tag) {
    FragmentManager fragmentManager = activity.getFragmentManager();
    Fragment fragmentByTag = fragmentManager.findFragmentByTag(tag);

    if (fragmentByTag == null) {
        dialogFragment.show(fragmentManager, tag);
    }
}
 
Example 6
Source File: AskExtStorageWritePermissionDialog.java    From edslite with GNU General Public License v2.0 5 votes vote down vote up
public static void showDialog(FragmentManager fm, String openerTag)
{
	Bundle args = new Bundle();
	args.putString(LocationOpenerBaseFragment.PARAM_RECEIVER_FRAGMENT_TAG, openerTag);
	DialogFragment newFragment = new AskExtStorageWritePermissionDialog();
	newFragment.setArguments(args);
    newFragment.show(fm, "AskExtStorageWritePermissionDialog");
}
 
Example 7
Source File: DialogUtil.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Display an error.
 *
 * @param activity the current activity
 * @param resource the error message
 * @param args     arguments for the error message
 */
public static void displayError(@NonNull final Activity activity, final int resource, final Object... args) {
	String message = String.format(activity.getString(resource), args);
	Bundle bundle = new Bundle();
	bundle.putCharSequence(PARAM_MESSAGE, message);
	bundle.putString(PARAM_TITLE, activity.getString(R.string.title_dialog_error));

	DialogFragment fragment = new DisplayMessageDialogFragment();
	fragment.setArguments(bundle);
	fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
}
 
Example 8
Source File: AbstractBrowserFragment.java    From SimpleExplorer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onMenuItemClick(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.createfile:
            final DialogFragment dialog1 = new CreateFileDialog();
            dialog1.show(fm, AbstractBrowserActivity.TAG_DIALOG);
            return true;
        case R.id.createfolder:
            final DialogFragment dialog2 = new CreateFolderDialog();
            dialog2.show(fm, AbstractBrowserActivity.TAG_DIALOG);
            return true;
        default:
            return false;
    }
}
 
Example 9
Source File: DialogUtil.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Display the info of this photo.
 *
 * @param activity the triggering activity
 * @param eyePhoto the photo for which the image should be displayed.
 */
public static void displayImageInfo(@NonNull final Activity activity, @NonNull final EyePhoto eyePhoto) {
	StringBuilder message = new StringBuilder();
	message.append(formatImageInfoLine(activity, R.string.imageinfo_line_filename, eyePhoto.getFilename()));
	message.append(formatImageInfoLine(activity, R.string.imageinfo_line_filedate, eyePhoto.getDateString(activity)));

	try {
		JpegMetadata metadata = JpegSynchronizationUtil.getJpegMetadata(eyePhoto.getAbsolutePath());

		if (metadata.getPerson() != null && metadata.getPerson().length() > 0) {
			message.append(formatImageInfoLine(activity, R.string.imageinfo_line_name, metadata.getPerson()));
		}
		if (metadata.getComment() != null && metadata.getComment().length() > 0) {
			message.append(formatImageInfoLine(activity, R.string.imageinfo_line_comment, metadata.getComment()));
		}
	}
	catch (Exception e) {
		// cannot append metadata.
	}

	Bundle bundle = new Bundle();
	bundle.putCharSequence(PARAM_MESSAGE, fromHtml(message.toString()));
	bundle.putString(PARAM_TITLE, activity.getString(R.string.title_dialog_image_info));
	bundle.putInt(PARAM_ICON, R.drawable.ic_title_info);
	DialogFragment fragment = new DisplayMessageDialogFragment();
	fragment.setArguments(bundle);
	fragment.show(activity.getFragmentManager(), fragment.getClass().toString());
}
 
Example 10
Source File: NewFileDialog.java    From edslite with GNU General Public License v2.0 5 votes vote down vote up
public static void showDialog(FragmentManager fm, int type, String receiverTag)
{
	DialogFragment newFragment = new NewFileDialog();
	Bundle b = new Bundle();
	b.putInt(ARG_TYPE, type);
	b.putString(ARG_RECEIVER_TAG, receiverTag);
	newFragment.setArguments(b);
    newFragment.show(fm, "NewFileDialog");
}
 
Example 11
Source File: AlbumVideosActivity.java    From Klyph with MIT License 5 votes vote down vote up
@Override
public void onVideoSelected(Fragment fragment, Video video)
{
	videoToDisplay = video;
	
	DialogFragment dialog = new VideoQualityDialog();
       dialog.show(getFragmentManager(), "VideoQualityDialog");
}
 
Example 12
Source File: PasswordManagerActivity.java    From SnooperStopper with GNU General Public License v3.0 4 votes vote down vote up
private void showPasswordChangeErrorDialog() {
    DialogFragment errorDialog = ErrorDialogFragment.newInstance(
            getResources().getString(R.string.password_change_error),
            getResources().getString(R.string.failed_to_change_password));
    errorDialog.show(getFragmentManager(), "passwordChangeErrorDialog");
}
 
Example 13
Source File: PasswordManagerActivity.java    From SnooperStopper with GNU General Public License v3.0 4 votes vote down vote up
private void showConfirmationDialog(String currentPasswd, String newPasswd) {
    DialogFragment confirmationDialog = ConfirmationDialogFragment
            .newInstance(currentPasswd, newPasswd);
    confirmationDialog.show(getFragmentManager(), "confirmationDialog");
}
 
Example 14
Source File: AddToDoActivity.java    From android_coursera_1 with MIT License 4 votes vote down vote up
private void showDatePickerDialog() {
	DialogFragment newFragment = new DatePickerFragment();
	newFragment.show(getFragmentManager(), "datePicker");
}
 
Example 15
Source File: BasicActivity.java    From uPods-android with Apache License 2.0 4 votes vote down vote up
@Override
public void showDialogFragment(DialogFragment dialogFragment) {
    long time = Calendar.getInstance().get(Calendar.MILLISECOND);
    String tag = DIALOG_TAG_START + String.valueOf(time);
    dialogFragment.show(getFragmentManager(), tag);
}
 
Example 16
Source File: CreateDialogBroadcastReceiverHelper.java    From moVirt with Apache License 2.0 4 votes vote down vote up
public static void showCertificateDialog(FragmentManager manager, MovirtAccount account, String reason, String apiUrl) {
    if (manager.findFragmentByTag(CERTIFICATE_DIALOG_TAG) == null) {
        DialogFragment importCertificateDialog = ImportCertificateDialogFragment.newInstance(reason, account, apiUrl);
        importCertificateDialog.show(manager, CERTIFICATE_DIALOG_TAG);
    }
}
 
Example 17
Source File: PolicyManagementFragment.java    From android-testdpc with Apache License 2.0 4 votes vote down vote up
private void showEapTlsWifiConfigCreationDialog() {
    DialogFragment fragment = WifiEapTlsCreateDialogFragment.newInstance(null);
    fragment.show(getFragmentManager(), WifiEapTlsCreateDialogFragment.class.getName());
}
 
Example 18
Source File: RCTDateTimePicker.java    From react-native-datetime with MIT License 4 votes vote down vote up
@ReactMethod
public void showTimePicker(ReadableMap options, Callback callback) {
    DialogFragment timePicker = new TimePicker(options, callback);
    timePicker.show(activity.getFragmentManager(), "timePicker");
}
 
Example 19
Source File: BaseActivity.java    From android-dagger-butterknife-mvp with Apache License 2.0 4 votes vote down vote up
protected final void showDialogFragment(DialogFragment dialogFragment, String tag) {
    dialogFragment.show(fragmentManager, tag);
}
 
Example 20
Source File: RMBTSyncEnterCodeFragment.java    From open-rmbt with Apache License 2.0 4 votes vote down vote up
@Override
public void taskEnded(final JSONArray resultList)
{
    
    overlay.setVisibility(View.GONE);
    overlay.setClickable(false);
    codeField.setClickable(true);
    syncButton.setOnClickListener(listener);
    
    if (resultList != null && resultList.length() > 0 && !syncTask.hasError())
        for (int i = 0; i < resultList.length(); i++)
        {
            
            codeField.clearFocus();
            syncButton.requestFocus();
            
            JSONObject resultListItem;
            try
            {
                resultListItem = resultList.getJSONObject(i);
                
                final String title = resultListItem.optString("msg_title");
                final String text = resultListItem.optString("msg_text");
                final boolean success = resultListItem.optBoolean("success");
                
                if (text.length() > 0)
                {
                    String popBackStackIncluding = null;
                    if (success)
                    {
                        popBackStackIncluding = "sync";
                        ((RMBTMainActivity) getActivity()).setHistoryDirty(true);
                        ((RMBTMainActivity) getActivity()).setSettings(null, null);
                        ((RMBTMainActivity) getActivity()).checkSettings(true, null);
                    }
                    
                    final DialogFragment newFragment = RMBTAlertDialogFragment.newInstance(title, text,
                            popBackStackIncluding);
                    
                    newFragment.show(getActivity().getFragmentManager(), "sync_msg");
                }
                
            }
            catch (final JSONException e)
            {
                e.printStackTrace();
            }
            
        }
}