Showing
3 changed files
with
26 additions
and
4 deletions
| ... | @@ -258,8 +258,8 @@ | ... | @@ -258,8 +258,8 @@ | 
| 258 | <!-- </intent-filter>--> | 258 | <!-- </intent-filter>--> | 
| 259 | <!-- </receiver>--> | 259 | <!-- </receiver>--> | 
| 260 | 260 | ||
| 261 | - <!-- <provider--> | 261 | + <provider | 
| 262 | - <!-- android:name=".utils.WarplyProvider"--> | 262 | + android:name=".utils.WarplyProvider" | 
| 263 | - <!-- android:authorities="ly.warp.sdk.utils.WarplyProvider" />--> | 263 | + android:authorities="ly.warp.sdk.utils.WarplyProvider" /> | 
| 264 | </application> | 264 | </application> | 
| 265 | </manifest> | 265 | </manifest> | 
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... | 
This diff is collapsed. Click to expand it.
| ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.utils; | ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.utils; | 
| 2 | 2 | ||
| 3 | import android.content.ContentProvider; | 3 | import android.content.ContentProvider; | 
| 4 | import android.content.ContentValues; | 4 | import android.content.ContentValues; | 
| 5 | +import android.content.Context; | ||
| 5 | import android.database.Cursor; | 6 | import android.database.Cursor; | 
| 6 | import android.net.Uri; | 7 | import android.net.Uri; | 
| 7 | 8 | ||
| ... | @@ -9,6 +10,8 @@ import androidx.annotation.NonNull; | ... | @@ -9,6 +10,8 @@ import androidx.annotation.NonNull; | 
| 9 | import androidx.annotation.Nullable; | 10 | import androidx.annotation.Nullable; | 
| 10 | import androidx.appcompat.app.AppCompatDelegate; | 11 | import androidx.appcompat.app.AppCompatDelegate; | 
| 11 | 12 | ||
| 13 | +import ly.warp.sdk.db.WarplyDBHelper; | ||
| 14 | + | ||
| 12 | /** | 15 | /** | 
| 13 | * Created by Panagiotis Triantafyllou on 05/Αυγ/2022. | 16 | * Created by Panagiotis Triantafyllou on 05/Αυγ/2022. | 
| 14 | */ | 17 | */ | 
| ... | @@ -16,7 +19,14 @@ public class WarplyProvider extends ContentProvider { | ... | @@ -16,7 +19,14 @@ public class WarplyProvider extends ContentProvider { | 
| 16 | 19 | ||
| 17 | @Override | 20 | @Override | 
| 18 | public boolean onCreate() { | 21 | public boolean onCreate() { | 
| 19 | - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); | 22 | +// AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); | 
| 23 | + | ||
| 24 | + // Initialize the database helper | ||
| 25 | + Context context = getContext(); | ||
| 26 | + if (context != null) { | ||
| 27 | + WarplyDBHelper dbHelper = WarplyDBHelper.getInstance(context); | ||
| 28 | + dbHelper.initialize(); // This will initialize the database connection on a background thread | ||
| 29 | + } | ||
| 20 | // ViewPump.init(ViewPump.builder() | 30 | // ViewPump.init(ViewPump.builder() | 
| 21 | // .addInterceptor(new CalligraphyInterceptor( | 31 | // .addInterceptor(new CalligraphyInterceptor( | 
| 22 | // new CalligraphyConfig.Builder() | 32 | // new CalligraphyConfig.Builder() | 
| ... | @@ -34,6 +44,18 @@ public class WarplyProvider extends ContentProvider { | ... | @@ -34,6 +44,18 @@ public class WarplyProvider extends ContentProvider { | 
| 34 | return true; | 44 | return true; | 
| 35 | } | 45 | } | 
| 36 | 46 | ||
| 47 | + @Override | ||
| 48 | + public void shutdown() { | ||
| 49 | + // Get the database helper instance and shut it down | ||
| 50 | + Context context = getContext(); | ||
| 51 | + if (context != null) { | ||
| 52 | + WarplyDBHelper dbHelper = WarplyDBHelper.getInstance(context); | ||
| 53 | + dbHelper.shutdown(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + super.shutdown(); | ||
| 57 | + } | ||
| 58 | + | ||
| 37 | @Nullable | 59 | @Nullable | 
| 38 | @Override | 60 | @Override | 
| 39 | public Cursor query(@NonNull Uri uri, @Nullable String[] strings, @Nullable String s, @Nullable String[] strings1, @Nullable String s1) { | 61 | public Cursor query(@NonNull Uri uri, @Nullable String[] strings, @Nullable String s, @Nullable String[] strings1, @Nullable String s1) { | ... | ... | 
- 
Please register or login to post a comment
