This commit is contained in:
Grishka 2022-05-13 19:18:29 +03:00
parent 75538deb9b
commit a8407571a4
2 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,9 @@ public class AudioStatusDisplayItem extends StatusDisplayItem{
public void onBind(AudioStatusDisplayItem item){
int seconds=(int)item.attachment.getDuration();
String duration=formatDuration(seconds);
time.getLayoutParams().width=(int)Math.ceil(time.getPaint().measureText("-"+duration));
// Some fonts (not Roboto) have different-width digits. 0 is supposedly the widest.
time.getLayoutParams().width=(int)Math.ceil(Math.max(time.getPaint().measureText("-"+duration),
time.getPaint().measureText("-"+duration.replaceAll("\\d", "0"))));
time.setText(duration);
AudioPlayerService service=AudioPlayerService.getInstance();
if(service!=null && service.getAttachmentID().equals(item.attachment.id)){

View File

@ -46,6 +46,7 @@
android:textAppearance="@style/m3_label_medium"
android:textColor="?colorButtonText"
android:gravity="end"
android:singleLine="true"
tools:text="1:23"/>
</LinearLayout>