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:de.baumann.hhsmoodle.popup.Popup_todo_restart.java

private void setTodoList() {

    NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nMgr.cancelAll();//  w ww  .j a  va  2  s. c  o  m

    Schedule_helper.setAlarm(Popup_todo_restart.this);

    Intent serviceIntent = new Intent(Popup_todo_restart.this, class_AlarmService.class);
    startService(serviceIntent);

    //display data
    final int layoutstyle = R.layout.list_item_notes;
    int[] xml_id = new int[] { R.id.textView_title_notes, R.id.textView_des_notes, R.id.textView_create_notes };
    String[] column = new String[] { "todo_title", "todo_content", "todo_creation" };
    final Cursor row = db.fetchAllData(Popup_todo_restart.this);
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(Popup_todo_restart.this, layoutstyle, row, column,
            xml_id, 0) {
        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {

            Cursor row2 = (Cursor) lv.getItemAtPosition(position);
            final String _id = row2.getString(row2.getColumnIndexOrThrow("_id"));
            final String todo_title = row2.getString(row2.getColumnIndexOrThrow("todo_title"));
            final String todo_content = row2.getString(row2.getColumnIndexOrThrow("todo_content"));
            final String todo_attachment = row2.getString(row2.getColumnIndexOrThrow("todo_attachment"));

            View v = super.getView(position, convertView, parent);
            ImageView iv_attachment = (ImageView) v.findViewById(R.id.att_notes);

            switch (todo_attachment) {
            case "true":
                iv_attachment.setVisibility(View.VISIBLE);
                iv_attachment.setImageResource(R.drawable.alert_circle);
                break;
            default:
                iv_attachment.setVisibility(View.VISIBLE);
                iv_attachment.setImageResource(R.drawable.alert_circle_red);

                int n = Integer.valueOf(_id);

                android.content.Intent iMain = new android.content.Intent();
                iMain.setAction("shortcutToDo");
                iMain.setClassName(Popup_todo_restart.this, "de.baumann.hhsmoodle.activities.Activity_splash");
                PendingIntent piMain = PendingIntent.getActivity(Popup_todo_restart.this, n, iMain, 0);

                NotificationCompat.Builder builderSummary = new NotificationCompat.Builder(
                        Popup_todo_restart.this).setSmallIcon(R.drawable.school)
                                .setColor(ContextCompat.getColor(Popup_todo_restart.this, R.color.colorPrimary))
                                .setGroup("HHS_Moodle").setGroupSummary(true).setContentIntent(piMain);

                Notification notification = new NotificationCompat.Builder(Popup_todo_restart.this)
                        .setColor(ContextCompat.getColor(Popup_todo_restart.this, R.color.colorPrimary))
                        .setSmallIcon(R.drawable.school).setContentTitle(todo_title)
                        .setContentText(todo_content).setContentIntent(piMain).setAutoCancel(true)
                        .setGroup("HHS_Moodle")
                        .setStyle(new NotificationCompat.BigTextStyle().bigText(todo_content))
                        .setPriority(Notification.PRIORITY_DEFAULT).setVibrate(new long[0]).build();

                NotificationManager notificationManager = (NotificationManager) Popup_todo_restart.this
                        .getSystemService(NOTIFICATION_SERVICE);
                notificationManager.notify(n, notification);
                notificationManager.notify(0, builderSummary.build());
                break;
            }
            return v;
        }
    };

    lv.setAdapter(adapter);
    //onClick function
    try {
        helper_security.encrypt(Popup_todo_restart.this, "/databases/todo_DB_v01.db",
                "/databases/todo_DB_v01_en.db");
    } catch (Exception e) {
        e.printStackTrace();
    }

    new Handler().postDelayed(new Runnable() {
        public void run() {
            finish();
        }
    }, 1000);
}

From source file:com.aqnote.app.wifianalyzer.wifi.AccessPointsDetail.java

void setView(@NonNull Resources resources, @NonNull View view, @NonNull WiFiDetail wiFiDetail,
        boolean isChild) {
    TextView textSSID = (TextView) view.findViewById(R.id.ssid);

    textSSID.setText(wiFiDetail.getTitle());

    view.findViewById(R.id.ipAddress).setVisibility(View.GONE);
    view.findViewById(R.id.linkSpeed).setVisibility(View.GONE);

    ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage);
    WiFiAdditional wiFiAdditional = wiFiDetail.getWiFiAdditional();
    if (wiFiAdditional.isConfiguredNetwork()) {
        configuredImage.setVisibility(View.VISIBLE);
        configuredImage.setColorFilter(resources.getColor(R.color.connected));
    } else {//  w  w  w  . j  a  va 2 s . c  o  m
        configuredImage.setVisibility(View.GONE);
    }

    WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal();
    Strength strength = wiFiSignal.getStrength();
    ImageView imageView = (ImageView) view.findViewById(R.id.levelImage);
    imageView.setImageResource(strength.imageResource());
    imageView.setColorFilter(resources.getColor(strength.colorResource()));

    Security security = wiFiDetail.getSecurity();
    ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage);
    securityImage.setImageResource(security.imageResource());
    securityImage.setColorFilter(resources.getColor(R.color.icons_color));

    TextView textLevel = (TextView) view.findViewById(R.id.level);
    textLevel.setText(wiFiSignal.getLevel() + "dBm");
    textLevel.setTextColor(resources.getColor(strength.colorResource()));

    ((TextView) view.findViewById(R.id.channel)).setText(wiFiSignal.getChannelDisplay());
    ((TextView) view.findViewById(R.id.primaryFrequency))
            .setText(wiFiSignal.getPrimaryFrequency() + WifiInfo.FREQUENCY_UNITS);
    ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance()));
    ((TextView) view.findViewById(R.id.channel_frequency_range))
            .setText(wiFiSignal.getFrequencyStart() + " - " + wiFiSignal.getFrequencyEnd());
    ((TextView) view.findViewById(R.id.width))
            .setText("(" + wiFiSignal.getWiFiWidth().getFrequencyWidth() + WifiInfo.FREQUENCY_UNITS + ")");
    ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities());

    TextView textVendor = ((TextView) view.findViewById(R.id.vendor));
    String vendor = wiFiAdditional.getVendorName();
    if (StringUtils.isBlank(vendor)) {
        textVendor.setVisibility(View.GONE);
    } else {
        textVendor.setVisibility(View.VISIBLE);
        textVendor.setText(vendor.substring(0, Math.min(VENDOR_NAME_MAX, vendor.length())));
    }

    if (isChild) {
        view.findViewById(R.id.tab).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.tab).setVisibility(View.GONE);
    }

}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

private void showButton(View v, int btnId) {
    ImageView plusImageView = v.findViewById(btnId);
    plusImageView.setVisibility(View.VISIBLE);
}

From source file:com.example.adbird.MenuTabActivity.java

public void onPageSelected(int pageNum) {
    int currentItem = mViewPager.getCurrentItem();
    ImageView refresh = (ImageView) findViewById(R.id.refresh);
    if (currentItem == 0) {
        refresh.setVisibility(View.VISIBLE);
    } else {//from w w w  .j  a  v  a  2  s  . co  m
        refresh.setVisibility(View.GONE);
    }

}

From source file:ru.orangesoftware.financisto.activity.ActivityLayout.java

private ImageView hideButton(View v, int btnId) {
    ImageView plusImageView = v.findViewById(btnId);
    plusImageView.setVisibility(View.GONE);
    return plusImageView;
}

From source file:net.jongrakko.zipsuri.fragment.PostDetailExpertFragment1.java

private void setVideo() {
    ImageView videoView = (ImageView) rootView.findViewById(R.id.imageViewVideo);
    if (mPostModel.getVideo() == null) {
        videoView.setVisibility(View.GONE);
    } else {/*from w w  w  .j  a  v  a  2s.co m*/
        videoView.setImageResource(R.drawable.ic_play_circle_outline_white_48dp);
        videoView.setOnClickListener(this);

    }
}

From source file:org.jared.synodroid.ds.adapter.DetailAdapter.java

/**
 * Bind commons torrent's data with widget
 * //w w w  . j a  va2s  . co  m
 * @param viewP
 * @param torrentP
 */
private void bindCommonsData(View viewP, final Detail detailP) {
    // The name of the detail
    TextView name = (TextView) viewP.findViewById(R.id.id_detail_name);
    name.setText(detailP.getName());
    // The action's image
    ImageView img = (ImageView) viewP.findViewById(R.id.id_detail_action);
    if (detailP.getAction() != null) {
        img.setVisibility(View.VISIBLE);
    } else {
        img.setVisibility(View.INVISIBLE);
    }
}

From source file:com.frostwire.android.gui.adapters.PeerListAdapter.java

@Override
protected void populateView(View view, Peer peer) {
    TextView title = findView(view, R.id.view_peer_list_item_title);
    title.setText(peer.isLocalHost() ? view.getResources().getString(R.string.my_files) : peer.getNickname());

    TextView version = findView(view, R.id.view_peer_list_item_version);
    version.setText("v. " + peer.getClientVersion());
    version.setTextColor(0xffcccccc);//  w  w w .j a v a2 s. co m

    ImageView icon = findView(view, R.id.view_peer_list_item_icon);
    populateIcon(icon, peer);

    ImageView howtoShareButton = findView(view, R.id.view_peer_list_item_button_how_to_share);
    howtoShareButton.setOnClickListener(howtoShareClickListener);

    if (!peer.isLocalHost()) {
        howtoShareButton.setVisibility(View.INVISIBLE);
        title.setTextColor(0xff3b3b3b);
    } else {
        title.setTextColor(0xff54afe4);

        // show my version in red If I'm old to encourage user to update.
        if (SoftwareUpdater.instance().isOldVersion()) {
            version.setTextColor(Color.RED);
            version.setText(getContext().getString(R.string.please_update_to_v,
                    SoftwareUpdater.instance().getLatestVersion()));
        }

        howtoShareButton.setVisibility(View.VISIBLE);
        howtoShareButton.setImageResource(R.drawable.share_howto);
    }

    TextView summary = findView(view, R.id.view_peer_list_item_summary);
    summary.setText(getContext().getString(R.string.summary_files_shared, peer.getNumSharedFiles()));
}

From source file:com.example.oris1991.anotherme.ExternalCalendar.CalendarAdapter.java

public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;/*from w  w w.j  av a 2  s. co m*/
    TextView dayView;
    if (convertView == null) { // if it's not recycled, initialize some
        // attributes
        LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.calendar_item, null);

    }
    dayView = (TextView) v.findViewById(R.id.date);
    // separates daystring into parts.
    String[] separatedTime = dayString.get(position).split("-");
    // taking last part of date. ie; 2 from 2012-12-02
    String gridvalue = separatedTime[2].replaceFirst("^0*", "");
    // checking whether the day is in current month or not.
    if ((Integer.parseInt(gridvalue) > 1) && (position < firstDay)) {
        // setting offdays to white color.
        dayView.setTextColor(ContextCompat.getColor(mContext, R.color.summer));
        dayView.setClickable(false);
        dayView.setFocusable(false);
    } else if ((Integer.parseInt(gridvalue) < 7) && (position > 28)) {
        dayView.setTextColor(ContextCompat.getColor(mContext, R.color.summer));
        dayView.setClickable(false);
        dayView.setFocusable(false);
    } else {
        // setting curent month's days in blue color.
        dayView.setTextColor(ContextCompat.getColor(mContext, R.color.colorPrimary));
    }

    if (dayString.get(position).equals(curentDateString)) {
        setSelected(v);
        previousView = v;
    } else {
        v.setBackgroundResource(R.drawable.list_item_background);
    }
    dayView.setText(gridvalue);

    // create date string for comparison
    String date = dayString.get(position);

    if (date.length() == 1) {
        date = "0" + date;
    }
    String monthStr = "" + (month.get(GregorianCalendar.MONTH) + 1);
    if (monthStr.length() == 1) {
        monthStr = "0" + monthStr;
    }

    // show icon if date is not empty and it exists in the items array
    ImageView iw = (ImageView) v.findViewById(R.id.date_icon);
    if (date.length() > 0 && items != null && items.contains(date)) {
        iw.setVisibility(View.VISIBLE);
    } else {
        iw.setVisibility(View.INVISIBLE);
    }
    return v;
}

From source file:com.github.pockethub.ui.comment.CommentListAdapter.java

protected void updateComment(final GithubComment comment) {
    imageGetter.bind(textView(0), comment.body, comment.id);
    avatars.bind(imageView(3), comment.user);

    setText(1, comment.user.login);//from www  .j  a  v  a 2 s .  c om
    setText(2, TimeUtils.getRelativeTime(comment.updated_at));

    final boolean canEdit = (isOwner || comment.user.login.equals(userName)) && editCommentListener != null;

    final boolean canDelete = (isOwner || comment.user.login.equals(userName)) && deleteCommentListener != null;

    final ImageView ivMore = view(4);

    if (!canEdit && !canDelete)
        ivMore.setVisibility(View.INVISIBLE);
    else
        ivMore.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                showMorePopup(ivMore, comment, canEdit, canDelete);
            }
        });
}