// Path: app/src/main/java/fr/ydelouis/selfoss/model/DatabaseHelper.java
// public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// 
// 	public static final String ACTION_TABLES_CLEARED = "fr.ydelouis.selfoss.ACTION_TABLES_CLEARED";
// 
// 	private static final String DATABASE_NAME = "selfoss.db";
// 	private static final int DATABASE_VERSION = 5;
// 
// 	private Context context;
// 
// 	public DatabaseHelper(Context context) {
// 		super(context, DATABASE_NAME, null, DATABASE_VERSION);
// 		this.context = context;
// 	}
// 
// 	@Override
// 	public void onCreate(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource) {
// 		try {
// 			TableUtils.createTable(connectionSource, Tag.class);
// 			TableUtils.createTable(connectionSource, Source.class);
// 			TableUtils.createTable(connectionSource, Article.class);
// 			TableUtils.createTable(connectionSource, ArticleSyncAction.class);
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	@Override
// 	public void onUpgrade(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource, int oldVersion, int newVersion) {
// 		try {
// 			if (oldVersion < 2) {
// 				TableUtils.dropTable(connectionSource, Article.class, true);
// 				TableUtils.createTable(connectionSource, Article.class);
// 			}
// 			if (oldVersion < 3) {
// 				TableUtils.createTable(connectionSource, Source.class);
// 			}
//             if (oldVersion < 4) {
//                 TableUtils.dropTable(connectionSource, Article.class, true);
//                 TableUtils.createTable(connectionSource, Article.class);
//             }
// 			if (oldVersion < 5) {
// 				TableUtils.dropTable(connectionSource, Article.class, true);
// 				TableUtils.createTable(connectionSource, Article.class);
// 			}
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public void clearTables() {
// 		try {
// 			TableUtils.clearTable(getConnectionSource(), Tag.class);
// 			TableUtils.clearTable(getConnectionSource(), Source.class);
// 			TableUtils.clearTable(getConnectionSource(), Article.class);
// 			TableUtils.clearTable(getConnectionSource(), ArticleSyncAction.class);
// 			context.sendBroadcast(new Intent(ACTION_TABLES_CLEARED));
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: app/src/main/java/fr/ydelouis/selfoss/sync/SyncManager.java
// @EBean
// public class SyncManager {
// 
// 	private static final String AUTHORITY = BuildConfig.AUTHORITY;
// 
// 	public static void setPeriodicSync(ConfigManager configManager, Config config) {
// 		Account account = configManager.getAccountForConfig(config);
// 		if (account != null) {
// 			ContentResolver.setSyncAutomatically(account, AUTHORITY, config.getSyncPeriod() > 0);
// 			ContentResolver.addPeriodicSync(account, AUTHORITY, new Bundle(), config.getSyncPeriod());
// 		}
// 	}
// 
// 	@Bean protected ConfigManager configManager;
// 
// 	public void requestSync() {
// 		Account account = configManager.getAccount();
// 		if (account != null) {
// 			Bundle extras = new Bundle();
// 			extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
// 			extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
// 			ContentResolver.requestSync(account, AUTHORITY, extras);
// 		}
// 	}
// 
// 	public boolean isActive() {
// 		Account account = configManager.getAccount();
// 		if (account != null) {
// 			return ContentResolver.isSyncActive(account, AUTHORITY);
// 		} else {
// 			return false;
// 		}
// 	}
// 
// }


import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;
import org.androidannotations.annotations.SystemService;
import fr.ydelouis.selfoss.BuildConfig;
import fr.ydelouis.selfoss.model.DatabaseHelper;
import fr.ydelouis.selfoss.sync.SyncManager;
package fr.ydelouis.selfoss.config.model;




@EBean
public class ConfigManager {

	public static final String ACCOUNT_TYPE = BuildConfig.ACCOUNT_TYPE;

	private static final String KEY_USERNAME = "username";
	private static final String KEY_SYNC_PERIOD = "syncPeriod";
	private static final String KEY_TRUST_ALL_CERTIFICATES = "trustAllCertificates";
	private static final String KEY_USE_HTTPS = "useHttps";
	private static final String KEY_SYNC_OVER_WIFI_ONLY = "syncOverWifiOnly";

	@SystemService protected AccountManager accountManager;
	@RootContext protected Context context;
	private DatabaseHelper databaseHelper;

	@AfterInject
	protected void init() {
// Path: app/src/main/java/fr/ydelouis/selfoss/model/DatabaseHelper.java
// public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// 
// 	public static final String ACTION_TABLES_CLEARED = "fr.ydelouis.selfoss.ACTION_TABLES_CLEARED";
// 
// 	private static final String DATABASE_NAME = "selfoss.db";
// 	private static final int DATABASE_VERSION = 5;
// 
// 	private Context context;
// 
// 	public DatabaseHelper(Context context) {
// 		super(context, DATABASE_NAME, null, DATABASE_VERSION);
// 		this.context = context;
// 	}
// 
// 	@Override
// 	public void onCreate(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource) {
// 		try {
// 			TableUtils.createTable(connectionSource, Tag.class);
// 			TableUtils.createTable(connectionSource, Source.class);
// 			TableUtils.createTable(connectionSource, Article.class);
// 			TableUtils.createTable(connectionSource, ArticleSyncAction.class);
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	@Override
// 	public void onUpgrade(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource, int oldVersion, int newVersion) {
// 		try {
// 			if (oldVersion < 2) {
// 				TableUtils.dropTable(connectionSource, Article.class, true);
// 				TableUtils.createTable(connectionSource, Article.class);
// 			}
// 			if (oldVersion < 3) {
// 				TableUtils.createTable(connectionSource, Source.class);
// 			}
//             if (oldVersion < 4) {
//                 TableUtils.dropTable(connectionSource, Article.class, true);
//                 TableUtils.createTable(connectionSource, Article.class);
//             }
// 			if (oldVersion < 5) {
// 				TableUtils.dropTable(connectionSource, Article.class, true);
// 				TableUtils.createTable(connectionSource, Article.class);
// 			}
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	public void clearTables() {
// 		try {
// 			TableUtils.clearTable(getConnectionSource(), Tag.class);
// 			TableUtils.clearTable(getConnectionSource(), Source.class);
// 			TableUtils.clearTable(getConnectionSource(), Article.class);
// 			TableUtils.clearTable(getConnectionSource(), ArticleSyncAction.class);
// 			context.sendBroadcast(new Intent(ACTION_TABLES_CLEARED));
// 		} catch (SQLException e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: app/src/main/java/fr/ydelouis/selfoss/sync/SyncManager.java
// @EBean
// public class SyncManager {
// 
// 	private static final String AUTHORITY = BuildConfig.AUTHORITY;
// 
// 	public static void setPeriodicSync(ConfigManager configManager, Config config) {
// 		Account account = configManager.getAccountForConfig(config);
// 		if (account != null) {
// 			ContentResolver.setSyncAutomatically(account, AUTHORITY, config.getSyncPeriod() > 0);
// 			ContentResolver.addPeriodicSync(account, AUTHORITY, new Bundle(), config.getSyncPeriod());
// 		}
// 	}
// 
// 	@Bean protected ConfigManager configManager;
// 
// 	public void requestSync() {
// 		Account account = configManager.getAccount();
// 		if (account != null) {
// 			Bundle extras = new Bundle();
// 			extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
// 			extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
// 			ContentResolver.requestSync(account, AUTHORITY, extras);
// 		}
// 	}
// 
// 	public boolean isActive() {
// 		Account account = configManager.getAccount();
// 		if (account != null) {
// 			return ContentResolver.isSyncActive(account, AUTHORITY);
// 		} else {
// 			return false;
// 		}
// 	}
// 
// }


// Path: app/src/main/java/fr/ydelouis/selfoss/config/model/ConfigManager.java
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;
import org.androidannotations.annotations.SystemService;
import fr.ydelouis.selfoss.BuildConfig;
import fr.ydelouis.selfoss.model.DatabaseHelper;
import fr.ydelouis.selfoss.sync.SyncManager;

package fr.ydelouis.selfoss.config.model;




@EBean
public class ConfigManager {

	public static final String ACCOUNT_TYPE = BuildConfig.ACCOUNT_TYPE;

	private static final String KEY_USERNAME = "username";
	private static final String KEY_SYNC_PERIOD = "syncPeriod";
	private static final String KEY_TRUST_ALL_CERTIFICATES = "trustAllCertificates";
	private static final String KEY_USE_HTTPS = "useHttps";
	private static final String KEY_SYNC_OVER_WIFI_ONLY = "syncOverWifiOnly";

	@SystemService protected AccountManager accountManager;
	@RootContext protected Context context;
	private DatabaseHelper databaseHelper;

	@AfterInject
	protected void init() {
		databaseHelper = new DatabaseHelper(context);