DownloadManager dm = (DownloadManager) cell.getDataSource();
long value = dm==null?-1:dm.getStats().getAvailWentBadTime();
if ( value == 0 ){
// zero means no recorded last bad availability time (bad=transition from >=1 -> < 1)
PEPeerManager pm = dm.getPeerManager();
if ( pm == null || pm.getMinAvailability() < 1.0 ){
long stopped = dm.getDownloadState().getLongAttribute( DownloadManagerState.AT_TIME_STOPPED );
if ( stopped > 0 ){
value = stopped;
}else{
value = -1;
}
}else{
value = -2;
}
}
String text;
if ( value == -1 ){
text = "";
}else if ( value == -2 ){
text = now_string;
}else{
text = DisplayFormatters.formatDate(value);
}
if (!cell.setSortValue(value) && cell.isValid())
return;
cell.setText(text);