Make ResourceDrawableIdHelper work with resource id

Reviewed By: fkgozali

Differential Revision: D5636657

fbshipit-source-id: 251b8b495655abf83618922b86f710fa38b08317
This commit is contained in:
Sriram Ramasubramanian 2017-08-16 15:39:02 -07:00 committed by Facebook Github Bot
parent 9c2a5cdbc3
commit dc61f10e8b
1 changed files with 7 additions and 0 deletions

View File

@ -55,6 +55,13 @@ public class ResourceDrawableIdHelper {
}
name = name.toLowerCase().replace("-", "_");
// name could be a resource id.
try {
return Integer.parseInt(name);
} catch (NumberFormatException e) {
// Do nothing.
}
synchronized (this) {
if (mResourceDrawableIdMap.containsKey(name)) {
return mResourceDrawableIdMap.get(name);