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


Java Dialog.setOnDismissListener方法代码示例

本文整理汇总了Java中android.app.Dialog.setOnDismissListener方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setOnDismissListener方法的具体用法?Java Dialog.setOnDismissListener怎么用?Java Dialog.setOnDismissListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Dialog的用法示例。


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

示例1: checkPlayServices

import android.app.Dialog; //导入方法依赖的package包/类
private boolean checkPlayServices() {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(
                    resultCode, this, REQUEST_CODE_PLAY_SERVICES).show();
        } else {
            Dialog playServicesDialog = DialogFactory.createSimpleOkErrorDialog(
                    this,
                    getString(R.string.dialog_error_title),
                    getString(R.string.error_message_play_services)
            );
            playServicesDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    finish();
                }
            });
            playServicesDialog.show();
        }
        return false;
    }
    return true;
}
 
开发者ID:sathishmscict,项目名称:Pickr,代码行数:25,代码来源:MainActivity.java

示例2: onCreateDialog

import android.app.Dialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setOnDismissListener(this);


    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    return dialog;
}
 
开发者ID:nidhinvv,项目名称:BubbleAlert,代码行数:17,代码来源:BblDialogFragmentBase.java

示例3: initDialog

import android.app.Dialog; //导入方法依赖的package包/类
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    //contentLayout.setFitsSystemWindows(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(false);//触摸屏幕取消窗体
    dialog.setCancelable(false);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:BaseDialog.java

示例4: initDialog

import android.app.Dialog; //导入方法依赖的package包/类
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:21,代码来源:BasicPopup.java

示例5: showTips

import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog showTips(Context context, String title, String des, String btn,
                              DialogInterface.OnDismissListener dismissListener) {
    AlertDialog.Builder builder = dialogBuilder(context, title, des);
    builder.setCancelable(true);
    builder.setPositiveButton(btn, null);
    Dialog dialog = builder.show();
    dialog.setCanceledOnTouchOutside(true);
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
开发者ID:BaoBaoJianqiang,项目名称:CustomListView,代码行数:11,代码来源:GoUtil.java

示例6: showTips

import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog showTips(Context context, String title, String des, String btn, DialogInterface.OnDismissListener dismissListener) {
    AlertDialog.Builder builder = dialogBuilder(context, title, des);
    builder.setCancelable(true);
    builder.setPositiveButton(btn, null);
    Dialog dialog = builder.show();
    dialog.setCanceledOnTouchOutside(true);
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
开发者ID:androidDaniel,项目名称:treasure,代码行数:10,代码来源:DialogUtil.java

示例7: showDialogForView

import android.app.Dialog; //导入方法依赖的package包/类
private void showDialogForView(View view) {
    mDialog = new Dialog(mActivity) {
        @Override
        public void onWindowFocusChanged(boolean hasFocus) {
            super.onWindowFocusChanged(hasFocus);
            if (!hasFocus) super.dismiss();
        }
    };
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.addContentView(view,
            new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                                          LinearLayout.LayoutParams.MATCH_PARENT));
    mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mItemSelectedCallback.onItemSelected("");
        }
    });

    Window window = mDialog.getWindow();
    if (!DeviceFormFactor.isTablet(mActivity)) {
        // On smaller screens, make the dialog fill the width of the screen,
        // and appear at the top.
        window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
        window.setGravity(Gravity.TOP);
        window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
                         ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    mDialog.show();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:ItemChooserDialog.java

示例8: createDialog

import android.app.Dialog; //导入方法依赖的package包/类
@Override
    public void createDialog() {
        cpuFilterDialog = new Dialog(this);//android context.
        LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.cpu_dialogue, (ViewGroup) findViewById(R.id.customDialog_root_element));

        cpuFilterDialog.setContentView(layout);

        lowestPriceET = (EditText) cpuFilterDialog.findViewById(R.id.lowestpricecpu);
        dismissBTN = (ImageView) cpuFilterDialog.findViewById(R.id.closeButton);//the "x" image in the top left
        dismissBTN.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                lowestPriceStr = lowestPriceET.getText().toString();
                //lowestPriceDisplyTV.setText("Dismissed");
                //Toast.makeText(CPUActivity.this, lowestPriceET.getText().toString(), Toast.LENGTH_SHORT).show();
                cpuFilterDialog.dismiss();
            }
        });

        cpuFilterDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
//                lowestPriceET = (EditText)cpuFilterDialog.findViewById(R.id.lowestprice);
//                lowestPriceStr = lowestPriceET.getText().toString();
                Toast.makeText(CPUActivity.this, lowestPriceET.getText().toString(), Toast.LENGTH_SHORT).show();
//                lowestPriceDisplyTV.setText(lowestPriceET.getText().toString());

            }
        });
    }
 
开发者ID:asdiamond,项目名称:CodeMineProject1,代码行数:32,代码来源:CPUActivity.java

示例9: onContextItemSelected

import android.app.Dialog; //导入方法依赖的package包/类
public boolean onContextItemSelected(MenuItem item) {
    KRFAM.log("MainActivity.java > onContextItemSelected");
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    final Account contextAccount = ACCOUNT_LIST_DATA.get(info.position);
    switch (item.getItemId()) {
        case R.id.context_rename: {
            renameAccount(contextAccount);
            break;
        }
        case R.id.context_move: {
            startMove(contextAccount);
            break;
        }
        case R.id.context_delete: {
            deleteAccount(contextAccount);
            break;
        }
        case R.id.context_lock: {
            db.setLock(contextAccount, true);
            getCurrentPage();
            break;
        }
        case R.id.context_unlock: {
            db.setLock(contextAccount, false);
            getCurrentPage();
            break;
        }
        case R.id.context_select: {
            toggleSelect(contextAccount);
            break;
        }
        case R.id.context_delete_folder: {
            deleteFolder(contextAccount);
            break;
        }
        case R.id.context_move_folder: {
            startMove(contextAccount);
            break;
        }
        case R.id.context_rename_folder: {
            renameFolder(contextAccount);
            break;
        }
        case R.id.context_qr: {
            temp_QR = QR_Account(contextAccount);
            if (temp_QR != null) {
                Dialog builder = new Dialog(this);
                builder.requestWindowFeature(Window.FEATURE_NO_TITLE);
                builder.getWindow().setBackgroundDrawable(
                        new ColorDrawable(android.graphics.Color.TRANSPARENT));
                builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialogInterface) {
                        //nothing;
                    }
                });
                ImageView imageView = new ImageView(this);
                imageView.setImageBitmap(temp_QR);
                builder.addContentView(imageView, new RelativeLayout.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.MATCH_PARENT));
                builder.show();
            }
            temp_QR = null;
            break;
        }
    }
    return true;
}
 
开发者ID:iebb,项目名称:Kasumi,代码行数:70,代码来源:MainActivity.java

示例10: showImagePopup

import android.app.Dialog; //导入方法依赖的package包/类
public void showImagePopup(Point p, final String uri) {
        Activity context = MainActivity.this;
        //COMPLETED solving video problem

        final Dialog dialog = new Dialog(context);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.image_popup_layout);
        dialog.show();
        WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        lp.copyFrom(dialog.getWindow().getAttributes());
        dialog.getWindow().setAttributes(lp);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        dialog.getWindow().setDimAmount(0);


        // Getting a reference to Close button, and close the popup when clicked.
        FloatingActionButton close = (FloatingActionButton) dialog.findViewById(R.id.close_image_popup_button);
        ImageView statusImage = (ImageView) dialog.findViewById(R.id.full_status_image_view);
        final SimpleExoPlayerView simpleExoPlayerView = dialog.findViewById(R.id.full_status_video_view);
        final SimpleExoPlayer player;
        if (uri.endsWith(".jpg")) {
            GlideApp.with(context).load(uri).fitCenter().into(statusImage);
        } else if (uri.endsWith(".mp4")) {
            statusImage.setVisibility(View.GONE);
            simpleExoPlayerView.setVisibility(View.VISIBLE);
            Uri myUri = Uri.parse(uri); // initialize Uri here

            // 1. Create a default TrackSelector
            BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
            TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
            TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

// 2. Create a default LoadControl
            LoadControl loadControl = new DefaultLoadControl();

// 3. Create the player
            player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);

//Set media controller
            simpleExoPlayerView.setUseController(true);
            simpleExoPlayerView.requestFocus();

// Bind the player to the view.
            simpleExoPlayerView.setPlayer(player);

            //Measures bandwidth during playback. Can be null if not required.
            DefaultBandwidthMeter bandwidthMeterA = new DefaultBandwidthMeter();
//Produces DataSource instances through which media data is loaded.
            DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(this, Util.
                    getUserAgent(this, "exoplayer2example"), bandwidthMeterA);
//Produces Extractor instances for parsing the media data.
            ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();

            MediaSource videoSource = new ExtractorMediaSource(myUri, dataSourceFactory, extractorsFactory, null, null);
            player.prepare(videoSource);
            player.setPlayWhenReady(true); //run file/link when ready to play.
            dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    player.release();
                }
            });

        }
        close.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
//                popup.dismiss();
                dialog.cancel();
            }
        });
    }
 
开发者ID:Lekky71,项目名称:WhatsAppStatusSaver,代码行数:75,代码来源:MainActivity.java

示例11: onSubDialogShow

import android.app.Dialog; //导入方法依赖的package包/类
@Override
protected void onSubDialogShow(Dialog dialog, int parentPosition) {
    dialog.setOnDismissListener(mDismissListener);
    //当次级窗口显示时需要修改标题
    final ViewGroup contentView = (ViewGroup) dialog.getWindow().findViewById(Window.ID_ANDROID_CONTENT);
    final TextView selectAll = (TextView) contentView.findViewById(R.id.text_select_all);
    TextView title = (TextView) contentView.findViewById(R.id.text_title);
    final EditText editText = (EditText) contentView.findViewById(R.id.edit_title);
    FrameLayout subContainer = (FrameLayout) contentView.findViewById(R.id.sub_container);
    final IReaderMockDataGroup mockDataGroup = (IReaderMockDataGroup) mMockSource.get(parentPosition);
    mSubObserver.setBindResource(mockDataGroup, selectAll, getMainAdapter(),getSubAdapter(),parentPosition);
    if(!mObservable.isRegister(mSubObserver)) mObservable.registerObserver(mSubObserver);
    selectAll.setVisibility(mEditMode ? mSubEditMode ? View.GONE : View.VISIBLE : View.GONE);
    title.setText(String.valueOf(mockDataGroup.getCategory()));
    /*if(Build.VERSION.SDK_INT >= 19) {
        title.setOnClickListener(new View.OnClickListener() {
            @TargetApi(Build.VERSION_CODES.KITKAT)
            @Override
            public void onClick(View v) {
                mSubEditMode = true;
                selectAll.setVisibility(View.GONE);
                editText.setText(String.valueOf(mockDataGroup.getCategory()));
                editText.setSelection(0,editText.getText().toString().length());
                int originWidth = editText.getWidth();
                editText.setWidth(0);
                TransitionManager.beginDelayedTransition(contentView);
                editText.setWidth(originWidth);
            }
        });
        editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                switch (actionId){
                    case KeyEvent.KEYCODE_ENTER:
                        break;
                }
                return false;
            }
        });
    }*/

}
 
开发者ID:AlphaBoom,项目名称:ClassifyView,代码行数:43,代码来源:IReaderAdapter.java

示例12: doHardwareControlsPrefs

import android.app.Dialog; //导入方法依赖的package包/类
public void doHardwareControlsPrefs() {

        final Dialog d = new Dialog(_gamePadActivity);
        d.setContentView(R.layout.prefs_hardware_controls);
        d.setCanceledOnTouchOutside(true);
        Button.OnClickListener l =
                new Button.OnClickListener(){
                    @Override
                    public void onClick(View v) {

                        // take note of which action this capture will apply to, then launch a capture..
                        if (v == d.findViewById(R.id.buttonPickUp)) _captureKey = CaptureKey.PICK_UP;
                        else if (v == d.findViewById(R.id.buttonJump)) _captureKey = CaptureKey.JUMP;
                        else if (v == d.findViewById(R.id.buttonPunch)) _captureKey = CaptureKey.PUNCH;
                        else if (v == d.findViewById(R.id.buttonBomb)) _captureKey = CaptureKey.BOMB;
                        else if (v == d.findViewById(R.id.buttonRun1)) _captureKey = CaptureKey.RUN1;
                        else if (v == d.findViewById(R.id.buttonRun2)) _captureKey = CaptureKey.RUN2;
                        else if (v == d.findViewById(R.id.buttonStart)) _captureKey = CaptureKey.START;
                        else LogThread.log("Error: unrecognized capture button",null);

                        Dialog d2 = doCaptureKey();
                        d2.setOnDismissListener(new Dialog.OnDismissListener() {
                            @Override
                            public void onDismiss(DialogInterface dialog) {
                                _updateHardwareControlsLabels(d);
                            }
                        });

                    }};

        d.findViewById(R.id.buttonPickUp).setOnClickListener(l);
        d.findViewById(R.id.buttonJump).setOnClickListener(l);
        d.findViewById(R.id.buttonPunch).setOnClickListener(l);
        d.findViewById(R.id.buttonBomb).setOnClickListener(l);
        d.findViewById(R.id.buttonRun1).setOnClickListener(l);
        d.findViewById(R.id.buttonRun2).setOnClickListener(l);
        d.findViewById(R.id.buttonStart).setOnClickListener(l);

        d.setTitle(R.string.configHardwareButtons);
        _updateHardwareControlsLabels(d);
        d.show();

    }
 
开发者ID:efroemling,项目名称:bombsquad-remote-android,代码行数:44,代码来源:GamePadActivity.java


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