Java Code Examples for android.widget.ImageButton#getTag()

The following examples show how to use android.widget.ImageButton#getTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TabletTabSwitcherLayout.java    From ChromeLikeTabSwitcher with Apache License 2.0 6 votes vote down vote up
/**
 * Animates the visibility of a tab's close button.
 *
 * @param viewHolder
 *         The view holder, which holds a reference to the close button, whose visibility should
 *         be animated, as an instance of the class {@link AbstractTabViewHolder}. The view
 *         holder may not be null
 * @param show
 *         True, if the close button should be shown, false otherwise
 */
private void animateCloseButtonVisibility(@NonNull final AbstractTabViewHolder viewHolder,
                                          final boolean show) {
    ImageButton closeButton = viewHolder.closeButton;
    Boolean visible = (Boolean) closeButton.getTag(R.id.tag_visibility);

    if (visible == null || visible != show) {
        closeButton.setTag(R.id.tag_visibility, show);

        if (closeButton.getAnimation() != null) {
            closeButton.getAnimation().cancel();
        }

        ViewPropertyAnimator animation = closeButton.animate();
        animation.setListener(createCloseButtonVisibilityAnimationListener(viewHolder, show));
        animation.alpha(show ? 1 : 0);
        animation.setStartDelay(0);
        animation.setDuration(closeButtonVisibilityAnimationDuration);
        animation.start();
    }
}
 
Example 2
Source File: FormNavigationUI.java    From commcare-android with Apache License 2.0 6 votes vote down vote up
private static void setDoneState(ImageButton nextButton,
                                 Context context,
                                 final ClippingFrame finishButton,
                                 FormNavigationController.NavigationDetails details,
                                 ProgressBar progressBar) {
    if (nextButton.getTag() == null) {
        setFinishVisible(finishButton);
    } else if (!FormEntryConstants.NAV_STATE_DONE.equals(nextButton.getTag())) {
        nextButton.setTag(FormEntryConstants.NAV_STATE_DONE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            expandAndShowFinishButton(context, finishButton);
        } else {
            setFinishVisible(finishButton);
        }
    }

    progressBar.setProgressDrawable(context.getResources().getDrawable(R.drawable.progressbar_full));
    progressBar.setProgress(details.totalQuestions);

    Log.i("Questions", "Form complete");
}
 
Example 3
Source File: VisibilityManager.java    From fullscreen-video-view with Apache License 2.0 5 votes vote down vote up
/**
 * Search recursively through all children of the parent layout and checks their class.
 * If they are ViewGroup classes, continues the recursion,
 * if they are View classes, terminates the recursion
 * <p>
 * Used in {@link #hideVisibleViews(ViewGroup)} to get all the Views that should be hidden
 * Used in {@link #showHiddenViews()} to get all the Views that should be shown
 *
 * @param parentLayout the top layout in XML file
 * @return a list of all non-ViewGroup views from the parent layout except the VideoView,
 * but including Toolbar
 */
private List<View> getVisibleChildViews(View parentLayout) {
    if (!shouldCheckChildren(parentLayout)) {
        return Collections.singletonList(parentLayout);
    }

    int childCount = ((ViewGroup) parentLayout).getChildCount();
    List<View> children = new ArrayList<>(childCount);
    for (int i = 0; i < childCount; i++) {
        View view = ((ViewGroup) parentLayout).getChildAt(i);
        if (shouldCheckChildren(view)) {
            children.addAll(getVisibleChildViews(view));
        } else {
            if (view instanceof FullscreenVideoView) {
                ImageButton fullscreenButton = view.findViewById(R.id.fullscreen_media_button);
                String buttonTag = (String) fullscreenButton.getTag();

                if (view.getVisibility() == VISIBLE &&
                        !Objects.equals(buttonTag, VIEW_TAG_CLICKED)) {
                    children.add(view);
                }
            } else {
                if (view.getVisibility() == VISIBLE) {
                    children.add(view);
                }
            }
        }
    }
    return children;
}
 
Example 4
Source File: RichEditWidgetView.java    From android-notepad with MIT License 5 votes vote down vote up
@Override public void onClick(View v){
	if (v instanceof ImageButton){
		ImageButton action = (ImageButton) v;
		Effect effect = (Effect) action.getTag();
		if (lastSelectionEffects.contains(effect)){
			richEditText.applyEffect(effect, false);
			setActionOff(action);
			lastSelectionEffects.remove(effect);
		}else{
			richEditText.applyEffect(effect, true);
			setActionOn(action);
			lastSelectionEffects.add(effect);
		}
	}
}
 
Example 5
Source File: NA_Native.java    From test-samples with Apache License 2.0 5 votes vote down vote up
private void tileClick(int x, int y) {
    ImageButton tile = tiles[x][y];

    if (tile.getTag() == STATE_HIGHLIGHTED) {
        swap(swapTile[0], swapTile[1], x, y);
        swapTile = new int[]{-1, -1};
        incrementRound();
    } else {
        swapTile = new int[]{x, y};
        tile.setTag(STATE_PRESSED);
        tile.setEnabled(false);
        tile.setBackgroundResource(R.drawable.button_game_pressed);
        highlightNeighbours(x, y);
    }
}
 
Example 6
Source File: ButtonsFragment.java    From android-vlc-remote with GNU General Public License v3.0 5 votes vote down vote up
private void updateDVDButton() {
    if(getView() == null) {
        return;
    }
    ImageButton dvd = (ImageButton) getView().findViewById(R.id.button_navigation);
    if(dvd != null && dvd.getTag() == null) {
        dvd.setVisibility(Preferences.get(getActivity()).isHideDVDTabSet() ? View.GONE : View.VISIBLE);
    }
}