當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。