Search in sources :

Example 1 with AppCompatImageButton

use of android.support.v7.widget.AppCompatImageButton in project collect by opendatakit.

the class MediaLayout method setAVT.

public void setAVT(FormIndex index, String selectionDesignator, TextView text, String audioURI, String imageURI, String videoURI, final String bigImageURI) {
    this.selectionDesignator = selectionDesignator;
    this.index = index;
    viewText = text;
    originalText = text.getText();
    viewText.setId(ViewIds.generateViewId());
    this.videoURI = videoURI;
    // Layout configurations for our elements in the relative layout
    RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    RelativeLayout.LayoutParams audioParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    RelativeLayout.LayoutParams videoParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    // First set up the audio button
    if (audioURI != null) {
        // An audio file is specified
        audioButton = new AudioButton(getContext(), this.index, this.selectionDesignator, audioURI, player);
        audioButton.setPadding(22, 12, 22, 12);
        audioButton.setBackgroundColor(Color.LTGRAY);
        audioButton.setOnClickListener(this);
        // random ID to be used by the
        audioButton.setId(ViewIds.generateViewId());
    // relative layout.
    } else {
    // No audio file specified, so ignore.
    }
    // Then set up the video button
    if (videoURI != null) {
        // An video file is specified
        videoButton = new AppCompatImageButton(getContext());
        Bitmap b = BitmapFactory.decodeResource(getContext().getResources(), android.R.drawable.ic_media_play);
        videoButton.setImageBitmap(b);
        videoButton.setPadding(22, 12, 22, 12);
        videoButton.setBackgroundColor(Color.LTGRAY);
        videoButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Collect.getInstance().getActivityLogger().logInstanceAction(this, "onClick", "playVideoPrompt" + MediaLayout.this.selectionDesignator, MediaLayout.this.index);
                MediaLayout.this.playVideo();
            }
        });
        videoButton.setId(ViewIds.generateViewId());
    } else {
    // No video file specified, so ignore.
    }
    // Now set up the image view
    String errorMsg = null;
    final int imageId = ViewIds.generateViewId();
    if (imageURI != null) {
        try {
            String imageFilename = ReferenceManager.instance().DeriveReference(imageURI).getLocalURI();
            final File imageFile = new File(imageFilename);
            if (imageFile.exists()) {
                DisplayMetrics metrics = context.getResources().getDisplayMetrics();
                int screenWidth = metrics.widthPixels;
                int screenHeight = metrics.heightPixels;
                Bitmap b = FileUtils.getBitmapScaledToDisplay(imageFile, screenHeight, screenWidth);
                if (b != null) {
                    imageView = new ImageView(getContext());
                    imageView.setPadding(2, 2, 2, 2);
                    imageView.setImageBitmap(b);
                    imageView.setId(imageId);
                    imageView.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            if (bigImageURI != null) {
                                Collect.getInstance().getActivityLogger().logInstanceAction(this, "onClick", "showImagePromptBigImage" + MediaLayout.this.selectionDesignator, MediaLayout.this.index);
                                try {
                                    File bigImage = new File(ReferenceManager.instance().DeriveReference(bigImageURI).getLocalURI());
                                    Intent i = new Intent("android.intent.action.VIEW");
                                    i.setDataAndType(Uri.fromFile(bigImage), "image/*");
                                    getContext().startActivity(i);
                                } catch (InvalidReferenceException e) {
                                    Timber.e(e, "Invalid image reference due to %s ", e.getMessage());
                                } catch (ActivityNotFoundException e) {
                                    Timber.d(e, "No Activity found to handle due to %s", e.getMessage());
                                    ToastUtils.showShortToast(getContext().getString(R.string.activity_not_found, getContext().getString(R.string.view_image)));
                                }
                            } else {
                                if (viewText instanceof RadioButton) {
                                    ((RadioButton) viewText).setChecked(true);
                                } else if (viewText instanceof CheckBox) {
                                    CheckBox checkbox = (CheckBox) viewText;
                                    checkbox.setChecked(!checkbox.isChecked());
                                }
                            }
                        }
                    });
                } else {
                    // Loading the image failed, so it's likely a bad file.
                    errorMsg = getContext().getString(R.string.file_invalid, imageFile);
                }
            } else {
                // We should have an image, but the file doesn't exist.
                errorMsg = getContext().getString(R.string.file_missing, imageFile);
            }
            if (errorMsg != null) {
                // errorMsg is only set when an error has occurred
                Timber.e(errorMsg);
                missingImage = new TextView(getContext());
                missingImage.setText(errorMsg);
                missingImage.setPadding(10, 10, 10, 10);
                missingImage.setId(imageId);
            }
        } catch (InvalidReferenceException e) {
            Timber.e(e, "Invalid image reference due to %s ", e.getMessage());
        }
    } else {
    // There's no imageURI listed, so just ignore it.
    }
    // e.g., for TextView that flag will be true
    boolean isNotAMultipleChoiceField = !RadioButton.class.isAssignableFrom(text.getClass()) && !CheckBox.class.isAssignableFrom(text.getClass());
    // Assumes LTR, TTB reading bias!
    if (viewText.getText().length() == 0 && (imageView != null || missingImage != null)) {
        // it will show a grey bar to the right of the image icon.
        if (imageView != null) {
            imageView.setScaleType(ScaleType.FIT_START);
        }
        // 
        // In this case, we have:
        // Text upper left; image upper, left edge aligned with text right edge;
        // audio upper right; video below audio on right.
        textParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        if (isNotAMultipleChoiceField) {
            imageParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
        } else {
            imageParams.addRule(RelativeLayout.RIGHT_OF, viewText.getId());
        }
        imageParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        if (audioButton != null && videoButton == null) {
            audioParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
            audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            audioParams.setMargins(0, 0, 11, 0);
            imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId());
        } else if (audioButton == null && videoButton != null) {
            videoParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
            videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            videoParams.setMargins(0, 0, 11, 0);
            imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId());
        } else if (audioButton != null && videoButton != null) {
            audioParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
            audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            audioParams.setMargins(0, 0, 11, 0);
            imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId());
            videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            videoParams.addRule(RelativeLayout.BELOW, audioButton.getId());
            videoParams.setMargins(0, 20, 11, 0);
            imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId());
        } else {
            // no need to bound it by the width of the parent...
            if (!isNotAMultipleChoiceField) {
                imageParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            }
        }
        imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    } else {
        // In this case, we want the image to be centered...
        if (imageView != null) {
            imageView.setScaleType(ScaleType.FIT_START);
        }
        // 
        // Text upper left; audio upper right; video below audio on right.
        // image below text, audio and video buttons; left-aligned with text.
        textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        textParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        if (audioButton != null && videoButton == null) {
            audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            audioParams.setMargins(0, 0, 11, 0);
            textParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId());
        } else if (audioButton == null && videoButton != null) {
            videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            videoParams.setMargins(0, 0, 11, 0);
            textParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId());
        } else if (audioButton != null && videoButton != null) {
            audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            audioParams.setMargins(0, 0, 11, 0);
            textParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId());
            videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            videoParams.setMargins(0, 20, 11, 0);
            videoParams.addRule(RelativeLayout.BELOW, audioButton.getId());
        } else {
            textParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        }
        if (imageView != null || missingImage != null) {
            imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
            if (videoButton != null) {
                imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId());
            } else if (audioButton != null) {
                imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId());
            }
            imageParams.addRule(RelativeLayout.BELOW, viewText.getId());
        } else {
            textParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        }
    }
    addView(viewText, textParams);
    if (audioButton != null) {
        addView(audioButton, audioParams);
    }
    if (videoButton != null) {
        addView(videoButton, videoParams);
    }
    if (imageView != null) {
        addView(imageView, imageParams);
    } else if (missingImage != null) {
        addView(missingImage, imageParams);
    }
}
Also used : Intent(android.content.Intent) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) RadioButton(android.widget.RadioButton) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) DisplayMetrics(android.util.DisplayMetrics) InvalidReferenceException(org.javarosa.core.reference.InvalidReferenceException) Bitmap(android.graphics.Bitmap) ActivityNotFoundException(android.content.ActivityNotFoundException) CheckBox(android.widget.CheckBox) RelativeLayout(android.widget.RelativeLayout) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) File(java.io.File)

Example 2 with AppCompatImageButton

use of android.support.v7.widget.AppCompatImageButton in project ForPDA by RadiationX.

the class AnnounceFragment method addSearchOnPageItem.

private void addSearchOnPageItem(Menu menu) {
    toolbar.inflateMenu(R.menu.theme_search_menu);
    MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search);
    searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView();
    searchView.setTag(searchViewTag);
    searchView.setOnSearchClickListener(v -> {
        if (searchView.getTag().equals(searchViewTag)) {
            ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
            if (searchClose != null)
                ((ViewGroup) searchClose.getParent()).removeView(searchClose);
            ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48);
            TypedValue outValue = new TypedValue();
            getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true);
            AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext());
            btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next));
            btnNext.setBackgroundResource(outValue.resourceId);
            AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext());
            btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev));
            btnPrev.setBackgroundResource(outValue.resourceId);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams);
            btnNext.setOnClickListener(v1 -> findNext(true));
            btnPrev.setOnClickListener(v1 -> findNext(false));
            searchViewTag++;
        }
    });
    SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
    if (null != searchManager) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
    }
    searchView.setIconifiedByDefault(true);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            findText(newText);
            return false;
        }
    });
}
Also used : SearchManager(android.app.SearchManager) ViewGroup(android.view.ViewGroup) MenuItem(android.view.MenuItem) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout) TypedValue(android.util.TypedValue)

Example 3 with AppCompatImageButton

use of android.support.v7.widget.AppCompatImageButton in project ForPDA by RadiationX.

the class ForumRulesFragment method addSearchOnPageItem.

private void addSearchOnPageItem(Menu menu) {
    toolbar.inflateMenu(R.menu.theme_search_menu);
    MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search);
    searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    /*MenuItemCompat.setOnActionExpandListener(searchOnPageMenuItem, new MenuItemCompat.OnActionExpandListener() {
            @Override
            public boolean onMenuItemActionCollapse(MenuItem item) {
                toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
                return true;
            }

            @Override
            public boolean onMenuItemActionExpand(MenuItem item) {
                toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER);
                return true;
            }
        });*/
    SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView();
    searchView.setTag(searchViewTag);
    searchView.setOnSearchClickListener(v -> {
        if (searchView.getTag().equals(searchViewTag)) {
            ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
            if (searchClose != null)
                ((ViewGroup) searchClose.getParent()).removeView(searchClose);
            ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48);
            TypedValue outValue = new TypedValue();
            getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true);
            AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext());
            btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next));
            btnNext.setBackgroundResource(outValue.resourceId);
            AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext());
            btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev));
            btnPrev.setBackgroundResource(outValue.resourceId);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams);
            ((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams);
            btnNext.setOnClickListener(v1 -> findNext(true));
            btnPrev.setOnClickListener(v1 -> findNext(false));
            searchViewTag++;
        }
    });
    SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
    if (null != searchManager) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
    }
    searchView.setIconifiedByDefault(true);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            findText(newText);
            return false;
        }
    });
}
Also used : SearchManager(android.app.SearchManager) ViewGroup(android.view.ViewGroup) MenuItem(android.view.MenuItem) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout) TypedValue(android.util.TypedValue)

Example 4 with AppCompatImageButton

use of android.support.v7.widget.AppCompatImageButton in project krypton-android by kryptco.

the class SelectIndividualsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_teams_individual_emails_invite, container, false);
    ArrayAdapter emailsAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_list_item_1, new ArrayList<>());
    ListViewCompat emailsList = rootView.findViewById(R.id.emailResultsList);
    AppCompatEditText emailText = rootView.findViewById(R.id.emailAddInput);
    AppCompatImageButton addButton = rootView.findViewById(R.id.addEmailButton);
    createButton = rootView.findViewById(R.id.createIndividualLink);
    cancelButton = rootView.findViewById(R.id.cancelIndividualLinkButton);
    emailsList.setAdapter(emailsAdapter);
    addButton.setEnabled(false);
    addButton.setOnClickListener(v -> {
        emailsAdapter.add(emailText.getText().toString());
        emailText.setText("");
        createButton.setEnabled(emailsAdapter.getCount() > 0);
    });
    Email.colorValidEmail(emailText);
    emailText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            addButton.setEnabled(Email.verifyEmailPattern.matcher(s.toString()).matches());
        }
    });
    createButton.setEnabled(false);
    createButton.setOnClickListener(v -> {
        List<String> emails = new ArrayList<String>();
        for (int i = 0; i < emailsAdapter.getCount(); i++) {
            emails.add((String) emailsAdapter.getItem(i));
        }
        inviteRestriction = new Sigchain.IndirectInvitationRestriction(emails.toArray(new String[0]));
        EventBus.getDefault().post(new TeamService.RequestTeamOperation(new Sigchain.RequestableTeamOperation(inviteRestriction), C.withConfirmStatusCallback(getActivity(), this::onCreateInvite)));
    });
    cancelButton.setOnClickListener(v -> {
        getFragmentManager().popBackStack();
    });
    return rootView;
}
Also used : ListViewCompat(android.support.v7.widget.ListViewCompat) Sigchain(co.krypt.krypton.team.Sigchain) ArrayList(java.util.ArrayList) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) View(android.view.View) AppCompatEditText(android.support.v7.widget.AppCompatEditText) TeamService(co.krypt.krypton.team.TeamService) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) ArrayAdapter(android.widget.ArrayAdapter)

Example 5 with AppCompatImageButton

use of android.support.v7.widget.AppCompatImageButton in project PhoneProfilesPlus by henrichg.

the class LocationGeofencePreference method showDialog.

@Override
protected void showDialog(Bundle state) {
    if (onlyEdit == 0) {
        String value = "";
        value = getPersistedString(value);
        DatabaseHandler.getInstance(context.getApplicationContext()).checkGeofence(value, 1);
    }
    MaterialDialog.Builder mBuilder = new MaterialDialog.Builder(getContext()).title(getDialogTitle()).icon(getDialogIcon()).autoDismiss(false).content(getDialogMessage()).customView(R.layout.activity_location_pref_dialog, false).dividerColor(0);
    if (onlyEdit == 0) {
        mBuilder.positiveText(getPositiveButtonText()).negativeText(getNegativeButtonText());
        mBuilder.onPositive(new MaterialDialog.SingleButtonCallback() {

            @Override
            public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
                persistGeofence(false);
                mDialog.dismiss();
            }
        });
        mBuilder.onNegative(new MaterialDialog.SingleButtonCallback() {

            @Override
            public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
                mDialog.dismiss();
            }
        });
    } else {
        mBuilder.positiveText(getPositiveButtonText());
        mBuilder.onPositive(new MaterialDialog.SingleButtonCallback() {

            @Override
            public void onClick(@NonNull MaterialDialog materialDialog, @NonNull DialogAction dialogAction) {
                mDialog.dismiss();
            }
        });
    }
    mDialog = mBuilder.build();
    View layout = mDialog.getCustomView();
    // progressLinearLayout = layout.findViewById(R.id.location_pref_dlg_linla_progress);
    // dataRelativeLayout = layout.findViewById(R.id.location_pref_dlg_rella_data);
    // geofenceName = layout.findViewById(R.id.location_pref_dlg_geofence_name);
    // updateGUIWithGeofence(dataWrapper.getDatabaseHandler().getCheckedGeofences());
    // noinspection ConstantConditions
    AppCompatImageButton addButton = layout.findViewById(R.id.location_pref_dlg_add);
    // noinspection ConstantConditions
    ListView geofencesListView = layout.findViewById(R.id.location_pref_dlg_listview);
    listAdapter = new LocationGeofencesPreferenceAdapter(context, DatabaseHandler.getInstance(context.getApplicationContext()).getGeofencesCursor(), this);
    geofencesListView.setAdapter(listAdapter);
    refreshListView();
    geofencesListView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            LocationGeofencesPreferenceAdapter.ViewHolder viewHolder = (LocationGeofencesPreferenceAdapter.ViewHolder) v.getTag();
            /*
                if (listAdapter.selectedRB != null){
                    long gid = (long)listAdapter.selectedRB.getTag();
                    Log.d("LocationGeofencePreference.onItemClick", "checked id="+gid);
                    listAdapter.selectedRB.setChecked(false);
                }
                */
            // listAdapter.selectedRB = viewHolder.radioButton;
            long gid = viewHolder.geofenceId;
            if (onlyEdit == 0) {
                DatabaseHandler.getInstance(context.getApplicationContext()).checkGeofence(String.valueOf(gid), 2);
                // viewHolder.radioButton.setChecked(true);
                // updateGUIWithGeofence(gid);
                refreshListView();
            } else {
                startEditor(gid);
            }
        }
    });
    /*
        final TextView helpText = layout.findViewById(R.id.wifi_ssid_pref_dlg_helpText);
        String helpString = context.getString(R.string.pref_dlg_info_about_wildcards_1) + " " +
                            context.getString(R.string.pref_dlg_info_about_wildcards_2) + " " +
                            context.getString(R.string.wifi_ssid_pref_dlg_info_about_wildcards) + " " +
                            context.getString(R.string.pref_dlg_info_about_wildcards_3);
        helpText.setText(helpString);

        ImageView helpIcon = layout.findViewById(R.id.wifi_ssid_pref_dlg_helpIcon);
        helpIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int visibility = helpText.getVisibility();
                if (visibility == View.VISIBLE)
                    visibility = View.GONE;
                else
                    visibility = View.VISIBLE;
                helpText.setVisibility(visibility);
            }
        });
        */
    addButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startEditor(0);
        }
    });
    final Button unselectAllButton = layout.findViewById(R.id.location_pref_dlg_uselectAll);
    unselectAllButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            DatabaseHandler.getInstance(context.getApplicationContext()).checkGeofence("", 0);
            refreshListView();
        }
    });
    GlobalGUIRoutines.registerOnActivityDestroyListener(this, this);
    if (state != null)
        mDialog.onRestoreInstanceState(state);
    mDialog.setOnDismissListener(this);
    mDialog.show();
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AppCompatImageButton(android.support.v7.widget.AppCompatImageButton) Button(android.widget.Button) DialogAction(com.afollestad.materialdialogs.DialogAction)

Aggregations

AppCompatImageButton (android.support.v7.widget.AppCompatImageButton)14 View (android.view.View)12 ImageView (android.widget.ImageView)6 RecyclerView (android.support.v7.widget.RecyclerView)5 ViewGroup (android.view.ViewGroup)5 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 SearchManager (android.app.SearchManager)3 Context (android.content.Context)3 Intent (android.content.Intent)3 Bundle (android.os.Bundle)3 TextView (android.widget.TextView)3 DialogAction (com.afollestad.materialdialogs.DialogAction)3 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)3 DialogInterface (android.content.DialogInterface)2 Fragment (android.support.v4.app.Fragment)2 AlertDialog (android.support.v7.app.AlertDialog)2 AppCompatEditText (android.support.v7.widget.AppCompatEditText)2 AppCompatTextView (android.support.v7.widget.AppCompatTextView)2 SearchView (android.support.v7.widget.SearchView)2 ItemTouchHelper (android.support.v7.widget.helper.ItemTouchHelper)2