Exemplo n.º 1
0
  /**
   * add the section tabs for different segment structures. For example in Genesis these can be:
   * Chapters | Parshas | Commentary
   *
   * @param nodeList
   */
  private void addTabsection(List<BilingualNode> nodeList) {
    tabRoot = new LinearLayout(context);
    tabRoot.setOrientation(LinearLayout.HORIZONTAL);
    tabRoot.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    tabRoot.setGravity(Gravity.CENTER);
    this.addView(tabRoot, 0); // make sure it's on top

    for (int count = 0; count < nodeList.size(); count++) {
      MenuNode menuNode = (MenuNode) nodeList.get(count);
      // although generally this isn't necessary b/c the nodes come from menuState.getSections
      // this is used when rebuilding after memory dump and nodes come from setHasTabs()
      if (menuNode.getTitle(Util.Lang.EN).equals("Commentary")
          || (menuNode.getTitle(Util.Lang.EN).equals("Rif"))) {

        continue;
      }
      if (count > 0 && count < nodeList.size()) {
        LayoutInflater inflater =
            (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);

        inflater.inflate(R.layout.tab_divider_menu, tabRoot);
      }

      MenuButtonTab mbt = new MenuButtonTab(context, menuNode, menuState.getLang());
      mbt.setOnClickListener(tabButtonClick);
      tabRoot.addView(mbt);
      menuElementList.add(mbt);
      menuButtonTabList.add(mbt);
    }
  }