Java Code Examples for android.widget.ImageView.getVisibility()

The following are Jave code examples for showing how to use getVisibility() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: xlight_android_native   File: ConnectingActivity.java   Source Code and License Vote up 7 votes
private void updateProgress(StepProgress progress, View progressStepContainer) {
    ProgressBar progBar = Ui.findView(progressStepContainer, R.id.spinner);
    ImageView checkmark = Ui.findView(progressStepContainer, R.id.checkbox);

    // don't show the spinner again if we've already shown the checkmark,
    // regardless of the underlying state that might hide
    if (checkmark.getVisibility() == View.VISIBLE) {
        return;
    }

    progressStepContainer.setVisibility(View.VISIBLE);

    if (progress.status == StepProgress.STARTING) {
        checkmark.setVisibility(View.GONE);

        progBar.setProgressDrawable(tintedSpinner);
        progBar.setVisibility(View.VISIBLE);

    } else {
        progBar.setVisibility(View.GONE);

        checkmark.setImageDrawable(tintedCheckmark);
        checkmark.setVisibility(View.VISIBLE);
    }
}
 
Example 2
Project: iosched-reader   File: SessionDetailFragment.java   Source Code and License Vote up 7 votes
/**
 * Aligns the Twitter icon the parent bottom right. Aligns the G+ icon to the left of the
 * Twitter icon if it is present. Otherwise, aligns the G+ icon to the parent bottom right.
 */
private void determineSocialIconPlacement(ImageView plusOneIcon, ImageView twitterIcon) {
    if (plusOneIcon.getVisibility() == View.VISIBLE) {
        // Set the dimensions of the G+ button.
        int socialIconDimension = getResources().getDimensionPixelSize(
                R.dimen.social_icon_box_size);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                socialIconDimension, socialIconDimension);
        params.addRule(RelativeLayout.BELOW, R.id.speaker_abstract);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

        if (twitterIcon.getVisibility() == View.VISIBLE) {
            params.addRule(RelativeLayout.LEFT_OF, R.id.twitter_icon_box);
        } else {
            params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        }
        plusOneIcon.setLayoutParams(params);
    }
}
 
Example 3
Project: JavaIsFun   File: Condicao7.java   Source Code and License Vote up 7 votes
public void avancarTxt(View view) {
    ImageView imageView44 = (ImageView) findViewById(R.id.imageView44);
    TextView exp2 = (TextView) findViewById(R.id.exp2);
    if(imageView44.getVisibility()==View.VISIBLE) {
        findViewById(R.id.voltar).setVisibility(View.VISIBLE);
        findViewById(R.id.proximo).setVisibility(View.GONE);
        findViewById(R.id.exp2).setVisibility(View.VISIBLE);
        findViewById(R.id.avancar).setVisibility(View.VISIBLE);
        findViewById(R.id.imageView44).setVisibility(View.GONE);
    }else
    if (exp2.getVisibility() == View.VISIBLE) {
        findViewById(R.id.voltar).setVisibility(View.VISIBLE);
        findViewById(R.id.proximo).setVisibility(View.VISIBLE);
        findViewById(R.id.exp3).setVisibility(View.VISIBLE);
        findViewById(R.id.exp2).setVisibility(View.GONE);
        findViewById(R.id.avancar).setVisibility(View.GONE);
        findViewById(R.id.imageView44).setVisibility(View.GONE);


    }
}
 
Example 4
Project: JavaIsFun   File: Scanner7.java   Source Code and License Vote up 7 votes
public void selecionar(View view) {
    ImageView incorreto = (ImageView) findViewById(R.id.incorreto);
    ImageView correto = (ImageView) findViewById(R.id.correto);
    if (incorreto.getVisibility() == View.VISIBLE) {
        findViewById(R.id.titulo1).setVisibility(View.GONE);
        findViewById(R.id.titulo2).setVisibility(View.GONE);
        findViewById(R.id.textCorreto).setVisibility(View.VISIBLE);
        findViewById(R.id.wink).setVisibility(View.VISIBLE);
        findViewById(R.id.buttonProx).setVisibility(View.VISIBLE);
        findViewById(R.id.deslizeWarn).setVisibility(View.GONE);
        findViewById(R.id.incorreto).setVisibility(View.GONE);
    } else if (correto.getVisibility() == View.VISIBLE) {
        findViewById(R.id.titulo1).setVisibility(View.GONE);
        findViewById(R.id.titulo2).setVisibility(View.GONE);
        findViewById(R.id.textErrado).setVisibility(View.VISIBLE);
        findViewById(R.id.textErrado2).setVisibility(View.VISIBLE);
        findViewById(R.id.buttonProx).setVisibility(View.VISIBLE);
        findViewById(R.id.deslizeWarn).setVisibility(View.GONE);
        findViewById(R.id.correto).setVisibility(View.GONE);
    }

}
 
Example 5
Project: GitHub   File: ImageLoader.java   Source Code and License Vote up 6 votes
private boolean validView4Callback(boolean forceValidAsyncDrawable) {
    final ImageView view = viewRef.get();
    if (view != null) {
        Drawable otherDrawable = view.getDrawable();
        if (otherDrawable instanceof AsyncDrawable) {
            ImageLoader otherLoader = ((AsyncDrawable) otherDrawable).getImageLoader();
            if (otherLoader != null) {
                if (otherLoader == this) {
                    if (view.getVisibility() != View.VISIBLE) {
                        otherLoader.cancel();
                        return false;
                    } else {
                        return true;
                    }
                } else {
                    if (this.seq > otherLoader.seq) {
                        otherLoader.cancel();
                        return true;
                    } else {
                        this.cancel();
                        return false;
                    }
                }
            }
        } else if (forceValidAsyncDrawable) {
            this.cancel();
            return false;
        }
        return true;
    }
    return false;
}
 
Example 6
Project: JavaIsFun   File: Classe4.java   Source Code and License Vote up 6 votes
public void prox(View view) {
    ImageView imageViewtop = (ImageView) findViewById(R.id.corretoerrado);
    ImageView classpeixe = (ImageView) findViewById(R.id.classpeixe);
    ImageView classcachorro = (ImageView) findViewById(R.id.classcachorro);
    ImageView classgato = (ImageView) findViewById(R.id.classgato);
    ImageView classabelha = (ImageView) findViewById(R.id.classabelha);
    TextView erradoabelha = (TextView) findViewById(R.id.erradoAbelha);
    TextView erradocachorro = (TextView) findViewById(R.id.erradoCachorro);
    TextView erradogato = (TextView) findViewById(R.id.erradoGato);
    imageViewtop.setVisibility(View.GONE);
    if (classabelha.getVisibility() == View.VISIBLE || erradoabelha.getVisibility() == View.VISIBLE) {
        findViewById(R.id.classabelha).setVisibility(View.GONE);
        findViewById(R.id.classgato).setVisibility(View.VISIBLE);
        findViewById(R.id.antP).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        imageViewtop.setVisibility(View.GONE);
    } else if (classgato.getVisibility() == View.VISIBLE || erradogato.getVisibility() == View.VISIBLE) {
        findViewById(R.id.classgato).setVisibility(View.GONE);
        findViewById(R.id.classcachorro).setVisibility(View.VISIBLE);
        findViewById(R.id.antP).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        imageViewtop.setVisibility(View.GONE);
    } else if (classcachorro.getVisibility() == View.VISIBLE || erradocachorro.getVisibility() == View.VISIBLE) {
        findViewById(R.id.classcachorro).setVisibility(View.GONE);
        findViewById(R.id.classpeixe).setVisibility(View.VISIBLE);
        findViewById(R.id.proxP).setVisibility(View.GONE);
        findViewById(R.id.antP).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        imageViewtop.setVisibility(View.GONE);
    }
}
 
Example 7
Project: cwac-crossport   File: TabLayoutLite.java   Source Code and License Vote up 5 votes
private void updateTextAndIcon(@Nullable final TextView textView,
            @Nullable final ImageView iconView) {
  final Drawable icon = mTab != null ? mTab.getIcon() : null;
  final CharSequence text = mTab != null ? mTab.getText() : null;
  final CharSequence contentDesc = mTab != null ? mTab.getContentDescription() : null;

  if (iconView != null) {
    if (icon != null) {
      iconView.setImageDrawable(icon);
      iconView.setVisibility(VISIBLE);
      setVisibility(VISIBLE);
    } else {
      iconView.setVisibility(GONE);
      iconView.setImageDrawable(null);
    }
    iconView.setContentDescription(contentDesc);
  }

  final boolean hasText = !TextUtils.isEmpty(text);
  if (textView != null) {
    if (hasText) {
      textView.setText(text);
      textView.setVisibility(VISIBLE);
      setVisibility(VISIBLE);
    } else {
      textView.setVisibility(GONE);
      textView.setText(null);
    }
    textView.setContentDescription(contentDesc);
  }

  if (iconView != null) {
    MarginLayoutParams lp = ((MarginLayoutParams) iconView.getLayoutParams());
    int bottomMargin = 0;
    if (hasText && iconView.getVisibility() == VISIBLE) {
      // If we're showing both text and icon, add some margin bottom to the icon
      bottomMargin = dpToPx(DEFAULT_GAP_TEXT_ICON);
    }
    if (bottomMargin != lp.bottomMargin) {
      lp.bottomMargin = bottomMargin;
      iconView.requestLayout();
    }
  }
        TooltipCompat.setTooltipText(this, hasText ? null : contentDesc);
}
 
Example 8
Project: cwac-crossport   File: TabLayout.java   Source Code and License Vote up 5 votes
private void updateTextAndIcon(@Nullable final TextView textView,
            @Nullable final ImageView iconView) {
  final Drawable icon = mTab != null ? mTab.getIcon() : null;
  final CharSequence text = mTab != null ? mTab.getText() : null;
  final CharSequence contentDesc = mTab != null ? mTab.getContentDescription() : null;

  if (iconView != null) {
    if (icon != null) {
      iconView.setImageDrawable(icon);
      iconView.setVisibility(VISIBLE);
      setVisibility(VISIBLE);
    } else {
      iconView.setVisibility(GONE);
      iconView.setImageDrawable(null);
    }
    iconView.setContentDescription(contentDesc);
  }

  final boolean hasText = !TextUtils.isEmpty(text);
  if (textView != null) {
    if (hasText) {
      textView.setText(text);
      textView.setVisibility(VISIBLE);
      setVisibility(VISIBLE);
    } else {
      textView.setVisibility(GONE);
      textView.setText(null);
    }
    textView.setContentDescription(contentDesc);
  }

  if (iconView != null) {
    MarginLayoutParams lp = ((MarginLayoutParams) iconView.getLayoutParams());
    int bottomMargin = 0;
    if (hasText && iconView.getVisibility() == VISIBLE) {
      // If we're showing both text and icon, add some margin bottom to the icon
      bottomMargin = dpToPx(DEFAULT_GAP_TEXT_ICON);
    }
    if (bottomMargin != lp.bottomMargin) {
      lp.bottomMargin = bottomMargin;
      iconView.requestLayout();
    }
  }
        TooltipCompat.setTooltipText(this, hasText ? null : contentDesc);
}
 
Example 9
Project: boohee_v5.6   File: TabLayout.java   Source Code and License Vote up 5 votes
private void updateTextAndIcon(@Nullable TextView textView, @Nullable ImageView iconView) {
    Drawable icon;
    CharSequence text;
    CharSequence contentDesc;
    boolean hasText;
    if (this.mTab != null) {
        icon = this.mTab.getIcon();
    } else {
        icon = null;
    }
    if (this.mTab != null) {
        text = this.mTab.getText();
    } else {
        text = null;
    }
    if (this.mTab != null) {
        contentDesc = this.mTab.getContentDescription();
    } else {
        contentDesc = null;
    }
    if (iconView != null) {
        if (icon != null) {
            iconView.setImageDrawable(icon);
            iconView.setVisibility(0);
            setVisibility(0);
        } else {
            iconView.setVisibility(8);
            iconView.setImageDrawable(null);
        }
        iconView.setContentDescription(contentDesc);
    }
    if (TextUtils.isEmpty(text)) {
        hasText = false;
    } else {
        hasText = true;
    }
    if (textView != null) {
        if (hasText) {
            textView.setText(text);
            textView.setVisibility(0);
            setVisibility(0);
        } else {
            textView.setVisibility(8);
            textView.setText(null);
        }
        textView.setContentDescription(contentDesc);
    }
    if (iconView != null) {
        MarginLayoutParams lp = (MarginLayoutParams) iconView.getLayoutParams();
        int bottomMargin = 0;
        if (hasText && iconView.getVisibility() == 0) {
            bottomMargin = TabLayout.this.dpToPx(8);
        }
        if (bottomMargin != lp.bottomMargin) {
            lp.bottomMargin = bottomMargin;
            iconView.requestLayout();
        }
    }
    if (hasText || TextUtils.isEmpty(contentDesc)) {
        setOnLongClickListener(null);
        setLongClickable(false);
        return;
    }
    setOnLongClickListener(this);
}
 
Example 10
Project: JavaIsFun   File: Classe4.java   Source Code and License Vote up 5 votes
public void ant(View view) {
    ImageView imageViewtop = (ImageView) findViewById(R.id.corretoerrado);

    TextView textocorreto = (TextView) findViewById(R.id.textCorreto);
    TextView erradocachorro = (TextView) findViewById(R.id.erradoCachorro);
    TextView erradogato = (TextView) findViewById(R.id.erradoGato);
    ImageView classpeixe = (ImageView) findViewById(R.id.classpeixe);
    ImageView classcachorro = (ImageView) findViewById(R.id.classcachorro);
    ImageView classgato = (ImageView) findViewById(R.id.classgato);
    ImageView classabelha = (ImageView) findViewById(R.id.classabelha);


    if (classgato.getVisibility() == View.VISIBLE || erradogato.getVisibility() == View.VISIBLE) {
        findViewById(R.id.classgato).setVisibility(View.GONE);
        findViewById(R.id.classabelha).setVisibility(View.VISIBLE);
        findViewById(R.id.antP).setVisibility(View.GONE);
        findViewById(R.id.proxP).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        findViewById(R.id.textCorreto).setVisibility(View.GONE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        imageViewtop.setVisibility(View.GONE);
    } else if (classcachorro.getVisibility() == View.VISIBLE || erradocachorro.getVisibility() == View.VISIBLE) {
        findViewById(R.id.classcachorro).setVisibility(View.GONE);
        findViewById(R.id.classgato).setVisibility(View.VISIBLE);
        findViewById(R.id.proxP).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        findViewById(R.id.textCorreto).setVisibility(View.GONE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        imageViewtop.setVisibility(View.GONE);
    } else if (classpeixe.getVisibility() == View.VISIBLE || textocorreto.getVisibility() == View.VISIBLE) {
        findViewById(R.id.classpeixe).setVisibility(View.GONE);
        findViewById(R.id.classcachorro).setVisibility(View.VISIBLE);
        findViewById(R.id.proxP).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        findViewById(R.id.textCorreto).setVisibility(View.GONE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        imageViewtop.setVisibility(View.GONE);

    }

}
 
Example 11
Project: JavaIsFun   File: Classe4.java   Source Code and License Vote up 5 votes
public void verificar(View view) {
    ImageView imageViewtop = (ImageView) findViewById(R.id.corretoerrado);

    TextView erradoabelha = (TextView) findViewById(R.id.erradoAbelha);
    TextView erradocachorro = (TextView) findViewById(R.id.erradoCachorro);
    TextView erradogato = (TextView) findViewById(R.id.erradoGato);
    TextView textocorreto = (TextView) findViewById(R.id.textCorreto);
    ImageView classpeixe = (ImageView) findViewById(R.id.classpeixe);
    ImageView classcachorro = (ImageView) findViewById(R.id.classcachorro);
    ImageView classgato = (ImageView) findViewById(R.id.classgato);
    ImageView classabelha = (ImageView) findViewById(R.id.classabelha);
    if (classpeixe.getVisibility() == View.VISIBLE) {
        findViewById(R.id.textCorreto).setVisibility(View.VISIBLE);
        findViewById(R.id.imageButton63).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        findViewById(R.id.classpeixe).setVisibility(View.GONE);
        imageViewtop.setImageResource(R.drawable.happy);
        imageViewtop.setVisibility(View.VISIBLE);
    } else if (classcachorro.getVisibility() == View.VISIBLE) {
        findViewById(R.id.textCorreto).setVisibility(View.GONE);
        findViewById(R.id.imageButton63).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        findViewById(R.id.erradoCachorro).setVisibility(View.VISIBLE);
        findViewById(R.id.classcachorro).setVisibility(View.GONE);
        imageViewtop.setImageResource(R.drawable.sad);
        imageViewtop.setVisibility(View.VISIBLE);
    } else if (classgato.getVisibility() == View.VISIBLE) {
        findViewById(R.id.textCorreto).setVisibility(View.GONE);
        findViewById(R.id.imageButton63).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoAbelha).setVisibility(View.GONE);
        findViewById(R.id.erradoGato).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        findViewById(R.id.classgato).setVisibility(View.GONE);
        imageViewtop.setImageResource(R.drawable.sad);
        imageViewtop.setVisibility(View.VISIBLE);
    } else if (classabelha.getVisibility() == View.VISIBLE) {
        findViewById(R.id.textCorreto).setVisibility(View.GONE);
        findViewById(R.id.imageButton63).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoAbelha).setVisibility(View.VISIBLE);
        findViewById(R.id.erradoGato).setVisibility(View.GONE);
        findViewById(R.id.erradoCachorro).setVisibility(View.GONE);
        findViewById(R.id.classabelha).setVisibility(View.GONE);
        imageViewtop.setImageResource(R.drawable.sad);
        imageViewtop.setVisibility(View.VISIBLE);
    }
}