def onCreate(self, bundle): Activity.onCreate(self, bundle) self.resources = self.getResources() self.fileBrowser = FileBrowser(self) self.fileBrowser.setHandler(self) self.spriteBrowser = SpriteBrowser(self) self.registerForContextMenu(self.spriteBrowser.getGrid()) self.setContentView(self.fileBrowser) # Obtain the intent that caused the activity to be started and define # the initial view to be displayed. intent = self.getIntent() self.initial_view = "files" # If the application was started with an intent requesting a view # action then we show the sprite browser instead of the file browser. if intent.getAction() == Intent.ACTION_VIEW: uri = intent.getData() if uri.getScheme() == "file": self.initial_view = "sprites" self.handleFileOpen(File(uri.getPath()))
def onCreate(self, bundle): Activity.onCreate(self, bundle) self.entryWidget = LocationWidget(self, self) self.forecastWidget = ForecastWidget(self) self.setContentView(self.entryWidget) self.parser = ForecastParser(self.getResources())
def onBackPressed(self): # If showing the initial view then exit, otherwise show the file browser. if self.showing == self.initial_view: Activity.onBackPressed(self) else: self.showing = "files" self.fileBrowser.rescan() self.setContentView(self.fileBrowser)
def onBackPressed(self): if self.state == "forecast": # Return to the entry widget. self.state = "entry" self.setContentView(self.entryWidget) elif self.state == "entry": # If already showing the entry widget then exit. Activity.onBackPressed(self)
def onPause(self): Activity.onPause(self) self.entryWidget.writeLocations()
def __init__(self): Activity.__init__(self) self.state = "entry" self.cache = {}
def onStop(self): Activity.onStop(self) if self.temp_file != None: self.temp_file.delete()
def onPause(self): Activity.onPause(self)
def onResume(self): Activity.onResume(self)
def __init__(self): Activity.__init__(self) self.showing = "files" self.temp_file = None
def onConfigurationChanged(self, config): Activity.onConfigurationChanged(self, config) self.spriteBrowser.updateLayout(config.screenWidthDp)