List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:com.example.android.bangla.WordAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View listItemView = convertView; if (listItemView == null) { listItemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, parent, false); }// w w w . j a va2 s . c o m Word currentWord = getItem(position); TextView banglaTextView = (TextView) listItemView.findViewById(R.id.bangla_text_view); banglaTextView.setText(currentWord.getMiwokTranslationId()); TextView englishTextView = (TextView) listItemView.findViewById(R.id.default_text_view); englishTextView.setText(currentWord.getDefaultTranslationId()); ImageView imageView = (ImageView) listItemView.findViewById(R.id.image); if (currentWord.hasImage()) { imageView.setImageResource(currentWord.getImageResourceId()); imageView.setVisibility(View.VISIBLE); } else { imageView.setVisibility(View.GONE); } View textContainer = listItemView.findViewById(R.id.text_container); int color = ContextCompat.getColor(getContext(), bColorResourceId); textContainer.setBackgroundColor(color); return listItemView; }
From source file:com.mastercard.masterpasswallet.adapters.CardPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { final Card card = mCards.get(position); View view = LayoutInflater.from(mContext).inflate(R.layout.partial_payment_card, null); ImageView cardImage = (ImageView) view.findViewById(R.id.img_card); cardImage.setImageResource(card.getCardImageFull()); TextView cardPan = (TextView) view.findViewById(R.id.txt_card_pan); cardPan.setText(mContext.getString(R.string.masked_pan, " " + card.getPANEnding())); TextView cardName = (TextView) view.findViewById(R.id.txt_card_name); cardName.setText(card.getCardName()); cardName.setVisibility(View.VISIBLE); // Show/hide overlay to indicate if card is suspended or not View inactiveOverlay = view.findViewById(R.id.img_overlay); if (card.IsActive()) { inactiveOverlay.setVisibility(View.GONE); } else {/*from www . jav a 2s . c o m*/ inactiveOverlay.setVisibility(View.VISIBLE); } // Set actions if (mListener != null) { // Configure card info action ImageView imgInfo = (ImageView) view.findViewById(R.id.img_info); imgInfo.setVisibility(View.VISIBLE); imgInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListener.showCardInfo(card); } }); // Configure making card default ImageView imgDefaultCard = (ImageView) view.findViewById(R.id.img_default_card); imgDefaultCard.setVisibility(View.VISIBLE); if (card.isDefault(PaymentContext.CONTACTLESS)) { imgDefaultCard.setImageResource(R.drawable.ic_favourite_selected); } else { imgDefaultCard.setImageResource(R.drawable.ic_favourite_deselected); } imgDefaultCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mListener.makeDefaultcard(card); } }); } // Configure card balance View layBalance = view.findViewById(R.id.lay_balance); layBalance.setVisibility(View.VISIBLE); TextView txtBalanceType = (TextView) view.findViewById(R.id.tvBalanceType); TextView txtBalance = (TextView) view.findViewById(R.id.tvBalance); if (card.isCreditCard()) { txtBalanceType.setText("Current Balance:"); } else { txtBalanceType.setText("Available Balance:"); } DecimalFormat decimalFormat = new DecimalFormat("$##,##0.00"); String amount = decimalFormat.format(card.getCardBalance() / 100f); txtBalance.setText(amount); // Add the layout to the container container.addView(view); return view; }
From source file:com.apptentive.android.sdk.module.engagement.interaction.fragment.UpgradeMessageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.apptentive_upgrade_message_interaction, container, false); ImageView iconView = (ImageView) v.findViewById(R.id.icon); Drawable icon = getIconDrawableResourceId(); if (icon != null) { iconView.setImageDrawable(icon); } else {//from w w w . ja v a 2 s . co m iconView.setVisibility(View.GONE); } WebView webview = (WebView) v.findViewById(R.id.webview); webview.loadData(interaction.getBody(), "text/html", "UTF-8"); webview.setBackgroundColor(Color.TRANSPARENT); // Hack to keep webview background from being colored after load. // If branding is not desired, turn the view off. final View branding = v.findViewById(R.id.apptentive_branding_view); if (branding != null) { if (!interaction.isShowPoweredBy() || Configuration.load().isHideBranding(getContext())) { branding.setVisibility(View.GONE); } } return v; }
From source file:eu.operando.proxy.wifi.AccessPointsDetail.java
public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) { TextView ssidLabel = (TextView) view.findViewById(R.id.ssid); ssidLabel.setText(wiFiDetail.getTitle()); TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed); String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress(); boolean isConnected = StringUtils.isNotBlank(ipAddress); if (!isConnected) { textLinkSpeed.setVisibility(View.GONE); ssidLabel.setTextColor(resources.getColor(android.R.color.white)); } else {/* www.jav a 2 s. c o m*/ ssidLabel.setTextColor(resources.getColor(R.color.connected)); int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed(); if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) { textLinkSpeed.setVisibility(View.GONE); } else { textLinkSpeed.setVisibility(View.VISIBLE); textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS)); } } WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); ImageView imageView = (ImageView) view.findViewById(R.id.levelImage); imageView.setImageResource(strength.imageResource()); imageView.setColorFilter(resources.getColor(strength.colorResource())); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(resources.getColor(R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(resources.getColor(strength.colorResource())); ((TextView) view.findViewById(R.id.channel)) .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel())); ((TextView) view.findViewById(R.id.frequency)) .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance())); ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities()); LayoutInflater layoutInflater = mainContext.getLayoutInflater(); final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig(); ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage); if (wiFiApConfig != null) { configuredImage.setVisibility(View.VISIBLE); if (isOperandoCompatible(wiFiApConfig)) { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light)); view.setOnClickListener( new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected)); } else { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light)); view.setOnClickListener(new ForgetClickListener(context, wiFiDetail)); } } else { configuredImage.setVisibility(View.GONE); view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater)); } }
From source file:nl.privacybarometer.privacyvandaag.adapter.FeedsCursorAdapter.java
@Override protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) { ImageView indicatorImage = (ImageView) view.findViewById(R.id.indicator); if (cursor.getInt(mIsGroupPos) == 1) { indicatorImage.setVisibility(View.VISIBLE); TextView textView = ((TextView) view.findViewById(android.R.id.text1)); textView.setEnabled(true);/* w w w. j a va 2s . c o m*/ textView.setText(cursor.getString(mNamePos)); textView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); textView.setText(cursor.getString(mNamePos)); if (isExpanded) indicatorImage.setImageResource(R.drawable.group_expanded); else indicatorImage.setImageResource(R.drawable.group_collapsed); } else { bindChildView(view, context, cursor); indicatorImage.setVisibility(View.GONE); } }
From source file:eu.operando.operandoapp.wifi.AccessPointsDetail.java
public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) { TextView ssidLabel = (TextView) view.findViewById(R.id.ssid); ssidLabel.setText(wiFiDetail.getTitle()); TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed); textLinkSpeed.setTextColor(Color.BLACK); String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress(); boolean isConnected = StringUtils.isNotBlank(ipAddress); if (!isConnected) { textLinkSpeed.setVisibility(View.GONE); ssidLabel.setTextColor(resources.getColor(android.R.color.black)); } else {/*from w w w . ja va 2 s. c om*/ ssidLabel.setTextColor(resources.getColor(R.color.connected)); int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed(); if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) { textLinkSpeed.setVisibility(View.GONE); } else { textLinkSpeed.setVisibility(View.VISIBLE); textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS)); } } WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); ImageView imageView = (ImageView) view.findViewById(R.id.levelImage); imageView.setImageResource(strength.imageResource()); imageView.setColorFilter(resources.getColor(strength.colorResource())); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(resources.getColor(R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(Color.BLACK); //textLevel.setTextColor(resources.getColor(strength.colorResource())); ((TextView) view.findViewById(R.id.channel)) .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel())); ((TextView) view.findViewById(R.id.frequency)) .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance())); ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities()); LayoutInflater layoutInflater = mainContext.getLayoutInflater(); final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig(); ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage); if (wiFiApConfig != null) { configuredImage.setVisibility(View.VISIBLE); if (isOperandoCompatible(wiFiApConfig)) { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light)); view.setOnClickListener( new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected)); } else { configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light)); view.setOnClickListener(new ForgetClickListener(context, wiFiDetail)); } } else { configuredImage.setVisibility(View.GONE); view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater)); } }
From source file:libra.spicy.vlicense.activity.QuestionActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_question); mQuestionActivityController = new QuestionActivityController(this, Chapter.Chapter2); // mAnswerAdapter = new QuestionAnswerListviewAdapter(this, // R.layout.question_listview_item); ViewPager viewPager = (ViewPager) findViewById(R.id.question_view_pager); LayoutInflater inflater = LayoutInflater.from(this); // ViewpageViewer final ArrayList<View> viewList = new ArrayList<View>(); for (int i = 0; i < 4; i++) { // pageView4 View view1 = inflater.inflate(R.layout.layout1, null); viewList.add(view1);// w w w .j a v a2 s. c om } PagerAdapter pageAdapter = new PagerAdapter() { @Override public int getCount() { // System.out.println("getCount"); return mQuestionActivityController.numberOfQueston(); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public Object instantiateItem(ViewGroup container, int position) { Log.d("debug", "instantiateItem position:" + position); // Question question = mQuestionActivityController.getQuestionAtPosition(position); // View View view = viewList.get(position % viewList.size()); // viewPager TextView question_textview = (TextView) view.findViewById(R.id.question_textview); question_textview.setText(question.getQuestion()); // viewPager if (question.getImageFileName() != null && question.getImageFileName().trim().length() > 0) { // System.out.println(String.format("id=%d has a imagefile", // question.getQuestionNumber())); Bitmap image = getImageFromAssetsFile(question.getImageFileName()); // System.out.println("image is " + image); ImageView imageView = (ImageView) view.findViewById(R.id.question_image); imageView.setVisibility(View.VISIBLE); imageView.setImageBitmap(image); } // ListviewCheckBox ListView answerListview = (ListView) view.findViewById(R.id.question_list_view); answerListview.setOnItemClickListener(QuestionActivity.this); answerListview.setAdapter( new QuestionAnswerListviewAdapter(QuestionActivity.this, question.getAnswers())); ((ViewPager) container).addView(view); return view; } @Override public void destroyItem(ViewGroup container, int position, Object object) { Log.d("debug", "destroyItem position:" + position); ((ViewPager) container).removeView(viewList.get(position % viewList.size())); } }; viewPager.setAdapter(pageAdapter); }
From source file:de.tudarmstadt.informatik.secuso.phishedu2.SwipeActivity.java
protected void hideStars(View layout) { ImageView[] stars = getStars(layout); for (ImageView star : stars) { if (star != null) { star.setVisibility(View.INVISIBLE); }/*www. j av a 2 s . co m*/ } }
From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingCursorAdapter.java
/** * Stop the animation drawable on this imageView and hide the imageView. *///from w w w. j a v a2 s . c o m private void stopAnimation(final ImageView imageView) { if (imageView.getVisibility() == View.VISIBLE) { Log.v(TAG, "stopAnimation"); imageView.setVisibility(View.INVISIBLE); final AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getDrawable(); animationDrawable.setVisible(false, false); } }
From source file:com.gammalabs.wifianalyzer.wifi.AccessPointsAdapter.java
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { WiFiDetail wiFiDetail = (WiFiDetail) getGroup(groupPosition); View view = accessPointDetail.makeView(convertView, parent, wiFiDetail, false); attachPopup(view, wiFiDetail);/*w w w.ja va 2 s . c om*/ ImageView groupIndicator = (ImageView) view.findViewById(R.id.groupIndicator); int childrenCount = getChildrenCount(groupPosition); if (childrenCount > 0) { groupIndicator.setVisibility(View.VISIBLE); groupIndicator.setImageResource( isExpanded ? R.drawable.ic_expand_less_black_24dp : R.drawable.ic_expand_more_black_24dp); groupIndicator.setColorFilter(ContextCompat.getColor(context, R.color.icons_color)); } else { groupIndicator.setVisibility(View.GONE); } return view; }