Пример #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_event_detail);

    DataEngine engine = DataEngine.getInstance();
    setTitle(engine.getUserName());
    setAvatar(engine.getUserAvatar());

    showLoadingView();

    mEventTitle = (TextView) findViewById(R.id.event_title);
    mEventImg = (UrlImageView) findViewById(R.id.event_img);
    mEventTime = (TextView) findViewById(R.id.event_time);
    mEventPersonCount = (TextView) findViewById(R.id.event_person_count);
    mEventCost = (TextView) findViewById(R.id.event_cost);
    mEventDetail = (TextView) findViewById(R.id.event_detail);

    mBtnSign = findViewById(R.id.btn_sign);
    mBtnShare = findViewById(R.id.btn_share);
    mBtnLike = findViewById(R.id.btn_like);

    mEventId = getIntent().getExtras().getInt(Constant.KEY_EVENT_ID);
    Bundle data = new Bundle();
    data.putInt(Constant.KEY_EVENT_ID, mEventId);
    mNetModel.put(AbstractModel.KEY_SUBMIT_INFO, data);
    mNetModel.doAction(AbstractModel.MODEL_ACTION_GET_EVENT_DETAIL);
  }
Пример #2
0
 private void updateView() {
   Event event = DataEngine.getInstance().getEvent(mEventId);
   mEventTitle.setText(event.getTitle());
   mEventImg.setDefaultBitmap(
       BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
   mEventImg.setImageFromUrl(event.getImg());
   mEventTime.setText(event.getEventTime());
   mEventPersonCount.setText(String.valueOf(event.getJoinCount()));
   mEventCost.setText(event.getCost());
   mEventDetail.setText(Html.fromHtml(event.getIntro()));
 }
Пример #3
0
  public void updateView() {
    Event[] hotEvents = DataEngine.getInstance().getHotEventList();
    int maxHeight = 0;
    Resources res = mContext.getResources();
    int eventIconSize = res.getDimensionPixelSize(R.dimen.event_img_size);
    LayoutInflater inflater = LayoutInflater.from(mContext);
    for (int i = 0; i < hotEvents.length; ++i) {
      View v = inflater.inflate(R.layout.view_event_list_cell, null);
      UrlImageView img = (UrlImageView) v.findViewById(R.id.event_img);
      img.setImageHeight(eventIconSize);
      img.setImageWidth(eventIconSize);
      img.setDefaultBitmap(BitmapFactory.decodeResource(res, R.drawable.ic_launcher));
      img.setImageFromUrl(hotEvents[i].getImg());

      TextView title = (TextView) v.findViewById(R.id.event_title);
      title.setText(hotEvents[i].getTitle());

      TextView author = (TextView) v.findViewById(R.id.event_author);
      author.setText(res.getString(R.string.tip_event_author, hotEvents[i].getAuthor()));

      TextView address = (TextView) v.findViewById(R.id.event_address);
      address.setText(res.getString(R.string.tip_event_address, hotEvents[i].getAddress()));

      TextView time = (TextView) v.findViewById(R.id.event_time);
      time.setText(res.getString(R.string.tip_event_time, hotEvents[i].getEventTime()));
      v.setTag(hotEvents[i].getEventId());
      v.setOnClickListener(mPageOnClickListener);
      mViews.add(v);
      measureView(v);
      maxHeight = maxHeight < v.getMeasuredHeight() ? v.getMeasuredHeight() : maxHeight;

      ImageView circle = new ImageView(mContext);
      if (0 == i) {
        circle.setImageResource(R.drawable.dot_selected);
      } else {
        circle.setImageResource(R.drawable.dot_none);
      }
      circle.setPadding(5, 0, 5, 0);
      mCircleContainer.addView(circle);
    }
    ViewGroup.LayoutParams lp = mViewPager.getLayoutParams();
    lp.height = maxHeight;
    mViewPager.setLayoutParams(lp);
    mViewPager.setAdapter(new HotPageAdapter());
    mViewPager.setOnPageChangeListener(mPageChangeListener);

    mCategoryGrid.setNumColumns(3);
    mCategoryGrid.setAdapter(new CategoryGridAdapter());
    mCategoryGrid.setVerticalSpacing(
        mContext.getResources().getDimensionPixelSize(R.dimen.category_vertical_padding));
  }
Пример #4
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      GridCell cell = null;
      if (null == convertView) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.view_category_grid_cell, null);
        cell = new GridCell();
        cell.icon = (NumButton) convertView.findViewById(R.id.category_icon);
        cell.name = (TextView) convertView.findViewById(R.id.category_name);
        convertView.setTag(cell);
      } else {
        cell = (GridCell) convertView.getTag();
      }

      Category category = DataEngine.getInstance().getCategoryList()[position];
      cell.icon.setIconFromUrl(category.getIcon());
      cell.icon.setNum(category.getCount());
      cell.name.setText(category.getName());
      return convertView;
    }
Пример #5
0
 @Override
 public int getCount() {
   return DataEngine.getInstance().getCategoryList().length;
 }