当前位置: 首页>>代码示例>>Java>>正文


Java DateUtils.FORMAT_ABBREV_RELATIVE属性代码示例

本文整理汇总了Java中android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtils.FORMAT_ABBREV_RELATIVE属性的具体用法?Java DateUtils.FORMAT_ABBREV_RELATIVE怎么用?Java DateUtils.FORMAT_ABBREV_RELATIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.text.format.DateUtils的用法示例。


在下文中一共展示了DateUtils.FORMAT_ABBREV_RELATIVE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindView

@Override
public void bindView(View view, Context context, Cursor cursor) {
    super.bindView(view, context, cursor);

    final ConversationListItemViews tagView = (ConversationListItemViews) view.getTag();
    String nbr = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_FROM));
    String fromFull = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_FROM_FULL));
    String to_number = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_TO));
    
    //int read = cursor.getInt(cursor.getColumnIndex(SipMessage.FIELD_READ));
    long date = cursor.getLong(cursor.getColumnIndex(SipMessage.FIELD_DATE));
    
    
    tagView.fromFull = fromFull;
    tagView.to = to_number;
    tagView.from = nbr;
    tagView.position = cursor.getPosition();
    
    
    /*
    Drawable background = (read == 0)?
            context.getResources().getDrawable(R.drawable.conversation_item_background_unread) :
            context.getResources().getDrawable(R.drawable.conversation_item_background_read);
    
    view.setBackgroundDrawable(background);
     */
    String number = cursor.getString(cursor.getColumnIndex(SipMessage.FIELD_FROM_FULL));
    CallerInfo info = CallerInfo.getCallerInfoFromSipUri(mContext, number);
    
    /*
    final Uri lookupUri = info.contactContentUri;
    final String name = info.name;
    final int ntype = info.numberType;
    final String label = info.phoneLabel;
    CharSequence formattedNumber = SipUri.getCanonicalSipContact(number, false);
    */
    
    
    // Photo
    tagView.quickContactView.assignContactUri(info.contactContentUri);
    ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(mContext, 
            tagView.quickContactView.getImageView(),
            info,
            R.drawable.ic_contact_picture_holo_dark);

    // From
    tagView.fromView.setText(formatMessage(cursor));

    //Date
    // Set the date/time field by mixing relative and absolute times.
    int flags = DateUtils.FORMAT_ABBREV_RELATIVE;
    tagView.dateView.setText(DateUtils.getRelativeTimeSpanString(date, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, flags));
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:53,代码来源:ConversationsAdapter.java


注:本文中的android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。