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:es.uma.lcc.tasks.DecryptionRequestTask.java

@Override
public void onPostExecute(Void l) {
    mProgressDialog.dismiss();//from  ww w  .  ja  va 2 s . c om
    if (mConnectionSucceeded) {
        if (mIsAuthError) {
            handleAuthenticationError();
        } else {
            mMainActivity.findViewById(R.id.imageBlock).setVisibility(View.VISIBLE);
            mMainActivity.findViewById(R.id.encryptBlock).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.decryptBlock).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.myPicsBlock).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.accountBlock).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.filler1).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.filler2).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.filler3).setVisibility(View.GONE);
            mMainActivity.findViewById(R.id.filler4).setVisibility(View.GONE);
            ImageView imageView = (ImageView) mMainActivity.findViewById(R.id.imageView);
            imageView.setVisibility(ImageView.VISIBLE);
            if (!mHasFoundKeys) {
                Toast.makeText(mMainActivity, R.string.noKeysRetrievedWarning, Toast.LENGTH_SHORT).show();
            }

            if (mWidth >= 2048 || mHeight >= 2048) {
                double factor = (mWidth > mHeight ? 2048.0 / mWidth : 2048.0 / mHeight);
                imageView.setImageBitmap(Bitmap.createScaledBitmap(mDecodedBmp, (int) (factor * mWidth),
                        (int) (factor * mHeight), false));
            } else {
                imageView.setImageBitmap(mDecodedBmp);
            }
        }
    } else {
        Toast.makeText(mMainActivity, R.string.noConnectionWarning, Toast.LENGTH_SHORT).show();
    }
}

From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java

private void setViewExtra(@NonNull Context context, @NonNull View view, @NonNull WiFiDetail wiFiDetail) {
    ImageView configuredImage = (ImageView) view.findViewById(kr.co.generic.wifianalyzer.R.id.configuredImage);
    WiFiAdditional wiFiAdditional = wiFiDetail.getWiFiAdditional();
    if (wiFiAdditional.isConfiguredNetwork()) {
        configuredImage.setVisibility(View.VISIBLE);
        configuredImage/*from  w  w w .  jav a 2s .  com*/
                .setColorFilter(ContextCompat.getColor(context, kr.co.generic.wifianalyzer.R.color.connected));
    } else {
        configuredImage.setVisibility(View.GONE);
    }

    WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal();
    Strength strength = wiFiSignal.getStrength();
    ImageView imageView = (ImageView) view.findViewById(kr.co.generic.wifianalyzer.R.id.levelImage);
    imageView.setImageResource(strength.imageResource());
    imageView.setColorFilter(ContextCompat.getColor(context, strength.colorResource()));

    ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.channel_frequency_range))
            .setText(wiFiSignal.getFrequencyStart() + " - " + wiFiSignal.getFrequencyEnd());
    ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.width))
            .setText("(" + wiFiSignal.getWiFiWidth().getFrequencyWidth() + WiFiSignal.FREQUENCY_UNITS + ")");
    ((TextView) view.findViewById(kr.co.generic.wifianalyzer.R.id.capabilities))
            .setText(wiFiDetail.getCapabilities());
}

From source file:com.casin.activity.HomeDrawerActivity.java

public void initHeaderLayout(String name, String balancePoints) {
    Typeface snapFont = Typeface.createFromAsset(getAssets(), "SNAP.TTF");
    TextView headrTitleTextView = (TextView) findViewById(R.id.headerTitle);
    headrTitleTextView.setTypeface(snapFont);
    headrTitleTextView.setText(name);/*from ww w .  j av a  2s.co m*/

    TextView scoreTitleTextView = (TextView) findViewById(R.id.score);
    scoreTitleTextView.setText(balancePoints);

    ImageView leftMenuBarImageView = (ImageView) findViewById(R.id.leftMenuBar);
    leftMenuBarImageView.setVisibility(View.VISIBLE);
    leftMenuBarImageView.setOnClickListener(leftMenuBarClickListener);
}

From source file:com.idt.ontomedia.geoconsum.fragments.DetailsBaseFragment.java

protected void setURL(Cursor _cursor, int _idTextViewTextURL, int _idTextViewTitleURL, int _idImageViewURL) {
    final String url = _cursor.getString(_cursor.getColumnIndex(DatabaseAdapter.COLUMN_URL));
    TextView textViewText = (TextView) mParentActivity.findViewById(_idTextViewTextURL);
    TextView textviewTitle = (TextView) mParentActivity.findViewById(_idTextViewTitleURL);
    ImageView imageViewUrl = (ImageView) mParentActivity.findViewById(_idImageViewURL);

    if (url.length() != 0) {
        textViewText.setVisibility(View.VISIBLE);
        textviewTitle.setVisibility(View.VISIBLE);
        imageViewUrl.setVisibility(View.VISIBLE);
        imageViewUrl.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

        imageViewUrl.setOnClickListener(new OnClickListener() {

            @Override/*from   ww w  . ja  va2  s.  c om*/
            public void onClick(View v) {
                String httpURL = url;

                if (!url.startsWith("http")) {
                    httpURL = "http://" + url;
                }
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(httpURL));
                startActivity(intent);
            }
        });
    }
}

From source file:org.tomahawk.tomahawk_android.fragments.SelectorFragment.java

protected void setupSelector(final List<FragmentInfo> fragmentInfos, final int initialPage,
        final String selectorPosStorageKey) {
    if (getView() != null) {
        FragmentInfo initalItem = fragmentInfos.get(initialPage);
        final ImageView imageViewHeader = (ImageView) getView().findViewById(R.id.imageview_header);
        imageViewHeader.setImageResource(initalItem.mIconResId);
        final TextView textViewHeader = (TextView) getView().findViewById(R.id.textview_header);
        textViewHeader.setText(initalItem.mTitle);
        textViewHeader.setVisibility(View.GONE);
        FragmentUtils.replace((TomahawkMainActivity) getActivity(), initalItem.mClass, initalItem.mBundle,
                R.id.content_frame);/*from  w ww .j a v  a2 s  . com*/

        final View selectorHeader = getView().findViewById(R.id.selectorHeader);
        selectorHeader.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectorHeader.setClickable(false);

                ImageView arrowTop = (ImageView) getView().findViewById(R.id.arrow_top_header);
                ImageView arrowBottom = (ImageView) getView().findViewById(R.id.arrow_bottom_header);
                arrowTop.setVisibility(View.GONE);
                arrowBottom.setVisibility(View.GONE);
                textViewHeader.setVisibility(View.VISIBLE);

                Selector selector = (Selector) getView().findViewById(R.id.selector);
                Selector.SelectorListener selectorListener = new Selector.SelectorListener() {
                    @Override
                    public void onSelectorItemSelected(int position) {
                        selectorHeader.setClickable(true);

                        ImageView arrowTop = (ImageView) getView().findViewById(R.id.arrow_top_header);
                        ImageView arrowBottom = (ImageView) getView().findViewById(R.id.arrow_bottom_header);
                        if (arrowTop != null) {
                            arrowTop.setVisibility(View.VISIBLE);
                        }
                        if (arrowBottom != null) {
                            arrowBottom.setVisibility(View.VISIBLE);
                        }

                        FragmentInfo selectedItem = fragmentInfos.get(position);
                        imageViewHeader.setImageResource(selectedItem.mIconResId);
                        textViewHeader.setText(selectedItem.mTitle);
                        textViewHeader.setVisibility(View.GONE);

                        FragmentUtils.replace((TomahawkMainActivity) getActivity(), selectedItem.mClass,
                                selectedItem.mBundle, R.id.content_frame);
                    }

                    @Override
                    public void onCancel() {
                    }
                };
                selector.setup(fragmentInfos, selectorListener, getActivity().findViewById(R.id.sliding_layout),
                        selectorPosStorageKey);
                selector.showSelectorList();
            }
        });
    }
}

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

boolean configureActionBarView() {

    if (mScreenName != null) {

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);

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

        int layout = R.layout.profile_title_thin;
        /*/*from  w  ww . j  av  a2  s.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;
        }*/

        View profileTitleView = inflator.inflate(layout, null);
        ((TextView) profileTitleView.findViewById(R.id.screenname)).setText("@" + mScreenName);

        TextView fullNameTextView = (TextView) profileTitleView.findViewById(R.id.fullname);
        if (fullNameTextView != null && mUser != null) {
            fullNameTextView.setText(mUser.getName());
        }

        ImageView verifiedImage = (ImageView) profileTitleView.findViewById(R.id.verifiedImage);
        verifiedImage.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE);

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

    return true;
}

From source file:com.popdeem.sdk.uikit.fragment.dialog.PDUINotificationDialogFragment.java

@NonNull
@Override/*from   w  w  w  .  ja  v a2 s . com*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(
            new ContextThemeWrapper(getActivity(), R.style.AlertDialogCustom));
    Bundle args = getArguments();
    if (args == null) {
        created = false;
        return builder.create();
    }

    final String title = args.getString("title", null);
    final String message = args.getString("message", null);
    final String imageUrl = args.getString("image", null);
    final String targetUrl = args.getString("targetUrl", null);
    final String deepLink = args.getString("deepLink", null);
    final String messageId = args.getString("messageId", null);

    if (title == null || message == null) {
        created = false;
        return builder.create();
    }

    // Dialog View
    View dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_pd_notification_dialog, null,
            false);
    builder.setView(dialogView);

    // Title
    TextView textView = (TextView) dialogView.findViewById(R.id.pd_notification_dialog_title_text_view);
    textView.setText(title);

    // Message
    textView = (TextView) dialogView.findViewById(R.id.pd_notification_dialog_message_text_view);
    textView.setText(message);

    // Image
    final ImageView imageView = (ImageView) dialogView.findViewById(R.id.pd_notification_dialog_image_view);
    if (imageUrl != null && !imageUrl.isEmpty()) {
        imageView.setVisibility(View.VISIBLE);
        imageView.post(new Runnable() {
            @Override
            public void run() {
                Glide.with(getActivity()).load(imageUrl).dontAnimate()
                        //                            .override(imageView.getWidth(), 1)
                        .into(imageView);
            }
        });
    }

    // Buttons
    final DialogInterface.OnClickListener negativeClick = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            markMessageAsRead(messageId);
        }
    };
    if (targetUrl == null && deepLink == null) {
        builder.setPositiveButton(android.R.string.ok, negativeClick);
    } else {
        builder.setPositiveButton(R.string.pd_notification_go_button_text,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        markMessageAsRead(messageId);

                        String url = targetUrl != null ? targetUrl : imageUrl;
                        if (url != null && !url.startsWith("http://") && !url.startsWith("https://")) {
                            url = "http://" + url;
                        }
                        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                        startActivity(intent);
                    }
                });
        builder.setNegativeButton(android.R.string.cancel, negativeClick);
    }

    return builder.create();
}

From source file:com.ramdroid.wizardbuilder.WizardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.wb_wizard_page, null);

    final WizardPage page = pageSet.get(pageId);

    int imageId = page.imageId;
    ImageView image = (ImageView) v.findViewById(R.id.image);
    if (image != null) {
        try {/*from  w  w  w  .  ja v a  2s.co  m*/
            image.setImageDrawable(getResources().getDrawable(imageId));
        } catch (Resources.NotFoundException e) {
            image.setVisibility(View.GONE);
        }
    }

    int descriptionId = page.descriptionId;
    ;
    TextView text = (TextView) v.findViewById(R.id.description);
    if (text != null) {
        text.setText(descriptionId);
    }

    LinearLayout layoutButtonPanel = (LinearLayout) v.findViewById(R.id.buttonPanel);
    layoutButtonPanel.setVisibility(page.buttonVisibility);

    Button buttonNoThanks = (Button) v.findViewById(R.id.buttonNoThanks);
    buttonNoThanks.setVisibility(page.dismissButtonVisibility);
    buttonNoThanks.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            getActivity().sendBroadcast(new Intent(ACTION_DISMISS_BUTTON));
            leave();
        }

    });

    if (page.buttonTextId > 0) {
        Button buttonLaunch = (Button) v.findViewById(R.id.buttonLaunch);
        buttonLaunch.setText(page.buttonTextId);
        buttonLaunch.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                getActivity().sendBroadcast(new Intent(ACTION_CLICKED_BUTTON).putExtra("page", page.id));
                leave();
            }

        });
    }

    return v;
}

From source file:com.shafiq.mytwittle.view.ProfileActivity.java

boolean configureActionBarView() {

    if (mScreenName != null) {

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);

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

        int layout = R.layout.profile_title_thin;
        /*//from w  ww .  j a  va  2  s .  com
         * // 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; }
         */

        View profileTitleView = inflator.inflate(layout, null);
        ((TextView) profileTitleView.findViewById(R.id.screenname)).setText("@" + mScreenName);

        TextView fullNameTextView = (TextView) profileTitleView.findViewById(R.id.fullname);
        if (fullNameTextView != null && mUser != null) {
            fullNameTextView.setText(mUser.getName());
        }

        ImageView verifiedImage = (ImageView) profileTitleView.findViewById(R.id.verifiedImage);
        verifiedImage.setVisibility(mUser != null && mUser.getVerified() ? View.VISIBLE : View.GONE);

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

    return true;
}

From source file:free.yhc.netmbuddy.YTSearchActivity.java

private void setupButton(ImageView iv, int drawable, View.OnClickListener onClick) {
    if (drawable <= 0 || null == onClick) {
        iv.setVisibility(View.GONE);
        iv.setOnClickListener(null);/*  w  ww .ja  va  2s .  c  o  m*/
    } else {
        iv.setImageResource(drawable);
        iv.setVisibility(View.VISIBLE);
        iv.setOnClickListener(onClick);
    }
}