def handle_event(event): """ This should handle events one at a time. It should return a manager.EVENT_* constant. """ if event["name"]=="click": id = event["data"]["id"] if id == "collectIcon": manager.push_view(common.views['collectData']) elif id == "mapIcon": droid.view("http://107.20.202.68:5052/static/launch.html") elif id == "settingsIcon": manager.push_view(common.views['settings']) elif id == "aboutIcon": manager.push_view(common.views['about']) elif event["name"]=="screen": if event["data"]=="destroy": # manager.close_app() return manager.EVENT_CONSUME elif event["name"] == "EXIT_APP": droid.stopLocating() manager.close_app() else: print "Unused event in startScreen." return manager.EVENT_UNUSED
import fix_json # On non-android systems, sl4a is the android module try: import android as sl4a except ImportError: import sl4a # In common we store a number of things shared throughout the program import common # On non-android systems, we allow a host and port to be passed for where # to connect to the RPC server if len(sys.argv) == 3: addr = sys.argv[1], sys.argv[2] droid = sl4a.Android(addr) else: droid = sl4a.Android() common.droid = droid common.path = path common.load_views() import manager if droid.checkWifiState().result == False: droid.makeToast("WiFi was not enabled. Enabling WiFi...") droid.toggleWifiState(True) # Turn on GPS at app startup #common.gps_lock() manager.push_view(common.views['startScreen']) #manager.push_view(common.views['settings']) manager.main_loop()