Search in sources :

Example 66 with ImageButton

use of android.widget.ImageButton in project pictureapp by EyeSeeTea.

the class DynamicTabAdapter method initializeNavigationButtons.

private void initializeNavigationButtons(View navigationButtonsHolder) {
    ImageButton button = (ImageButton) navigationButtonsHolder.findViewById(R.id.next_btn);
    ((LinearLayout) button.getParent()).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (isClicked) {
                Log.d(TAG, "onClick ignored to avoid double click");
                return;
            }
            Log.d(TAG, "onClicked");
            isClicked = true;
            boolean questionsWithError = false;
            for (IMultiQuestionView multiquestionView : mMultiQuestionViews) {
                if (multiquestionView.hasError()) {
                    questionsWithError = true;
                    break;
                }
            }
            Log.d(TAG, "Questions with failed validation " + failedValidations);
            if (failedValidations == 0 && !questionsWithError) {
                TableRow currentRow = (TableRow) tableLayout.getChildAt(0);
                if (!readOnly && currentRow != null && currentRow.getChildAt(0) instanceof ImageRadioButtonSingleQuestionView) {
                    navigationController.isMovingToForward = true;
                    ImageRadioButtonSingleQuestionView imageRadioButtonSingleQuestionView = (ImageRadioButtonSingleQuestionView) currentRow.getChildAt(0);
                    ImageRadioButtonOption selectedOptionView = imageRadioButtonSingleQuestionView.getSelectedOptionView();
                    if (selectedOptionView != null) {
                        final Question question = navigationController.getCurrentQuestion();
                        Option selectedOption = selectedOptionView.getOption();
                        Question counterQuestion = question.findCounterByOption(selectedOption);
                        if ((mReviewMode && isCounterValueEqualToMax(question, selectedOption))) {
                            saveOptionValue(selectedOptionView, selectedOptionView.getOption(), question, true);
                        } else if (counterQuestion != null) {
                            showConfirmCounter(selectedOptionView, selectedOptionView.getOption(), question, counterQuestion);
                        } else {
                            finishOrNext();
                        }
                    } else {
                        isClicked = false;
                    }
                } else {
                    finishOrNext();
                }
            } else if (navigationController.getCurrentQuestion().hasCompulsoryNotAnswered() || Tab.isDynamicTreatmentTab(navigationController.getCurrentTab().getType())) {
                UIMessagesStrategy.getInstance().showCompulsoryUnansweredToast();
                isClicked = false;
                return;
            } else {
                isClicked = false;
            }
        }
    });
    button = (ImageButton) navigationButtonsHolder.findViewById(R.id.back_btn);
    //Save the numberpicker value in the DB, and continue to the next screen.
    ((LinearLayout) button.getParent()).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            previous();
        }
    });
}
Also used : ImageRadioButtonOption(org.eyeseetea.malariacare.views.option.ImageRadioButtonOption) ImageButton(android.widget.ImageButton) TableRow(android.widget.TableRow) IMultiQuestionView(org.eyeseetea.malariacare.views.question.IMultiQuestionView) Question(org.eyeseetea.malariacare.data.database.model.Question) QuestionOption(org.eyeseetea.malariacare.data.database.model.QuestionOption) ImageRadioButtonOption(org.eyeseetea.malariacare.views.option.ImageRadioButtonOption) Option(org.eyeseetea.malariacare.data.database.model.Option) AKeyboardQuestionView(org.eyeseetea.malariacare.views.question.AKeyboardQuestionView) ImageView(android.widget.ImageView) AOptionQuestionView(org.eyeseetea.malariacare.views.question.AOptionQuestionView) View(android.view.View) INavigationQuestionView(org.eyeseetea.malariacare.views.question.INavigationQuestionView) IQuestionView(org.eyeseetea.malariacare.views.question.IQuestionView) ImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.ImageRadioButtonSingleQuestionView) CustomTextView(org.eyeseetea.sdk.presentation.views.CustomTextView) ListView(android.widget.ListView) IMultiQuestionView(org.eyeseetea.malariacare.views.question.IMultiQuestionView) DynamicStockImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView) IImageQuestionView(org.eyeseetea.malariacare.views.question.IImageQuestionView) NumberRadioButtonMultiquestionView(org.eyeseetea.malariacare.views.question.multiquestion.NumberRadioButtonMultiquestionView) ScrollView(android.widget.ScrollView) LinearLayout(android.widget.LinearLayout) ImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.ImageRadioButtonSingleQuestionView) DynamicStockImageRadioButtonSingleQuestionView(org.eyeseetea.malariacare.views.question.singlequestion.DynamicStockImageRadioButtonSingleQuestionView)

Example 67 with ImageButton

use of android.widget.ImageButton in project HumaneApp by Ganesh1010.

the class HomeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_page);
    appliedFilter = new TreeSet<>();
    /* Spinner */
    spinner = (Spinner) findViewById(R.id.author_spinner_donor_home);
    tvEmptyView = (TextView) findViewById(R.id.empty_view);
    spinner.setOnItemSelectedListener(HomeActivity.this);
    gson = new Gson();
    List<String> categories = new ArrayList<>();
    categories.add("Donor");
    categories.add("Organization");
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, categories);
    dataAdapter.setDropDownViewResource(android.R.layout.simple_list_item_checked);
    spinner.setAdapter(dataAdapter);
    intent = getIntent();
    Log.d("hai", intent.getStringExtra(USER_KEY_TYPE));
    if (intent.getStringExtra(USER_KEY_TYPE).equals("DONOR")) {
        if (compareValue != null) {
            compareValue = "Donor";
            int spinnerPosition = dataAdapter.getPosition(compareValue);
            spinner.setSelection(spinnerPosition);
            Log.d("hai", spinnerPosition + "");
            nextUrl = RestAPIURL.needList;
        }
    }
    if (intent.getStringExtra(USER_KEY_TYPE).equals("ORGANISATION")) {
        if (compareValue != null) {
            compareValue = "Organization";
            int spinnerPosition = dataAdapter.getPosition(compareValue);
            spinner.setSelection(spinnerPosition);
            Log.d("hai", spinnerPosition + "");
            nextUrl = RestAPIURL.orgDetails;
        }
    }
    handler = new Handler();
    /* Menu Button */
    menuButton = (ImageButton) findViewById(R.id.menu_imagebutton_donor_home);
    menuButton.setOnClickListener(HomeActivity.this);
    /* Choose Location */
    ImageButton currentLocationImageButton = (ImageButton) findViewById(R.id.current_location_imagebutton_home);
    currentLocationImageButton.setOnClickListener(HomeActivity.this);
    TextView currentLocationTextView = (TextView) findViewById(R.id.current_location_textview_home);
    currentLocationTextView.setOnClickListener(HomeActivity.this);
    filterImageButton = (ImageButton) findViewById(R.id.filter_imagebutton_donor_home);
    filterImageButton.setOnClickListener(HomeActivity.this);
    newNeedFloatingActionButton = (FloatingActionButton) findViewById(R.id.new_need_home_page);
    newNeedFloatingActionButton.setOnClickListener(HomeActivity.this);
    recyclerView = (RecyclerView) findViewById(R.id.needs_recyclerview_home_page);
}
Also used : ImageButton(android.widget.ImageButton) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) Handler(android.os.Handler) TextView(android.widget.TextView) ArrayAdapter(android.widget.ArrayAdapter)

Example 68 with ImageButton

use of android.widget.ImageButton in project TapTargetView by KeepSafe.

the class ToolbarTapTarget method findNavView.

private static View findNavView(Object instance) {
    final ToolbarProxy toolbar = proxyOf(instance);
    // First we try to find the view via its content description
    final CharSequence currentDescription = toolbar.getNavigationContentDescription();
    final boolean hadContentDescription = !TextUtils.isEmpty(currentDescription);
    final CharSequence sentinel = hadContentDescription ? currentDescription : "taptarget-findme";
    toolbar.setNavigationContentDescription(sentinel);
    final ArrayList<View> possibleViews = new ArrayList<>(1);
    toolbar.findViewsWithText(possibleViews, sentinel, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
    if (!hadContentDescription) {
        toolbar.setNavigationContentDescription(null);
    }
    if (possibleViews.size() > 0) {
        return possibleViews.get(0);
    }
    // If that doesn't work, we try to grab it via matching its drawable
    final Drawable navigationIcon = toolbar.getNavigationIcon();
    if (navigationIcon != null) {
        final int size = toolbar.getChildCount();
        for (int i = 0; i < size; ++i) {
            final View child = toolbar.getChildAt(i);
            if (child instanceof ImageButton) {
                final Drawable childDrawable = ((ImageButton) child).getDrawable();
                if (childDrawable == navigationIcon) {
                    return child;
                }
            }
        }
    }
    // "mNavButtonView" to represent the navigation icon
    try {
        return (View) ReflectUtil.getPrivateField(toolbar.internalToolbar(), "mNavButtonView");
    } catch (NoSuchFieldException e) {
        throw new IllegalStateException("Could not find navigation view for Toolbar!", e);
    } catch (IllegalAccessException e) {
        throw new IllegalStateException("Unable to access navigation view for Toolbar!", e);
    }
}
Also used : ImageButton(android.widget.ImageButton) ArrayList(java.util.ArrayList) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) View(android.view.View)

Example 69 with ImageButton

use of android.widget.ImageButton in project SuperToasts by JohnPersano.

the class TabStrip method addIconTab.

private void addIconTab(final int position, int resId) {
    ImageButton tab = new ImageButton(getContext());
    tab.setImageResource(resId);
    addTab(position, tab);
}
Also used : ImageButton(android.widget.ImageButton)

Example 70 with ImageButton

use of android.widget.ImageButton in project emojicon by rockerhieu.

the class EmojiconsView method addTabIcon.

private void addTabIcon(EmojiconPage page, int index) {
    ImageButton icon = new ImageButton(getContext());
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT);
    params.weight = 1;
    icon.setBackground(null);
    icon.setScaleType(ImageView.ScaleType.CENTER);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        icon.setImageDrawable(getContext().getResources().getDrawable(page.getIcon()));
    } else {
        icon.setImageDrawable(getContext().getDrawable(page.getIcon()));
    }
    mTabsContainer.addView(icon, mTabsContainer.getChildCount() - 2, params);
    mTabs[index] = icon;
    final int indexToMove = index;
    icon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mViewPager.setCurrentItem(indexToMove, true);
        }
    });
}
Also used : ImageButton(android.widget.ImageButton) ImageView(android.widget.ImageView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Aggregations

ImageButton (android.widget.ImageButton)158 View (android.view.View)112 TextView (android.widget.TextView)87 ImageView (android.widget.ImageView)55 Button (android.widget.Button)27 ListView (android.widget.ListView)25 AdapterView (android.widget.AdapterView)24 OnClickListener (android.view.View.OnClickListener)21 LinearLayout (android.widget.LinearLayout)21 Intent (android.content.Intent)19 RelativeLayout (android.widget.RelativeLayout)13 DialogInterface (android.content.DialogInterface)12 Bundle (android.os.Bundle)11 LayoutInflater (android.view.LayoutInflater)11 EditText (android.widget.EditText)11 ViewGroup (android.view.ViewGroup)10 ArrayList (java.util.ArrayList)10 Builder (android.app.AlertDialog.Builder)7 Drawable (android.graphics.drawable.Drawable)7 RecyclerView (android.support.v7.widget.RecyclerView)7