Example usage for android.app Dialog Dialog

List of usage examples for android.app Dialog Dialog

Introduction

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

Prototype

public Dialog(@NonNull Context context) 

Source Link

Document

Creates a dialog window that uses the default dialog theme.

Usage

From source file:com.mindorks.framework.mvp.ui.base.BaseDialog.java

@NonNull
@Override/*from   w ww .  j  ava 2  s.  c  om*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // the content
    final RelativeLayout root = new RelativeLayout(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    // creating the fullscreen dialog
    final Dialog dialog = new Dialog(getContext());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(root);
    if (dialog.getWindow() != null) {
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    }
    dialog.setCanceledOnTouchOutside(false);

    return dialog;
}

From source file:com.mobicage.rogerthat.ServiceBoundActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    T.setUIThread("ServiceBoundActivity.onCreate()");
    super.onCreate(savedInstanceState);
    logMethod("onCreate");
    SystemUtils.logIntentFlags(getIntent());
    IntentFilter filter = new IntentFilter(MainService.CLOSE_ACTIVITY_INTENT);
    registerReceiver(closeActivityListener, filter);
    doBindService();//from w  w  w .  j  av  a  2 s . c  o m
    mTransmitProgressDialog = new Dialog(this);
    mTransmitProgressDialog.setContentView(R.layout.progressdialog);
    mTransmitProgressDialog.setTitle(R.string.transmitting);
    mTransmitProgressBar = (ProgressBar) mTransmitProgressDialog.findViewById(R.id.progress_bar);
    mTransmitProgressDialog.setCancelable(true);
    mTransmitProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            completeTransmit(null);
        }
    });
    mConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
}

From source file:com.example.nestedarchetypeactivityexample.InnerArchetypeViewerActivity.java

/**
  * Show info dialog./*from w ww  .  j a  v  a  2 s  . c o m*/
  *
  * @param content the content
  */
private void showInfoDialog(String content) {
    final Dialog dialog = new Dialog(this);
    dialog.setTitle("Json Adl Structure");
    dialog.setContentView(R.layout.custom_dialog);
    TextView dialogText = (TextView) dialog.findViewById(R.id.dialogText);
    dialogText.setMovementMethod(new ScrollingMovementMethod());
    dialogText.setText(content);

    Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
    dialogButton.setOnClickListener(new OnClickListener() {

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

        }
    });

    dialog.show();
}

From source file:com.infamous.site.activity.MainActivity.java

public Dialog getChangelog() {
    final Dialog CDialog = new Dialog(MainActivity.this);
    CDialog.setTitle(getResources().getString(R.string.changelog_title));
    CDialog.setContentView(R.layout.changelog);
    CDialog.setCanceledOnTouchOutside(true);
    CDialog.setCancelable(true);/* ww w .ja v a 2 s.c o  m*/

    Button Close = (Button) CDialog.findViewById(R.id.close);
    Close.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            CDialog.dismiss();
        }
    });

    return CDialog;
}

From source file:com.mobicage.rogerthat.ServiceBoundMapActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    T.setUIThread("ServiceBoundMapActivity.onCreate()");
    super.onCreate(savedInstanceState);
    logMethod("onCreate");
    SystemUtils.logIntentFlags(getIntent());
    IntentFilter filter = new IntentFilter(MainService.CLOSE_ACTIVITY_INTENT);
    registerReceiver(closeActivityListener, filter);
    mUnknownAvatar = getResources().getDrawable(R.drawable.unknown_avatar);
    mICDachboardAvatar = getResources().getDrawable(R.drawable.ic_dashboard);
    doBindService();// ww w .j  ava2 s.  c om
    mTransmitProgressDialog = new Dialog(this);
    mTransmitProgressDialog.setContentView(R.layout.progressdialog);
    mTransmitProgressDialog.setTitle(R.string.transmitting);
    mTransmitProgressBar = (ProgressBar) mTransmitProgressDialog.findViewById(R.id.progress_bar);
    mTransmitProgressDialog.setCancelable(true);
    mTransmitProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            completeTransmit(null);
        }
    });
    mConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
}

From source file:com.privacity.PermisosActivity.java

public void validar(View view) {
    JSONObject jsonObject = comm.modificarPermisosPorPalabras(lconversor());
    Dialog dialogo = new Dialog(this);
    if (jsonObject.has("Error")) {
        dialogo.setTitle(R.string.errorDeConexion);
    } else {/*from  www  . j  a  v a  2s.  c  o  m*/
        dialogo.setTitle(R.string.permisosModificados);
    }
    dialogo.show();
}

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();//from www . j a 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:fr.cph.stock.android.activity.OverallActivity.java

private void showPanelUpdateHistory() {
    final Dialog alert = new Dialog(this);
    alert.setTitle("Update history");
    alert.setContentView(R.layout.history_dialog);

    final Spinner checked = (Spinner) alert.findViewById(R.id.accountList);
    List<String> list = new ArrayList<String>();
    for (Account acc : portfolio.getAccounts()) {
        list.add(acc.getName());//ww w.  jav  a 2 s.c o  m
    }
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            list);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    checked.setAdapter(dataAdapter);

    Button dialogButton = (Button) alert.findViewById(R.id.dialogButtonOK);
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshItem.setActionView(R.layout.progressbar);
            refreshItem.expandActionView();
            Account account = portfolio.getAccounts().get(checked.getSelectedItemPosition());
            EditText liquidityView = (EditText) alert.findViewById(R.id.liquidityMov);
            EditText yieldView = (EditText) alert.findViewById(R.id.yield);
            EditText buyView = (EditText) alert.findViewById(R.id.buy);
            EditText sellView = (EditText) alert.findViewById(R.id.sell);
            EditText taxeView = (EditText) alert.findViewById(R.id.taxe);
            EditText commentaryView = (EditText) alert.findViewById(R.id.commentaryEditText);

            String params = null;
            params = "?accountId=" + account.getId() + "&liquidity=" + liquidityView.getText() + "&yield="
                    + yieldView.getText() + "&buy=" + buyView.getText() + "&sell=" + sellView.getText()
                    + "&taxe=" + taxeView.getText() + "&commentary="
                    + commentaryView.getText().toString().replaceAll(" ", "%20");
            MainTask mainTask = new MainTask(OverallActivity.this, UrlType.UPDATEHISTORY, params);
            mainTask.execute((Void) null);
            alert.dismiss();
        }
    });
    dialogButton = (Button) alert.findViewById(R.id.dialogButtonCancel);
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            alert.dismiss();
        }
    });
    alert.show();
}

From source file:com.nextgis.libngui.dialog.StyledDialogFragment.java

@NonNull
@Override/*w w w  .j a v  a  2 s.  c  o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Idea from here
    // http://thanhcs.blogspot.ru/2014/10/android-custom-dialog-fragment.html

    Dialog dialog = new Dialog(mContext);

    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

    return dialog;
}

From source file:com.adwardstark.lyricswithmusixmatchapi.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        // create a Dialog component
        final Dialog dialog = new Dialog(this);
        //tell the Dialog to use the dialog.xml as it's layout description
        dialog.setContentView(R.layout.aboutdialog);
        dialog.setTitle("About Developer");
        dialog.show();// ww w. ja v  a 2s.c  o m
        return true;
    }

    return super.onOptionsItemSelected(item);
}