Add cache mechanism to improve icon and label loading performance

Bug: 185207505
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I73dba5e40783f9ef4cfc0c4c33ea56b12754535d
This commit is contained in:
ykhung
2021-04-15 01:16:20 +08:00
committed by YUKAI HUNG
parent 3909ddb789
commit b2674eb5be
5 changed files with 153 additions and 22 deletions

View File

@@ -255,7 +255,8 @@ public class BatteryChartView extends AppCompatImageView implements View.OnClick
private int getTrapezoidIndex(float x) {
for (int index = 0; index < mTrapezoidSlot.length; index++) {
final TrapezoidSlot slot = mTrapezoidSlot[index];
if (x >= slot.mLeft && x <= slot.mRight) {
if (x >= slot.mLeft - mTrapezoidHOffset
&& x <= slot.mRight + mTrapezoidHOffset) {
return index;
}
}