58 lines
1.7 KiB
Java
Raw Normal View History

2012-07-13 12:23:47 +02:00
package de.danoeh.antennapod;
2011-12-23 19:22:06 +01:00
import android.app.Application;
import android.content.res.Configuration;
import de.danoeh.antennapod.core.asynctask.PicassoProvider;
import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.spa.SPAUtil;
/** Main application class. */
2013-02-25 20:49:37 +01:00
public class PodcastApp extends Application {
2011-12-23 19:22:06 +01:00
2014-10-12 18:18:36 +02:00
// make sure that ClientConfigurator executes its static code
static {
try {
Class.forName("de.danoeh.antennapod.config.ClientConfigurator");
} catch (Exception e) {
throw new RuntimeException("ClientConfigurator not found");
}
}
2012-07-07 23:37:52 +02:00
private static final String TAG = "PodcastApp";
private static float LOGICAL_DENSITY;
2012-07-07 23:37:52 +02:00
private static PodcastApp singleton;
2011-12-23 19:22:06 +01:00
public static PodcastApp getInstance() {
return singleton;
}
@Override
public void onCreate() {
super.onCreate();
singleton = this;
LOGICAL_DENSITY = getResources().getDisplayMetrics().density;
2013-02-25 20:49:37 +01:00
PicassoProvider.setupPicassoInstance(this);
UserPreferences.createInstance(this);
2013-02-25 20:49:37 +01:00
PlaybackPreferences.createInstance(this);
2013-02-25 10:47:37 +01:00
EventDistributor.getInstance();
SPAUtil.sendSPAppsQueryFeedsIntent(this);
2011-12-23 19:22:06 +01:00
}
public static float getLogicalDensity() {
return LOGICAL_DENSITY;
}
public boolean isLargeScreen() {
return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE
|| (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
}
2011-12-23 19:22:06 +01:00
}