use of android.support.v7.app.AlertDialog.Builder in project HumaneApp by Ganesh1010.
the class ChooseLocationActivity method setCurrentLocation.
private void setCurrentLocation() {
GPSTracker gpsTracker = new GPSTracker(ChooseLocationActivity.this);
String cityName = gpsTracker.getLocality(ChooseLocationActivity.this);
if (cityName != null) {
HomeActivity.locationName = cityName;
finish();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(ChooseLocationActivity.this);
builder.setTitle("Alert !");
builder.setMessage("Unable to fetch location details");
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
}
use of android.support.v7.app.AlertDialog.Builder in project dobby-android by InceptAi.
the class WifiDocDialogFragment method createFeedbackFormDialog.
private Dialog createFeedbackFormDialog(Bundle bundle) {
final int parentViewId = bundle.getInt(PARENT_VIEW_ID);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
rootView = inflater.inflate(R.layout.feedback_dialog_fragment, null);
Button submitButton = (Button) rootView.findViewById(R.id.feedback_submit_button);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//FrameLayout fl = (FrameLayout) getActivity().findViewById(R.id.wifi_doc_placeholder_fl);
FrameLayout fl = (FrameLayout) getActivity().findViewById(parentViewId);
Snackbar.make(fl, "Thanks for your feedback !", Snackbar.LENGTH_SHORT).show();
//Write the feedback to database
FeedbackRecord feedbackRecord = createFeedbackRecord(rootView);
feedbackDatabaseWriter.writeFeedbackToDatabase(feedbackRecord);
dismiss();
}
});
Button cancelButton = (Button) rootView.findViewById(R.id.feedback_cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//FrameLayout fl = (FrameLayout) getActivity().findViewById(R.id.wifi_doc_placeholder_fl);
FrameLayout fl = (FrameLayout) getActivity().findViewById(parentViewId);
Snackbar.make(fl, "Feedback cancelled.", Snackbar.LENGTH_SHORT).show();
dismiss();
}
});
builder.setView(rootView);
return builder.create();
}
use of android.support.v7.app.AlertDialog.Builder in project dobby-android by InceptAi.
the class WifiDocDialogFragment method createSuggestionsDialog.
private Dialog createSuggestionsDialog(Bundle bundle) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
rootView = inflater.inflate(R.layout.more_suggestions_dialog_fragment, null);
ListView listView = (ListView) rootView.findViewById(R.id.more_suggest_listview);
suggestionList = bundle.getStringArrayList(DIALOG_SUGGESTION_LIST);
ArrayAdapter<String> itemsAdapter = new ArrayAdapter<String>(getContext(), R.layout.custom_simple_list_item, suggestionList);
listView.setAdapter(itemsAdapter);
Button dismissButton = (Button) rootView.findViewById(R.id.more_suggestions_dismiss_button);
dismissButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
builder.setView(rootView);
return builder.create();
}
use of android.support.v7.app.AlertDialog.Builder in project smartmodule by carozhu.
the class CaptureActivity method displayFrameworkBugMessageAndExit.
/**
* 若摄像头被占用或者摄像头有问题则跳出提示对话框
*/
private void displayFrameworkBugMessageAndExit() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
//builder.setIcon(R.drawable.launcher_icon);
builder.setTitle(getString(R.string.app_name));
builder.setMessage(getString(R.string.msg_camera_framework_bug));
builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
builder.setOnCancelListener(new FinishListener(this));
builder.show();
}
use of android.support.v7.app.AlertDialog.Builder in project apps-android-commons by commons-app.
the class CategorizationFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.menu_save_categories:
int numberSelected = 0;
for (CategoryItem item : categoriesAdapter.getItems()) {
if (item.selected) {
selectedCategories.add(item.name);
numberSelected++;
}
}
//If no categories selected, display warning to user
if (numberSelected == 0) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Images without categories are rarely usable. Are you sure you want to submit without selecting categories?").setTitle("No Categories Selected");
builder.setPositiveButton("No, go back", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//Exit menuItem so user can select their categories
return;
}
});
builder.setNegativeButton("Yes, submit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//Proceed to submission
onCategoriesSaveHandler.onCategoriesSave(selectedCategories);
return;
}
});
AlertDialog dialog = builder.create();
dialog.show();
} else {
//Proceed to submission
onCategoriesSaveHandler.onCategoriesSave(selectedCategories);
return true;
}
}
return super.onOptionsItemSelected(menuItem);
}
Aggregations