java parseobject参数_Java ParseObject.getList方法代码示例

import com.parse.ParseObject; //导入方法依赖的package包/类

private void modelToUI() {

ParseObject event = mEvent;

aq.id(R.id.textHospitalName).text(event.getString("hospital"));

String location = event.getString("location");

location+=" "+StringUtils.isNullOrEmpty(event.getString("room"), "");

aq.id(R.id.textLocation).text(location);

aq.id(R.id.textDate).text(StringUtils.formatDate(event.getDate("startTime"), StringUtils.DATE_AND_TIME_SHORT));

int duration = event.getInt("duration");

int clockRes = Reflect.getImageResId("ic_clock_" + duration);

if (clockRes==0)clockRes=R.drawable.ic_clock_60;

aq.id(R.id.imgDate).image(clockRes);

String category = event.getString("category");

category = StringUtils.isNullOrEmpty(category, "lecture").toLowerCase();

int categoryRes = Reflect.getImageResId("ic_event_" + category);

if(categoryRes==0) categoryRes=R.drawable.ic_event_lecture;

aq.id(R.id.imgCategory).image(categoryRes);

List tags = event.getList("tags");

if(tags==null) tags = new ArrayList<>();

TagCloudLinkView hashTags = (TagCloudLinkView) aq.id(R.id.hashtag_tags).getView();

while(hashTags.getTags().size()>0){

hashTags.remove(0);

}

for(String tag : tags){

hashTags.add(new Tag(1, tag));

}

hashTags.drawTags();

ParseObject owner = event.getParseObject("owner");

if(owner!=null)

aq.id(R.id.textOwnerName).text(String.format("%s %s", owner.get("firstName"), owner.get("lastName")));

else

aq.id(R.id.textOwnerName).text("");

aq.id(R.id.textBlurb).text(event.getString("blurb"));

int headCount = event.getInt("headCount");

int quota = event.getInt("quota");

SpannableStringBuilder stringBuilder = new SpannableStringBuilder();

if(headCount>=quota)

StringUtils.appendSpan(stringBuilder, ""+headCount, new ForegroundColorSpan(getResources().getColor(R.color.body_text_1_negative)));

else

stringBuilder.append(""+headCount);

stringBuilder.append(String.format("/%d places taken", quota));

aq.id(R.id.textHeadCount).text(stringBuilder);

ParseUser user = ParseUser.getCurrentUser();

if(user!=null && owner!=null && user.getObjectId().equals(owner.getObjectId())){

aq.id(R.id.btn_submit).text("Cancel").enabled(false);

}

else{

aq.id(R.id.btn_submit).text("Reserve").enabled(!mHasJoined);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值