Search in sources :

Example 56 with Builder

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();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Example 57 with Builder

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) FeedbackRecord(com.inceptai.dobby.database.FeedbackRecord)

Example 58 with Builder

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ListView(android.widget.ListView) Button(android.widget.Button) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 59 with Builder

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();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) FinishListener(com.caro.smartmodule.zxing.decode.FinishListener)

Example 60 with Builder

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);
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Aggregations

AlertDialog (android.support.v7.app.AlertDialog)114 DialogInterface (android.content.DialogInterface)76 View (android.view.View)67 TextView (android.widget.TextView)48 Intent (android.content.Intent)36 RecyclerView (android.support.v7.widget.RecyclerView)27 ListView (android.widget.ListView)23 Dialog (android.app.Dialog)22 LayoutInflater (android.view.LayoutInflater)20 ImageView (android.widget.ImageView)20 EditText (android.widget.EditText)18 SuppressLint (android.annotation.SuppressLint)17 Context (android.content.Context)17 Bundle (android.os.Bundle)15 NonNull (android.support.annotation.NonNull)14 Button (android.widget.Button)13 ArrayList (java.util.ArrayList)12 BrowserDialog (acr.browser.lightning.dialog.BrowserDialog)10 OnClickListener (android.content.DialogInterface.OnClickListener)10 ScrollView (android.widget.ScrollView)10