Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5b55c80 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing LauncherProvider dependency in DatabaseHeler

This will allow DatabaseHeler to easily be moved to an independent class

Change-Id: I9a3d5d3380ed0af246d7a01553a492467c3096b0
parent 6b360f68
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -630,7 +630,7 @@ public class AutoInstallsLayout {
                    copyInteger(myValues, childValues, Favorites.CELLY);

                    addedId = folderItems.get(0);
                    mDb.update(LauncherProvider.TABLE_FAVORITES, childValues,
                    mDb.update(Favorites.TABLE_NAME, childValues,
                            Favorites._ID + "=" + addedId, null);
                }
            }
+145 −194

File changed.

Preview size limit exceeded, changes collapsed.

+9 −3
Original line number Diff line number Diff line
package com.android.launcher3.util;

import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper;

import com.android.launcher3.LauncherProvider;

@@ -17,16 +18,21 @@ public class TestLauncherProvider extends LauncherProvider {
    @Override
    protected synchronized void createDbIfNotExists() {
        if (mOpenHelper == null) {
            mOpenHelper = new MyDatabaseHelper(getContext(), this);
            mOpenHelper = new MyDatabaseHelper(getContext());
        }
    }

    public SQLiteOpenHelper getHelper() {
        createDbIfNotExists();
        return mOpenHelper;
    }

    @Override
    protected void notifyListeners() { }

    private static class MyDatabaseHelper extends DatabaseHelper {
        public MyDatabaseHelper(Context context, LauncherProvider provider) {
            super(context, provider, null, null);
        public MyDatabaseHelper(Context context) {
            super(context, null, null);
            initIds();
        }