SoFunction
Updated on 2025-04-09

Time display of SMS and call history in imitation iPhone


public String getRelativeTimeSpanStringForIphone(long time,long now){
  SimpleDateFormat formatter = null;
  Resources res = ();
  formatter = new SimpleDateFormat("yy-MM-dd");
  String yearMonthDay = (time);
  if(time>now){
   return yearMonthDay;
  }
  formatter = new SimpleDateFormat("E");
  String dayOfWeek = (time);

  formatter = new SimpleDateFormat("kk:mm");
  String hourMinuOfTime = (time);

  formatter = new SimpleDateFormat("kk:mm:ss");

  String hourMinuSecOfNow = (now);

  long millisecOfNow = getMillisecOfNow(hourMinuSecOfNow);

  if((now-millisecOfNow<time)||(now-millisecOfNow==time)){
   String timeOfCurrentDay = hourMinuOfTime;
   String[] hourAndminute = (":");
   int hour =(hourAndminute[0]);
   ContentResolver cv = ();
            String strTimeFormat = (cv,.TIME_12_24);
            if(strTimeFormat!=null){
                if(("12")){
                    if(hour>12){
                    return  ()+hour%12+":"+hourAndminute[1];
                    }else{
                        return  ()+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 ();

    }else{      
     return dayOfWeek;
    }
   }
  }
 }