コード例 #1
0
 private void bindMenuItem(NavigationItemMenuViewHolder holder, int position) {
   switch (position) {
     case 0:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_home);
       break;
     case 1:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_contract_history);
       break;
     case 2:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_broker_list);
       break;
     case 3:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_settings);
       break;
   }
 }
コード例 #2
0
 private void bindSelectedMenuItem(NavigationItemMenuViewHolder holder, int position) {
   holder.getRowContainer().setBackgroundResource(R.color.ccw_navigation_view_menu_item_overlay);
   switch (position) {
     case 0:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_home_selected);
       break;
     case 1:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_contract_history_selected);
       break;
     case 2:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_broker_list_selected);
       break;
     case 3:
       holder.getIcon().setImageResource(R.drawable.ccw_btn_drawer_settings_selected);
       break;
   }
 }
コード例 #3
0
  /**
   * Bind ViewHolder
   *
   * @param holder ViewHolder object
   * @param data Object data to render
   * @param position position to render
   */
  @Override
  protected void bindHolder(NavigationItemMenuViewHolder holder, MenuItem data, int position) {
    try {
      holder.getLabel().setText(data.getLabel());

      if (data.isSelected()) {
        bindSelectedMenuItem(holder, position);
      } else {
        bindMenuItem(holder, position);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }