gpt4 book ai didi

仿iphone中短信以及通话记录的时间显示

转载 作者:qq735679552 更新时间:2022-09-28 22:32:09 26 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章仿iphone中短信以及通话记录的时间显示由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

废话不多说,上代码 。

复制代码 代码如下

public String getRelativeTimeSpanStringForIphone(long time,long now){   SimpleDateFormat formatter = null;   Resources res = mContext.getResources();   formatter = new SimpleDateFormat("yy-MM-dd");   String yearMonthDay = formatter.format(time);   if(time>now){    return yearMonthDay;   }   formatter = new SimpleDateFormat("E");   String dayOfWeek = formatter.format(time);   formatter = new SimpleDateFormat("kk:mm");   String hourMinuOfTime = formatter.format(time);   formatter = new SimpleDateFormat("kk:mm:ss");   String hourMinuSecOfNow = formatter.format(now);   long millisecOfNow = getMillisecOfNow(hourMinuSecOfNow);   if((now-millisecOfNow<time)||(now-millisecOfNow==time)){    String timeOfCurrentDay = hourMinuOfTime;    String[] hourAndminute = timeOfCurrentDay.split(":");    int hour =Integer.parseInt(hourAndminute[0]);    ContentResolver cv = mContext.getContentResolver();             String strTimeFormat = android.provider.Settings.System.getString(cv,android.provider.Settings.System.TIME_12_24);             if(strTimeFormat!=null){                 if(strTimeFormat.equals("12")){                     if(hour>12){                     return  res.getString(R.string.pm)+hour%12+":"+hourAndminute[1];                     }else{                         return  res.getString(R.string.am)+hour%12+":"+hourAndminute[1];                     }                 }else{                     return hour%24+":"+hourAndminute[1];                 }             }else{                 return hour%24+":"+hourAndminute[1];             }   }else{       if(now-518400000l-millisecOfNow>time){     return yearMonthDay;    }else{     if(now-millisecOfNow-86400000l<time){      //End:modified by sunjinbiao on 20120823 for bug[540]       return res.getString(R.string.yesterday);     }else{            return dayOfWeek;     }    }   }  } 。

最后此篇关于仿iphone中短信以及通话记录的时间显示的文章就讲到这里了,如果你想了解更多关于仿iphone中短信以及通话记录的时间显示的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com