本文整理汇总了Java中android.support.v4.app.DialogFragment.show方法的典型用法代码示例。如果您正苦于以下问题:Java DialogFragment.show方法的具体用法?Java DialogFragment.show怎么用?Java DialogFragment.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.DialogFragment
的用法示例。
在下文中一共展示了DialogFragment.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_locate:
if (hasLocationPermission()) {
findCoords();
} else if (ActivityCompat.shouldShowRequestPermissionRationale(
getActivity(), LOCATION_PERMISSIONS[0])) {
DialogFragment dialog = new PermissionRationaleFragment();
dialog.setTargetFragment(PlaceListFragment.this, 0);
dialog.show(getFragmentManager(), PERMISSION_RATIONALE_DIALOG);
} else {
requestPermissions(LOCATION_PERMISSIONS, REQUEST_LOCATION_PERMISSIONS);
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例2: onDisplayPreferenceDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Override
public void onDisplayPreferenceDialog(Preference preference) {
if (callback != null) {
callback.onSettingChanged();
}
DialogFragment dialogFragment = null;
if (preference instanceof StylePreference) {
dialogFragment
= StylePreferenceDialogFragment
.newInstance(preference);
} else if (preference instanceof ColumnCountPreference) {
dialogFragment
= ColumnCountPreferenceDialogFragment
.newInstance(preference);
}
if (dialogFragment != null) {
dialogFragment.setTargetFragment(this, 0);
dialogFragment.show(this.getFragmentManager(), DIALOG_FRAGMENT_TAG);
return;
}
super.onDisplayPreferenceDialog(preference);
}
示例3: dontClearForDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Test
public void dontClearForDialog() throws Throwable {
testFragment.testValue = new AutoClearedValue<>(testFragment, "foo");
DialogFragment dialogFragment = new DialogFragment();
dialogFragment.show(testFragment.getFragmentManager(), "dialog");
dialogFragment.dismiss();
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
assertThat(testFragment.testValue.get(), is("foo"));
}
示例4: onSuccess
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Override
public void onSuccess(List<String> connectionInfo) {
if (getActivity() == null) {
// our activity went away while we worked...
return;
}
if (snackbar != null) {
snackbar.dismiss();
}
DialogFragment newFragment = HtmlDialogFragment.newInstance(connectionInfo.get(0));
newFragment.show(getActivity().getSupportFragmentManager(), "conninfo");
}
示例5: onFileUploaded
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Override
public void onFileUploaded(final String fileCode) {
if (isUIVisible) {
showUploadDialog = false;
hideBottomNotice();
DialogFragment dialog = UploadFileDialog.newInstance(fileCode);
dialog.show(getActivity().getSupportFragmentManager(), UploadFileDialogTag);
} else {
showUploadDialog = true;
showUploadDialogCode = fileCode;
}
mUploadFile.setEnabled(true);
mUploadFile.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable
.ic_file_upload_24dp, null));
}
示例6: onDisplayPreferenceDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
/**
* Called when a preference in the tree requests to display a dialog. Subclasses should
* override this method to display custom dialogs or to handle dialogs for custom preference
* classes.
*
* @param preference The Preference object requesting the dialog.
*/
@Override
public void onDisplayPreferenceDialog(Preference preference) {
if (preference instanceof VolumePreference) {
DialogFragment fragment = VolumePreferenceFragment.newInstance(preference);
fragment.setTargetFragment(this, 0);
fragment.show(getFragmentManager(),
"android.support.v7.preference.PreferenceFragment.DIALOG");
} else {
super.onDisplayPreferenceDialog(preference);
}
}
示例7: pickDate
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
public void pickDate(View view) {
/* This function is called when the user presses the "pick the date" button. */
//Create the arguments for the fragment:
Bundle defaultDate = new Bundle();
defaultDate.putInt("year", startingTime.get(Calendar.YEAR));
defaultDate.putInt("month", startingTime.get(Calendar.MONTH));
defaultDate.putInt("day", startingTime.get(Calendar.DAY_OF_MONTH));
//This fragment will allow the user to pick the date, with the default being the date that was picked before:
DialogFragment dateFragment = new DriveDateFragment();
dateFragment.setArguments(defaultDate);
//Start the date fragment:
dateFragment.show(getSupportFragmentManager(), "DriveDateFragment");
}
示例8: pickTime
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
public void pickTime(Calendar driveTime) {
//Create the arguments for the fragment:
Bundle defaultTime = new Bundle();
defaultTime.putInt("hour", driveTime.get(Calendar.HOUR_OF_DAY));
defaultTime.putInt("minute", driveTime.get(Calendar.MINUTE));
//This fragment will allow the user to pick the date:
DialogFragment timeFragment = new DriveTimeFragment();
timeFragment.setArguments(defaultTime);
//Start the date fragment:
timeFragment.show(getSupportFragmentManager(), "DriveTimeFragment");
}
示例9: showMemoDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
private void showMemoDialog(){
DialogFragment dialog = new MemoDialogFragment();
Bundle args = new Bundle();
args.putSerializable("type", requestMessage.getChallengeType());
args.putString("opponent", requestMessage.getFrom());
args.putString("sender", requestMessage.getSender());
args.putSerializable("date", requestMessage.getTime());
args.putString("opponentEmail", requestMessage.getFrom());
dialog.setArguments(args);
dialog.show(getSupportFragmentManager(), "MemoDialogFragment");
}
示例10: showDiaryEntryDeletionMessage
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Override
public void showDiaryEntryDeletionMessage(final int position) {
mDeletionPosition = position;
DialogFragment newFragment = new DeleteDiaryEntryDialogFragment();
newFragment.setTargetFragment(this, ENTRY_DELETION_REQ_CODE);
newFragment.show(getFragmentManager(), "delete entry");
}
示例11: onCreate
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feature_dfu);
isBLESupported();
if (!isBLEEnabled()) {
showBLEDialog();
}
setGUI();
// Try to create sample files
if (FileHelper.newSamplesAvailable(this)) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
FileHelper.createSamples(this);
} else {
final DialogFragment dialog = PermissionRationaleFragment.getInstance(R.string.permission_sd_text, Manifest.permission.WRITE_EXTERNAL_STORAGE);
dialog.show(getSupportFragmentManager(), null);
}
}
// restore saved state
mFileType = DfuService.TYPE_AUTO; // Default
if (savedInstanceState != null) {
mFileType = savedInstanceState.getInt(DATA_FILE_TYPE);
mFileTypeTmp = savedInstanceState.getInt(DATA_FILE_TYPE_TMP);
mFilePath = savedInstanceState.getString(DATA_FILE_PATH);
mFileStreamUri = savedInstanceState.getParcelable(DATA_FILE_STREAM);
mInitFilePath = savedInstanceState.getString(DATA_INIT_FILE_PATH);
mInitFileStreamUri = savedInstanceState.getParcelable(DATA_INIT_FILE_STREAM);
mSelectedDevice = savedInstanceState.getParcelable(DATA_DEVICE);
mStatusOk = mStatusOk || savedInstanceState.getBoolean(DATA_STATUS);
mUploadButton.setEnabled(mSelectedDevice != null && mStatusOk);
}
}
示例12: showConfirmGoBackDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
public void showConfirmGoBackDialog() {
if (!mTimeControl.isEqual(mTimeControlSnapshot)) {
DialogFragment newFragment = ExitConfirmationDialogFragment.newInstance();
newFragment.setTargetFragment(this, REQUEST_EXIT_DIALOG);
newFragment.show(getFragmentManager(), TAG_EXIT_DIALOG_FRAGMENT);
} else {
getActivity().getSupportFragmentManager().popBackStack();
}
}
示例13: createImportDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
public void createImportDialog() {
DialogFragment dialogFragment = new ImportSongDialog();
dialogFragment.show(getSupportFragmentManager(), "Import");
}
示例14: createDownloadFailureDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
public void createDownloadFailureDialog(DialogFragment d) {
d.dismiss();
DialogFragment uploadFailureDialog = new DownloadConnectionFailureDialog();
uploadFailureDialog.show(getSupportFragmentManager(), "UploadFailure");
}
示例15: featureSelectorDialog
import android.support.v4.app.DialogFragment; //导入方法依赖的package包/类
public void featureSelectorDialog() {
DialogFragment dialogFragment = PoiFeatureDialogFragment.newInstance();
dialogFragment.setTargetFragment(this, 1);
dialogFragment.show(getActivity().getSupportFragmentManager(), "PoiFeatureDialogFragment");
}