Example usage for android.widget ImageView setVisibility

List of usage examples for android.widget ImageView setVisibility

Introduction

In this page you can find the example usage for android.widget ImageView setVisibility.

Prototype

@RemotableViewMethod
    @Override
    public void setVisibility(int visibility) 

Source Link

Usage

From source file:com.mobicage.rogerthat.GroupDetailActivity.java

private void updateGroupForEdit() {
    T.UI();//  w ww  .jav a  2 s .  c om
    final Button saveBtn = (Button) findViewById(R.id.save_group);
    final ImageView editBtn = (ImageView) findViewById(R.id.edit_group);
    final RelativeLayout updateGroupName = ((RelativeLayout) findViewById(R.id.update_group_name));
    final LinearLayout updateGroupAvatar = ((LinearLayout) findViewById(R.id.update_group_avatar));
    final ImageView newGroupAvatar = ((ImageView) findViewById(R.id.update_group_avatar_img));
    final Button updateAvatarBtn = (Button) findViewById(R.id.update_avatar);
    final Button cancelBtn = (Button) findViewById(R.id.cancel);

    final ImageView friendAvatar = (ImageView) findViewById(R.id.friend_avatar);
    final TextView friendName = (TextView) findViewById(R.id.friend_name);

    if (mEditing) {
        updateGroupName.setVisibility(View.VISIBLE);
        updateGroupAvatar.setVisibility(View.VISIBLE);
        updateGroupName.setBackgroundResource(android.R.drawable.edit_text);
        cancelBtn.setVisibility(View.VISIBLE);
        saveBtn.setVisibility(View.VISIBLE);
        editBtn.setVisibility(View.GONE);

        friendAvatar.setVisibility(View.GONE);
        friendName.setVisibility(View.GONE);

        updateGroupName.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mUpdateGroupName.requestFocus()) {
                    int pos = mUpdateGroupName.getText().length();
                    mUpdateGroupName.setSelection(pos);
                    UIUtils.showKeyboard(getApplicationContext());
                }
            }
        });

        OnClickListener newAvatarListener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getNewAvatar(true);
                UIUtils.hideKeyboard(getApplicationContext(), mUpdateGroupName);
            }
        };

        updateAvatarBtn.setOnClickListener(newAvatarListener);
        newGroupAvatar.setOnClickListener(newAvatarListener);

    } else {
        updateGroupName.setVisibility(View.GONE);
        updateGroupAvatar.setVisibility(View.GONE);
        updateGroupName.setBackgroundResource(0);
        cancelBtn.setVisibility(View.GONE);
        saveBtn.setVisibility(View.GONE);
        editBtn.setVisibility(View.VISIBLE);

        friendAvatar.setVisibility(View.VISIBLE);
        friendName.setVisibility(View.VISIBLE);

        final byte[] byteArray;
        if (mPhotoSelected) {
            Bitmap bm = BitmapFactory.decodeFile(mUriSavedImage.getPath(), null);
            bm = ImageHelper.rotateBitmap(bm, mPhoneExifRotation);

            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bm.compress(Bitmap.CompressFormat.PNG, 100, stream);
            byteArray = stream.toByteArray();
            File image;
            try {
                image = getTmpUploadPhotoLocation();
            } catch (IOException e) {
                L.d(e.getMessage());
                UIUtils.showLongToast(getApplicationContext(), e.getMessage());
                return;
            }
            image.delete();
            mPhotoSelected = false;
            mGroup.avatar = byteArray;
        }
        mGroup.name = mUpdateGroupName.getText().toString();
        mFriendsPlugin.getStore().updateGroup(mGroup.guid, mGroup.name, mGroup.avatar, null);
        mFriendsPlugin.putGroup(mGroup);

        mBackupMembers = new ArrayList<String>(mGroup.members);

        Intent intent = new Intent(mIsNewGroup ? FriendsPlugin.GROUP_ADDED : FriendsPlugin.GROUP_MODIFIED);
        intent.putExtra("guid", mGroup.guid);
        mService.sendBroadcast(intent);
    }
}

From source file:com.cleanwiz.applock.ui.adapter.AppPagerAdapter.java

private View buildAppView(final CommLockInfo lockInfo) {

    View convertView = mInflater.inflate(R.layout.old_item_applock, null);
    ImageView ivLogo = (ImageView) convertView.findViewById(R.id.iv_app_logo);
    final ImageView ivTag = (ImageView) convertView.findViewById(R.id.iv_tag);
    View itemView = convertView.findViewById(R.id.rl_item);
    TextView tvName = (TextView) convertView.findViewById(R.id.tv_app_name);

    if (itemHeight > 0 && itemWidth > 0) {
        RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) itemView.getLayoutParams();
        lp.height = itemHeight;//  ww  w .j  a  v  a 2  s.co  m
        lp.width = itemWidth;
    }

    ApplicationInfo appInfo = null;
    try {
        appInfo = pkgMgr.getApplicationInfo(lockInfo.getPackageName(), PackageManager.GET_UNINSTALLED_PACKAGES);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    if (appInfo != null) {
        ivLogo.setImageDrawable(pkgMgr.getApplicationIcon(appInfo));
        tvName.setText(pkgMgr.getApplicationLabel(appInfo));
    }
    ivLogo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (lockInfo.getIsLocked()) {
                appLocker.unlockApp(lockInfo.getPackageName());
                lockInfo.setIsLocked(false);
            } else {
                appLocker.lockApp(lockInfo.getPackageName());
                lockInfo.setIsLocked(true);
            }
            LogUtil.d("demo3", "lock:" + lockInfo.getIsLocked());
            if (lockInfo.getIsLocked()) {
                ivTag.setVisibility(View.VISIBLE);
            } else {
                ivTag.setVisibility(View.INVISIBLE);
            }
        }
    });

    if (lockInfo.getIsLocked()) {
        ivTag.setVisibility(View.VISIBLE);
    } else {
        ivTag.setVisibility(View.INVISIBLE);
    }

    return convertView;
}

From source file:org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsFragment.java

public boolean isRootSynced(ImageView v) {
    boolean isRootSynced = SyncContentManager.getInstance(getActivity()).isRootSynced(getAccount(), node);
    if (isRootSynced) {
        v.setImageResource(isRootSynced ? R.drawable.ic_synced_dark : R.drawable.ic_sync_light);
        v.setVisibility(View.VISIBLE);
    } else {//  w  ww  .j  a  va  2s  .  c o  m
        v.setVisibility(View.GONE);
    }
    return isRootSynced;
}

From source file:com.DGSD.Teexter.UI.Recipient.BaseRecipientAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final RecipientEntry entry = mEntries.get(position);
    switch (entry.getEntryType()) {
    case RecipientEntry.ENTRY_TYPE_WAITING_FOR_DIRECTORY_SEARCH: {
        return convertView != null ? convertView
                : mInflater.inflate(getWaitingForDirectorySearchLayout(), parent, false);
    }/*  w  ww  .j a va 2 s.c  o m*/
    default: {
        String displayName = entry.getDisplayName();
        String destination = entry.getDestination();
        if (TextUtils.isEmpty(displayName) || TextUtils.equals(displayName, destination)) {
            displayName = destination;
            destination = null;
        }

        final View itemView = convertView != null ? convertView
                : mInflater.inflate(getItemLayout(), parent, false);
        final TextView displayNameView = (TextView) itemView.findViewById(getDisplayNameId());
        final TextView destinationView = (TextView) itemView.findViewById(getDestinationId());
        final TextView destinationTypeView = (TextView) itemView.findViewById(getDestinationTypeId());
        final ImageView imageView = (ImageView) itemView.findViewById(getPhotoId());
        displayNameView.setText(displayName);
        if (!TextUtils.isEmpty(destination)) {
            destinationView.setText(destination);
        } else {
            destinationView.setText(null);
        }
        if (destinationTypeView != null) {
            final CharSequence destinationType = Email.getTypeLabel(mContext.getResources(),
                    entry.getDestinationType(), entry.getDestinationLabel()).toString().toUpperCase();

            destinationTypeView.setText(destinationType);
        }

        if (entry.isFirstLevel()) {
            displayNameView.setVisibility(View.VISIBLE);
            if (imageView != null) {
                imageView.setVisibility(View.VISIBLE);
                final byte[] photoBytes = entry.getPhotoBytes();
                if (photoBytes != null && imageView != null) {
                    final Bitmap photo = BitmapFactory.decodeByteArray(photoBytes, 0, photoBytes.length);
                    imageView.setImageBitmap(photo);
                } else {
                    imageView.setImageResource(getDefaultPhotoResource());
                }
            }
        } else {
            displayNameView.setVisibility(View.GONE);
            if (imageView != null) {
                imageView.setVisibility(View.INVISIBLE);
            }
        }
        return itemView;
    }
    }
}

From source file:dev.ukanth.ufirewall.MainActivity.java

private void addColumns(int id) {
    ImageView view = (ImageView) this.findViewById(id);
    view.setVisibility(View.VISIBLE);
    view.setOnClickListener(this);
}

From source file:dev.ukanth.ufirewall.MainActivity.java

private void hideColumns(int id) {
    ImageView view = (ImageView) this.findViewById(id);
    view.setVisibility(View.GONE);
    view.setOnClickListener(this);
}

From source file:net.inbox.dialogs.DialogsCerts.java

@Override
public Object instantiateItem(ViewGroup vg, int position) {
    String[] st = nodes.get(position);

    View view = lay_inflate.inflate(R.layout.session_info_row, vg, false);

    ImageView tv_01 = (ImageView) view.findViewById(R.id.tv_this_device_img);
    TextView tv_02 = (TextView) view.findViewById(R.id.tv_this_device_title);

    TextView tv_03 = (TextView) view.findViewById(R.id.tv_name_title);
    TextView tv_04 = (TextView) view.findViewById(R.id.tv_name);
    TextView tv_05 = (TextView) view.findViewById(R.id.tv_organization_title);
    TextView tv_06 = (TextView) view.findViewById(R.id.tv_organization);
    TextView tv_07 = (TextView) view.findViewById(R.id.tv_type_title);
    TextView tv_08 = (TextView) view.findViewById(R.id.tv_type);
    TextView tv_09 = (TextView) view.findViewById(R.id.tv_location_title);
    TextView tv_10 = (TextView) view.findViewById(R.id.tv_location);
    TextView tv_11 = (TextView) view.findViewById(R.id.tv_state_title);
    TextView tv_12 = (TextView) view.findViewById(R.id.tv_state);
    TextView tv_13 = (TextView) view.findViewById(R.id.tv_country_title);
    TextView tv_14 = (TextView) view.findViewById(R.id.tv_country);
    TextView tv_15 = (TextView) view.findViewById(R.id.tv_security_title);
    TextView tv_16 = (TextView) view.findViewById(R.id.tv_security);
    TextView tv_17 = (TextView) view.findViewById(R.id.tv_key_size_title);
    TextView tv_18 = (TextView) view.findViewById(R.id.tv_key_size);

    if (position == 0) {
        tv_01.setVisibility(View.VISIBLE);
        tv_02.setVisibility(View.VISIBLE);
        tv_03.setVisibility(View.GONE);
        tv_04.setVisibility(View.GONE);
        tv_05.setVisibility(View.GONE);
        tv_06.setVisibility(View.GONE);
        tv_07.setVisibility(View.GONE);
        tv_08.setVisibility(View.GONE);
        tv_09.setVisibility(View.GONE);
        tv_10.setVisibility(View.GONE);
        tv_11.setVisibility(View.GONE);
        tv_12.setVisibility(View.GONE);
        tv_13.setVisibility(View.GONE);
        tv_14.setVisibility(View.GONE);
        tv_15.setVisibility(View.GONE);
        tv_16.setVisibility(View.GONE);
        tv_17.setVisibility(View.GONE);
        tv_18.setVisibility(View.GONE);
    } else {/*from   w w  w  .  j a  v  a2s  . co  m*/
        tv_01.setVisibility(View.GONE);
        tv_02.setVisibility(View.GONE);

        if (st[0] != null && st[0].length() > 0) {
            tv_03.setVisibility(View.VISIBLE);
            tv_04.setVisibility(View.VISIBLE);
            tv_04.setText(st[0]);
        } else {
            tv_03.setVisibility(View.GONE);
            tv_04.setVisibility(View.GONE);
        }

        if (st[1] != null && st[1].length() > 0) {
            tv_05.setVisibility(View.VISIBLE);
            tv_06.setVisibility(View.VISIBLE);
            tv_06.setText(st[1]);
        } else {
            tv_05.setVisibility(View.GONE);
            tv_06.setVisibility(View.GONE);
        }

        if (st[2] != null && st[2].length() > 0) {
            tv_07.setVisibility(View.VISIBLE);
            tv_08.setVisibility(View.VISIBLE);
            tv_08.setText(st[2]);
        } else {
            tv_07.setVisibility(View.GONE);
            tv_08.setVisibility(View.GONE);
        }

        if (st[3] != null && st[3].length() > 0) {
            tv_09.setVisibility(View.VISIBLE);
            tv_10.setVisibility(View.VISIBLE);
            tv_10.setText(st[3]);
        } else {
            tv_09.setVisibility(View.GONE);
            tv_10.setVisibility(View.GONE);
        }

        if (st[4] != null && st[4].length() > 0) {
            tv_11.setVisibility(View.VISIBLE);
            tv_12.setVisibility(View.VISIBLE);
            tv_12.setText(st[4]);
        } else {
            tv_11.setVisibility(View.GONE);
            tv_12.setVisibility(View.GONE);
        }

        if (st[5] != null && st[5].length() > 0) {
            tv_13.setVisibility(View.VISIBLE);
            tv_14.setVisibility(View.VISIBLE);
            tv_14.setText(st[5]);
        } else {
            tv_14.setVisibility(View.GONE);
            tv_14.setVisibility(View.GONE);
        }

        if (st[6] != null && st[6].length() > 0) {
            tv_15.setVisibility(View.VISIBLE);
            tv_16.setVisibility(View.VISIBLE);
            tv_16.setText(st[6]);
        } else {
            tv_15.setVisibility(View.GONE);
            tv_16.setVisibility(View.GONE);
        }

        if (st[7] != null && st[7].length() > 0) {
            tv_17.setVisibility(View.VISIBLE);
            tv_18.setVisibility(View.VISIBLE);
            tv_18.setText(st[7]);
        } else {
            tv_17.setVisibility(View.GONE);
            tv_18.setVisibility(View.GONE);
        }
    }

    vg.addView(view);

    return view;
}

From source file:org.mythtv.client.ui.dvr.EpisodeFragment.java

public void loadEpisode(int channelId, DateTime startTime) {
    Log.v(TAG, "loadEpisode : enter");

    mLocationProfile = mLocationProfileDaoHelper.findConnectedProfile(getActivity());

    Log.v(TAG, "loadEpisode : channelId=" + channelId + ", startTime="
            + DateUtils.dateTimeFormatterPretty.print(startTime));
    program = mRecordedDaoHelper.findOne(getActivity(), mLocationProfile, channelId, startTime);
    if (null != program) {
        Log.v(TAG, "loadEpisode : program found");

        LiveStreamInfo liveStreamInfo = mLiveStreamDaoHelper.findByProgram(getActivity(), mLocationProfile,
                program);/*  w  w  w. ja  v  a 2  s .  co m*/
        if (null != liveStreamInfo) {
            Log.v(TAG, "loadEpisode : program has livestream");

            if (liveStreamInfo.getPercentComplete() < 100) {
                Log.v(TAG, "loadEpisode : livestream is not complete, start update");

                startUpdateStreamService();
            }

        }

        // get activity to grab views from
        Activity activity = this.getActivity();

        // coverart
        final ImageView iView = (ImageView) activity.findViewById(R.id.imageView_episode_coverart);
        iView.setImageDrawable(null);

        if (null != program.getInetref() && !"".equals(program.getInetref())) {

            String imageUri = mLocationProfile.getUrl() + "Content/GetRecordingArtwork?Type=Coverart&Inetref="
                    + program.getInetref();
            imageLoader.displayImage(imageUri, iView, options, new SimpleImageLoadingListener() {

                /* (non-Javadoc)
                 * @see com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener#onLoadingComplete(android.graphics.Bitmap)
                 */
                @Override
                public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                    iView.setVisibility(View.VISIBLE);
                }

                /* (non-Javadoc)
                 * @see com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener#onLoadingFailed(com.nostra13.universalimageloader.core.assist.FailReason)
                 */
                @Override
                public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                    if (options.shouldShowImageOnFail()) {
                        iView.setImageResource(options.getImageOnFail());
                        iView.setVisibility(View.VISIBLE);
                    } else {
                        iView.setVisibility(View.GONE);
                    }
                }

            });

        } else {

            if (options.shouldShowImageOnFail()) {
                iView.setImageResource(options.getImageOnFail());
                iView.setVisibility(View.VISIBLE);
            } else {
                iView.setVisibility(View.GONE);
            }

        }

        // title
        TextView tView = (TextView) activity.findViewById(R.id.textView_episode_title);
        tView.setText(program.getTitle());

        // subtitle
        tView = (TextView) activity.findViewById(R.id.textView_episode_subtitle);
        tView.setText(program.getSubTitle());

        // description
        tView = (TextView) activity.findViewById(R.id.textView_episode_description);
        tView.setText(program.getDescription());

        // channel number
        tView = (TextView) activity.findViewById(R.id.textView_episode_ch_num);
        tView.setText(program.getChannelInfo().getChannelNumber());

        // airdate
        tView = (TextView) activity.findViewById(R.id.textView_episode_airdate);
        tView.setText(DateUtils.getDateTimeUsingLocaleFormattingPretty(program.getStartTime(),
                getMainApplication().getDateFormat(), getMainApplication().getClockType()));

        if (null == hlsView) {
            hlsView = (TextView) activity.findViewById(R.id.textView_episode_hls);
        }

        updateHlsDetails();
    }

    Log.v(TAG, "loadEpisode : exit");
}

From source file:im.vector.activity.RoomActivity.java

void refreshAccountThumbnail() {
    // remove the ring
    ImageView presenceRingView = (ImageView) findViewById(R.id.imageView_presenceRing);
    presenceRingView.setVisibility(View.GONE);

    ImageView avatarView = (ImageView) findViewById(R.id.avatar_img);

    String avatarUrl = mSession.getMyUser().avatarUrl;

    if (avatarUrl == null) {
        avatarView.setImageResource(R.drawable.ic_contact_picture_holo_light);
    } else {//w w  w. ja v a2s  .  c  om
        int size = getResources().getDimensionPixelSize(R.dimen.chat_avatar_size);
        mMediasCache.loadAvatarThumbnail(avatarView, avatarUrl, size);
    }
}

From source file:org.alfresco.mobile.android.application.fragments.properties.DetailsFragment.java

private void display(NodeSyncPlaceHolder refreshedNode) {
    node = refreshedNode;//from  www .ja v  a 2 s  .c  om

    // Header
    TextView tv = (TextView) vRoot.findViewById(R.id.title);
    tv.setText(node.getName());
    tv = (TextView) vRoot.findViewById(R.id.details);
    tv.setText(NodeSyncPlaceHolderFormatter.createContentBottomText(getActivity(), refreshedNode, true));

    // Preview + Thumbnail
    if (vRoot.findViewById(R.id.icon) != null) {
        ((ImageView) vRoot.findViewById(R.id.icon))
                .setImageResource(MimeTypeManager.getIcon(getActivity(), node.getName(), false));
    }
    if (vRoot.findViewById(R.id.preview) != null) {
        ((ImageView) vRoot.findViewById(R.id.preview))
                .setImageResource(MimeTypeManager.getIcon(getActivity(), node.getName(), true));
    }

    // Description
    Integer generalPropertyTitle = null;
    tv = (TextView) vRoot.findViewById(R.id.description);
    List<String> filter = new ArrayList<String>();
    if (node.getDescription() != null && node.getDescription().length() > 0
            && vRoot.findViewById(R.id.description_group) != null) {
        vRoot.findViewById(R.id.description_group).setVisibility(View.VISIBLE);
        tv.setText(node.getDescription());
        ((TextView) vRoot.findViewById(R.id.prop_name_value)).setText(node.getName());
        filter.add(ContentModel.PROP_NAME);
        generalPropertyTitle = -1;
    } else if (vRoot.findViewById(R.id.description_group) != null) {
        vRoot.findViewById(R.id.description_group).setVisibility(View.GONE);
        generalPropertyTitle = R.string.metadata;
    }

    // Tabs
    mTabHost = (TabHost) vRoot.findViewById(android.R.id.tabhost);
    if (mTabHost != null) {
        mTabHost.setup();
        mTabHost.setOnTabChangedListener(this);
        if (refreshedNode.isDocument() && ConnectivityUtils.hasInternetAvailable(getActivity()) && Boolean
                .parseBoolean((String) refreshedNode.getPropertyValue(PropertyIds.IS_LATEST_VERSION))) {
            mTabHost.addTab(newTab(TAB_PREVIEW, R.string.preview, android.R.id.tabcontent));
        }
        mTabHost.addTab(newTab(TAB_METADATA, R.string.metadata, android.R.id.tabcontent));
        if (tabSelection != null) {
            if (tabSelection == 0) {
                return;
            }
            int index = (node.isDocument()) ? tabSelection : tabSelection - 1;
            mTabHost.setCurrentTab(index);
        }
    } else {
        LayoutInflater inflater = (LayoutInflater) getActivity()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ViewGroup parent = (ViewGroup) vRoot.findViewById(R.id.metadata);
        ViewGroup generalGroup = createAspectPanel(inflater, parent, node, ContentModel.ASPECT_GENERAL, false,
                generalPropertyTitle, filter);
        addPathProperty(generalGroup, inflater);
    }

    // Hide Buttons
    ImageView b = (ImageView) vRoot.findViewById(R.id.action_openin);
    if (!isRestrictable) {
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                openin();
            }
        });
    } else {
        b.setVisibility(View.GONE);
    }

    b = (ImageView) vRoot.findViewById(R.id.action_share);
    if (!isRestrictable) {
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                share();
            }
        });
    } else {
        b.setVisibility(View.GONE);
    }

    b = (ImageView) vRoot.findViewById(R.id.like);
    vRoot.findViewById(R.id.like_progress).setVisibility(View.GONE);
    b.setVisibility(View.GONE);

    b = (ImageView) vRoot.findViewById(R.id.action_favorite);
    b.setImageResource(R.drawable.ic_favorite_dark);
    vRoot.findViewById(R.id.favorite_progress).setVisibility(View.GONE);

    if (DisplayUtils.hasCentralPane(getActivity())) {
        if (!isRestrictable && !AccessibilityHelper.isEnabled(getActivity())) {
            vRoot.findViewById(R.id.icon).setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    openin();
                }
            });
        }
    } else {
        if (!isRestrictable) {
            vRoot.findViewById(R.id.preview).setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    openin();
                }
            });
        }
    }
}