GestureProvider.java
/*
* Copyright © 2012 Nokia Corporation. All rights reserved.
* Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
* Oracle and Java are trademarks or registered trademarks of Oracle and/or its
* affiliates. Other product and company names mentioned herein may be trademarks
* or trade names of their respective owners.
* See LICENSE.TXT for license information.
*/
package com.nokia.example.racer.gestures;
public abstract class GestureProvider {
private static GestureProvider provider;
/**
* Set gesture listener
*
* @param listener
*/
public static boolean enableGestures() {
provider = getImplementation();
if (provider == null) {
return false;
}
else {
return true;
}
}
/**
* Loads up the isolated implementation class
*
* @return Orientation Returns Orientation implementation or null, if
* orientations are not supported
*/
private static GestureProvider getImplementation() {
GestureProvider implementation = null;
try {
Class.forName("com.nokia.mid.ui.gestures.GestureInteractiveZone");
Class c = Class.forName(
"com.nokia.example.racer.gestures.GestureProviderImpl");
implementation = (GestureProvider) (c.newInstance());
}
catch (Exception e) {
e.printStackTrace();
}
return implementation;
}
}