Search in sources :

Example 96 with AlertDialog

use of android.support.v7.app.AlertDialog in project LAN-Messenger by harshitbudhraja.

the class Messaging method showDialog.

protected void showDialog(String myTitle, String myContent) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(myContent).setTitle(myTitle).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Example 97 with AlertDialog

use of android.support.v7.app.AlertDialog in project LAN-Messenger by harshitbudhraja.

the class ServerMessaging method showDialog.

protected void showDialog(String myTitle, String myContent) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(myContent).setTitle(myTitle).setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Example 98 with AlertDialog

use of android.support.v7.app.AlertDialog in project LAN-Messenger by harshitbudhraja.

the class Selection method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_selection);
    Button send = (Button) findViewById(R.id.sendbutton);
    send.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                LayoutInflater layoutInflaterAndroid = LayoutInflater.from(c);
                View mView = layoutInflaterAndroid.inflate(R.layout.userinputdialog, null);
                AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(c);
                alertDialogBuilderUserInput.setView(mView);
                final EditText userInputDialogEditText = (EditText) mView.findViewById(R.id.hint);
                alertDialogBuilderUserInput.setCancelable(false).setPositiveButton("PROCEED", new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialogBox, int id) {
                        // ToDo get user input here
                        if (!userInputDialogEditText.getText().toString().isEmpty())
                            hostIP = userInputDialogEditText.getText().toString();
                        Intent intent = new Intent(Selection.this, Messaging.class);
                        startActivity(intent);
                    }
                }).setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialogBox, int id) {
                        dialogBox.cancel();
                    }
                });
                AlertDialog alertDialogAndroid = alertDialogBuilderUserInput.create();
                alertDialogAndroid.show();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    Button receive = (Button) findViewById(R.id.receivebutton);
    receive.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Selection.this, ServerMessaging.class);
            startActivity(intent);
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) View(android.view.View) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater)

Example 99 with AlertDialog

use of android.support.v7.app.AlertDialog in project hello-storj by kaloyan-raev.

the class FileInfoFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Bucket bucket = (Bucket) getArguments().getSerializable(FilesFragment.BUCKET);
    final File file = (File) getArguments().getSerializable(FILE);
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.title_fileinfo).setMessage(String.format("ID: %s\nBucket: %s\nName: %s\nCreated: %s\nDecrypted: %b\nSize: %s\nMIME Type: %s\nErasure: %s\nIndex: %s\nHMAC: %s", file.getId(), file.getBucketId(), file.getName(), file.getCreated(), file.isDecrypted(), Formatter.formatFileSize(getContext(), file.getSize()), file.getMimeType(), file.getErasure(), file.getIndex(), file.getHMAC())).setPositiveButton(R.string.button_download, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            ((DownloadListener) getActivity()).onDownload(bucket, file);
        }
    });
    // Create the AlertDialog object and return it
    return builder.create();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Bucket(io.storj.libstorj.Bucket) DialogInterface(android.content.DialogInterface) File(io.storj.libstorj.File) NonNull(android.support.annotation.NonNull)

Example 100 with AlertDialog

use of android.support.v7.app.AlertDialog in project MyNewCC98 by 6769.

the class MainActivity method onNavigationItemSelected.

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    if (id == R.id.nav_camera) {
        UserProfileActivity.startActivity(this, 517471);
    } else if (id == R.id.nav_slideshow) {
        EditActivity.startActivity(this);
    } else if (id == R.id.nav_manage_setting) {
        SettingActivity.startActivity(this);
    } else if (id == R.id.nav_about_page) {
        AboutActivity.startActivity(this);
    } else if (id == R.id.nav_gotopic) {
        // possible dangerous memory leaks!!!
        editText = new EditText(this);
        editText.setInputType(InputType.TYPE_CLASS_NUMBER);
        alertbuilder = new AlertDialog.Builder(this);
        alert = alertbuilder.setTitle(R.string.main_activity_gotopic_title).setMessage(R.string.main_activity_gotopic_msg).setView(editText).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                logi("gotopic Canceled");
            }
        }).setPositiveButton("OK", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                String userInput = editText.getText().toString().trim();
                try {
                    int topicId = Integer.valueOf(userInput);
                    PostReadActivity.startActivity(MainActivity.this, topicId);
                } catch (Exception e) {
                    loge(e, "input Error");
                }
            }
        }).create();
        alert.show();
    } else if (id == R.id.nav_exit_app) {
        ActivityCollector.finishAll();
    } else if (id == R.id.nav_loutout) {
        AlertDialog alertRelog = new AlertDialog.Builder(this).setTitle("LogOut").setMessage("Are You Sure?").setNegativeButton("Cancel", null).setPositiveButton("Quit", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                LoginActivity.startActivity(MainActivity.this, LoginActivity.LoginType.RELOGIN);
                finish();
            }
        }).create();
        alertRelog.show();
    }
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
Also used : EditText(android.widget.EditText) AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Aggregations

AlertDialog (android.support.v7.app.AlertDialog)410 DialogInterface (android.content.DialogInterface)274 View (android.view.View)219 TextView (android.widget.TextView)165 Intent (android.content.Intent)117 EditText (android.widget.EditText)86 ImageView (android.widget.ImageView)69 Button (android.widget.Button)68 LayoutInflater (android.view.LayoutInflater)59 RecyclerView (android.support.v7.widget.RecyclerView)54 NonNull (android.support.annotation.NonNull)52 AdapterView (android.widget.AdapterView)51 SuppressLint (android.annotation.SuppressLint)50 ArrayList (java.util.ArrayList)49 Bundle (android.os.Bundle)47 ListView (android.widget.ListView)42 Context (android.content.Context)35 SharedPreferences (android.content.SharedPreferences)35 Uri (android.net.Uri)32 LinearLayout (android.widget.LinearLayout)30