Example usage for android.app Dialog requestWindowFeature

List of usage examples for android.app Dialog requestWindowFeature

Introduction

In this page you can find the example usage for android.app Dialog requestWindowFeature.

Prototype

public final boolean requestWindowFeature(int featureId) 

Source Link

Document

Enable extended window features.

Usage

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

public void showconfirmationdialog(final int fragnumber) {
    final Dialog dialog = new Dialog(TabsActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_leaving_confirmation);
    dialog.getWindow()//from   w w w . j a  v a 2 s .c  o m
            .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

    Button yes = (Button) dialog.findViewById(R.id.yesbtn);
    yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            switch (fragnumber) {
            case 1:
                showpickupschool();
                break;
            case 2:
                showdrill();
                break;
            case 3:
                showservice();
                break;
            case 4:
                showinstall();
                break;
            case 5:
                showpending();
                break;

            }
            dialog.dismiss();

        }
    });
    Button no = (Button) dialog.findViewById(R.id.nobtn);
    no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
    close.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:org.glucosio.android.fragment.OverviewFragment.java

private void showA1cDialog() {
    final Dialog a1CDialog = new Dialog(getActivity(), R.style.GlucosioTheme);

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(a1CDialog.getWindow().getAttributes());
    a1CDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    a1CDialog.setContentView(R.layout.dialog_a1c);
    a1CDialog.getWindow().setAttributes(lp);
    a1CDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    a1CDialog.getWindow().setDimAmount(0.5f);
    a1CDialog.setCanceledOnTouchOutside(true);
    a1CDialog.show();/*  w  ww.  j av a 2s  .  c  o m*/

    ListView a1cListView = (ListView) a1CDialog.findViewById(R.id.dialog_a1c_listview);

    A1cEstimateAdapter customAdapter = new A1cEstimateAdapter(getActivity(), R.layout.dialog_a1c_item,
            presenter.getA1cEstimateList());

    a1cListView.setAdapter(customAdapter);
}

From source file:org.thoughtland.xlocation.ActivityApp.java

@SuppressLint("InflateParams")
public static void showHelp(ActivityBase context, View parent, Hook hook) {
    // Build dialog
    Dialog dlgHelp = new Dialog(context);
    dlgHelp.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dlgHelp.setTitle(R.string.app_name);
    dlgHelp.setContentView(R.layout.helpfunc);
    dlgHelp.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, context.getThemed(R.attr.icon_launcher));
    dlgHelp.setCancelable(true);//from w w w  . j  a  v  a 2s  .c  om

    // Set title
    TextView tvTitle = (TextView) dlgHelp.findViewById(R.id.tvTitle);
    tvTitle.setText(hook.getName());

    // Set info
    TextView tvInfo = (TextView) dlgHelp.findViewById(R.id.tvInfo);
    tvInfo.setText(Html.fromHtml(hook.getAnnotation()));
    tvInfo.setMovementMethod(LinkMovementMethod.getInstance());

    // Set permissions
    String[] permissions = hook.getPermissions();
    if (permissions != null && permissions.length > 0)
        if (!permissions[0].equals("")) {
            TextView tvPermissions = (TextView) dlgHelp.findViewById(R.id.tvPermissions);
            tvPermissions.setText(Html.fromHtml(TextUtils.join("<br />", permissions)));
        }

    dlgHelp.show();
}

From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java

private void confirmSendLog() {
    CommonLogUtil.flushLog(mContext, mGp);
    mThemeColorList = ThemeUtil.getThemeColorList(getActivity());
    createTempLogFile();//from   w  w w  .  jav a 2s.c om

    final Dialog dialog = new Dialog(getActivity());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.confirm_send_log_dlg);
    dialog.setCanceledOnTouchOutside(false);

    LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.confirm_send_log_dlg_title_view);
    title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color);
    TextView title = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_title);
    title.setTextColor(mThemeColorList.text_color_dialog_title);
    TextView msg = (TextView) dialog.findViewById(R.id.confirm_send_log_dlg_msg);
    msg.setTextColor(mThemeColorList.text_color_info);
    msg.setBackgroundColor(mThemeColorList.dialog_msg_background_color);

    final Button btn_ok = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_ok_btn);
    final Button btn_cancel = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_cancel_btn);
    final Button btn_preview = (Button) dialog.findViewById(R.id.confirm_send_log_dlg_preview);

    CommonDialog.setDlgBoxSizeLimit(dialog, false);

    btn_preview.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.parse("file://" + mGp.getLogDirName() + "temp_log.txt"), "text/plain");
            startActivity(intent);
        }
    });

    btn_ok.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            sendLogFileToDeveloper(mGp.getLogDirName() + "temp_log.txt");
            dialog.dismiss();
        }
    });

    btn_cancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            dialog.dismiss();
        }
    });

    dialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btn_cancel.performClick();
        }
    });

    dialog.show();

}

From source file:com.hp.map.CustomerMapActivity.java

public void menuDialog() {
    final Dialog dialog = new Dialog(this);
    LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = li.inflate(R.layout.menu_dialog, null, false);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(v);//w  ww . j a v  a  2  s .  co  m

    dialog.setTitle("Danh mc chnh");

    Display display = getWindowManager().getDefaultDisplay();

    dialog.getWindow().setLayout(2 * display.getWidth() / 3, LayoutParams.FILL_PARENT);
    dialog.getWindow().getAttributes().gravity = Gravity.LEFT | Gravity.CENTER_VERTICAL;

    lv = (ListView) dialog.findViewById(R.id.menu_list_view);

    lv.setAdapter(
            new DialogArrayAdapter(context, android.R.layout.simple_list_item_1, DetailListData.MENU_LIST));
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            DetailsList selectedValue = (DetailsList) lv.getAdapter().getItem(arg2);
            if (selectedValue.activityClass != null) {
                //if sigout
                if (selectedValue.activityClass == LoginActivity.class) {
                    //LoginActivity.threadLooper.quit();
                }
                startActivity(new Intent(context, selectedValue.activityClass));
            }
        }
    });

    dialog.show();

    //      ImageView iv = (ImageView)dialog.findViewById(R.id.menu_list_view);
    //      iv.setImageResource(1);
}

From source file:com.android.cabapp.fragments.MyAccountFragment.java

void showDialog() {

    final Dialog dialog = new Dialog(mContext);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.device_id_dialog);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setCancelable(false);/*from   w  w w . j  a v  a  2s  . c  om*/

    etDeviceName = (EditText) dialog.findViewById(R.id.etDeviceName);
    rlBtnSave = (RelativeLayout) dialog.findViewById(R.id.rlbtnSave);
    rlBtnCancel = (RelativeLayout) dialog.findViewById(R.id.rlbtnCancel);

    if (!Util.getPOSDeviceName(mContext).equals(""))
        etDeviceName.setText(Util.getPOSDeviceName(mContext));
    etDeviceName.setSelection(etDeviceName.getText().length());

    // dialog.setTitle("Please enter Serial number");
    rlBtnSave.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String szDeviceName = etDeviceName.getText().toString().trim();
            if (szDeviceName.isEmpty()) {
                Util.showToastMessage(mContext, "Field cannot be left empty!", Toast.LENGTH_LONG);
            } else if (szDeviceName.length() < 11) {
                Util.showToastMessage(mContext, "Serial number cannot be less than 10!", Toast.LENGTH_LONG);
            } else {
                Util.setPOSDeviceName(mContext, szDeviceName);
                tvDeviceID.setVisibility(View.VISIBLE);
                tvDeviceID.setText(Util.getPOSDeviceName(mContext));
                Util.hideSoftKeyBoard(mContext, rlBtnSave);
                dialog.dismiss();

            }

        }
    });

    rlBtnCancel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Util.hideSoftKeyBoard(mContext, v);
            dialog.dismiss();
        }
    });
    dialog.show();

}

From source file:com.borax12.materialdaterangepicker.single.date.DatePickerDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:com.nanostuffs.yurdriver.fragment.RegisterFragment.java

private void datepicker() {

    final Dialog dialog = new Dialog(getActivity());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCanceledOnTouchOutside(true);
    dialog.setContentView(R.layout.datepicker_layout);
    final DatePicker date = (DatePicker) dialog.findViewById(R.id.datePicker1);
    final Calendar c = Calendar.getInstance();
    c.add(Calendar.DAY_OF_YEAR, -1 * (16 * 365));
    date.setMaxDate(c.getTimeInMillis());

    Button text = (Button) dialog.findViewById(R.id.ok);
    text.setOnClickListener(new OnClickListener() {
        @Override/*from  w  ww .j ava2s  .  c  o m*/
        public void onClick(View v) {
            v.bringToFront();

            String dateString = String
                    .valueOf(date.getYear() + "-" + (date.getMonth() + 1) + "-" + date.getDayOfMonth());
            etDOB.setText(dateString);

            dialog.dismiss();
        }
    });
    Button cancel = (Button) dialog.findViewById(R.id.cancel);
    cancel.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            v.bringToFront();
            dialog.dismiss();
        }
    });
    dialog.show();

}

From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java

void init() {

    //        img=(ImageView)findViewById(R.id.logo);

    TextView build = (TextView) findViewById(R.id.checkfornew);
    build.setOnClickListener(new View.OnClickListener() {
        @Override//  w w  w.  j ava  2 s  .c o  m
        public void onClick(View v) {
            if (android.os.Build.VERSION.SDK_INT > 9) {
                StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
                StrictMode.setThreadPolicy(policy);
            }

            CommonUtilities.logMe("about to check for version ");
            try {
                WebServiceHandler wsb = new WebServiceHandler();
                ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
                String result = wsb.getWebServiceData("http://doe.emergencyskills.com/api/version.php",
                        postParameters);
                JSONObject jsonObject = new JSONObject(result);
                String version = jsonObject.getString("version");
                String features = jsonObject.getString("features");
                System.err.println("version is : " + version);
                if (!LoginActivity.myversion.equals(version)) {
                    MyToast.popmessagelong(
                            "There is a new build available. Please download for these features: " + features,
                            TabsActivity.this);
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://vireo.org/esiapp"));
                    browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(browserIntent);
                } else {
                    MyToast.popmessagelong("You have the most current version!", TabsActivity.this);
                }
            } catch (Exception exc) {
                exc.printStackTrace();
            }

        }
    });

    TextView maillog = (TextView) findViewById(R.id.maillog);
    maillog.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            final Dialog dialog = new Dialog(TabsActivity.this);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialog_logout);

            TextView question = (TextView) dialog.findViewById(R.id.question);
            question.setText("Are you sure you want to email the log?");
            TextView extra = (TextView) dialog.findViewById(R.id.extratext);
            extra.setText("");

            dialog.getWindow().setBackgroundDrawable(
                    new ColorDrawable(getResources().getColor(android.R.color.transparent)));
            Button yes = (Button) dialog.findViewById(R.id.yesbtn);
            yes.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    Intent i = new Intent(Intent.ACTION_SEND);
                    i.setType("message/rfc822");
                    i.putExtra(Intent.EXTRA_EMAIL, new String[] { "rachelc@gmail.com" });
                    i.putExtra(Intent.EXTRA_SUBJECT, "Sending Log");
                    i.putExtra(Intent.EXTRA_TEXT, "body of email");
                    try {
                        startActivity(Intent.createChooser(i, "Send mail..."));
                    } catch (android.content.ActivityNotFoundException ex) {
                        Toast.makeText(TabsActivity.this, "There are no email clients installed.",
                                Toast.LENGTH_SHORT).show();
                    }

                    finish();
                }
            });
            Button no = (Button) dialog.findViewById(R.id.nobtn);
            no.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });
            ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
            close.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });

            dialog.show();

        }
    });

    listops listops = new listops(TabsActivity.this);
    CommonUtilities.logMe("logging in as: " + listops.getString("firstname"));
    TextView name = (TextView) findViewById(R.id.welcome);
    name.setText("Welcome, " + listops.getString("firstname"));

    TextView logoutname = (TextView) findViewById(R.id.logoutname);
    logoutname.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final Dialog dialog = new Dialog(TabsActivity.this);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialog_logout);
            dialog.getWindow().setBackgroundDrawable(
                    new ColorDrawable(getResources().getColor(android.R.color.transparent)));
            dialog.setContentView(R.layout.dialog_logout);
            Button yes = (Button) dialog.findViewById(R.id.yesbtn);
            yes.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    MyToast.popmessagelong("Logging out... ", TabsActivity.this);
                    SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
                    SharedPreferences.Editor editor = prefs.edit();
                    editor.putString(Constants.loginkey, "");
                    editor.commit();
                    listops listops = new listops(TabsActivity.this);
                    //make sure to remove the downloaded schools

                    Intent intent = new Intent(TabsActivity.this, LoginActivity.class);
                    startActivity(intent);
                    ArrayList<Schoolinfomodel> ls = new ArrayList<Schoolinfomodel>();
                    listops.putdrilllist(ls);
                    listops.putservicelist(ls);
                    listops.putinstallllist(ls);
                    ArrayList<PendingUploadModel> l = new ArrayList<PendingUploadModel>();
                    listops.putpendinglist(l);

                    finish();
                }
            });
            Button no = (Button) dialog.findViewById(R.id.nobtn);
            no.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });
            ImageView close = (ImageView) dialog.findViewById(R.id.ivClose);
            close.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });

            dialog.show();
        }

    });

    ll1 = (LinearLayout) findViewById(R.id.ll1);
    ll2 = (LinearLayout) findViewById(R.id.ll2);
    ll3 = (LinearLayout) findViewById(R.id.ll3);
    ll4 = (LinearLayout) findViewById(R.id.ll4);
    ll5 = (LinearLayout) findViewById(R.id.ll5);
    ll6 = (LinearLayout) findViewById(R.id.ll6);
    ll1.setBackgroundColor(getResources().getColor(R.color.White));

    llPickSchools = (LinearLayout) findViewById(R.id.llPickSchool);
    llDrills = (LinearLayout) findViewById(R.id.llDrills);
    llServiceCalls = (LinearLayout) findViewById(R.id.llServiceCalls);
    llNewInstalls = (LinearLayout) findViewById(R.id.llNewInstalls);
    llPendingUploads = (LinearLayout) findViewById(R.id.llPendingUploads);

    frameLayout = (FrameLayout) findViewById(R.id.frame);

}

From source file:com.birdeye.MainActivity.java

private void removeAdsDialog() {

    final Dialog dialog = new Dialog(MainActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.setContentView(R.layout.progress_pre);

    TextView tv_pay15 = (TextView) dialog.findViewById(R.id.tv_pay15);

    tv_pay15.setOnClickListener(new View.OnClickListener() {
        @Override/*from w w  w .jav a 2 s  .c om*/
        public void onClick(View v) {

            if (!BillingProcessor.isIabServiceAvailable(MainActivity.this)) {
                showToast(
                        "In-app billing service is unavailable, please upgrade Android Market/Play to version >= 3.9.16");
            }

            else {

                //    asdasd

                //  onFuturePaymentPressed(v);
                bp.subscribe(MainActivity.this, SUBSCRIPTION_ID);

            }

            dialog.dismiss();

        }
    });

    dialog.setCancelable(true);

    dialog.show();

}