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:org.jared.synodroid.ds.adapter.FileDetailAdapter.java

/**
 * Bind commons torrent's data with widget
 * /*from   w ww .  j  av  a 2  s .  co  m*/
 * @param viewP
 * @param torrentP
 */
private void bindData(View viewP, final TaskFile fileP) {
    // The filename
    TextView fileText = (TextView) viewP.findViewById(R.id.id_file_name);
    fileText.setText(fileP.name);

    TextView fileExt = (TextView) viewP.findViewById(R.id.id_file_ext);
    //int ext_index = fileP.name.lastIndexOf('.');
    //if (ext_index != -1){
    //   fileExt.setText(fileP.name.substring(ext_index));
    //}
    //else{
    fileExt.setText("");
    //}

    // The file size
    TextView fileSize = (TextView) viewP.findViewById(R.id.id_file_size);
    try {
        fileSize.setText(Utils.bytesToFileSize(Long.parseLong(fileP.filesize), false, fileP.filesize));
    } catch (Exception ex) {
        fileSize.setText(fileP.filesize);
    }

    ImageView img = (ImageView) viewP.findViewById(R.id.img_priority);
    if (task.isTorrent) {
        FileIconFacade.bindPriorityStatus(img, fileP);
    } else {
        img.setVisibility(View.GONE);
    }

    // Is the file has to be download
    CheckBox downloadFile = (CheckBox) viewP.findViewById(R.id.id_file_to_download);
    downloadFile.setTag(fileP);
    if ((!task.status.equals(TaskStatus.TASK_DOWNLOADING.name())
            && !task.status.equals(TaskStatus.TASK_SEEDING.name())) || version == null
            || version.smallerThen(DSMVersion.VERSION3_1))
        downloadFile.setVisibility(View.GONE);
    else
        downloadFile.setVisibility((task.isTorrent ? View.VISIBLE : View.GONE));
    downloadFile.setOnCheckedChangeListener(fragment);
    downloadFile.setChecked(fileP.selected);

    // Changing the checkbox state is only able if the download is not finished
    downloadFile.setEnabled(((task.status.equals(TaskStatus.TASK_DOWNLOADING.name())
            || task.status.equals(TaskStatus.TASK_SEEDING.name())) ? true : false));
}

From source file:fm.smart.r1.activity.ItemActivity.java

static void setSound(ImageView sound_icon, final String sound_url, final Context context, final int type_id,
        final String artifact_id, final String to_record) {
    if (!TextUtils.isEmpty(sound_url)) {
        OnClickListener sound_listener = new OnClickListener() {
            public void onClick(View v) {
                Main.playSound(sound_url, ItemListActivity.mMediaPlayer, context);
            }/*from  ww w.  j a  va 2 s.c  om*/
        };
        sound_icon.setOnClickListener(sound_listener);
    } else {
        if (type_id == R.id.response_sound || type_id == R.id.translation_sound) {
            sound_icon.setVisibility(View.INVISIBLE);
        } else {
            sound_icon.setImageBitmap(
                    BitmapFactory.decodeResource(context.getResources(), R.drawable.inactive_sound_add));

            OnClickListener listener = new OnClickListener() {
                public void onClick(View v) {
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setClassName(context, CreateSoundActivity.class.getName());
                    Utils.putExtra(intent, "item_id", (String) item.item_node.atts.get("id"));
                    Utils.putExtra(intent, "to_record", to_record);
                    Utils.putExtra(intent, "id", artifact_id);
                    Utils.putExtra(intent, "sound_type", Integer.toString(type_id));
                    context.startActivity(intent);

                }
            };
            sound_icon.setOnClickListener(listener);
        }
    }
}

From source file:com.tweetlanes.android.core.view.ProfileActivity.java

void configureActionBarView() {

    if (mScreenName != null) {

        final ActionBar actionBar = getActionBar();
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle("@" + mScreenName);

        final LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        final int layout = R.layout.profile_title_thin;
        /*//from w ww.  j a  v  a2s . c o m
         * // TODO: This is messy, and likely won't work for large screen
         * devices. Need to come up with a better solution int layout; if
         * (getResources().getConfiguration().orientation ==
         * Configuration.ORIENTATION_LANDSCAPE) { layout=
         * R.layout.profile_title_thin; } else { layout =
         * R.layout.profile_title; }
         */

        final View abView = inflator.inflate(layout, null);
        final ImageView verified = (ImageView) abView.findViewById(R.id.verifiedImage);
        verified.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE);

        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setCustomView(abView);
    }
}

From source file:com.scoreloop.android.coreui.BaseActivity.java

void setProgressIndicator(final boolean visible) {
    final ImageView imageView = ((ImageView) getTopActivity().findViewById(R.id.progress_indicator));
    if (visible) {
        imageView.setVisibility(View.VISIBLE);
    } else {/*from  w  ww  . j  a v  a  2  s .c o m*/
        imageView.setVisibility(View.INVISIBLE);
    }
}

From source file:com.github.jvanhie.discogsscrobbler.ReleaseDetailFragment.java

private void setRelease() {
    ((TextView) mRootView.findViewById(R.id.detail_title)).setText(mRelease.title);
    ((TextView) mRootView.findViewById(R.id.detail_artist)).setText(mRelease.artist);
    ((TextView) mRootView.findViewById(R.id.detail_label)).setText(mRelease.label);
    ((TextView) mRootView.findViewById(R.id.detail_format)).setText(mRelease.format_extended);
    ((TextView) mRootView.findViewById(R.id.detail_country)).setText(mRelease.country);
    ((TextView) mRootView.findViewById(R.id.detail_released)).setText(mRelease.released_formatted);
    ((TextView) mRootView.findViewById(R.id.detail_genre)).setText(mRelease.genres);
    ((TextView) mRootView.findViewById(R.id.detail_style)).setText(mRelease.styles);
    ((TextView) mRootView.findViewById(R.id.detail_notes)).setText(mRelease.notes);
    ((TextView) mRootView.findViewById(R.id.detail_marketplace))
            .setText("http://www.discogs.com/marketplace?release_id=" + mRelease.releaseid);
    if (mRelease.master_id != 0) {
        ((TextView) mRootView.findViewById(R.id.detail_marketplace_master))
                .setText("http://www.discogs.com/marketplace?master_id=" + mRelease.master_id);
    } else {/*from ww  w.j  av a 2 s  . c  om*/
        mRootView.findViewById(R.id.detail_marketplace_master).setVisibility(View.GONE);
    }
    //decide to load big or small image
    if (!mRelease.hasExtendedInfo) {
        //we don't got extended info on this release yet, only display thumbnail
        ImageView thumb = (ImageView) mRootView.findViewById(R.id.detail_thumb);
        thumb.setVisibility(ImageView.VISIBLE);
        mImageLoader.displayImage(mRelease.thumb, thumb);
    } else {
        ImageView image = (ImageView) mRootView.findViewById(R.id.detail_image);

        if (mRelease.images().size() > 0) {
            Image img = mRelease.images().get(0);
            mImageLoader.displayImage(img.uri, image, new SimpleImageLoadingListener() {
                @Override
                public void onLoadingComplete(Bitmap loadedImage) {
                    super.onLoadingComplete(loadedImage);
                    //make the small thumbnail invisible
                    mRootView.findViewById(R.id.detail_thumb).setVisibility(ImageView.INVISIBLE);
                }
            });
        }
    }
}

From source file:de.tudarmstadt.informatik.secuso.phishedu2.SwipeActivity.java

protected void checkAndHideButtons(int page) {
    ImageView imgPrevious = (ImageView) getActivity().findViewById(R.id.game_intro_arrow_back);
    ImageView imgNext = (ImageView) getActivity().findViewById(R.id.game_intro_arrow_forward);
    Button bStartLevel = (Button) getActivity().findViewById(R.id.game_intro_start_button);
    imgNext.setVisibility(View.VISIBLE);
    imgPrevious.setVisibility(View.VISIBLE);
    bStartLevel.setVisibility(View.INVISIBLE);
    if (page == getPageCount() - 1) {
        imgNext.setVisibility(View.INVISIBLE);
        if (this.startButtonText() != null) {
            bStartLevel.setVisibility(View.VISIBLE);
        }/*from  w w w.jav a 2s  .co  m*/
    }
    if (page == 0) {
        imgPrevious.setVisibility(View.INVISIBLE);
    }
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Increments or decrements the number of defense dice to use on click.
 *///from  w w  w .  j  ava2  s.c o  m
public void defendDiceOnClick() {
    ImageView dDie2 = (ImageView) findViewById(R.id.defend_die_2);

    if (dDie2.getVisibility() == View.VISIBLE) {
        dDie2.setVisibility(View.INVISIBLE);
    } else {
        dDie2.setVisibility(View.VISIBLE);
    }
}

From source file:com.pertamina.tbbm.rewulu.ecodriving.ContentsActivity.java

private void initPanel() {
    // TODO Auto-generated method stub
    imgs = new ArrayList<>();
    panel.removeAllViews();//  w  w  w .  ja  va2s. c om
    for (int w = 0; w < pageSize; w++) {
        ImageView img = new ImageView(getApplicationContext());
        img.setLayoutParams(params);
        if (0 == w)
            img.setImageResource(R.drawable.panel_indicator_full);
        else
            img.setImageResource(R.drawable.panel_indicator);
        img.setVisibility(View.VISIBLE);
        img.setOnClickListener(this);
        panel.addView(img);
        imgs.add(img);
    }

}

From source file:com.sim2dial.dialer.ContactFragment.java

private void displayContact(LayoutInflater inflater, View view) {
    AvatarWithShadow contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture);
    if (contact.getPhotoUri() != null) {
        InputStream input = Compatibility.getContactPictureInputStream(
                LinphoneActivity.instance().getContentResolver(), contact.getID());
        contactPicture.setImageBitmap(BitmapFactory.decodeStream(input));
    } else {/*from  w w w . j  a  va  2  s .co m*/
        contactPicture.setImageResource(R.drawable.unknown_small);
    }

    TextView contactName = (TextView) view.findViewById(R.id.contactName);
    contactName.setText(contact.getName());

    TableLayout controls = (TableLayout) view.findViewById(R.id.controls);
    controls.removeAllViews();
    for (String numberOrAddress : contact.getNumerosOrAddresses()) {
        View v = inflater.inflate(R.layout.contact_control_row, null);

        String displayednumberOrAddress = numberOrAddress;
        if (numberOrAddress.startsWith("sip:")) {
            displayednumberOrAddress = displayednumberOrAddress.substring(4);
        }

        TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
        tv.setText(displayednumberOrAddress);
        tv.setSelected(true);

        if (!displayChatAddressOnly) {
            v.findViewById(R.id.dial).setOnClickListener(dialListener);
            v.findViewById(R.id.dial).setTag(displayednumberOrAddress);
        } else {
            v.findViewById(R.id.dial).setVisibility(View.GONE);
        }

        v.findViewById(R.id.chat).setOnClickListener(chatListener);
        if (LinphoneUtils.isSipAddress(numberOrAddress)) {
            v.findViewById(R.id.chat).setTag(numberOrAddress);
        } else {
            LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
            if (lpc != null) {
                if (!numberOrAddress.startsWith("sip:")) {
                    numberOrAddress = "sip:" + numberOrAddress;
                }
                v.findViewById(R.id.chat).setTag(numberOrAddress + "@" + lpc.getDomain());
            }
        }

        final String finalNumberOrAddress = numberOrAddress;
        ImageView friend = (ImageView) v.findViewById(R.id.addFriend);
        if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) {
            friend.setVisibility(View.VISIBLE);

            boolean isAlreadyAFriend = LinphoneManager.getLc()
                    .findFriendByAddress(finalNumberOrAddress) != null;
            if (!isAlreadyAFriend) {
                friend.setImageResource(R.drawable.friend_add);
                friend.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (LinphoneActivity.instance().newFriend(contact, finalNumberOrAddress)) {
                            displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
                        }
                    }
                });
            } else {
                friend.setImageResource(R.drawable.friend_remove);
                friend.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (LinphoneActivity.instance().removeFriend(contact, finalNumberOrAddress)) {
                            displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
                        }
                    }
                });
            }
        }

        if (getResources().getBoolean(R.bool.disable_chat)) {
            v.findViewById(R.id.chat).setVisibility(View.GONE);
        }

        controls.addView(v);
    }
}

From source file:eisene.riskspeedtools.BattleFrag.java

/**
 * Increments or decrements the number of attack dice to use on click.
 *//*ww w .ja  v a2  s  .c o m*/
public void attackDiceOnClick() {
    ImageView aDie2 = (ImageView) findViewById(R.id.attack_die_2);
    ImageView aDie3 = (ImageView) findViewById(R.id.attack_die_3);

    if (aDie3.getVisibility() == View.VISIBLE) {
        aDie3.setVisibility(View.INVISIBLE);
        isDiceCountIncreasing = false;
    } else if (aDie2.getVisibility() == View.VISIBLE) {
        if (isDiceCountIncreasing) {
            aDie3.setVisibility(View.VISIBLE);
        } else {
            aDie2.setVisibility(View.INVISIBLE);
        }
    } else {
        aDie2.setVisibility(View.VISIBLE);
        isDiceCountIncreasing = true;
    }
}