Esempio n. 1
0
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    DashboardItem dashboardItem = mDefinition.getItems().get(position);

    if (dashboardItem.getKind() == DashboardMetadataLoader.COMPONENT_KIND) {
      String link = dashboardItem.getObjectName();
      ActivityLauncher.CallComponent(mContext, link);
    } else {
      runDashboardItem(mContext, dashboardItem, mDashboardEntity);
    }
  }
Esempio n. 2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
      if (mDefinition.getControl().equalsIgnoreCase(DashboardMetadata.CONTROL_LIST))
        convertView = mInflater.inflate(R.layout.dashboarditeminlist, parent, false);
      else convertView = mInflater.inflate(R.layout.dashboarditem, parent, false);

      holder = new ViewHolder();
      holder.text = (GxTextView) convertView.findViewById(R.id.DashBoardTextView);
      holder.icon = (GxImageViewStatic) convertView.findViewById(R.id.DashBoardImageView);

      convertView.setTag(holder);
    } else holder = (ViewHolder) convertView.getTag();

    // Bind the data efficiently with the holder.
    DashboardItem dashboardItem = mDefinition.getItems().get(position);
    holder.text.setText(dashboardItem.getTitle());

    GxLinearLayout layout = (GxLinearLayout) convertView;
    String themeClass = dashboardItem.getThemeClass();
    if (Services.Strings.hasValue(themeClass)) {
      // Apply Style for the item
      GxTheme.applyStyle(layout, dashboardItem.getThemeClass());
      ThemeUtils.setFontProperties(
          holder.text, PlatformHelper.getThemeClass(dashboardItem.getThemeClass()));

      // Take into account the Content Mode of Images
      ThemeClassDefinition classDef = PlatformHelper.getThemeClass(themeClass);
      if (classDef != null) {
        String imageClass = classDef.getThemeImageClass();
        if (Services.Strings.hasValue(imageClass)) GxTheme.applyStyle(holder.icon, imageClass);
      }
    }

    ImageHelper.showStaticImage(getImageLoader(), holder.icon, dashboardItem.getImageName());

    ControlTestHelper.onGxControlCreated(convertView, dashboardItem);
    return convertView;
  }
Esempio n. 3
0
  @Override
  public int getCount() {
    if (mDefinition == null) return 0;

    return mDefinition.getItems().size();
  }