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.arantius.tivocommander.Explore.java

public void doRecord(View v) {
    ArrayAdapter<String> choicesAdapter = new ArrayAdapter<String>(this, android.R.layout.select_dialog_item,
            mChoices);/* www  .  j a  va2s.  c  om*/
    Builder dialogBuilder = new AlertDialog.Builder(this);
    dialogBuilder.setTitle("Operation?");
    dialogBuilder.setAdapter(choicesAdapter, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int position) {
            setRefreshResult();

            String label = mChoices.get(position);
            if (RecordActions.DONT_RECORD.toString().equals(label)) {
                getParent().setProgressBarIndeterminateVisibility(true);
                MindRpc.addRequest(new RecordingUpdate(mRecordingId, "cancelled"),
                        new MindRpcResponseListener() {
                            public void onResponse(MindRpcResponse response) {
                                getParent().setProgressBarIndeterminateVisibility(false);
                                ImageView iconSubType = (ImageView) findViewById(R.id.icon_sub_type);
                                TextView textSubType = (TextView) findViewById(R.id.text_sub_type);
                                iconSubType.setVisibility(View.GONE);
                                textSubType.setVisibility(View.GONE);
                            }
                        });
            } else if (RecordActions.RECORD.toString().equals(label)) {
                Intent intent = new Intent(getBaseContext(), SubscribeOffer.class);
                intent.putExtra("contentId", mContentId);
                intent.putExtra("offerId", mOfferId);
                startActivity(intent);
            } else if (RecordActions.RECORD_STOP.toString().equals(label)) {
                getParent().setProgressBarIndeterminateVisibility(true);
                MindRpc.addRequest(new RecordingUpdate(mRecordingId, "complete"),
                        new MindRpcResponseListener() {
                            public void onResponse(MindRpcResponse response) {
                                getParent().setProgressBarIndeterminateVisibility(false);
                                mRecordingId = null;
                            }
                        });
            } else if (RecordActions.SP_ADD.toString().equals(label)) {
                Intent intent = new Intent(getBaseContext(), SubscribeCollection.class);
                intent.putExtra("collectionId", mCollectionId);
                startActivity(intent);
                // TODO: Start for result, get subscription ID.
            } else if (RecordActions.SP_CANCEL.toString().equals(label)) {
                getParent().setProgressBarIndeterminateVisibility(true);
                MindRpc.addRequest(new Unsubscribe(mSubscriptionId), new MindRpcResponseListener() {
                    public void onResponse(MindRpcResponse response) {
                        getParent().setProgressBarIndeterminateVisibility(false);
                        mSubscriptionId = null;
                    }
                });
            } else if (RecordActions.SP_MODIFY.toString().equals(label)) {
                Intent intent = new Intent(getBaseContext(), SubscribeCollection.class);
                intent.putExtra("collectionId", mCollectionId);
                intent.putExtra("subscriptionId", mSubscriptionId);
                intent.putExtra("subscriptionJson", Utils.stringifyToJson(mSubscription));
                startActivity(intent);
            }
        }
    });
    AlertDialog dialog = dialogBuilder.create();
    dialog.show();
}

From source file:com.dunrite.aisle5.activities.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;/*  w  w w  .j  a  v  a2 s  . co  m*/
    // The action bar home/up action should open or close the drawer.
    // ActionBarDrawerToggle will take care of this.
    if (mDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }

    // Handle action buttons
    switch (item.getItemId()) {
    case R.id.clear_all:
        MyListMgr.getInstance().clearAll();
        while (mAdapter.getItemCount() != 0) {
            ((RecAdapter) mAdapter).remove(0);
        }
        mAdapter.notifyDataSetChanged();
        ImageView empty = (ImageView) findViewById(R.id.empty);
        empty.setVisibility(View.VISIBLE);
        myListHasItems = false;
        supportInvalidateOptionsMenu();
        return true;
    case R.id.go_to_myList:
        selectItem(0);
        supportInvalidateOptionsMenu();
        return true;
    case R.id.action_share:
        supportInvalidateOptionsMenu();
        intent = new Intent(this, SharingActivity.class); //call Sharing class
        startActivity(intent);
        return true;
    case R.id.action_about:
        supportInvalidateOptionsMenu();
        intent = new Intent(this, AboutActivity.class); //call About class
        startActivity(intent);
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:eu.trentorise.smartcampus.trentinofamiglia.fragments.event.EventDetailsFragment.java

@Override
public void onStart() {
    super.onStart();
    if (mEvent != null) {

        ImageView certifiedIcon = (ImageView) this.getView().findViewById(R.id.event_details_icon);
        ImageView bannerCertifiedIcon = (ImageView) this.getView().findViewById(R.id.banner_certified);

        if (CategoryHelper.CAT_EVENT_ESTATE_GIOVANI_E_FAMIGLIA.equals(mEvent.getType())
                && mEvent.isCertified()) {
            bannerCertifiedIcon.setVisibility(View.VISIBLE);
            ///*  w  w  w.j a va 2 s  .  com*/
        }
        certifiedIcon.setImageDrawable(ExplorerObject.getIconsEventCertified(getActivity(), mEvent));
        // title
        TextView tv = (TextView) this.getView().findViewById(R.id.event_details_title);
        tv.setText(mEvent.getTitle());

        /*
         * BUTTONS
         */

        // map
        ImageButton mapBtn = (ImageButton) getView().findViewById(R.id.event_details_map);
        mapBtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mEvent.getLocation() != null) {
                    ArrayList<BaseDTObject> list = new ArrayList<BaseDTObject>();
                    getEvent().setLocation(mEvent.getLocation());
                    list.add(getEvent());
                    MapManager.switchToMapView(list, mFragment);
                } else {
                    Toast.makeText(getActivity(), R.string.toast_poi_not_found, Toast.LENGTH_SHORT).show();
                }
            }
        });

        // directions
        ImageButton directionsBtn = (ImageButton) getView().findViewById(R.id.event_details_directions);
        directionsBtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mEvent.getLocation() != null) {

                    bringMeThere(getEvent());
                } else {
                    Toast.makeText(getActivity(), R.string.toast_poi_not_found, Toast.LENGTH_SHORT).show();
                }
            }
        });

        if (mEvent.getLocation()[0] == 0 && mEvent.getLocation()[1] == 0) {
            mapBtn.setVisibility(View.INVISIBLE);
            directionsBtn.setVisibility(View.GONE);
        }

        /*
         * END BUTTONS
         */

        // location
        tv = (TextView) this.getView().findViewById(R.id.event_details_loc);
        //         POIObject poi = getPOI();
        if (mEvent.getCustomData() != null && mEvent.getCustomData().get("place") != null) {
            //esegui get address information
            tv.setText((CharSequence) mEvent.getCustomData().get("place"));
        } else {
            ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv);
        }

        // timing
        tv = (TextView) this.getView().findViewById(R.id.event_timing);
        if (getEvent().getTiming() != null && mEvent.getTiming().length() > 0) {
            tv.setText(mEvent.getTimingFormatted());
        } else {
            ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv);
        }

        // description, optional
        tv = (TextView) this.getView().findViewById(R.id.event_details_descr);
        String customDesc = mEvent.customDescription(getActivity());
        if (customDesc != null && customDesc.length() > 0) {
            tv.setText(Html.fromHtml(customDesc));
        } else {
            ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv);
        }

        // notes
        tv = (TextView) this.getView().findViewById(R.id.event_details_notes);
        // if (mEvent.getCommunityData() != null &&
        // mEvent.getCommunityData().getNotes() != null
        // && mEvent.getCommunityData().getNotes().length() > 0) {
        // tv.setText(mEvent.getCommunityData().getNotes());

        // } else {
        ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv);
        // }

        // tags
        tv = (TextView) this.getView().findViewById(R.id.event_details_tags);
        if (mEvent.getCommunityData() != null && mEvent.getCommunityData().getTags() != null
                && mEvent.getCommunityData().getTags().size() > 0) {
            tv.setText(Utils.conceptToSimpleString(mEvent.getCommunityData().getTags()));
        } else {
            ((LinearLayout) this.getView().findViewById(R.id.eventdetails)).removeView(tv);
        }

        // date
        tv = (TextView) this.getView().findViewById(R.id.event_details_date);
        if (mEvent.getFromTime() != null && mEvent.getFromTime() > 0) {
            CharSequence fromTime = mEvent.dateTimeString();
            CharSequence toTime = mEvent.toDateTimeString();
            if (fromTime.equals(toTime)) {
                tv.setText(fromTime);
            } else {
                tv.setText(fromTime + " - " + toTime);
            }
        } else {
            tv.setText("");
        }
        commentsHandler = new CommentsHandler(getEvent(), getActivity(), getView());
    }

}

From source file:de.geeksfactory.opacclient.frontend.ResultsAdapter.java

@Override
public View getView(int position, View contentView, ViewGroup viewGroup) {
    View view;/*from w  w w  .  j av  a2s  . c o m*/

    // position always 0-7
    if (objects.get(position) == null) {
        LayoutInflater layoutInflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = layoutInflater.inflate(R.layout.listitem_searchresult, viewGroup, false);
        return view;
    }

    SearchResult item = objects.get(position);

    if (contentView == null) {
        LayoutInflater layoutInflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = layoutInflater.inflate(R.layout.listitem_searchresult, viewGroup, false);
    } else {
        view = contentView;
    }

    TextView tv = (TextView) view.findViewById(R.id.tvResult);
    tv.setText(Html.fromHtml(item.getInnerhtml()));

    ImageView ivType = (ImageView) view.findViewById(R.id.ivType);

    PreferenceDataSource pds = new PreferenceDataSource(getContext());
    ConnectivityManager connMgr = (ConnectivityManager) getContext()
            .getSystemService(Context.CONNECTIVITY_SERVICE);

    if (item.getCoverBitmap() != null) {
        ivType.setImageBitmap(BitmapUtils.bitmapFromBytes(item.getCoverBitmap()));
        ivType.setVisibility(View.VISIBLE);
        ivType.setPadding(0, 0, 0, 0);
    } else if ((pds.isLoadCoversOnDataPreferenceSet()
            || !ConnectivityManagerCompat.isActiveNetworkMetered(connMgr)) && item.getCover() != null) {
        LoadCoverTask lct = new LoadCoverTask(ivType, item);
        lct.execute();
        ivType.setImageResource(R.drawable.ic_loading);
        ivType.setVisibility(View.VISIBLE);
        ivType.setPadding(0, 0, 0, 0);
    } else if (item.getType() != null && item.getType() != MediaType.NONE) {
        ivType.setImageResource(getResourceByMediaType(item.getType()));
        ivType.setVisibility(View.VISIBLE);
        ivType.setPadding(padding8dp, padding8dp, padding8dp, padding8dp);
    } else {
        ivType.setVisibility(View.INVISIBLE);
    }
    ImageView ivStatus = (ImageView) view.findViewById(R.id.ivStatus);

    if (item.getStatus() != null) {
        ivStatus.setVisibility(View.VISIBLE);
        switch (item.getStatus()) {
        case GREEN:
            ivStatus.setImageResource(R.drawable.status_light_green_check);
            break;
        case RED:
            ivStatus.setImageResource(R.drawable.status_light_red_cross);
            break;
        case YELLOW:
            ivStatus.setImageResource(R.drawable.status_light_yellow_alert);
            break;
        case UNKNOWN:
            ivStatus.setVisibility(View.INVISIBLE);
            break;
        }
    } else {
        ivStatus.setVisibility(View.GONE);
    }

    return view;
}

From source file:com.jcedar.tixee.activity.ScanTicketActivity.java

private void scanAndReturn(Context context, Uri uri, TextView scanResultss, ImageView scanTicket) {
    Bitmap bitmap = null;/*w  ww .  jav  a  2s .  co  m*/
    try {
        bitmap = decodeBitmapUri(context, uri);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    if (detector.isOperational() && bitmap != null) {
        scanTicket.setImageURI(uri);
        scanTicket.setVisibility(View.VISIBLE);
        Frame frame = new Frame.Builder().setBitmap(bitmap).build();
        SparseArray<Barcode> barcodes = detector.detect(frame);
        for (int index = 0; index < barcodes.size(); index++) {
            Barcode code = barcodes.valueAt(index);
            cdScanResult.setVisibility(View.VISIBLE);
            //                scanResultss.setText(scanResultss.getText() + code.displayValue + "\n");
            //                scanResultString = scanResultss.getText() + code.displayValue;
            scanResultString = code.rawValue;
            scanResultss.setText(scanResultString);
            //                Log.e(TAG, " scanned Barcode String " + rr);

            //Required only if you need to extract the type of barcode
            int type = barcodes.valueAt(index).valueFormat;
            switch (type) {
            case Barcode.CONTACT_INFO:
                Log.i(TAG, code.contactInfo.title);
                break;
            case Barcode.EMAIL:
                Log.i(TAG, code.email.address);
                break;
            case Barcode.ISBN:
                Log.i(TAG, code.rawValue);
                break;
            case Barcode.PHONE:
                Log.i(TAG, code.phone.number);
                break;
            case Barcode.PRODUCT:
                Log.i(TAG, code.rawValue);
                break;
            case Barcode.SMS:
                Log.i(TAG, code.sms.message);
                break;
            case Barcode.TEXT:
                Log.i(TAG, code.rawValue);
                break;
            case Barcode.URL:
                Log.i(TAG, "url: " + code.url.url);
                break;
            case Barcode.WIFI:
                Log.i(TAG, code.wifi.ssid);
                break;
            case Barcode.GEO:
                Log.i(TAG, code.geoPoint.lat + ":" + code.geoPoint.lng);
                break;
            case Barcode.CALENDAR_EVENT:
                Log.i(TAG, code.calendarEvent.description);
                break;
            case Barcode.DRIVER_LICENSE:
                Log.i(TAG, code.driverLicense.licenseNumber);
                break;
            default:
                Log.i(TAG, code.rawValue);
                break;
            }
        }
        if (barcodes.size() == 0) {
            scanResultss.setText("Scan Failed: Found nothing to scan");
        }
    } else {
        scanResultss.setText("Could not set up the detector!");
    }
}

From source file:com.sahildave.snackbar.SnackBar.java

private void setSnackIcon(MessageType messageType, ImageView mSnackIcon) {
    int icon = getSnackIcon(messageType);
    if (icon != 0) {
        mSnackIcon.setImageResource(getSnackIcon(messageType));
    } else {//from   w  w  w  .j av  a2s  .co m
        mSnackIcon.setVisibility(View.GONE);
    }
}

From source file:de.enlightened.peris.Mail.java

@SuppressLint("NewApi")
public void onCreate(final Bundle savedInstanceState) {
    final PerisApp application = (PerisApp) getApplication();
    final String background = application.getSession().getServer().serverColor;

    ThemeSetter.setTheme(this, background);
    super.onCreate(savedInstanceState);
    ThemeSetter.setActionBar(this, background);

    setTitle("Inbox");
    setContentView(R.layout.single_frame_activity);

    //Setup forum background
    final String forumWallpaper = application.getSession().getServer().serverWallpaper;
    final String forumBackground = application.getSession().getServer().serverBackground;
    final FrameLayout sfaHolder = (FrameLayout) findViewById(R.id.sfa_holder);
    final ImageView sfaWallpaper = (ImageView) findViewById(R.id.sfa_wallpaper);
    if (forumBackground != null && forumBackground.contains("#") && forumBackground.length() == 7) {
        sfaHolder.setBackgroundColor(Color.parseColor(forumBackground));
    } else {//  w  w  w .  j  a v a2s . c o m
        sfaHolder.setBackgroundColor(Color.parseColor(getString(R.string.default_background)));
    }

    if (forumWallpaper != null && forumWallpaper.contains("http")) {
        final String imageUrl = forumWallpaper;
        ImageLoader.getInstance().displayImage(imageUrl, sfaWallpaper);
    } else {
        sfaWallpaper.setVisibility(View.GONE);
    }

    final MailFragment mf = new MailFragment();
    final FragmentManager fragmentManager = getSupportFragmentManager();
    final FragmentTransaction ftZ = fragmentManager.beginTransaction();
    ftZ.replace(R.id.single_frame_layout_frame, mf);
    ftZ.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ftZ.commit();
}

From source file:de.vanita5.twittnuker.activity.support.CustomTabEditorActivity.java

public void setExtraFieldSelectText(final View view, final int text) {
    final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
    final TextView text2 = (TextView) view.findViewById(android.R.id.text2);
    final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
    text1.setVisibility(View.VISIBLE);
    text2.setVisibility(View.GONE);
    icon.setVisibility(View.GONE);
    text1.setText(text);/* www.j av  a  2s  .  co  m*/
}

From source file:com.binroot.fatpita.BitmapManager.java

public void fetchBitmapOnThread(final String urlString, final ImageView imageView,
        final ProgressBar indeterminateProgressBar, final Activity act, final boolean saveToHistory) {
    SoftReference<Bitmap> ref = mCache.get(urlString);
    if (ref != null && ref.get() != null) {
        imageView.setImageBitmap(ref.get());
        return;/*w  ww  .  j a  va  2  s  . c  om*/
    }

    final Runnable progressBarShow = new Runnable() {
        public void run() {
            if (indeterminateProgressBar != null) {
                imageView.setVisibility(View.GONE);
                indeterminateProgressBar.setVisibility(View.VISIBLE);
            }
        }
    };
    final Runnable progressBarHide = new Runnable() {
        public void run() {
            if (indeterminateProgressBar != null) {
                indeterminateProgressBar.setVisibility(View.GONE);
                imageView.setVisibility(View.VISIBLE);
            }
        }
    };

    final Handler handler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (indeterminateProgressBar != null && act != null)
                act.runOnUiThread(progressBarHide);
            imageView.setImageBitmap((Bitmap) message.obj);
        }
    };

    Thread thread = new Thread() {
        @Override
        public void run() {
            if (indeterminateProgressBar != null && act != null)
                act.runOnUiThread(progressBarShow);
            Bitmap bitmap = fetchBitmap(urlString, saveToHistory);
            Message message = handler.obtainMessage(1, bitmap);
            handler.sendMessage(message);
        }
    };
    thread.start();
}

From source file:com.android.browser.GearsBaseDialog.java

/**
 * Utility method to update the icon.//from  w w w .  j  a  va2s.  c  o  m
 * Called on the UI thread.
 */
public void updateIcon() {
    if (mIcon == null) {
        return;
    }
    View view = findViewById(R.id.origin_icon);
    if (view != null) {
        ImageView imageView = (ImageView) view;
        imageView.setMaxHeight(MAX_ICON_SIZE);
        imageView.setMaxWidth(MAX_ICON_SIZE);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setImageBitmap(mIcon);
        imageView.setVisibility(View.VISIBLE);
    }
}