Ejemplo n.º 1
0
  @Override
  public void onBindViewHolder(LinkTextHolder holder, int position) {
    Util.Lang lang = activity.getTextLang();

    Segment link = itemList.get(position);
    if (link.getText(lang).length() == 0) lang = Util.Lang.BI; // TODO noah, make this better.

    holder.title.setVisibility(View.VISIBLE);
    holder.title.setText(Html.fromHtml(link.getLocationString(Settings.getMenuLang())));
    holder.title.setFont(Settings.getMenuLang(), true, activity.getTextSize());
    holder.setPosition(position);

    // itemList might not have updated yet if you switched pesukim. make sure it's up to date
    if (!holder.getItemList().equals(itemList)) holder.setItemList(itemList);

    if (holder instanceof LinkMonoTextHolder) {
      LinkMonoTextHolder monoHolder = (LinkMonoTextHolder) holder;

      String text;
      if (link.getText(lang).length() == 0)
        text = activity.getResources().getString(R.string.no_text);
      else text = link.getText(lang);

      monoHolder.monoTv.setText(Html.fromHtml(Util.getBidiString(text, lang)));
      monoHolder.monoTv.setFont(lang, true, activity.getTextSize());
      monoHolder.monoTv.setLangGravity(lang);

    } else if (holder instanceof LinkBiTextHolder) {
      LinkBiTextHolder biHolder = (LinkBiTextHolder) holder;

      biHolder.enTv.setVisibility(View.VISIBLE);
      biHolder.heTv.setVisibility(View.VISIBLE);

      String enText = link.getText(Util.Lang.EN);
      String heText = link.getText(Util.Lang.HE);

      if (enText.length() == 0) biHolder.enTv.setVisibility(View.GONE);
      else biHolder.enTv.setText(Html.fromHtml(Util.getBidiString(enText, Util.Lang.EN)));
      biHolder.enTv.setFont(Util.Lang.EN, true, activity.getTextSize());

      if (heText.length() == 0) biHolder.heTv.setVisibility(View.GONE);
      else biHolder.heTv.setText(Html.fromHtml(Util.getBidiString(heText, Util.Lang.HE)));
      biHolder.heTv.setFont(Util.Lang.HE, true, activity.getTextSize());
    }
  }
Ejemplo n.º 2
0
  // if currLinkCount == null, all linkSelectorBarButtons will be gray
  public void update(LinkFilter currLinkCount, Util.Lang lang) {
    this.currLinkCount = currLinkCount;
    selectorListLayout.removeAllViews();
    if (linkSelectorQueue == null) return;
    ListIterator<LinkFilter> linkIt = linkSelectorQueue.listIterator(linkSelectorQueue.size());
    while (linkIt.hasPrevious()) {
      // add children in reverse order
      LinkFilter tempLC = linkIt.previous();
      LinkSelectorBarButton lssb =
          new LinkSelectorBarButton(activity, tempLC, activity.getBook(), lang);
      lssb.setOnClickListener(linkSelectorBarButtonClick);
      selectorListLayout.addView(lssb);

      if (!LinkFilter.pseudoEquals(tempLC, currLinkCount)) {
        lssb.setTextColor(Util.getColor(activity, R.attr.text_chapter_header_color));
      }
    }

    Settings.Link.setLinks(activity.getBook().getTitle(Util.Lang.EN), linkSelectorQueue);
  }