Search in sources :

Example 31 with DialogFragment

use of android.support.v4.app.DialogFragment in project android-betterpickers by code-troopers.

the class SampleRecurrenceForcedOn method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_button);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button button = (Button) findViewById(R.id.button);
    mResultTextView.setText(R.string.no_value);
    button.setText(R.string.recurrence_picker_set);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentManager fm = getSupportFragmentManager();
            Bundle bundle = new Bundle();
            Time time = new Time();
            time.setToNow();
            bundle.putLong(RecurrencePickerDialogFragment.BUNDLE_START_TIME_MILLIS, time.toMillis(false));
            bundle.putString(RecurrencePickerDialogFragment.BUNDLE_TIME_ZONE, time.timezone);
            bundle.putBoolean(RecurrencePickerDialogFragment.BUNDLE_HIDE_SWITCH_BUTTON, true);
            // may be more efficient to serialize and pass in EventRecurrence
            bundle.putString(RecurrencePickerDialogFragment.BUNDLE_RRULE, mRrule);
            RecurrencePickerDialogFragment dialogFragment = (RecurrencePickerDialogFragment) fm.findFragmentByTag(FRAG_TAG_RECUR_PICKER);
            if (dialogFragment != null) {
                dialogFragment.dismiss();
            }
            dialogFragment = new RecurrencePickerDialogFragment();
            dialogFragment.setArguments(bundle);
            dialogFragment.setOnRecurrenceSetListener(SampleRecurrenceForcedOn.this);
            dialogFragment.show(fm, FRAG_TAG_RECUR_PICKER);
        }
    });
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Button(android.widget.Button) Bundle(android.os.Bundle) RecurrencePickerDialogFragment(com.codetroopers.betterpickers.recurrencepicker.RecurrencePickerDialogFragment) Time(android.text.format.Time) TextView(android.widget.TextView) View(android.view.View)

Example 32 with DialogFragment

use of android.support.v4.app.DialogFragment in project android by owncloud.

the class AuthenticatorActivity method onSsoFinished.

@Override
public void onSsoFinished(String sessionCookie) {
    if (sessionCookie != null && sessionCookie.length() > 0) {
        Log_OC.d(TAG, "Successful SSO - time to save the account");
        mAuthToken = sessionCookie;
        getRemoteUserNameOperation(sessionCookie);
        Fragment fd = getSupportFragmentManager().findFragmentByTag(SAML_DIALOG_TAG);
        if (fd != null && fd instanceof DialogFragment) {
            Dialog d = ((DialogFragment) fd).getDialog();
            if (d != null && d.isShowing()) {
                d.dismiss();
            }
        }
    } else {
        // TODO - show fail
        Log_OC.d(TAG, "SSO failed");
    }
}
Also used : LoadingDialog(com.owncloud.android.ui.dialog.LoadingDialog) SamlWebViewDialog(com.owncloud.android.ui.dialog.SamlWebViewDialog) Dialog(android.app.Dialog) SslUntrustedCertDialog(com.owncloud.android.ui.dialog.SslUntrustedCertDialog) DialogFragment(android.support.v4.app.DialogFragment) CredentialsDialogFragment(com.owncloud.android.ui.dialog.CredentialsDialogFragment) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment) CredentialsDialogFragment(com.owncloud.android.ui.dialog.CredentialsDialogFragment)

Example 33 with DialogFragment

use of android.support.v4.app.DialogFragment in project android by owncloud.

the class ShareActivity method onCreateShareViaLinkOperationFinish.

private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation operation, RemoteOperationResult result) {
    if (result.isSuccess()) {
        updateFileFromDB();
        // Create dialog to allow the user choose an app to send the link
        Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
        String link = ((OCShare) (result.getData().get(0))).getShareLink();
        intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
        intentToShareLink.setType("text/plain");
        String username = AccountUtils.getUsernameForAccount(getAccount());
        if (username != null) {
            intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.subject_user_shared_with_you, username, getFile().getFileName()));
        } else {
            intentToShareLink.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.subject_shared_with_you, getFile().getFileName()));
        }
        String[] packagesToExclude = new String[] { getPackageName() };
        DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
        chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
    } else {
        // Detect Failure (403) --> maybe needs password
        String password = operation.getPassword();
        if (result.getCode() == RemoteOperationResult.ResultCode.SHARE_FORBIDDEN && (password == null || password.length() == 0) && getCapabilities().getFilesSharingPublicEnabled().isUnknown()) {
            // Was tried without password, but not sure that it's optional.
            // Try with password before giving up; see also ShareFileFragment#OnShareViaLinkListener
            ShareFileFragment shareFileFragment = getShareFileFragment();
            if (shareFileFragment != null && shareFileFragment.isAdded()) {
                // only if added to the view hierarchy!!
                shareFileFragment.requestPasswordForShareViaLink(true);
            }
        } else {
            Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), Snackbar.LENGTH_LONG);
            snackbar.show();
        }
    }
}
Also used : OCShare(com.owncloud.android.lib.resources.shares.OCShare) DialogFragment(android.support.v4.app.DialogFragment) Intent(android.content.Intent) ShareFileFragment(com.owncloud.android.ui.fragment.ShareFileFragment) Snackbar(android.support.design.widget.Snackbar)

Example 34 with DialogFragment

use of android.support.v4.app.DialogFragment in project android by owncloud.

the class FileOperationsHelper method sendDownloadedFile.

public void sendDownloadedFile(OCFile file) {
    if (file != null) {
        Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
        // set MimeType
        sendIntent.setType(file.getMimetype());
        sendIntent.putExtra(Intent.EXTRA_STREAM, file.getExposedFileUri(mFileActivity));
        // Send Action
        sendIntent.putExtra(Intent.ACTION_SEND, true);
        // Show dialog, without the own app
        String[] packagesToExclude = new String[] { mFileActivity.getPackageName() };
        DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude);
        chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
    } else {
        Log_OC.e(TAG, "Trying to send a NULL OCFile");
    }
}
Also used : DialogFragment(android.support.v4.app.DialogFragment) Intent(android.content.Intent)

Example 35 with DialogFragment

use of android.support.v4.app.DialogFragment in project Rocket.Chat.Android by RocketChat.

the class RoomFragment method showExtraActionSelectionDialog.

private void showExtraActionSelectionDialog() {
    final DialogFragment fragment = ExtraActionPickerDialogFragment.create(new ArrayList<>(extraActionItems));
    fragment.setTargetFragment(this, DIALOG_ID);
    fragment.show(getFragmentManager(), "ExtraActionPickerDialogFragment");
}
Also used : DialogFragment(android.support.v4.app.DialogFragment) MessageOptionsDialogFragment(chat.rocket.android.fragment.chatroom.dialog.MessageOptionsDialogFragment) FileUploadProgressDialogFragment(chat.rocket.android.fragment.chatroom.dialog.FileUploadProgressDialogFragment) ExtraActionPickerDialogFragment(chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment) UsersOfRoomDialogFragment(chat.rocket.android.fragment.chatroom.dialog.UsersOfRoomDialogFragment)

Aggregations

DialogFragment (android.support.v4.app.DialogFragment)85 Fragment (android.support.v4.app.Fragment)31 FragmentTransaction (android.support.v4.app.FragmentTransaction)24 Bundle (android.os.Bundle)10 FragmentManager (android.support.v4.app.FragmentManager)9 View (android.view.View)8 SherlockDialogFragment (com.actionbarsherlock.app.SherlockDialogFragment)8 TextView (android.widget.TextView)7 AlertDialog (android.app.AlertDialog)5 DialogInterface (android.content.DialogInterface)4 OnClickListener (android.content.DialogInterface.OnClickListener)4 Intent (android.content.Intent)4 ListFragment (android.support.v4.app.ListFragment)4 AppCompatDialogFragment (android.support.v7.app.AppCompatDialogFragment)4 OnClickListener (android.view.View.OnClickListener)4 Button (android.widget.Button)4 ItemPinnedMessageDialogFragment (com.h6ah4i.android.example.advrecyclerview.common.fragment.ItemPinnedMessageDialogFragment)4 ProgressDialogFragment (com.wada811.android.dialogfragments.material.ProgressDialogFragment)4 Dialog (android.app.Dialog)3 ProgressDialogFragment (com.wada811.android.dialogfragments.traditional.ProgressDialogFragment)3