public void setRootActivity(TiRootActivity rootActivity) { // TODO consider weakRef this.rootActivity = rootActivity; this.windowHandler = rootActivity; // calculate the display density DisplayMetrics dm = new DisplayMetrics(); rootActivity.getWindowManager().getDefaultDisplay().getMetrics(dm); switch (dm.densityDpi) { case DisplayMetrics.DENSITY_HIGH: { density = "high"; break; } case DisplayMetrics.DENSITY_MEDIUM: { density = "medium"; break; } case DisplayMetrics.DENSITY_LOW: { density = "low"; break; } } if (collectAnalytics()) { analyticsIntent = new Intent(this, TiAnalyticsService.class); analyticsModel = new TiAnalyticsModel(this); needsEnrollEvent = analyticsModel.needsEnrollEvent(); if (needsEnrollEvent()) { String deployType = systemProperties.getString("ti.deploytype", "unknown"); postAnalyticsEvent(TiAnalyticsEventFactory.createAppEnrollEvent(this, deployType)); } if (needsStartEvent()) { String deployType = systemProperties.getString("ti.deploytype", "unknown"); postAnalyticsEvent(TiAnalyticsEventFactory.createAppStartEvent(this, deployType)); } } else { needsEnrollEvent = false; needsStartEvent = false; Log.i(LCAT, "Analytics have been disabled"); } }
public void postOnCreate() { TiConfig.LOGD = systemProperties.getBool("ti.android.debug", false); // Register the default cache handler File cacheDir = new File(new TiFileHelper(this).getDataDirectory(false), "remote-image-cache"); if (!cacheDir.exists()) { cacheDir.mkdirs(); } TiResponseCache.setDefault(new TiResponseCache(cacheDir.getAbsoluteFile(), this)); }
@Kroll.setProperty @Kroll.method public void setShowOnAppClick(boolean enabled) { TiProperties appProperties = TiApplication.getInstance().getAppProperties(); appProperties.setBool(PROPERTY_PREFIX + PROPERTY_SHOW_APP_ON_CLICK, enabled); }
private static boolean launchAppOnClick() { TiProperties appProperties = TiApplication.getInstance().getAppProperties(); return appProperties.getBool(PROPERTY_PREFIX + PROPERTY_SHOW_APP_ON_CLICK, false); }