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.google.android.apps.forscience.whistlepunk.EditNoteDialog.java

@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
    mLabel = getArguments().getParcelable(KEY_SAVED_LABEL);
    String timeText = getArguments().getString(KEY_SAVED_TIME_TEXT, "");
    String timeTextContentDescription = getArguments().getString(KEY_SAVED_TIME_TEXT_DESCRIPTION);
    mTimestamp = getArguments().getLong(KEY_SAVED_TIMESTAMP);
    try {/* ww w. j  a  v  a2 s .c  o m*/
        mSelectedValue = GoosciLabelValue.LabelValue.parseFrom(getArguments().getByteArray(KEY_SELECTED_VALUE));
    } catch (InvalidProtocolBufferNanoException ex) {
        Log.wtf(TAG, "Couldn't parse label value");
    }
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());

    LinearLayout rootView = (LinearLayout) LayoutInflater.from(getActivity())
            .inflate(R.layout.run_review_label_edit, null);
    alertDialog.setView(rootView);

    ImageView imageView = (ImageView) rootView.findViewById(R.id.picture_note_preview_image);
    final EditText editText = (EditText) rootView.findViewById(R.id.edit_note_text);
    TextView autoTextView = (TextView) rootView.findViewById(R.id.auto_note_text);

    // Use mSelectedValue to load content, because the user may have changed the value since
    // it was stored in the label. Note that picture labels can't be edited at this time,
    // but in the future this will apply to picture labels as well.
    if (mLabel instanceof PictureLabel) {
        imageView.setVisibility(View.VISIBLE);
        autoTextView.setVisibility(View.GONE);
        editText.setText(PictureLabel.getCaption(mSelectedValue));
        editText.setHint(R.string.picture_note_caption_hint);
        Glide.with(getActivity()).load(PictureLabel.getFilePath(mSelectedValue)).into(imageView);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PictureUtils.launchExternalViewer(getActivity(), (PictureLabel.getFilePath(mSelectedValue)));
            }
        });
    } else if (mLabel instanceof TextLabel) {
        imageView.setVisibility(View.GONE);
        autoTextView.setVisibility(View.GONE);
        editText.setText(TextLabel.getText(mSelectedValue));
    } else if (mLabel instanceof SensorTriggerLabel) {
        imageView.setVisibility(View.GONE);
        autoTextView.setVisibility(View.VISIBLE);
        editText.setText(SensorTriggerLabel.getCustomText(mSelectedValue));
        String autoText = SensorTriggerLabel.getAutogenText(mSelectedValue);
        TriggerHelper.populateAutoTextViews(autoTextView, autoText, R.drawable.ic_label_black_24dp,
                getResources());
    }

    alertDialog.setPositiveButton(R.string.action_save, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            mLabel.setTimestamp(mTimestamp);
            if (mLabel instanceof TextLabel) {
                ((TextLabel) mLabel).setText(editText.getText().toString());
            } else if (mLabel instanceof PictureLabel) {
                ((PictureLabel) mLabel).setCaption(editText.getText().toString());
            } else if (mLabel instanceof SensorTriggerLabel) {
                ((SensorTriggerLabel) mLabel).setCustomText(editText.getText().toString());
            }
            getDataController().editLabel(mLabel,
                    ((EditNoteDialogListener) getParentFragment()).onLabelEdit(mLabel));
        }
    });
    alertDialog.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    alertDialog.setCancelable(true);

    TextView timeTextView = (TextView) rootView.findViewById(R.id.edit_note_time);
    timeTextView.setText(timeText);
    timeTextView.setContentDescription(timeTextContentDescription);
    if (labelBelongsToRun() && mLabel.canEditTimestamp()) {
        timeTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                GoosciLabelValue.LabelValue value = new GoosciLabelValue.LabelValue();
                if (mLabel instanceof PictureLabel) {
                    // Captions can be edited, but the picture path cannot be edited at this
                    // time.
                    PictureLabel.populateStorageValue(value, ((PictureLabel) mLabel).getFilePath(),
                            editText.getText().toString());
                    ((EditNoteDialogListener) getParentFragment()).onEditNoteTimestampClicked(mLabel, value,
                            mTimestamp);
                } else if (mLabel instanceof TextLabel) {
                    TextLabel.populateStorageValue(value, editText.getText().toString());
                    ((EditNoteDialogListener) getParentFragment()).onEditNoteTimestampClicked(mLabel, value,
                            mTimestamp);
                }
            }
        });
    } else if (labelBelongsToRun()) {
        Drawable lockDrawable = getResources().getDrawable(R.drawable.ic_lock_black_18dp);
        DrawableCompat.setTint(lockDrawable, getResources().getColor(R.color.text_color_light_grey));
        // There is already a start drawable. Use it again.
        Drawable[] drawables = timeTextView.getCompoundDrawablesRelative();
        timeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], null, lockDrawable, null);
    }

    AlertDialog dialog = alertDialog.create();
    if (mLabel instanceof TextLabel || mLabel instanceof SensorTriggerLabel) {
        dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    }
    return dialog;
}

From source file:com.stasbar.knowyourself.stopwatch.StopwatchFragment.java

public void onUpdateFab(@NonNull ImageView fab) {
    if (getStopwatch().isRunning()) {
        fab.setImageResource(R.drawable.ic_pause_white_24dp);
        fab.setContentDescription(fab.getResources().getString(R.string.sw_pause_button));
    } else {/*from w ww  . ja v  a 2s. c  o m*/
        fab.setImageResource(R.drawable.ic_start_white_24dp);
        fab.setContentDescription(fab.getResources().getString(R.string.sw_start_button));
    }
    fab.setVisibility(VISIBLE);
}

From source file:com.eutectoid.dosomething.picker.GraphObjectAdapter.java

protected View createGraphObjectView(JSONObject graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {/*from w w  w  . java 2 s .  c om*/
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}

From source file:com.tecnojin.timekiller.menuviews.GamePageAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {

    GameDescriptor descriptor = GameManager.instance(context).getGameFromIndex(context, position);

    View layout = inflater.inflate(R.layout.game_page, null);

    TextView t = (TextView) layout.findViewById(R.id.game_name);
    ImageView icon = (ImageView) layout.findViewById(R.id.gameIcon);

    ImageView sett = (ImageView) layout.findViewById(R.id.settings);
    ImageView tutorial = (ImageView) layout.findViewById(R.id.tutorial);
    ImageView stat = (ImageView) layout.findViewById(R.id.stat);

    if (descriptor.getName() != 0) {
        t.setText(descriptor.getName());
        ActivityUtil.setFont(t, ActivityUtil.FONTS_BATES_SHOWER);
        if (descriptor.isReady())
            icon.setImageResource(descriptor.getIcon());
        else/*from   w w w.  ja  v a2  s  .  co m*/
            icon.setImageResource(R.drawable.work);

        if (!descriptor.isReady()) {
            tutorial.setEnabled(false);
            icon.setEnabled(false);
        }
        if (!descriptor.isReady() || descriptor.getOptions() == null)
            sett.setEnabled(false);
        if (descriptor.getStatistics() == null)
            stat.setVisibility(View.INVISIBLE);

    }
    icon.setOnClickListener(new myOnclickListener(myOnclickListener.PLAY,
            GameManager.instance(context).getIndexFor(descriptor), context));
    sett.setOnClickListener(new myOnclickListener(myOnclickListener.SETTINGS,
            GameManager.instance(context).getIndexFor(descriptor), context));
    tutorial.setOnClickListener(new myOnclickListener(myOnclickListener.TUTORIAL,
            GameManager.instance(context).getIndexFor(descriptor), context));
    stat.setOnClickListener(new myOnclickListener(myOnclickListener.STATISTICS,
            GameManager.instance(context).getIndexFor(descriptor), context));
    container.addView(layout);

    return layout;
}

From source file:org.onebusaway.android.ui.NavigationDrawerFragment.java

private View makeNavDrawerItem(final int itemId, ViewGroup container) {
    boolean selected = mCurrentSelectedPosition == itemId;
    int layoutToInflate = 0;
    if (itemId == NAVDRAWER_ITEM_SEPARATOR) {
        layoutToInflate = R.layout.navdrawer_separator;
    } else if (itemId == NAVDRAWER_ITEM_SEPARATOR_SPECIAL) {
        layoutToInflate = R.layout.navdrawer_separator;
    } else {/* ww w.j a v a 2  s .  c  o m*/
        layoutToInflate = R.layout.navdrawer_item;
    }
    View view = getActivity().getLayoutInflater().inflate(layoutToInflate, container, false);

    if (isSeparator(itemId)) {
        // we are done
        UIUtils.setAccessibilityIgnore(view);
        return view;
    }

    ImageView iconView = (ImageView) view.findViewById(R.id.icon);
    TextView titleView = (TextView) view.findViewById(R.id.title);
    int iconId = itemId >= 0 && itemId < NAVDRAWER_ICON_RES_ID.length ? NAVDRAWER_ICON_RES_ID[itemId] : 0;
    int titleId = itemId >= 0 && itemId < NAVDRAWER_TITLE_RES_ID.length ? NAVDRAWER_TITLE_RES_ID[itemId] : 0;

    // set icon and text
    iconView.setVisibility(iconId > 0 ? View.VISIBLE : View.GONE);
    if (iconId > 0) {
        iconView.setImageResource(iconId);
    }
    titleView.setText(getString(titleId));

    formatNavDrawerItem(view, itemId, selected);

    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            selectItem(itemId);
        }
    });

    return view;
}

From source file:com.android.beez.loadimage.ImageWorker.java

/**
 * Load an image specified by the data parameter into an ImageView (override
 * {@link ImageWorker#processBitmap(Object)} to define the processing
 * logic). A memory and disk cache will be used if an {@link ImageCache} has
 * been added using/*from w ww. ja  va 2s.  c om*/
 * {@link ImageWorker#addImageCache(FragmentManager, ImageCache.ImageCacheParams)}
 * . If the image is found in the memory cache, it is set immediately,
 * otherwise an {@link AsyncTask} will be created to asynchronously load the
 * bitmap.
 * 
 * @param data
 *            The URL of the image to download.
 * @param imageView
 *            The ImageView to bind the downloaded image to.
 */
public void loadImage(Object data, ImageView imageView) {
    if (data == null) {
        return;
    }

    BitmapDrawable value = null;
    if (mImageCache != null) {
        value = mImageCache.getBitmapFromMemCache(String.valueOf(data));
    }

    if (value != null) {
        // Bitmap found in memory cache

        imageView.setVisibility(View.VISIBLE);
        imageView.setImageDrawable(value);
    } else {
        if (cancelPotentialWork(data, imageView)) {
            if (this.imageWorkerEventListener != null) {
                final BitmapWorkerTask task = new BitmapWorkerTask(imageView, (String) data,
                        this.imageWorkerEventListener);
                final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task);
                imageView.setImageDrawable(asyncDrawable);
                task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR, data);
            } else {
                final BitmapWorkerTask task = new BitmapWorkerTask(imageView, (String) data);
                final AsyncDrawable asyncDrawable = new AsyncDrawable(mResources, mLoadingBitmap, task);
                imageView.setImageDrawable(asyncDrawable);

                // NOTE: This uses a custom version of AsyncTask that has been
                // pulled from the
                // framework and slightly modified. Refer to the docs at the top of
                // the class
                // for more info on what was changed.
                task.executeOnExecutor(AsyncTask.DUAL_THREAD_EXECUTOR, data);
            }
        }
    }

}

From source file:com.nextgis.maplibui.fragment.LayersListAdapter.java

private View getStandardLayerView(final ILayer layer, View view) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    View v = view;//  w  ww. j ava  2  s  . com
    if (v == null || v.getId() == R.id.empty_row)
        v = inflater.inflate(R.layout.row_layer, null);

    if (layer instanceof NGWLookupTable || layer instanceof NGWTrackLayer)
        return inflater.inflate(R.layout.row_empty, null);

    final ILayerUI layerui;
    if (layer == null) {
        return v;
    } else if (layer instanceof ILayerUI) {
        layerui = (ILayerUI) layer;
    } else {
        layerui = null;
    }

    ImageView ivIcon = (ImageView) v.findViewById(R.id.ivIcon);
    ivIcon.setImageDrawable(layerui != null ? layerui.getIcon(mContext) : null);

    TextView tvPaneName = (TextView) v.findViewById(R.id.tvLayerName);
    tvPaneName.setText(layer.getName());
    //final int id = layer.getId();

    final ImageButton btMore = (ImageButton) v.findViewById(R.id.btMore);
    ImageButton btShow = (ImageButton) v.findViewById(R.id.btShow);
    ImageView ivEdited = (ImageView) v.findViewById(R.id.ivEdited);

    boolean hide = layerui instanceof VectorLayer && ((VectorLayer) layerui).isLocked();
    btMore.setVisibility(hide ? View.GONE : View.VISIBLE);
    btShow.setVisibility(hide ? View.GONE : View.VISIBLE);
    ivEdited.setVisibility(hide ? View.VISIBLE : View.GONE);
    if (mOnPencilClickListener != null)
        ivEdited.setOnClickListener(mOnPencilClickListener);

    int[] attrs = new int[] { R.attr.ic_action_visibility_on, R.attr.ic_action_visibility_off };
    TypedArray ta = mContext.obtainStyledAttributes(attrs);
    Drawable visibilityOn = ta.getDrawable(0);
    Drawable visibilityOff = ta.getDrawable(1);

    if (layer instanceof Layer) {
        btShow.setImageDrawable(//setImageResource(
                ((Layer) layer).isVisible() ? visibilityOn : visibilityOff);
        //btShow.refreshDrawableState();
        btShow.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                //Layer layer = mMap.getLayerById(id);
                ((Layer) layer).setVisible(!((Layer) layer).isVisible());
                layer.save();
            }
        });
    }
    ta.recycle();

    btMore.setOnClickListener(new View.OnClickListener() {
        public void onClick(View arg0) {
            PopupMenu popup = new PopupMenu(mContext, btMore);
            popup.getMenuInflater().inflate(R.menu.layer_popup, popup.getMenu());

            if (layerui == null) {
                popup.getMenu().findItem(R.id.menu_settings).setEnabled(false);
                popup.getMenu().findItem(R.id.menu_share).setEnabled(false);
            }

            if (layer instanceof VectorLayerUI)
                popup.getMenu().findItem(R.id.menu_send_to_ngw).setVisible(true);

            if (layerui instanceof TrackLayer) {
                popup.getMenu().findItem(R.id.menu_delete).setVisible(false);
                popup.getMenu().findItem(R.id.menu_settings).setTitle(R.string.track_list);

                List<ILayer> tracks = new ArrayList<>();
                LayerGroup.getLayersByType(mMap, LAYERTYPE_NGW_TRACKS, tracks);
                popup.getMenu().findItem(R.id.menu_share).setVisible(true);
                mTracksSyncEnabled = tracks.size() > 0;
                int title = mTracksSyncEnabled ? R.string.sync_disable : R.string.sync;
                popup.getMenu().findItem(R.id.menu_share).setTitle(title);
            } else if (layerui instanceof VectorLayer) {
                popup.getMenu().findItem(R.id.menu_edit).setVisible(true);
                popup.getMenu().findItem(R.id.menu_share).setVisible(true);
                popup.getMenu().findItem(R.id.menu_zoom_extent).setVisible(true);
                popup.getMenu().findItem(R.id.menu_download_tiles).setVisible(true);
                popup.getMenu().findItem(R.id.menu_download_tiles).setTitle(R.string.attributes);
            } else if (layerui instanceof LocalTMSLayer) {
                popup.getMenu().findItem(R.id.menu_zoom_extent).setVisible(true);
            } else if (layerui instanceof NGWRasterLayer) {
                popup.getMenu().findItem(R.id.menu_zoom_extent).setVisible(true);
                popup.getMenu().findItem(R.id.menu_download_tiles).setVisible(true);
            } else if (layerui instanceof RemoteTMSLayer) {
                popup.getMenu().findItem(R.id.menu_download_tiles).setVisible(true);
            }

            if (layerui instanceof NGWWebMapLayerUI) {
                popup.getMenu().findItem(R.id.menu_zoom_extent).setVisible(false);
                popup.getMenu().findItem(R.id.menu_edit).setVisible(true);
                popup.getMenu().findItem(R.id.menu_edit).setTitle(R.string.sync_layers);
            }

            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                public boolean onMenuItemClick(MenuItem item) {
                    int i = item.getItemId();
                    if (i == R.id.menu_settings) {
                        assert layerui != null;
                        layerui.changeProperties(mContext);
                    } else if (i == R.id.menu_share) {
                        assert layerui != null;

                        if (layerui instanceof TrackLayerUI) {
                            //                                                handleTrackSync();
                            Toast.makeText(mContext, R.string.commercial, Toast.LENGTH_SHORT).show();
                            return true;
                        } else if (layerui instanceof VectorLayer) {
                            VectorLayer vectorLayer = (VectorLayer) layerui;
                            LayerUtil.shareLayerAsGeoJSON(mActivity, vectorLayer);
                        }
                    } else if (i == R.id.menu_edit) {
                        if (layerui instanceof NGWWebMapLayerUI)
                            ((NGWWebMapLayerUI) layerui).showLayersDialog(mMapView, mActivity);
                        else if (mEditListener != null)
                            mEditListener.onLayerEdit(layer);
                    } else if (i == R.id.menu_delete) {
                        return deleteLayer(layer);
                    } else if (i == R.id.menu_zoom_extent) {
                        mMap.zoomToExtent(layer.getExtents());
                    } else if (i == R.id.menu_download_tiles) {
                        GeoEnvelope env = mMap.getCurrentBounds();

                        if (layer instanceof RemoteTMSLayerUI) {
                            RemoteTMSLayerUI remoteTMSLayer = (RemoteTMSLayerUI) layer;
                            remoteTMSLayer.downloadTiles(mContext, env);
                        } else if (layer instanceof NGWRasterLayerUI) {
                            NGWRasterLayerUI remoteTMSLayer = (NGWRasterLayerUI) layer;
                            remoteTMSLayer.downloadTiles(mContext, env);
                        } else if (layer instanceof NGWWebMapLayerUI) {
                            NGWWebMapLayerUI remoteTMSLayer = (NGWWebMapLayerUI) layer;
                            remoteTMSLayer.downloadTiles(mContext, env);
                        } else if (layer instanceof IVectorLayerUI) {
                            IVectorLayerUI vectorLayerUI = (IVectorLayerUI) layer;
                            vectorLayerUI.showAttributes();
                        }
                    } else if (i == R.id.menu_send_to_ngw) {
                        if (layer instanceof VectorLayerUI)
                            ((VectorLayerUI) layer).sendToNGW(mActivity);
                    }

                    if (mDrawer != null)
                        mDrawer.closeDrawers();

                    return true;
                }
            });

            popup.show();
        }
    });

    return v;
}

From source file:de.blinkt.openvpn.ActivityServerList.java

private void makeSelectedServer() {
    linearSelectedServer.removeAllViews();
    View viewSelectedServer = LayoutInflater.from(this).inflate(R.layout.item_selected_server,
            linearSelectedServer, false);
    ImageView imgViewFlag = (ImageView) viewSelectedServer.findViewById(R.id.imgViewFlag);
    TextView txtCountry = (TextView) viewSelectedServer.findViewById(R.id.txtViewCountryName);

    imgViewFlag.setVisibility(View.GONE);
    for (int i = 0; i < countryList.length; i++) {
        String country = countryList[i];
        if (ActivityDashboard.lolstring.toLowerCase().contains(country.toLowerCase())) {
            String resourceName = country.toLowerCase().replace(" ", "_");

            int checkExistence = getResources().getIdentifier(resourceName, "drawable", getPackageName());
            if (checkExistence != 0) { // the resouce exists...
                imgViewFlag.setVisibility(View.VISIBLE);
                imgViewFlag.setImageResource(
                        getResources().getIdentifier("drawable/" + resourceName, null, getPackageName()));
            }//from  w w  w.j av a2s  .  c o m
            break;
        }
    }
    txtCountry.setText(ActivityDashboard.lolstring);
    linearSelectedServer.addView(viewSelectedServer);
}

From source file:org.wheelmap.android.activity.MainMultiPaneActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    ActionBar bar = getSupportActionBar();
    if (bar == null) {
        return true;
    }//  w  w w.  j  a  va  2 s  .  c o  m

    LayoutInflater inflater = LayoutInflater.from(this);
    View customView = inflater.inflate(R.layout.actionbar_tablet, null);
    bar.setCustomView(customView, new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT, Gravity.CENTER_VERTICAL | Gravity.END));

    boolean isPortraitMode = getResources()
            .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
    if (isPortraitMode) {

        ImageView addItem = (ImageView) customView.findViewById(R.id.menu_new_poi);
        addItem.setVisibility(View.VISIBLE);
        OnClickListener addClickListener = new OnClickListener() {
            @Override
            public void onClick(View v) {
                createNewPoi();
            }
        };
        addItem.setOnClickListener(addClickListener);

        LinearLayout l = (LinearLayout) findViewById(R.id.actionbar_bottom);
        for (int i = 0; i < l.getChildCount(); i++) {
            l.getChildAt(i).setOnTouchListener(new PressSelector());
        }

        bar.setDisplayShowCustomEnabled(true);
        View v = findViewById(R.id.menu_filter);
        MapActivityUtils.setAccessFilterOptionDrawable(this, null, v);

        View filterWc = findViewById(R.id.menu_wc);
        MapActivityUtils.setWcFilterOptionsDrawable(this, null, filterWc);

        UserCredentials credentials = new UserCredentials(getApplicationContext());
        ImageView image = (ImageView) findViewById(R.id.menu_login);
        image.setImageResource(
                credentials.isLoggedIn() ? R.drawable.start_icon_logged_in : R.drawable.start_icon_login);
    } else {
        MenuInflater inflaterMenu = getMenuInflater();
        inflaterMenu.inflate(R.menu.ab_multi_activity, menu);
        MenuItem item = menu.findItem(R.id.menu_filter);
        MapActivityUtils.setAccessFilterOptionDrawable(this, item, null);
        item = menu.findItem(R.id.menu_wc);
        MapActivityUtils.setWcFilterOptionsDrawable(this, item, null);

    }

    if (mapModeType == MapModeType.MAP_MODE_ENGAGE) {
        MenuItem itemFilterWheelChairs = menu.findItem(R.id.menu_filter);
        itemFilterWheelChairs.setEnabled(false);
        //TODO Disable it - doesn't work yet
    }

    ImageView listMapToggle = (ImageView) findViewById(R.id.switch_view);
    if (listMapToggle != null) {
        listMapToggle.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                toggleMovableResize();
            }
        });
    }

    return true;
}

From source file:com.facebook.widget.GraphObjectAdapter.java

protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {/*from  ww  w.j a  va 2 s  . c o m*/
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}