Example usage for android.widget TextView setVisibility

List of usage examples for android.widget TextView setVisibility

Introduction

In this page you can find the example usage for android.widget TextView setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java

private void jostaruzunueymahziba(String message) {

    LayoutInflater inflater = this.getLayoutInflater();
    View dialogView = inflater.inflate(R.layout.alert_dialog_login, null);

    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
    dialogBuilder.setView(dialogView);//from   www.  j  a  va2  s  .  co m

    TextView textView = (TextView) dialogView.findViewById(R.id.aaT);
    TextView textVie = (TextView) dialogView.findViewById(R.id.aT);
    textView.setText(message);
    textVie.setVisibility(View.INVISIBLE);
    Button button = (Button) dialogView.findViewById(R.id.buttombastan);
    final AlertDialog alertDialog = dialogBuilder.create();
    alertDialog.show();

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            alertDialog.cancel();
            /*Intent intent = new Intent(PageVirayesh.this,PageVirayesh.class);
            startActivity(intent);*/

        }
    });

}

From source file:com.android.contacts.activities.ActionBarAdapter.java

public void setSelectionCount(int selectionCount) {
    TextView textView = (TextView) mSelectionContainer.findViewById(R.id.selection_count_text);
    if (selectionCount == 0) {
        textView.setVisibility(View.GONE);
    } else {//from w ww . j  av a 2  s .co  m
        textView.setVisibility(View.VISIBLE);
    }
    textView.setText(String.valueOf(selectionCount));
}

From source file:com.android.launcher3.allapps.AllAppsGridAdapter.java

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
    case ICON_VIEW_TYPE: {
        AppInfo info = mApps.getAdapterItems().get(position).appInfo;
        BubbleTextView icon = (BubbleTextView) holder.mContent;
        icon.applyFromApplicationInfo(info);
        icon.setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate());
        break;//from  ww w  . jav a 2 s .co  m
    }
    case PREDICTION_ICON_VIEW_TYPE: {
        AppInfo info = mApps.getAdapterItems().get(position).appInfo;
        BubbleTextView icon = (BubbleTextView) holder.mContent;
        icon.applyFromApplicationInfo(info);
        icon.setAccessibilityDelegate(LauncherAppState.getInstance().getAccessibilityDelegate());
        break;
    }
    case EMPTY_SEARCH_VIEW_TYPE:
        TextView emptyViewText = (TextView) holder.mContent;
        emptyViewText.setText(mEmptySearchMessage);
        emptyViewText.setGravity(
                mApps.hasNoFilteredResults() ? Gravity.CENTER : Gravity.START | Gravity.CENTER_VERTICAL);
        break;
    case SEARCH_MARKET_VIEW_TYPE:
        TextView searchView = (TextView) holder.mContent;
        if (mMarketSearchIntent != null) {
            searchView.setVisibility(View.VISIBLE);
            searchView.setContentDescription(mMarketSearchMessage);
            searchView.setGravity(
                    mApps.hasNoFilteredResults() ? Gravity.CENTER : Gravity.START | Gravity.CENTER_VERTICAL);
            searchView.setText(mMarketSearchMessage);
        } else {
            searchView.setVisibility(View.GONE);
        }
        break;
    }
    if (mBindViewCallback != null) {
        mBindViewCallback.onBindView(holder);
    }
}

From source file:com.arantius.tivocommander.Explore.java

protected void finishRequest() {
    if (--mRequestCount != 0) {
        return;//from   w  w w  .  j ava2s .co  m
    }

    getParent().setProgressBarIndeterminateVisibility(false);

    if (mRecordingId == null) {
        for (JsonNode recording : mContent.path("recordingForContentId")) {
            String state = recording.path("state").asText();
            if ("inProgress".equals(state) || "complete".equals(state) || "scheduled".equals(state)) {
                mRecordingId = recording.path("recordingId").asText();
                mRecordingState = state;
                break;
            }
        }
    }

    // Fill mChoices based on the data we now have.
    if ("scheduled".equals(mRecordingState)) {
        mChoices.add(RecordActions.DONT_RECORD.toString());
    } else if ("inProgress".equals(mRecordingState)) {
        mChoices.add(RecordActions.RECORD_STOP.toString());
    } else if (mOfferId != null) {
        mChoices.add(RecordActions.RECORD.toString());
    }
    if (mSubscriptionId != null) {
        mChoices.add(RecordActions.SP_MODIFY.toString());
        mChoices.add(RecordActions.SP_CANCEL.toString());
    } else if (mCollectionId != null && !"movie".equals(mContent.path("collectionType").asText())
            && !mContent.has("movieYear")) {
        mChoices.add(RecordActions.SP_ADD.toString());
    }

    setContentView(R.layout.explore);

    // Show only appropriate buttons.
    findViewById(R.id.explore_btn_watch).setVisibility(
            "complete".equals(mRecordingState) || "inprogress".equals(mRecordingState) ? View.VISIBLE
                    : View.GONE);
    hideViewIfNull(R.id.explore_btn_upcoming, mCollectionId);
    if (mChoices.size() == 0) {
        findViewById(R.id.explore_btn_record).setVisibility(View.GONE);
    }
    // Delete / undelete buttons visible only if appropriate.
    findViewById(R.id.explore_btn_delete)
            .setVisibility("complete".equals(mRecordingState) ? View.VISIBLE : View.GONE);
    findViewById(R.id.explore_btn_undelete)
            .setVisibility("deleted".equals(mRecordingState) ? View.VISIBLE : View.GONE);

    // Display titles.
    String title = mContent.path("title").asText();
    String subtitle = mContent.path("subtitle").asText();
    ((TextView) findViewById(R.id.content_title)).setText(title);
    TextView subtitleView = ((TextView) findViewById(R.id.content_subtitle));
    if ("".equals(subtitle)) {
        subtitleView.setVisibility(View.GONE);
    } else {
        subtitleView.setText(subtitle);
    }

    // Display (only the proper) badges.
    if (mRecording != null && mRecording.path("episodic").asBoolean()
            && !mRecording.path("repeat").asBoolean()) {
        findViewById(R.id.badge_new).setVisibility(View.VISIBLE);
    }
    if (mRecording != null && mRecording.path("hdtv").asBoolean()) {
        findViewById(R.id.badge_hd).setVisibility(View.VISIBLE);
    }
    ImageView iconSubType = (ImageView) findViewById(R.id.icon_sub_type);
    TextView textSubType = (TextView) findViewById(R.id.text_sub_type);
    // TODO: Downloading state?
    if ("complete".equals(mRecordingState)) {
        iconSubType.setVisibility(View.GONE);
        textSubType.setVisibility(View.GONE);
    } else if ("inProgress".equals(mRecordingState)) {
        iconSubType.setImageResource(R.drawable.recording_recording);
        textSubType.setText(R.string.sub_recording);
    } else if (mSubscriptionType != null) {
        switch (mSubscriptionType) {
        case SEASON_PASS:
            iconSubType.setImageResource(R.drawable.todo_seasonpass);
            textSubType.setText(R.string.sub_season_pass);
            break;
        case SINGLE_OFFER:
            iconSubType.setImageResource(R.drawable.todo_single_offer);
            textSubType.setText(R.string.sub_single_offer);
            break;
        case WISHLIST:
            iconSubType.setImageResource(R.drawable.todo_wishlist);
            textSubType.setText(R.string.sub_wishlist);
            break;
        default:
            iconSubType.setVisibility(View.GONE);
            textSubType.setVisibility(View.GONE);
        }
    } else {
        iconSubType.setVisibility(View.GONE);
        textSubType.setVisibility(View.GONE);
    }

    // Display channel and time.
    if (mRecording != null) {
        String channelStr = "";
        JsonNode channel = mRecording.path("channel");
        if (!channel.isMissingNode()) {
            channelStr = String.format("%s %s, ", channel.path("channelNumber").asText(),
                    channel.path("callSign").asText());
        }

        // Lots of shows seem to be a few seconds short, add padding so that
        // rounding down works as expected. Magic number.
        final int minutes = (30 + mRecording.path("duration").asInt()) / 60;

        String durationStr = minutes >= 60 ? String.format(Locale.US, "%d hr", minutes / 60)
                : String.format(Locale.US, "%d min", minutes);
        if (isRecordingPartial()) {
            durationStr += " (partial)";
        }
        ((TextView) findViewById(R.id.content_chan_len)).setText(channelStr + durationStr);

        String airTime = new SimpleDateFormat("EEE MMM d, hh:mm a", Locale.US)
                .format(Utils.parseDateTimeStr(mRecording.path("actualStartTime").asText()));
        ((TextView) findViewById(R.id.content_air_time)).setText("Air time: " + airTime);
    } else {
        ((TextView) findViewById(R.id.content_chan_len)).setVisibility(View.GONE);
        ((TextView) findViewById(R.id.content_air_time)).setVisibility(View.GONE);
    }

    // Construct and display details.
    ArrayList<String> detailParts = new ArrayList<String>();
    int season = mContent.path("seasonNumber").asInt();
    int epNum = mContent.path("episodeNum").path(0).asInt();
    if (season != 0 && epNum != 0) {
        detailParts.add(String.format("Sea %d Ep %d", season, epNum));
    }
    if (mContent.has("mpaaRating")) {
        detailParts.add(mContent.path("mpaaRating").asText().toUpperCase(Locale.US));
    } else if (mContent.has("tvRating")) {
        detailParts.add("TV-" + mContent.path("tvRating").asText().toUpperCase(Locale.US));
    }
    detailParts.add(mContent.path("category").path(0).path("label").asText());
    int year = mContent.path("originalAirYear").asInt();
    if (year != 0) {
        detailParts.add(Integer.toString(year));
    }

    // Filter empty strings.
    for (int i = detailParts.size() - 1; i >= 0; i--) {
        if ("".equals(detailParts.get(i)) || null == detailParts.get(i)) {
            detailParts.remove(i);
        }
    }
    // Then format the parts into one string.
    String detail1 = "(" + Utils.join(", ", detailParts) + ") ";
    if ("() ".equals(detail1)) {
        detail1 = "";
    }

    String detail2 = mContent.path("description").asText();
    TextView detailView = ((TextView) findViewById(R.id.content_details));
    if (detail2 == null) {
        detailView.setText(detail1);
    } else {
        Spannable details = new SpannableString(detail1 + detail2);
        details.setSpan(new ForegroundColorSpan(Color.WHITE), detail1.length(), details.length(), 0);
        detailView.setText(details);
    }

    // Add credits.
    ArrayList<String> credits = new ArrayList<String>();
    for (JsonNode credit : mContent.path("credit")) {
        String role = credit.path("role").asText();
        if ("actor".equals(role) || "host".equals(role) || "guestStar".equals(role)) {
            credits.add(credit.path("first").asText() + " " + credit.path("last").asText());
        }
    }
    TextView creditsView = (TextView) findViewById(R.id.content_credits);
    creditsView.setText(Utils.join(", ", credits));

    // Find and set the banner image if possible.
    ImageView imageView = (ImageView) findViewById(R.id.content_image);
    View progressView = findViewById(R.id.content_image_progress);
    String imageUrl = Utils.findImageUrl(mContent);
    new DownloadImageTask(this, imageView, progressView).execute(imageUrl);
}

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 {/*from w  ww. j  a va  2  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.irccloud.android.activity.UploadsActivity.java

private void checkEmpty() {
    if (adapter.getCount() == 0 && !canLoadMore) {
        findViewById(android.R.id.list).setVisibility(View.GONE);
        TextView empty = (TextView) findViewById(android.R.id.empty);
        empty.setVisibility(View.VISIBLE);
        empty.setText("You haven't uploaded any files to IRCCloud yet.");
    } else {//from   w w  w . j  a v  a 2s.  c o  m
        findViewById(android.R.id.list).setVisibility(View.VISIBLE);
        findViewById(android.R.id.empty).setVisibility(View.GONE);
    }
}

From source file:com.entertailion.android.launcher.Dialogs.java

/**
 * Display dialog to allow user to select which row to add the shortcut. For
 * TV channels let the user change the channel name.
 * /*from   w  w  w . j  av a 2  s.c  o  m*/
 * @see InstallShortcutReceiver
 * 
 * @param context
 * @param name
 * @param icon
 * @param uri
 */
public static void displayShortcutsRowSelection(final Launcher context, final String name, final String icon,
        final String uri) {
    if (uri == null) {
        return;
    }
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    final boolean isChannel = uri.startsWith("tv");
    dialog.setContentView(R.layout.select_row);

    final TextView channelTextView = (TextView) dialog.findViewById(R.id.channelText);
    final EditText channelNameEditText = (EditText) dialog.findViewById(R.id.channelName);
    if (isChannel) {
        channelTextView.setVisibility(View.VISIBLE);
        channelNameEditText.setVisibility(View.VISIBLE);
        channelNameEditText.setText(name);
    }

    final TextView selectTextView = (TextView) dialog.findViewById(R.id.selectText);
    selectTextView.setText(context.getString(R.string.dialog_select_row, name));

    final Spinner spinner = (Spinner) dialog.findViewById(R.id.spinner);

    final EditText nameEditText = (EditText) dialog.findViewById(R.id.rowName);
    final RadioButton currentRadioButton = (RadioButton) dialog.findViewById(R.id.currentRadio);
    currentRadioButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // hide the row name edit field if the current row radio button
            // is selected
            nameEditText.setVisibility(View.GONE);
            spinner.setVisibility(View.VISIBLE);
        }

    });
    final RadioButton newRadioButton = (RadioButton) dialog.findViewById(R.id.newRadio);
    newRadioButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // show the row name edit field if the new radio button is
            // selected
            nameEditText.setVisibility(View.VISIBLE);
            nameEditText.requestFocus();
            spinner.setVisibility(View.GONE);
        }

    });

    List<String> list = new ArrayList<String>();
    final ArrayList<RowInfo> rows = RowsTable.getRows(context);
    if (rows != null) {
        for (RowInfo row : rows) {
            list.add(row.getTitle());
        }
    }
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context, R.layout.simple_spinner_item, list);
    dataAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(dataAdapter);

    Button buttonYes = (Button) dialog.findViewById(R.id.buttonOk);
    buttonYes.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            String shortcutName = name;
            try {
                if (isChannel) {
                    String channelName = channelNameEditText.getText().toString().trim();
                    if (channelName.length() == 0) {
                        channelNameEditText.requestFocus();
                        displayAlert(context, context.getString(R.string.dialog_channel_name_alert));
                        return;
                    }
                    shortcutName = channelName;
                }
                // if the new row radio button is selected, the user must
                // enter a name for the new row
                String rowName = nameEditText.getText().toString().trim();
                if (newRadioButton.isChecked() && rowName.length() == 0) {
                    nameEditText.requestFocus();
                    displayAlert(context, context.getString(R.string.dialog_new_row_name_alert));
                    return;
                }
                boolean currentRow = !newRadioButton.isChecked();
                int rowId = 0;
                int rowPosition = 0;
                if (currentRow) {
                    if (rows != null) {
                        String selectedRow = (String) spinner.getSelectedItem();
                        for (RowInfo row : rows) {
                            if (row.getTitle().equals(selectedRow)) {
                                rowId = row.getId();
                                ArrayList<ItemInfo> items = ItemsTable.getItems(context, rowId);
                                rowPosition = items.size(); // in last
                                // position
                                // for selected
                                // row
                                break;
                            }
                        }
                    }
                } else {
                    rowId = (int) RowsTable.insertRow(context, rowName, 0, RowInfo.FAVORITE_TYPE);
                    rowPosition = 0;
                }

                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(uri));
                ItemsTable.insertItem(context, rowId, rowPosition, shortcutName, intent, icon,
                        DatabaseHelper.SHORTCUT_TYPE);
                Toast.makeText(context, context.getString(R.string.shortcut_installed, shortcutName),
                        Toast.LENGTH_SHORT).show();
                context.reloadAllGalleries();

                if (currentRow) {
                    Analytics.logEvent(Analytics.ADD_SHORTCUT);
                } else {
                    Analytics.logEvent(Analytics.ADD_SHORTCUT_WITH_ROW);
                }

            } catch (Exception e) {
                Log.d(LOG_TAG, "onClick", e);
            }

            context.showCover(false);
            dialog.dismiss();
        }

    });
    Button buttonNo = (Button) dialog.findViewById(R.id.buttonCancel);
    buttonNo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            context.showCover(false);
            dialog.dismiss();
        }

    });
    dialog.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            context.showCover(false);
        }

    });
    context.showCover(true);
    dialog.show();
    Analytics.logEvent(Analytics.DIALOG_ADD_SHORTCUT);
}

From source file:com.android.calendar.month.SimpleDayPickerFragment.java

/**
 * Fixes the day names header to provide correct spacing and updates the
 * label text. Override this to set up a custom header.
 *//*  w w  w  . j  a v a 2 s .c  o m*/
protected void updateHeader() {
    TextView label = (TextView) mDayNamesHeader.findViewById(R.id.wk_label);
    if (mShowWeekNumber) {
        label.setVisibility(View.VISIBLE);
    } else {
        label.setVisibility(View.GONE);
    }
    int offset = mFirstDayOfWeek;
    for (int i = 0, j = 6; j >= 0; i++, j--) {
        label = (TextView) mDayNamesHeader.getChildAt(j);
        if (i < mDaysPerWeek) {
            int position = (offset + i) % 7;
            label.setText(mDayLabels[position]);
            label.setVisibility(View.VISIBLE);
            // if (position == Time.SATURDAY) {
            // label.setTextColor(mSaturdayColor);
            // } else if (position == Time.SUNDAY) {
            // label.setTextColor(mSundayColor);
            // }
            if (position == Time.FRIDAY) {
                label.setTextColor(mFridayColor);
            } else {
                label.setTextColor(mDayNameColor);
            }
        } else {
            label.setVisibility(View.GONE);
        }
    }
    mDayNamesHeader.invalidate();
}

From source file:com.android.mail.ui.NestedFolderTeaserView.java

private void updateViews(final FolderHolder folderHolder) {
    final Folder folder = folderHolder.getFolder();

    // Update unread count
    final String unreadText = Utils.getUnreadCountString(getContext(), folder.unreadCount);
    folderHolder.getCountTextView().setText(unreadText.isEmpty() ? "0" : unreadText);

    // Update unread senders
    final String sendersText = TextUtils.join(getResources().getString(R.string.enumeration_comma),
            folderHolder.getUnreadSenders());
    final TextView sendersTextView = folderHolder.getSendersTextView();
    if (!TextUtils.isEmpty(sendersText)) {
        sendersTextView.setVisibility(VISIBLE);
        sendersTextView.setText(sendersText);
    } else {/*from  w  w w  .j av  a2s  .c  o m*/
        sendersTextView.setVisibility(GONE);
    }
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_release_detail, container, false);
    mRootView = rootView;//from   w  ww. j  ava2s .  c o  m
    // Show the content
    if (mRelease != null) {
        setRelease();
        if (!mRelease.hasExtendedInfo) {
            //we don't got extended info on this release yet, get it and display it
            mDiscogs.refreshRelease(mRelease, new Discogs.DiscogsWaiter() {
                @Override
                public void onResult(boolean success) {
                    if (success) {
                        //refresh the info
                        setRelease();
                    }
                }
            });
        }
    } else {
        mDiscogs.getRelease(getArguments().getLong(ARG_ITEM_ID, 0), new Discogs.DiscogsDataWaiter<Release>() {
            @Override
            public void onResult(boolean success, Release data) {
                if (success) {
                    mRelease = data;
                    setRelease();
                }
            }
        });
    }

    //pricesuggestions
    //get price suggestions
    mDiscogs.getPriceSuggestions(getArguments().getLong(ARG_ITEM_ID, 0),
            new Discogs.DiscogsDataWaiter<DiscogsPriceSuggestion>() {
                @Override
                public void onResult(boolean success, DiscogsPriceSuggestion data) {
                    if (success && data != null) {

                        ArrayList<Bar> bars = new ArrayList<Bar>();
                        for (DiscogsPriceSuggestion.Quality quality : data.getSuggestion()) {
                            Bar b = new Bar();
                            b.setName(quality.type);
                            b.setValue(quality.value);
                            b.setValueString(Math.round(quality.value * 10) / 10f + "");
                            bars.add(b);
                        }

                        if (bars.size() > 0) {
                            TextView heading = (TextView) mRootView.findViewById(R.id.detail_price_header);
                            BarGraph graph = (BarGraph) mRootView.findViewById(R.id.detail_price_graph);
                            heading.setText(heading.getText() + " in " + data.getSuggestion().get(0).currency);
                            graph.setBars(bars);
                            heading.setVisibility(View.VISIBLE);
                            graph.setVisibility(View.VISIBLE);
                        }
                    }
                }
            });

    return rootView;
}