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


Java AppCompatDialog类代码示例

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


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

示例1: dismiss

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
/**
 * 关闭弹出框
 */
public static void dismiss(DialogInterface... dialogs) {
    if (dialogs != null && dialogs.length > 0) {
        for (DialogInterface dialog : dialogs) {
            if (dialog instanceof Dialog) {
                Dialog dialog1 = (Dialog) dialog;
                if (dialog1.isShowing()) {
                    dialog1.dismiss();
                }
            } else if (dialog instanceof AppCompatDialog) {
                AppCompatDialog dialog2 = (AppCompatDialog) dialog;
                if (dialog2.isShowing()) {
                    dialog2.dismiss();
                }
            }
        }

    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:DialogUIUtils.java

示例2: dismiss

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
/**
 * 关闭弹出框
 */
public static void dismiss(DialogInterface... dialogs) {
    if (dialogs != null && dialogs.length > 0) {
        for (DialogInterface dialog : dialogs) {
            if (dialog instanceof Dialog) {
                Dialog dialog1 = (Dialog) dialog;
                if (dialog1.isShowing()) {
                    dialog1.dismiss();
                }
            } else if (dialog instanceof AppCompatDialog) {
                AppCompatDialog dialog2 = (AppCompatDialog) dialog;
                if (dialog2.isShowing()) {
                    dialog2.dismiss();
                }
            }
        }

    }


}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:24,代码来源:DialogUIUtils.java

示例3: showLoading

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
public static void showLoading(Context context, String type) {

        final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);

        final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(context, type);
        dialog.setContentView(avLoadingIndicatorView);

        int deviceWidth = DimenUtil.getScreenWidth();
        int deviceHeight = DimenUtil.getScreenHeight();

        final Window dialogWindow = dialog.getWindow();
        if (dialog != null) {
            final WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            lp.width = deviceWidth / LOADER_SIZE_SCALE;
            lp.height = deviceHeight / LOADER_SIZE_SCALE;
            lp.height = lp.height + deviceHeight / LOADER_OFFSET_SCALE;
            lp.gravity = Gravity.CENTER;
        }

        LOADERS.add(dialog);
        dialog.show();
    }
 
开发者ID:remerber,项目名称:FastEc,代码行数:23,代码来源:LatteLoader.java

示例4: DynamicAlertController

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
public DynamicAlertController(Context context, AppCompatDialog di, Window window) {
    mContext = context;
    mDialog = di;
    mWindow = window;
    mHandler = new DynamicAlertController.ButtonHandler(di);

    final TypedArray a = context.obtainStyledAttributes(null, android.support.v7.appcompat.R.styleable.AlertDialog,
            android.support.v7.appcompat.R.attr.alertDialogStyle, 0);

    mAlertDialogLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_android_layout, 0);
    mButtonPanelSideLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_buttonPanelSideLayout, 0);

    mListLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_listLayout, 0);
    mMultiChoiceItemLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_multiChoiceItemLayout, 0);
    mSingleChoiceItemLayout = a
            .getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_singleChoiceItemLayout, 0);
    mListItemLayout = a.getResourceId(android.support.v7.appcompat.R.styleable.AlertDialog_listItemLayout, 0);
    mShowTitle = a.getBoolean(android.support.v7.appcompat.R.styleable.AlertDialog_showTitle, true);

    a.recycle();

    /* We use a custom title so never request a window title */
    di.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
}
 
开发者ID:pranavpandey,项目名称:dynamic-dialogs,代码行数:25,代码来源:DynamicAlertController.java

示例5: showLoading

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
private static void showLoading(Context context, String type) {

        final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);

        final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(type, context);
        dialog.setContentView(avLoadingIndicatorView);

        int deviceWidth = DimenUtil.getScreenWidth();
        int deviceHeight = DimenUtil.getScreenHeight();

        final Window dialogWindow = dialog.getWindow();

        if (dialogWindow != null) {
            final WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            lp.width = deviceWidth / LOADER_SIZE_SCALE;
            lp.height = deviceHeight / LOADER_SIZE_SCALE;
            lp.height = lp.height + deviceHeight / LOADER_OFFSET_SCALE;
            lp.gravity = Gravity.CENTER;
        }
        LOADERS.add(dialog);
        dialog.show();
    }
 
开发者ID:organizationAllink,项目名称:wzyx-android-user,代码行数:23,代码来源:WzyxLoader.java

示例6: showProgressbar

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
public AppCompatDialog showProgressbar(Activity activity, long timeout, boolean cancelable) {
    final AppCompatDialog dialog = new AppCompatDialog(activity);
    dialog.setContentView(R.layout.dialog_progress);
    dialog.setCancelable(cancelable);
    dialog.setTitle("Progressing...");
    ProgressBar progressBar = (ProgressBar) dialog.findViewById(R.id.progress);
    if (timeout > 0) {
        Handler handler = new Handler(activity.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                dialog.cancel();
                dialog.dismiss();
            }
        }, timeout);
        dialog.show();
    } else {
        dialog.show();
    }
    return dialog;
}
 
开发者ID:PuffOpenSource,项目名称:Puff-Android,代码行数:22,代码来源:ResUtil.java

示例7: setupDialog

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
private static AppCompatDialog setupDialog(final Activity activity, String message, final Runnable upgradeCallback)
{

    String title = activity.getString(R.string.pro_proFeatureDialog_title);
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);

    builder.setIcon(R.drawable.ic_launcher);
    builder.setTitle(title);
    builder.setMessage(message);
    builder.setPositiveButton(R.string.pro_proFeatureDialog_okBtn, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which)
        {
            upgradeCallback.run();
        }
    });
    builder.setNegativeButton(R.string.pro_proFeatureDialog_cancelBtn,null);


    return (AppCompatDialog) builder.create();
}
 
开发者ID:joseliko7,项目名称:Snapmatic-Life,代码行数:22,代码来源:ProHelper.java

示例8: rescan

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
private void rescan(){

        ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
        NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);

        if (mWifi.isConnected() && mWifi.isAvailable()){
             AppCompatDialog dialog = new AppCompatDialog(this);
            dialog.setTitle(R.string.scanning);
            dialog.setCancelable(false);
            dialog.show();
            AsyncScan scan = new AsyncScan(dialog, getString(R.string.scanning_your_network));
            scan.execute(adapter);

        }else {
            Toast.makeText(this, getString(R.string.not_connected_error), Toast.LENGTH_LONG).show();
        }

    }
 
开发者ID:dmashuda,项目名称:networkScanner,代码行数:19,代码来源:Scan.java

示例9: create

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
private AppCompatDialog create(String mLicensesText, CharSequence str) {
    //Get resources
    final WebView webView = new WebView(getContext());
    webView.loadDataWithBaseURL(null, mLicensesText, "text/html", "utf-8", null);

    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
            .setView(webView).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
    if (str != null)
        builder.setTitle(str);
    return builder.create();
}
 
开发者ID:soarcn,项目名称:COCOFramework,代码行数:17,代码来源:CocoQuery.java

示例10: stopLoading

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
public static void stopLoading() {
    for (AppCompatDialog dialog :
            LOADERS) {
        if (dialog != null) {
            if (dialog.isShowing()) {
                dialog.cancel();
            }
        }
    }
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:11,代码来源:LatteLoader.java

示例11: onCreateDialog

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
@NonNull
@Override
public AppCompatDialog onCreateDialog(final Bundle savedInstanceState)
{
	// use the Builder class for convenient dialog construction
	final Activity activity = getActivity();
	assert activity != null;
	final AlertDialog.Builder builder = new AlertDialog.Builder(activity);

	// get the layout inflater
	final LayoutInflater inflater = activity.getLayoutInflater();

	// inflate layout for the dialog
	final FrameLayout frameLayout = activity.findViewById(android.R.id.custom);
	final View view = inflater.inflate(R.layout.tip_layout, frameLayout, false);

	// data
	final WebView webView = view.findViewById(R.id.text);
	webView.loadData(this.text, "text/html; charset=UTF-8", "utf-8");

	// set the layout for the dialog
	builder.setView(view) //
	// .setMessage(R.string.treebolic) //
	// .setNegativeButton(R.string.action_dismiss, new DialogInterface.OnClickListener()
	// {
	// @Override
	// public void onClick(DialogInterface dialog, int id)
	// {
	// // user cancelled the dialog
	// }
	// })
	;

	// create the dialog and return it
	final AppCompatDialog dialog = builder.create();
	dialog.setCanceledOnTouchOutside(true);
	return dialog;
}
 
开发者ID:1313ou,项目名称:TreebolicLib,代码行数:39,代码来源:Tip.java

示例12: stopLoading

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
public static void stopLoading() {
    for (AppCompatDialog dialog : LOADERS) {
        if (dialog != null) {
            if (dialog.isShowing()) {
                dialog.cancel();
            }
        }
    }
}
 
开发者ID:organizationAllink,项目名称:wzyx-android-user,代码行数:10,代码来源:WzyxLoader.java

示例13: showPopupMenu

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
/**
 * Show a custom action menu
 *
 * @param view menu called from this view
 */
public void showPopupMenu(View view) {
    final Context context = this;
    PopupMenu popup = new PopupMenu(this, view);
    popup.inflate(R.menu.menu_main);
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.action_save:
                    saveImageToExternalStorage();
                    return true;
                case R.id.action_share:
                    shareDrawing();
                    return true;
                case R.id.action_about:
                    final AppCompatDialog dialog = new AppCompatDialog(context);
                    dialog.setContentView(R.layout.dialog_about);
                    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
                    dialog.show();
                    return true;
                default: // User's action was not recognized
                    return false;
            }
        }
    });
    popup.show();
}
 
开发者ID:xarone,项目名称:Dromi,代码行数:33,代码来源:MainActivity.java

示例14: showDialog

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
private void showDialog() {
        // AlertDialog dialog = new AlertDialog(this);
        AppCompatDialog dialog = new AppCompatDialog(this);
        dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);//key code to remove title
        Window window = dialog.getWindow();
        window.setGravity(Gravity.BOTTOM);
        window.setWindowAnimations(R.style.mystyle);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//round corner
        // window.setBackgroundDrawableResource(R.drawable.bg_ios_roundcorner);
        // window.requestFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_ios_alert_bottom);
        // AlertDialog.Builder builder = new AlertDialog.Builder(this);


        // 可以在此设置显示动画
        WindowManager.LayoutParams wl = window.getAttributes();
       /* wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();*/
// 以下这两句是为了保证按钮可以水平满屏
        int width = getWindowManager().getDefaultDisplay().getWidth();

        // wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.width = (int) (width * 0.85);  // todo keycode gap
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        //wl.horizontalMargin= 0.2f;
// 设置显示位置
        // wl.gravity = Gravity.CENTER_HORIZONTAL;

        dialog.onWindowAttributesChanged(wl);
        dialog.show();
    }
 
开发者ID:glassLake,项目名称:DialogUtils,代码行数:32,代码来源:MainActivity.java

示例15: onCreateDialog

import android.support.v7.app.AppCompatDialog; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AppCompatDialog dialog = new AppCompatDialog(getActivity(), RaraHelper.getThemeMaterialDialog(getContext()));
    dialog.setCanceledOnTouchOutside(false);
    dialog.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}
 
开发者ID:lloydtorres,项目名称:stately,代码行数:8,代码来源:ProgressDialog.java


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