Ejemplo n.º 1
0
  public void showNumberLayout(List<ShowInfoBean> list) {
    LogUtil.e(getClass(), "showNumberLayout list size==>" + list.size());
    showNumberLayout.removeAllViews();
    LayoutParams layoutParams =
        new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    LinearLayout itemLayout = null;
    for (int i = 0; i < list.size(); i++) {
      LogUtil.e(getClass(), "showNumberLayout i==>" + i);
      if (i % 3 == 0) {
        itemLayout =
            (LinearLayout)
                LayoutInflater.from(showNumberLayout.getContext()).inflate(R.layout.show, null);
        itemLayout.setLayoutParams(layoutParams);
        showNumberLayout.addView(itemLayout);
      }
      RelativeLayout itemView =
          (RelativeLayout)
              LayoutInflater.from(showNumberLayout.getContext()).inflate(R.layout.show_item, null);
      initItem(itemView, list.get(i), i);
      LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
      params.setMargins(20, 20, 0, 0);
      params.weight = 1;
      itemView.setLayoutParams(params);
      itemLayout.addView(itemView);
    }
  }
Ejemplo n.º 2
0
  private void groupShowByDate(List<ShowInfoBean> list) {
    todayList.clear();
    tomorrrowList.clear();
    theDayAfter.clear();

    Date date = new Date();
    String today = DateUtil.getDateString(date, "yyyy-MM-dd");
    for (ShowInfoBean bean : list) {
      LogUtil.e(getClass(), "today==>" + today + ", bean fdate==>" + bean.getShowdate());
      if (today.equals(bean.getShowdate())) {
        todayList.add(bean);
      }
    }

    Calendar c = Calendar.getInstance();
    c.setTime(date);
    c.add(c.DATE, 1);
    String tomorrow = DateUtil.getDateString(c.getTime(), "yyyy-MM-dd");
    for (ShowInfoBean bean : list) {
      if (tomorrow.equals(bean.getShowdate())) {
        tomorrrowList.add(bean);
      }
    }
    c.setTime(date);
    c.add(c.DATE, 2);
    String after = DateUtil.getDateString(c.getTime(), "yyyy-MM-dd");
    for (ShowInfoBean bean : list) {
      if (after.equals(bean.getShowdate())) {
        theDayAfter.add(bean);
      }
    }
  }
Ejemplo n.º 3
0
 private void initTime() {
   LogUtil.e(getClass(), "initTime");
   LogUtil.e(
       getClass(),
       "todaylist size==>" + todayList.size() + ", tomorrowlist size==>" + tomorrrowList.size());
   if (todayList.size() > 0) {
     todayText.setVisibility(View.VISIBLE);
     String[] strs = todayList.get(0).getShowdate().split("-");
     todayText.setText("今天 " + strs[1] + "-" + strs[2]);
   } else {
     todayText.setVisibility(View.GONE);
   }
   if (tomorrrowList.size() > 0) {
     tomorrowText.setVisibility(View.VISIBLE);
     String[] strs = tomorrrowList.get(0).getShowdate().split("-");
     tomorrowText.setText("明天 " + strs[1] + "-" + strs[2]);
   } else {
     tomorrowText.setVisibility(View.GONE);
   }
   if (theDayAfter.size() > 0) {
     afterText.setVisibility(View.VISIBLE);
     String[] strs = theDayAfter.get(0).getShowdate().split("-");
     afterText.setText("后天 " + strs[1] + "-" + strs[2]);
   } else {
     afterText.setVisibility(View.GONE);
   }
   if (todayList.size() > 0) {
     currentDay = 1;
     showNumberLayout(todayList);
     todayText.setTextColor(getResources().getColor(R.color.day_on));
     tomorrowText.setBackgroundResource(R.color.cinema_bg);
     afterText.setBackgroundResource(R.color.cinema_bg);
   } else if (tomorrrowList.size() > 0) {
     currentDay = 2;
     showNumberLayout(tomorrrowList);
     tomorrowText.setTextColor(getResources().getColor(R.color.day_on));
     todayText.setBackgroundResource(R.color.cinema_bg);
     afterText.setBackgroundResource(R.color.cinema_bg);
   } else if (theDayAfter.size() > 0) {
     currentDay = 3;
     afterText.setTextColor(getResources().getColor(R.color.day_on));
     tomorrowText.setBackgroundResource(R.color.cinema_bg);
     todayText.setBackgroundResource(R.color.cinema_bg);
     showNumberLayout(theDayAfter);
   }
 }
Ejemplo n.º 4
0
 public ShowInfoWidget(Context context) {
   super(context);
   mContext = context;
   LogUtil.e(getClass(), "showinfowidget()");
   init(context);
 }
 @Override
 public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
   LogUtil.e(MessageExtension.class, parser.getName() + "||" + parser.getText());
   return null;
 }