mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-13 11:22:58 +08:00
35 lines
696 B
Java
35 lines
696 B
Java
package com.phonegap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import android.content.Context;
|
|
import android.webkit.WebView;
|
|
|
|
public class AccelBroker {
|
|
private WebView mAppView;
|
|
private Context mCtx;
|
|
private HashMap<String, AccelListener> accelListeners;
|
|
|
|
public AccelBroker(WebView view, Context ctx)
|
|
{
|
|
mCtx = ctx;
|
|
mAppView = view;
|
|
accelListeners = new HashMap<String, AccelListener>();
|
|
}
|
|
|
|
public String start(int freq, String key)
|
|
{
|
|
AccelListener listener = new AccelListener(key, freq, mCtx, mAppView);
|
|
listener.start(freq);
|
|
accelListeners.put(key, listener);
|
|
return key;
|
|
}
|
|
|
|
public void stop(String key)
|
|
{
|
|
AccelListener acc = accelListeners.get(key);
|
|
acc.stop();
|
|
}
|
|
|
|
}
|