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.mimp.fragment.institucion.PlanTrabajoPage.java

public void btnAgregar() {
    final Dialog dialog = new Dialog(this.getActivity());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    //dialog.setCancelable(false);
    dialog.setContentView(R.layout.dialog_plan_trabajo);

    TextView lblResponsable = (TextView) dialog.findViewById(R.id.lblResponsable);
    lblResponsable.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblResponsable.getTextSize() + SizeText);

    TextView lblDResponsable = (TextView) dialog.findViewById(R.id.lblDResponsable);
    lblDResponsable.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblDResponsable.getTextSize() + SizeText);

    TextView lblObejtivo = (TextView) dialog.findViewById(R.id.lblObejtivo);
    lblObejtivo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblObejtivo.getTextSize() + SizeText);

    TextView lblMeta = (TextView) dialog.findViewById(R.id.lblMeta);
    lblMeta.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblMeta.getTextSize() + SizeText);

    TextView lblActividad = (TextView) dialog.findViewById(R.id.lblActividad);
    lblActividad.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblActividad.getTextSize() + SizeText);

    TextView lblCronograma = (TextView) dialog.findViewById(R.id.lblCronograma);
    lblCronograma.setTextSize(TypedValue.COMPLEX_UNIT_DIP, lblCronograma.getTextSize() + SizeText);

    final EditText txtObejtivo = (EditText) dialog.findViewById(R.id.txtObejtivo);
    txtObejtivo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtObejtivo.getTextSize() + SizeText);
    txtObejtivo.setText("");

    final EditText txtActividad = (EditText) dialog.findViewById(R.id.txtActividad);
    txtActividad.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtActividad.getTextSize() + SizeText);
    txtActividad.setText("");

    final EditText txtCronograma = (EditText) dialog.findViewById(R.id.txtCronograma);
    txtCronograma.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtCronograma.getTextSize() + SizeText);
    txtCronograma.setText("");

    final EditText txtMeta = (EditText) dialog.findViewById(R.id.txtMeta);
    txtMeta.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtMeta.getTextSize() + SizeText);
    txtMeta.setText("");

    final EditText txtResponsable = (EditText) dialog.findViewById(R.id.txtResponsable);
    txtResponsable.setTextSize(TypedValue.COMPLEX_UNIT_DIP, txtResponsable.getTextSize() + SizeText);
    txtResponsable.setText("");

    Button btnAgregar = (Button) dialog.findViewById(R.id.btnAgregar);
    btnAgregar.setOnClickListener(new View.OnClickListener() {
        @Override//from  w w w  .j  a  va2s .  c  o  m
        public void onClick(View v) {
            clsPlanTrabajo entidad = new clsPlanTrabajo();
            entidad.setActividad(txtActividad.getText().toString());
            entidad.setCronograma(txtCronograma.getText().toString());
            entidad.setMeta(txtMeta.getText().toString());
            entidad.setObejtivo(txtObejtivo.getText().toString());
            entidad.setResponsable(txtResponsable.getText().toString());
            list.add(entidad);
            getListaPlanTrabajo();
            dialog.dismiss();
        }
    });
    dialog.show();

}

From source file:com.untie.daywal.activity.MainActivity.java

private void showDayPicker() {

    Calendar calender = Calendar.getInstance();
    pickedYear = calender.get(Calendar.YEAR);
    pickedMonth = calender.get(Calendar.MONTH) + 1;
    final Dialog dayPickerDialog = new Dialog(this);
    dayPickerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dayPickerDialog.setContentView(R.layout.dialog);
    Button okBtn = (Button) dayPickerDialog.findViewById(R.id.birthday_btn_ok);
    Button cancelBtn = (Button) dayPickerDialog.findViewById(R.id.birthday_btn_cancel);
    dialog_year_title = (TextView) dayPickerDialog.findViewById(R.id.dialog_year_title);
    dialog_month_title = (TextView) dayPickerDialog.findViewById(R.id.dialog_month_title);
    final NumberPicker yearPicker = (NumberPicker) dayPickerDialog.findViewById(R.id.yearPicker);
    final NumberPicker monthPicker = (NumberPicker) dayPickerDialog.findViewById(R.id.monthPicker);

    dialog_year_title.setText(String.valueOf(pickedYear) + "");
    dialog_month_title.setText(String.valueOf(pickedMonth) + "");
    yearPicker.setMinValue(pickedYear - 100);
    yearPicker.setMaxValue(pickedYear + 40);
    yearPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    //   setDividerColor(yearPicker, android.R.color.white );
    yearPicker.setWrapSelectorWheel(false);
    yearPicker.setValue(pickedYear);//  ww  w  .  j  a  v  a  2s .  c om
    yearPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            dialog_year_title.setText(String.valueOf(newVal) + "");
        }
    });

    monthPicker.setMinValue(1);
    monthPicker.setMaxValue(12);
    monthPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
    //   setDividerColor(monthPicker, android.R.color.white);
    //monthPicker.setWrapSelectorWheel(false);
    monthPicker.setValue(pickedMonth);
    monthPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            dialog_month_title.setText(String.valueOf(newVal) + "");
        }
    });

    okBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //TODO :  ?? yearPicker.getValue() monthPicker.getValue()

            //Toast.makeText(MainActivity.this, String.valueOf(yearPicker.getValue())+"/"+monthPicker.getValue(), Toast.LENGTH_SHORT).show();

            Intent intent = new Intent(MainActivity.this, MainActivity.class);
            intent.putExtra("year", yearPicker.getValue());
            intent.putExtra("month", monthPicker.getValue());
            intent.putExtra("order", 1);
            dayPickerDialog.dismiss();
            startActivity(intent);
            overridePendingTransition(0, 0);

        }
    });
    cancelBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dayPickerDialog.dismiss();
        }
    });
    dayPickerDialog.show();

}

From source file:com.angelhack.person2person.AbstractGetNameTask.java

@Override
protected void onPostExecute(Void result) {
    // TODO Auto-generated method stub
    super.onPostExecute(result);

    try {//w  w  w  .ja  va  2 s . c om
        System.out.println("On Home Page***" + AbstractGetNameTask.GOOGLE_USER_DATA);
        JSONObject profileData = new JSONObject(AbstractGetNameTask.GOOGLE_USER_DATA);

        if (profileData.has("picture")) {
            SocialMedia_New.userImageUrl = profileData.getString("picture");

        }
        if (profileData.has("name")) {
            SocialMedia_New.textName = profileData.getString("name");
            //      SocialMedia_New.textViewName.setText(SocialMedia_New.textName);
        }

        dialog.dismiss();

        final Dialog alert_dialog = new Dialog(mActivity);
        alert_dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        alert_dialog.setContentView(R.layout.dialog_custom);

        TextView content = (TextView) alert_dialog.findViewById(R.id.content_tv_id);
        TextView ok = (TextView) alert_dialog.findViewById(R.id.ok_tv_id);
        profile = (ImageView) alert_dialog.findViewById(R.id.image_id);

        new GetImageFromUrl().execute(SocialMedia_New.userImageUrl);

        content.setText(" Welcome  " + SocialMedia_New.textName);
        ok.setText("Stay Connect with Us..!");

        ok.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                Intent intent = new Intent(mActivity, Home_Activity.class);
                mActivity.startActivity(intent);

                mActivity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);

                mActivity.finish();

            }
        });

        alert_dialog.show();

    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:com.ubimobitech.spotifystreamer.PlaybackFragment.java

/** The system calls this only when creating the layout in a dialog. */
@Override//w w w.j  a v  a2 s .  c  o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}

From source file:com.untie.daywal.activity.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    thisMonthTv = (TextView) findViewById(R.id.this_month_tv);

    Calendar now = Calendar.getInstance();

    Intent intent = getIntent();//ww w  .ja v  a 2  s  .  c  o m
    year = intent.getIntExtra("year", now.get(Calendar.YEAR));
    month = intent.getIntExtra("month", now.get(Calendar.MONTH));
    order = intent.getIntExtra("order", 0);

    if (order == 0) {
        mf = MonthlyFragment.newInstance(year, month);
        getSupportFragmentManager().beginTransaction().add(R.id.monthly, mf).commit();
    } else if (order == 1) {
        mf = MonthlyFragment.newInstance(year, month - 1);
        getSupportFragmentManager().beginTransaction().replace(R.id.monthly, mf).commit();
    }
    mf.setOnMonthChangeListener(new MonthlyFragment.OnMonthChangeListener() {

        @Override
        public void onChange(int year, int month) {
            HLog.d(TAG, CLASS, "onChange " + year + "." + month);
            thisMonthTv.setText(year + " " + (month + 1) + "");

        }

        @Override
        public void onDayClick(OneDayView dayView) {
            int year = dayView.get(Calendar.YEAR);
            int month = dayView.get(Calendar.MONTH);
            int day = dayView.get(Calendar.DAY_OF_MONTH);
            int week = dayView.get(Calendar.DAY_OF_WEEK);

            Intent intent = new Intent(MainActivity.this, PopupActivity.class);
            intent.putExtra("year", year);
            intent.putExtra("month", month);
            intent.putExtra("day", day);
            intent.putExtra("week", week);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            startActivity(intent);
            //overridePendingTransition(0, 0);
        }

        @Override
        public void onDayLongClick(OneDayView dayView) {

            if (dayView.getImage() != null) {
                final Dialog dayPickerDialog = new Dialog(MainActivity.this);
                dayPickerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                dayPickerDialog.setContentView(R.layout.dialog_image);
                dayPickerDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                dayPickerDialog.getWindow().setBackgroundDrawable((new ColorDrawable(0x7000000)));
                ImageView imageView = (ImageView) dayPickerDialog.findViewById(R.id.image_popup);
                Uri uri = dayView.getImage();
                Glide.with(MainActivity.this).load(uri).centerCrop().into(imageView);
                dayPickerDialog.show();
                //dayPickerDialog.dismiss();
            }
        }
    });

    thisMonthTv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showDayPicker();
        }
    });

}

From source file:no.barentswatch.fiskinfo.MyPageActivity.java

public void createSubscriptionInformationDialog(int JSONObjectIndex) {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
    dialog.setContentView(R.layout.subscription_info_dialog);

    TextView subscriptionNameView = (TextView) dialog.findViewById(R.id.subscription_description_text_view);
    TextView subscriptionOwnerView = (TextView) dialog.findViewById(R.id.subscription_owner_text_view);
    TextView subscriptionUpdatedView = (TextView) dialog.findViewById(R.id.subscription_last_updated_text_view);
    Button okButton = (Button) dialog.findViewById(R.id.dismiss_dialog_button);
    Button viewOnMapButton = (Button) dialog.findViewById(R.id.go_to_map_button);
    String subscriptionName = null;
    String subscriptionOwner = null;
    String subscriptionDescription = null;

    JSONArray subscriptions = getSharedCacheOfAvailableSubscriptions();
    List<String> updateValues = new ArrayList<String>();
    JSONObject currentSubscription;//from   ww w  .  j  av a2  s.c  o m
    String lastUpdated = "";

    updateValues.add("Name");
    updateValues.add("DataOwner");
    updateValues.add("LastUpdated");
    updateValues.add("Description");
    updateValues.add("UpdateFrequencyText");

    if (subscriptions != null) {
        try {
            currentSubscription = getSharedCacheOfAvailableSubscriptions().getJSONObject(JSONObjectIndex);
            subscriptionName = currentSubscription.getString("Name");
            subscriptionOwner = currentSubscription.getString("DataOwner");
            subscriptionDescription = currentSubscription.getString("Description");
            lastUpdated = currentSubscription.get("LastUpdated").toString();
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    String[] updateDateAndTime = lastUpdated.split("T");
    lastUpdated = updateDateAndTime[1] + "  " + updateDateAndTime[0];

    subscriptionNameView.setText(subscriptionDescription);
    subscriptionOwnerView.setText(subscriptionOwner);
    subscriptionUpdatedView.setText(lastUpdated);

    okButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    viewOnMapButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Do some map stuff here so we only show this layer I
            // guess?
            loadView(MapActivity.class);
        }
    });

    int subscriptionIconId = getSubscriptionIconId(subscriptionName);

    dialog.setTitle(subscriptionName);
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    if (subscriptionIconId != 0) {
        dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, subscriptionIconId);
    }

}

From source file:piuk.blockchain.android.ui.WalletActivity.java

@Override
protected Dialog onCreateDialog(final int id) {
    final WebView webView = new WebView(this);
    if (id == DIALOG_HELP)
        webView.loadUrl("file:///android_asset/help" + languagePrefix() + ".html");

    final Dialog dialog = new Dialog(WalletActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(webView);/*from  w  w  w .  j a  v a 2 s.c  o  m*/
    dialog.setCanceledOnTouchOutside(true);

    return dialog;
}

From source file:com.fbartnitzek.tasteemall.filter.EntityFilterDialogFragment.java

@NonNull
@Override/*  ww  w.j a va  2s . co  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    Bundle bundle = getArguments();
    if (bundle == null) {
        bundle = savedInstanceState;
    }
    if (bundle == null) {
        throw new RuntimeException("neither args nor savedInstance - should never happen...");
    }

    mBaseEntity = bundle.getString(BASE_ENTITY);
    if (bundle.containsKey(FILTER_JSON)) {
        try {
            mFilterJson = new JSONObject(bundle.getString(FILTER_JSON));
        } catch (JSONException e) {
            // conversion did not work ... use new Object, but log error
            Log.e(LOG_TAG, "onCreateDialog: json could not be restored: " + mFilterJson, e);
            e.printStackTrace();
        }
    }

    if (mFilterJson == null) {
        mFilterJson = new JSONObject();
        try {
            mFilterJson.put(mBaseEntity, new JSONObject());
        } catch (JSONException e) {
            e.printStackTrace();// ignore...
        }
    }

    // TODO: restore position

    //dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.YELLOW));
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    return dialog;
}

From source file:ca.frozen.curlingtv.activities.ScannerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // get the controls
    View view = inflater.inflate(R.layout.fragment_scanner, container, false);
    message = (TextView) view.findViewById(R.id.scanner_message);
    status = (TextView) view.findViewById(R.id.scanner_status);
    progress = (ProgressBar) view.findViewById(R.id.scanner_progress);
    cancelButton = (Button) view.findViewById(R.id.scanner_cancel);

    // configure the dialog
    Dialog dialog = getDialog();
    if (dialog != null) {
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setCancelable(false);/*from  w  w  w .  j a v a 2 s.c  om*/
        dialog.setCanceledOnTouchOutside(false);
        dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(android.content.DialogInterface dialog, int keyCode,
                    android.view.KeyEvent event) {
                if ((keyCode == android.view.KeyEvent.KEYCODE_BACK)) {
                    cancel();
                }
                return false;
            }
        });
    }

    // handle the cancel button
    cancelButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            cancel();
            dismiss();
        }
    });

    // create the dismiss handler and runnable
    dismissHandler = new Handler();
    dismissRunner = new Runnable() {
        @Override
        public void run() {
            dismiss();
        }
    };

    // configure the view if we've already done the scan
    if (savedInstanceState != null) {
        DeviceScanner scanner = (scannerWeakRef != null) ? scannerWeakRef.get() : null;
        if (scanner != null) {
            boolean complete = scanner.isComplete();
            scanner.setStatus(complete);
            if (complete) {
                cancelButton.setText(App.getStr(R.string.done));
            }
        }
    }

    return view;
}

From source file:com.kircherelectronics.accelerationexplorer.activity.NoiseActivity.java

private void showHelpDialog() {
    Dialog helpDialog = new Dialog(this);

    helpDialog.setCancelable(true);//from w  w  w  .jav a  2  s.c o m
    helpDialog.setCanceledOnTouchOutside(true);
    helpDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    View view = getLayoutInflater().inflate(R.layout.layout_help_noise, null);

    helpDialog.setContentView(view);

    helpDialog.show();
}