本文整理汇总了Java中android.app.DialogFragment.show方法的典型用法代码示例。如果您正苦于以下问题:Java DialogFragment.show方法的具体用法?Java DialogFragment.show怎么用?Java DialogFragment.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.DialogFragment
的用法示例。
在下文中一共展示了DialogFragment.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: alertDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
/**
* For working with pre-Android M security permissions
* @param gpsEnabled If the cacheManifest and system allow gps
* @param networkLocationEnabled If the cacheManifest and system allow network location access
* @param cellularEnabled If the cacheManifest and system allow cellular data access
*/
private void alertDialog(boolean gpsEnabled, boolean networkLocationEnabled, boolean cellularEnabled){
if(!gpsEnabled || !networkLocationEnabled){
sendCallback(PluginResult.Status.ERROR,
JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.LOCATION_SERVICES_UNAVAILABLE()));
final DialogFragment gpsFragment = new GPSAlertDialogFragment();
gpsFragment.show(_cordovaActivity.getFragmentManager(), "GPSAlert");
}
if(!cellularEnabled){
sendCallback(PluginResult.Status.ERROR,
JSONHelper.errorJSON(PROVIDER_PRIMARY, ErrorMessages.CELL_DATA_NOT_AVAILABLE()));
final DialogFragment networkUnavailableFragment = new NetworkUnavailableDialogFragment();
networkUnavailableFragment.show(_cordovaActivity.getFragmentManager(), "NetworkUnavailableAlert");
}
}
示例2: showChangelog
import android.app.DialogFragment; //导入方法依赖的package包/类
public static void showChangelog(FragmentManager fm)
{
FragmentTransaction ft = fm.beginTransaction();
Fragment prev = fm.findFragmentByTag(TAG);
if (prev != null)
{
ft.remove(prev);
}
try
{
DialogFragment dialog = DialogFragmentChangelog.newInstance();
dialog.show(ft, TAG);
}
catch (IllegalArgumentException | IllegalStateException ignored)
{ }
}
示例3: onOptionsItemSelected
import android.app.DialogFragment; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if(R.id.add_photo == id) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, getResources().getString(R.string.add_photo)), PICK_IMAGE);
} else if(R.id.clear == id) {
List<Drawable> drawables = imageViewPagerAdapter.drawables;
drawables.clear();
addDefaultImages(drawables);
imageViewPagerAdapter.notifyDataSetChanged();
} else if(R.id.info == id) {
DialogFragment infoDialogFragment = new InfoDialogFragment();
infoDialogFragment.show(getFragmentManager(), "info");
}
return super.onOptionsItemSelected(item);
}
示例4: onDateSet
import android.app.DialogFragment; //导入方法依赖的package包/类
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
String tag = getTag();
MainActivity activity = (MainActivity) getActivity();
// threeten's LocalDate months are zero-indexed.
month++;
switch (tag) {
case "start_date_picker":
activity.set_start_date(year, month, dayOfMonth);
DialogFragment end_date_fragment = new DatePickerFragment();
end_date_fragment.show(getFragmentManager(), "end_date_picker");
break;
case "end_date_picker":
activity.set_end_date(year, month, dayOfMonth);
activity.generate_potd_list();
break;
}
}
示例5: showDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
void showDialog(String text) {
// DialogFragment.show() will take care of adding the fragment
// in a transaction. We also want to remove any currently showing
// dialog, so make our own transaction and take care of that here.
FragmentTransaction ft = getFragmentManager().beginTransaction();
DialogFragment newFragment = MyDialogFragment.newInstance(text);
// Show the dialog.
newFragment.show(ft, "dialog");
}
示例6: onEventMainThread
import android.app.DialogFragment; //导入方法依赖的package包/类
public void onEventMainThread(ThrowableFailureEvent event) {
if (ErrorDialogManager.isInExecutionScope(this.executionScope, event)) {
ErrorDialogManager.checkLogException(event);
FragmentManager fm = getFragmentManager();
fm.executePendingTransactions();
DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(ErrorDialogManager.TAG_ERROR_DIALOG);
if (existingFragment != null) {
existingFragment.dismiss();
}
DialogFragment errorFragment = (DialogFragment) ErrorDialogManager.factory.prepareErrorFragment(event, this.finishAfterDialog, this.argumentsForErrorDialog);
if (errorFragment != null) {
errorFragment.show(fm, ErrorDialogManager.TAG_ERROR_DIALOG);
}
}
}
示例7: onOptionsItemSelected
import android.app.DialogFragment; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id) {
case R.id.action_selet_dates:
DialogFragment start_date_fragment = new DatePickerFragment();
start_date_fragment.show(getFragmentManager(), "start_date_picker");
return true;
case R.id.action_set_seed:
DialogFragment set_seed_fragment = new SetSeedDialogFragment();
Bundle args = new Bundle();
args.putString("seed", seed);
set_seed_fragment.setArguments(args);
set_seed_fragment.show(getFragmentManager(), "set_seed_dialog");
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例8: onPreferenceTreeClick
import android.app.DialogFragment; //导入方法依赖的package包/类
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (preference.equals(findPreference(Constants.PREF_IMAGES_CACHE))) {
File cacheDir = getActivity().getCacheDir();
File picassoCacheDir = new File(cacheDir, "picasso-cache");
int messageId = AppUtils.deleteDir(picassoCacheDir) ? R.string.clear_cache_message_ok : R.string.clear_cache_message_fail;
DialogFragment dialogFragment = new SettingsAlertDialog().newInstance(messageId);
dialogFragment.show(getActivity().getFragmentManager(), "clearCache");
updateSummary(Constants.PREF_IMAGES_CACHE, false);
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
示例9: showDatePickerDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
public void showDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getFragmentManager(), "datePicker");
}
示例10: taskEnded
import android.app.DialogFragment; //导入方法依赖的package包/类
@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();
}
}
}
示例11: show
import android.app.DialogFragment; //导入方法依赖的package包/类
public static void show(final FragmentManager fm, final Transaction tx) {
final DialogFragment newFragment = instance(tx);
newFragment.show(fm, FRAGMENT_TAG);
}
示例12: showSearchDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
/**
* Creates a new instance of the search dialog and displays it.
*/
public void showSearchDialog() {
DialogFragment dialog = UserSearchDialog.newInstance();
dialog.show(getFragmentManager(), "UserSearchDialog");
}
示例13: showCommentDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
/**
* Displays the comment dialog
*/
public void showCommentDialog() {
DialogFragment dialog = AddCommentDialog.newInstance();
dialog.show(getFragmentManager(), "AddCommentDialog");
}
示例14: showRequestDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
/**
* Displays the dialog asking if the user wishes to send a follow request to the selected profile
* @param p Profile to be requested to follow
*/
public void showRequestDialog(Profile p) {
DialogFragment dialog = SendRequestDialog.newInstance(p.getUsername());
dialog.show(getFragmentManager(), "SendRequestDialog");
}
示例15: showAcceptDialog
import android.app.DialogFragment; //导入方法依赖的package包/类
/**
* Displays the dialog to accept or decline a follower request
* @param follower Potential follower profile
*/
public void showAcceptDialog(Profile follower) {
DialogFragment dialog = AcceptFollowerDialog.newInstance(follower);
dialog.show(getFragmentManager(), "AcceptFollowerDialog");
}