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