// Path: app/src/main/java/ooo/oxo/apps/earth/dao/Settings.java
// public class Settings {
// 
//     public long interval;
// 
//     public int resolution;
// 
//     public boolean wifiOnly;
// 
//     public float offsetLong;
// 
//     public float offsetShort;
// 
//     public float scale;
// 
//     public boolean debug;
// 
//     public static Settings fromLegacySharedState(Context context) {
//         LegacyEarthSharedState sharedState = new LegacyEarthSharedState(context);
// 
//         Settings settings = new Settings();
// 
//         settings.interval = sharedState.getInterval();
//         settings.resolution = sharedState.getResolution();
//         settings.wifiOnly = sharedState.getWifiOnly();
//         settings.offsetLong = 0f;
//         settings.offsetShort = 0f;
//         settings.scale = 1f;
// 
//         return settings;
//     }
// 
//     @Nullable
//     public static Settings fromCursor(@NonNull Cursor cursor) {
//         if (!cursor.moveToNext()) {
//             return null;
//         }
// 
//         Settings settings = new Settings();
//         settings.interval = cursor.getLong(cursor.getColumnIndexOrThrow(SettingsContract.Columns.INTERVAL));
//         settings.resolution = cursor.getInt(cursor.getColumnIndexOrThrow(SettingsContract.Columns.RESOLUTION));
//         settings.wifiOnly = cursor.getInt(cursor.getColumnIndexOrThrow(SettingsContract.Columns.WIFI_ONLY)) != 0;
//         settings.offsetLong = cursor.getFloat(cursor.getColumnIndexOrThrow(SettingsContract.Columns.OFFSET_L));
//         settings.offsetShort = cursor.getFloat(cursor.getColumnIndexOrThrow(SettingsContract.Columns.OFFSET_S));
//         settings.scale = cursor.getFloat(cursor.getColumnIndexOrThrow(SettingsContract.Columns.SCALE));
//         settings.debug = cursor.getInt(cursor.getColumnIndexOrThrow(SettingsContract.Columns.DEBUG)) != 0;
// 
//         return settings;
//     }
// 
//     public ContentValues toContentValues() {
//         ContentValues values = new ContentValues();
//         values.put(SettingsContract.Columns.INTERVAL, interval);
//         values.put(SettingsContract.Columns.RESOLUTION, resolution);
//         values.put(SettingsContract.Columns.WIFI_ONLY, wifiOnly ? 1 : 0);
//         values.put(SettingsContract.Columns.OFFSET_L, offsetLong);
//         values.put(SettingsContract.Columns.OFFSET_S, offsetShort);
//         values.put(SettingsContract.Columns.SCALE, scale);
//         values.put(SettingsContract.Columns.DEBUG, debug ? 1 : 0);
//         return values;
//     }
// 
// }


import ooo.oxo.apps.earth.BuildConfig;
import ooo.oxo.apps.earth.dao.Settings;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

    @Override
    public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
        throw new UnsupportedOperationException();
    }

    private class SettingsDatabaseHelper extends SQLiteOpenHelper {

        private static final String TAG = "SettingsDatabaseHelper";

        private static final String DATABASE_NAME = "settings.db";
        private static final int DATABASE_VERSION = 3;

        SettingsDatabaseHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL("CREATE TABLE " + SettingsContract.TABLE +
                    " (" + SettingsContract.Columns.INTERVAL + " INTEGER" +
                    ", " + SettingsContract.Columns.RESOLUTION + " INTEGER" +
                    ", " + SettingsContract.Columns.WIFI_ONLY + " INTEGER" +
                    ", " + SettingsContract.Columns.DEBUG + " INTEGER" +
                    ", " + SettingsContract.Columns.OFFSET_L + " REAL" +
                    ", " + SettingsContract.Columns.OFFSET_S + " REAL" +
                    ", " + SettingsContract.Columns.SCALE + " REAL DEFAULT 1" +
                    ")");

            db.insertOrThrow(SettingsContract.TABLE, null,
// Path: app/src/main/java/ooo/oxo/apps/earth/dao/Settings.java
// public class Settings {
// 
//     public long interval;
// 
//     public int resolution;
// 
//     public boolean wifiOnly;
// 
//     public float offsetLong;
// 
//     public float offsetShort;
// 
//     public float scale;
// 
//     public boolean debug;
// 
//     public static Settings fromLegacySharedState(Context context) {
//         LegacyEarthSharedState sharedState = new LegacyEarthSharedState(context);
// 
//         Settings settings = new Settings();
// 
//         settings.interval = sharedState.getInterval();
//         settings.resolution = sharedState.getResolution();
//         settings.wifiOnly = sharedState.getWifiOnly();
//         settings.offsetLong = 0f;
//         settings.offsetShort = 0f;
//         settings.scale = 1f;
// 
//         return settings;
//     }
// 
//     @Nullable
//     public static Settings fromCursor(@NonNull Cursor cursor) {
//         if (!cursor.moveToNext()) {
//             return null;
//         }
// 
//         Settings settings = new Settings();
//         settings.interval = cursor.getLong(cursor.getColumnIndexOrThrow(SettingsContract.Columns.INTERVAL));
//         settings.resolution = cursor.getInt(cursor.getColumnIndexOrThrow(SettingsContract.Columns.RESOLUTION));
//         settings.wifiOnly = cursor.getInt(cursor.getColumnIndexOrThrow(SettingsContract.Columns.WIFI_ONLY)) != 0;
//         settings.offsetLong = cursor.getFloat(cursor.getColumnIndexOrThrow(SettingsContract.Columns.OFFSET_L));
//         settings.offsetShort = cursor.getFloat(cursor.getColumnIndexOrThrow(SettingsContract.Columns.OFFSET_S));
//         settings.scale = cursor.getFloat(cursor.getColumnIndexOrThrow(SettingsContract.Columns.SCALE));
//         settings.debug = cursor.getInt(cursor.getColumnIndexOrThrow(SettingsContract.Columns.DEBUG)) != 0;
// 
//         return settings;
//     }
// 
//     public ContentValues toContentValues() {
//         ContentValues values = new ContentValues();
//         values.put(SettingsContract.Columns.INTERVAL, interval);
//         values.put(SettingsContract.Columns.RESOLUTION, resolution);
//         values.put(SettingsContract.Columns.WIFI_ONLY, wifiOnly ? 1 : 0);
//         values.put(SettingsContract.Columns.OFFSET_L, offsetLong);
//         values.put(SettingsContract.Columns.OFFSET_S, offsetShort);
//         values.put(SettingsContract.Columns.SCALE, scale);
//         values.put(SettingsContract.Columns.DEBUG, debug ? 1 : 0);
//         return values;
//     }
// 
// }


// Path: app/src/main/java/ooo/oxo/apps/earth/provider/SettingsProvider.java
import ooo.oxo.apps.earth.BuildConfig;
import ooo.oxo.apps.earth.dao.Settings;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;


    @Override
    public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
        throw new UnsupportedOperationException();
    }

    private class SettingsDatabaseHelper extends SQLiteOpenHelper {

        private static final String TAG = "SettingsDatabaseHelper";

        private static final String DATABASE_NAME = "settings.db";
        private static final int DATABASE_VERSION = 3;

        SettingsDatabaseHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL("CREATE TABLE " + SettingsContract.TABLE +
                    " (" + SettingsContract.Columns.INTERVAL + " INTEGER" +
                    ", " + SettingsContract.Columns.RESOLUTION + " INTEGER" +
                    ", " + SettingsContract.Columns.WIFI_ONLY + " INTEGER" +
                    ", " + SettingsContract.Columns.DEBUG + " INTEGER" +
                    ", " + SettingsContract.Columns.OFFSET_L + " REAL" +
                    ", " + SettingsContract.Columns.OFFSET_S + " REAL" +
                    ", " + SettingsContract.Columns.SCALE + " REAL DEFAULT 1" +
                    ")");

            db.insertOrThrow(SettingsContract.TABLE, null,
                    Settings.fromLegacySharedState(getContext()).toContentValues());