2012-07-13 12:23:47 +02:00
|
|
|
package de.danoeh.antennapod;
|
2011-12-23 19:22:06 +01:00
|
|
|
|
|
|
|
import android.app.Application;
|
2012-08-11 15:45:30 +02:00
|
|
|
import android.content.res.Configuration;
|
2014-09-19 22:51:35 +02:00
|
|
|
|
2014-11-10 22:00:49 +01:00
|
|
|
import de.danoeh.antennapod.core.asynctask.PicassoProvider;
|
2014-09-19 22:51:35 +02:00
|
|
|
import de.danoeh.antennapod.core.feed.EventDistributor;
|
|
|
|
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
|
|
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
2014-03-12 17:11:46 +01:00
|
|
|
import de.danoeh.antennapod.spa.SPAUtil;
|
2012-07-08 13:40:10 +02:00
|
|
|
|
2012-08-07 13:56:33 +02:00
|
|
|
/** 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";
|
|
|
|
|
2012-07-21 19:35:07 +02:00
|
|
|
private static float LOGICAL_DENSITY;
|
2012-07-08 13:40:10 +02:00
|
|
|
|
2012-07-07 23:37:52 +02:00
|
|
|
private static PodcastApp singleton;
|
2012-10-30 21:03:59 +01:00
|
|
|
|
2011-12-23 19:22:06 +01:00
|
|
|
public static PodcastApp getInstance() {
|
|
|
|
return singleton;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreate() {
|
|
|
|
super.onCreate();
|
|
|
|
singleton = this;
|
2012-07-21 19:35:07 +02:00
|
|
|
LOGICAL_DENSITY = getResources().getDisplayMetrics().density;
|
2013-02-25 20:49:37 +01:00
|
|
|
|
2014-11-10 22:00:49 +01:00
|
|
|
PicassoProvider.setupPicassoInstance(this);
|
2013-02-24 10:46:10 +01:00
|
|
|
UserPreferences.createInstance(this);
|
2013-02-25 20:49:37 +01:00
|
|
|
PlaybackPreferences.createInstance(this);
|
2013-02-25 10:47:37 +01:00
|
|
|
EventDistributor.getInstance();
|
2014-03-12 17:11:46 +01:00
|
|
|
|
|
|
|
SPAUtil.sendSPAppsQueryFeedsIntent(this);
|
2011-12-23 19:22:06 +01:00
|
|
|
}
|
2012-08-07 13:56:33 +02:00
|
|
|
|
2012-07-21 19:35:07 +02:00
|
|
|
public static float getLogicalDensity() {
|
|
|
|
return LOGICAL_DENSITY;
|
|
|
|
}
|
2012-10-30 21:03:59 +01:00
|
|
|
|
2012-08-11 15:45:30 +02:00
|
|
|
public boolean isLargeScreen() {
|
2012-10-30 21:03:59 +01:00
|
|
|
return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE
|
|
|
|
|| (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
2012-08-11 15:45:30 +02:00
|
|
|
|
|
|
|
}
|
2011-12-23 19:22:06 +01:00
|
|
|
}
|