Merge "Merge "Revert "Revert "Add "incrementEventCountBy" function to Onboardi..."" into tm-dev am: 223bfe0908 am: 5b39a7db99" into tm-d1-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
a0a4ff8848
@@ -140,4 +140,19 @@ public class OnboardingPrefs<T extends ActivityContext> {
|
||||
mSharedPrefs.edit().putInt(eventKey, count).apply();
|
||||
return hasReachedMaxCount(count, eventKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "incCountBy" to the given event count, if we haven't already reached the max count.
|
||||
*
|
||||
* @return Whether we have now reached the max count.
|
||||
*/
|
||||
public boolean incrementEventCountBy(int incCountBy, @EventCountKey String eventKey) {
|
||||
int count = getCount(eventKey);
|
||||
if (hasReachedMaxCount(count, eventKey)) {
|
||||
return true;
|
||||
}
|
||||
count += incCountBy;
|
||||
mSharedPrefs.edit().putInt(eventKey, count).apply();
|
||||
return hasReachedMaxCount(count, eventKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user