當前位置: 首頁>>代碼示例>>Java>>正文


Java AppCompatDialog.show方法代碼示例

本文整理匯總了Java中android.support.v7.app.AppCompatDialog.show方法的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatDialog.show方法的具體用法?Java AppCompatDialog.show怎麽用?Java AppCompatDialog.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.app.AppCompatDialog的用法示例。


在下文中一共展示了AppCompatDialog.show方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: showProMessage

import android.support.v7.app.AppCompatDialog; //導入方法依賴的package包/類
public static void showProMessage(Activity ctx, int msgResId, Runnable upgradeCallback)
{
    String msg = ctx.getResources().getString(msgResId);
    AppCompatDialog dialog = setupDialog(ctx, msg, upgradeCallback);
    dialog.show();

}
 
開發者ID:joseliko7,項目名稱:Snapmatic-Life,代碼行數:8,代碼來源:ProHelper.java

示例7: showWarningDialog

import android.support.v7.app.AppCompatDialog; //導入方法依賴的package包/類
/**
 * Shows the initial warning dialog
 */
void showWarningDialog() {
    final AppCompatDialog d = new AppCompatDialog(this);
    d.setTitle("Warning");
    d.setCancelable(false);
    d.setContentView(R.layout.warningdialog);

    final CheckBox c = (CheckBox) d.findViewById(R.id.c);
    final Button b = (Button) d.findViewById(R.id.b);

    c.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
            b.setText(checked ? android.R.string.ok : android.R.string.cancel);
        }
    });

    b.setText(android.R.string.cancel);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (c.isChecked()) {
                getSharedPreferences("settings", MODE_PRIVATE).edit()
                        .putBoolean("warningRead", true).commit();
                d.dismiss();
            } else {
                d.dismiss();
                finish();
            }
        }
    });

    d.show();
}
 
開發者ID:j4velin,項目名稱:SystemAppMover,代碼行數:37,代碼來源:MoverActivity.java


注:本文中的android.support.v7.app.AppCompatDialog.show方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。