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();
}
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();
}
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);
}
});
}
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();
}
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;
}
Aggregations