当前位置: 首页>>代码示例>>Java>>正文


Java DialogFragment类代码示例

本文整理汇总了Java中android.support.v4.app.DialogFragment的典型用法代码示例。如果您正苦于以下问题:Java DialogFragment类的具体用法?Java DialogFragment怎么用?Java DialogFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DialogFragment类属于android.support.v4.app包,在下文中一共展示了DialogFragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCallback

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
public void testCallback() throws Throwable {
  final WritableMap options = new WritableNativeMap();
  options.putDouble("date", getDateInMillis(2020, 5, 6));

  final DialogFragment datePickerFragment = showDialog(options);

  runTestOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          ((DatePickerDialog) datePickerFragment.getDialog())
              .getButton(DialogInterface.BUTTON_POSITIVE).performClick();
        }
      });

  getInstrumentation().waitForIdleSync();
  waitForBridgeAndUIIdle();

  assertEquals(0, mRecordingModule.getErrors());
  assertEquals(1, mRecordingModule.getDates().size());
  assertEquals(2020, (int) mRecordingModule.getDates().get(0)[0]);
  assertEquals(5, (int) mRecordingModule.getDates().get(0)[1]);
  assertEquals(6, (int) mRecordingModule.getDates().get(0)[2]);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:25,代码来源:DatePickerDialogTestCase.java

示例2: testDismissCallback

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
public void testDismissCallback() throws Throwable {
  final DialogFragment fragment = showDialog(null);

  assertEquals(0, mRecordingModule.getDismissed());

  runTestOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          fragment.getDialog().dismiss();
        }
      });

  getInstrumentation().waitForIdleSync();
  waitForBridgeAndUIIdle();

  assertEquals(0, mRecordingModule.getErrors());
  assertEquals(0, mRecordingModule.getTimes().size());
  assertEquals(1, mRecordingModule.getDismissed());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:TimePickerDialogTestCase.java

示例3: onEventMainThread

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
public void onEventMainThread(ThrowableFailureEvent event) {
    if (!isInExecutionScope(executionScope, event)) {
        return;
    }
    checkLogException(event);
    // Execute pending commits before finding to avoid multiple error fragments being shown
    FragmentManager fm = getFragmentManager();
    fm.executePendingTransactions();

    DialogFragment existingFragment = (DialogFragment) fm.findFragmentByTag(TAG_ERROR_DIALOG);
    if (existingFragment != null) {
        // Just show the latest error
        existingFragment.dismiss();
    }

    DialogFragment errorFragment = (DialogFragment) factory
            .prepareErrorFragment(event, finishAfterDialog, argumentsForErrorDialog);
    if (errorFragment != null) {
        errorFragment.show(fm, TAG_ERROR_DIALOG);
    }
}
 
开发者ID:weileng11,项目名称:KUtils-master,代码行数:22,代码来源:ErrorDialogManager.java

示例4: onBackPressed

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
/**
 * 监听返回键
 */
private void onBackPressed() {
    //设置窗口以对话框样式显示
    setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Dialog);
    //设置对话框背景色,否则有虚框
    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    getDialog().setCancelable(isCancelable);
    getDialog().setCanceledOnTouchOutside(isCancelableTouchOutSide);

    getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
                if (isBack) {
                    onCancel();
                }
                return !isBack;
            }

            return false;
        }
    });
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:26,代码来源:BaseDialogFragment.java

示例5: onCreate

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_guide);
    ArrayList<Integer> layouts = new ArrayList<>();

    List<Integer> list = Arrays.asList(R.layout.view_guide_one,
            R.layout.view_guide_two,
            R.layout.view_guide_three,
            R.layout.view_guide_four);
    layouts.addAll(list);


    DialogFragment guideFg = GuideFragment.newInstance(0.85f, 0.7f, layouts);
    FragmentManager fm = getSupportFragmentManager();
    guideFg.show(fm, "guide fg");
}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:18,代码来源:GuideActivity.java

示例6: newInstance

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
/**
 * Factory method for creating the DialogFragment with a listener.
 * @param item        QuadrantItem being manipulated
 * @param listener    Listener for passing back the information to update item in QuadrantItem
 * @return            New EditItemDialogFragment instance
 */
public static DialogFragment newInstance(QuadrantItem item, ModifyItemListener listener,
                                         String title) {

  // Initialize new EditItemDialogFragment fragment
  DialogFragment dialog = new EditItemDialogFragment();

  // Pass itemUid to onCreateDialog
  Bundle args = new Bundle();
  args.putParcelable("quadrantItem", item);
  dialog.setArguments(args);

  // Set the listener
  ((EditItemDialogFragment) dialog).setListener(listener);
  ((ModifyItemDialogFragment) dialog).setTitle(title);

  // Return the dialog
  return dialog;
}
 
开发者ID:Austin-Ray,项目名称:Hexis,代码行数:25,代码来源:EditItemDialogFragment.java

示例7: createView

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
@Override
protected View createView(ViewGroup parent) {
    View root = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.dialog_option, parent, false);

    TextView title = (TextView) root.findViewById(R.id.preference_dialog_title);
    TextView detail = (TextView) root.findViewById(R.id.preference_dialog_description);
    mDetailTextView = new WeakReference<>(detail);

    title.setText(getTitle());
    detail.setText(getSelection().getName());

    root.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            DialogFragment fragment = ListDialogFragment.create(getValues(), getSelection());
            fragment.setTargetFragment(getFragment(), getOptionId());
            fragment.show(getFragment().getFragmentManager(), DIALOG_TAG);
        }
    });

    return root;
}
 
开发者ID:marverenic,项目名称:Options,代码行数:24,代码来源:DialogListOption.java

示例8: testPresetDate

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
public void testPresetDate() {
  final WritableMap options = new WritableNativeMap();
  options.putDouble("date", getDateInMillis(2020, 5, 6));

  final DialogFragment datePickerFragment = showDialog(options);
  final DatePicker datePicker =
      ((DatePickerDialog) datePickerFragment.getDialog()).getDatePicker();

  assertEquals(2020, datePicker.getYear());
  assertEquals(5, datePicker.getMonth());
  assertEquals(6, datePicker.getDayOfMonth());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:DatePickerDialogTestCase.java

示例9: onNoteEditPositiveClock

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
@Override
public void onNoteEditPositiveClock(String str, DialogFragment dialog) {
    ContentValues values = new ContentValues();
    values.put(ActivityDiaryContract.Diary.NOTE, str);

    mQHandler.startUpdate(0,
            null,
            mCurrentDiaryUri,
            values,
            null, null);
    mNoteTextView.setText(str);
    ActivityHelper.helper.setCurrentNote(str);
}
 
开发者ID:ramack,项目名称:ActivityDiary,代码行数:14,代码来源:MainActivity.java

示例10: dismissDialog

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
protected boolean dismissDialog() {
    boolean isVisible = false;
    Fragment prev = getSupportFragmentManager().findFragmentByTag(LoadingDialog.DIALOG_TAG);
    if (prev != null) {
        DialogFragment df = (DialogFragment) prev;
        df.dismiss();
        isVisible = true;
    }
    return isVisible;
}
 
开发者ID:CactusSoft,项目名称:zabbkit-android,代码行数:11,代码来源:LoadingDialogActivity.java

示例11: onCreateDialogFragment

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
@NonNull
@Override
protected DialogFragment onCreateDialogFragment(String key) {
    final HttpUriPreferenceDialogFragment fragment = new HttpUriPreferenceDialogFragment();
    final Bundle b  = new Bundle(1);
    b.putString(PreferenceDialogFragment.ARG_KEY, key);
    b.putString(HttpUriPreferenceDialogFragment.ARG_KEY_USERNAME, keyUsername);
    b.putString(HttpUriPreferenceDialogFragment.ARG_KEY_PASSWORD, keyPassword);
    fragment.setArguments(b);
    return fragment;
}
 
开发者ID:RikkaApps,项目名称:FCM-for-Mojo,代码行数:12,代码来源:HttpUriPreference.java

示例12: onCreateHomeScreenShortcutCreate

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
@Override
public void onCreateHomeScreenShortcutCreate(DialogFragment dialog) {

    Intent bookmarkShortcut = new Intent();
    bookmarkShortcut.setAction(Intent.ACTION_VIEW);
    bookmarkShortcut.setData(Uri.parse(UrlCleaner));
    Intent shortcutMaker = new Intent();
    shortcutMaker.putExtra("duplicate", false);
    shortcutMaker.putExtra("android.intent.extra.shortcut.INTENT", bookmarkShortcut);
    shortcutMaker.putExtra("android.intent.extra.shortcut.ICON", favoriteIcon);
    shortcutMaker.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    sendBroadcast(shortcutMaker);
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:14,代码来源:MainActivity.java

示例13: showDialog

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
public void showDialog(ArrayList<Boolean> state) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    //String inputText = inputTextField.getText().toString();

    DialogFragment newFragment = MyDialogFragment.newInstance(state, list);
    newFragment.show(ft, "dialog");

}
 
开发者ID:icaynia,项目名称:pracler,代码行数:15,代码来源:MyMusicListFragment.java

示例14: showDialog

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
private void showDialog(final DialogFragment dialog, final String nameOfFragment) {
    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    final Fragment prev = getSupportFragmentManager().findFragmentByTag(nameOfFragment);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    dialog.show(ft, nameOfFragment);
}
 
开发者ID:videgro,项目名称:Ships,代码行数:10,代码来源:OpenDeviceActivity.java

示例15: showFileDialog

import android.support.v4.app.DialogFragment; //导入依赖的package包/类
private static void showFileDialog(FragmentActivity activity, FileDialog dialog) {
    Bundle args = new Bundle();
    args.putString(FileDialog.EXTENSION, REPOSITORY_EXTENSION);
    dialog.setArguments(args);
    dialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme);
    dialog.show(activity.getSupportFragmentManager(), OpenFileDialog.class.getName());
}
 
开发者ID:djuelg,项目名称:Neuronizer,代码行数:8,代码来源:FileDialogs.java


注:本文中的android.support.v4.app.DialogFragment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。