Browse Source

Created a method in FormattedNumberTextView.java to format the counts. It groups the displayed number by thousands.

balint_virag
Bálint 3 years ago
parent
commit
2ee3874c91
  1. 9
      app/src/main/java/awais/instagrabber/customviews/FormattedNumberTextView.java

9
app/src/main/java/awais/instagrabber/customviews/FormattedNumberTextView.java

@ -13,6 +13,8 @@ import androidx.transition.Transition;
import androidx.transition.TransitionManager;
import androidx.transition.TransitionSet;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.time.Duration;
import awais.instagrabber.customviews.helpers.ChangeText;
@ -156,10 +158,15 @@ public class FormattedNumberTextView extends AppCompatTextView {
setText(NumberUtils.abbreviate(number, null));
return;
}
setText(String.valueOf(number));
setText(numberFormatter(number));
if (autoToggleToAbbreviation) {
getHandler().postDelayed(() -> setShowAbbreviation(true), autoToggleTimeoutMs);
}
});
}
private String numberFormatter(long number){
DecimalFormat decimalFormat = new DecimalFormat("###,###");
return decimalFormat.format(number);
}
}
Loading…
Cancel
Save