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