/** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { boolean abort = false; try { // handle java.lang.NoClassDefFoundError super.onCreate(icicle); } catch (Throwable t) { ACRA.getErrorReporter().handleSilentException(t); IntentsHelper.getInstance().setActivity(this); IntentsHelper.getInstance().showInfoToast("Sorry. Your device is currently unsupported :("); abort = true; } if (!abort) { final Intent intent = getIntent(); final String action = intent.getAction(); // If the intent is a request to create a shortcut, we'll do that and exit if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) { IntentsHelper.getInstance().setActivity(this); IntentsHelper.getInstance().setupShortcut(); abort = true; } else { long lastStartupTime = ConfigurationManager.getInstance().getLong(ConfigurationManager.LAST_STARTING_DATE); LoggerUtils.debug( "Last startup time is: " + DateTimeUtils.getDefaultDateTimeString( lastStartupTime, ConfigurationManager.getInstance().getCurrentLocale())); ConfigurationManager.getInstance() .putLong(ConfigurationManager.LAST_STARTING_DATE, System.currentTimeMillis()); Intent mapActivity; if (OsUtil.isHoneycombOrHigher()) { if (GoogleApiAvailability.getInstance() .isGooglePlayServicesAvailable(getApplicationContext()) == ConnectionResult.SUCCESS && ConfigurationManager.getInstance().getInt(ConfigurationManager.MAP_PROVIDER) == ConfigurationManager.GOOGLE_MAPS) { mapActivity = new Intent(this, GMSClient3MainActivity.class); } else { ConfigurationManager.getInstance() .putInteger(ConfigurationManager.MAP_PROVIDER, ConfigurationManager.OSM_MAPS); mapActivity = new Intent(this, GMSClient2OSMMainActivity.class); } startActivity(mapActivity); } else { IntentsHelper.getInstance() .showInfoToast("This application requires Android 3.0 or higher to run!"); } } } if (abort) { finish(); } }
private void addLayerAction() { name = StringUtils.trimToNull(nameText.getText().toString()); if (StringUtils.isNotEmpty(name)) { String keywords = keywordsText.getText().toString(); // parse keywords to comma separated List<String> keywordsList = new ArrayList<String>(); keywordsList.add(name); if (!StringUtils.isEmpty(keywords)) { String[] tokens = StringUtils.split(keywords, ","); for (int i = 0; i < tokens.length; i++) { String token = StringUtils.trimToNull(tokens[i]); if (token != null) { keywordsList.add(token); } } } String keywordsJoin = StringUtils.join(keywordsList, ","); boolean containsLayer = false; containsLayer = LayerManager.getInstance().addDynamicLayer(keywordsJoin); if (containsLayer) { IntentsHelper.getInstance().showInfoToast(Locale.getMessage(R.string.Layer_exists_error)); } else { AsyncTaskManager.getInstance() .executeIndexDynamicLayer(name, keywordsList.toArray(new String[keywordsList.size()])); IntentsHelper.getInstance().showInfoToast(Locale.getMessage(R.string.layerCreated)); finish(); } } else { IntentsHelper.getInstance().showInfoToast(Locale.getMessage(R.string.Layer_name_empty_error)); } }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { boolean abort = false; try { // handle java.lang.NoClassDefFoundError super.onCreate(icicle); } catch (Throwable t) { ACRA.getErrorReporter().handleSilentException(t); IntentsHelper.getInstance().setActivity(this); IntentsHelper.getInstance().showInfoToast("Sorry. Your device is currently unsupported :("); abort = true; } if (!abort) { final Intent intent = getIntent(); final String action = intent.getAction(); // If the intent is a request to create a shortcut, we'll do that and exit if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) { IntentsHelper.getInstance().setActivity(this); IntentsHelper.getInstance().setupShortcut(); abort = true; } else { long lastStartupTime = ConfigurationManager.getInstance().getLong(ConfigurationManager.LAST_STARTING_DATE); LoggerUtils.debug( "Last startup time is: " + DateTimeUtils.getDefaultDateTimeString( lastStartupTime, ConfigurationManager.getInstance().getCurrentLocale())); ConfigurationManager.getInstance() .putLong(ConfigurationManager.LAST_STARTING_DATE, System.currentTimeMillis()); Intent mapActivity; if (OsUtil.isHoneycombOrHigher()) { if (OsUtil.isGoogleMapActivityInstalled() && OsUtil.hasSystemSharedLibraryInstalled(this, "com.google.android.maps")) { mapActivity = new Intent(this, GMSClient2MainActivity.class); } else { ConfigurationManager.getInstance() .putInteger(ConfigurationManager.MAP_PROVIDER, ConfigurationManager.OSM_MAPS); mapActivity = new Intent(this, GMSClient2OSMMainActivity.class); } } else { if (OsUtil.isGoogleMapActivityInstalled() && OsUtil.hasSystemSharedLibraryInstalled(this, "com.google.android.maps")) { mapActivity = new Intent(this, GMSClientMainActivity.class); } else { ConfigurationManager.getInstance() .putInteger(ConfigurationManager.MAP_PROVIDER, ConfigurationManager.OSM_MAPS); mapActivity = new Intent(this, GMSClientOSMMainActivity.class); } } startActivity(mapActivity); } } if (abort) { finish(); } }