2012-07-13 11:06:24 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-08-02 10:33:44 -07:00
|
|
|
package org.mozilla.gecko.util;
|
2012-07-13 11:06:24 -07:00
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2012-08-02 10:33:44 -07:00
|
|
|
public final class ActivityResultHandlerMap {
|
2012-07-13 11:06:24 -07:00
|
|
|
private Map<Integer, ActivityResultHandler> mMap = new HashMap<Integer, ActivityResultHandler>();
|
|
|
|
private int mCounter = 0;
|
|
|
|
|
2012-08-02 10:33:44 -07:00
|
|
|
public synchronized int put(ActivityResultHandler handler) {
|
2012-07-13 11:06:24 -07:00
|
|
|
mMap.put(mCounter, handler);
|
|
|
|
return mCounter++;
|
|
|
|
}
|
|
|
|
|
2012-08-02 10:33:44 -07:00
|
|
|
public synchronized ActivityResultHandler getAndRemove(int i) {
|
2012-07-13 11:06:24 -07:00
|
|
|
return mMap.remove(i);
|
|
|
|
}
|
|
|
|
}
|