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);
}
});
}
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");
}
}
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();
}
}
}
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");
}
}
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");
}
Aggregations