コード例 #1
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View view;

      if (convertView == null) {
        LayoutInflater inflater = getLayoutInflater();
        view = inflater.inflate(R.layout.message_list_view_item, null);
      } else {
        view = convertView;
      }

      MessageModel messageModel = messageModelList.get(position);

      BRtextview lblMessageTitle = (BRtextview) view.findViewById(R.id.lblMessageTitle);
      BRtextview lblMessageText = (BRtextview) view.findViewById(R.id.lblMessageText);
      BRtextview lblTurnDate = (BRtextview) view.findViewById(R.id.lblTurnDate);

      Calendar calendar = Calendar.getInstance();
      calendar.setTimeInMillis(messageModel.getMessageDateTime());
      PersianCalendar persianCalendar = new PersianCalendar(calendar.getTime());

      lblMessageTitle.setText(messageModel.getTitle());
      lblMessageText.setText(messageModel.getMessageText());
      lblTurnDate.setText(persianCalendar.getIranianDate());

      return view;
    }
コード例 #2
0
  /** populating data */
  private void populatingData() {
    for (int i = 0; i < 10; i++) {
      MessageModel messageModel = new MessageModel();

      Calendar calendar = Calendar.getInstance();

      messageModel.setMessageId(i);
      messageModel.setTitle("خوش آمدید");
      messageModel.setMessageText(
          "به سامانه نوبت دهی دکترها خوش آمدید.امیدواریم بتوانیم به صورت روزافزون در کنار شما خدمت رسانی کنیم");
      messageModel.setMessageDateTime(calendar.getTimeInMillis());
      messageModel.setEnable(true);

      messageModelList.add(messageModel);
    }
  }