Showing
3 changed files
with
90 additions
and
0 deletions
| ... | @@ -47,5 +47,9 @@ | ... | @@ -47,5 +47,9 @@ | 
| 47 | <receiver | 47 | <receiver | 
| 48 | android:name=".receivers.LocationChangedReceiver" | 48 | android:name=".receivers.LocationChangedReceiver" | 
| 49 | android:exported="false" /> | 49 | android:exported="false" /> | 
| 50 | + | ||
| 51 | + <provider | ||
| 52 | + android:name=".utils.WarplyProvider" | ||
| 53 | + android:authorities="ly.warp.sdk.utils.WarplyProvider" /> | ||
| 50 | </application> | 54 | </application> | 
| 51 | </manifest> | 55 | </manifest> | 
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... | 
This diff is collapsed. Click to expand it.
| 1 | +package ly.warp.sdk.utils; | ||
| 2 | + | ||
| 3 | +import android.content.ContentProvider; | ||
| 4 | +import android.content.ContentValues; | ||
| 5 | +import android.content.Context; | ||
| 6 | +import android.database.Cursor; | ||
| 7 | +import android.net.Uri; | ||
| 8 | + | ||
| 9 | +import androidx.annotation.NonNull; | ||
| 10 | +import androidx.annotation.Nullable; | ||
| 11 | +import androidx.appcompat.app.AppCompatDelegate; | ||
| 12 | + | ||
| 13 | +import ly.warp.sdk.db.WarplyDBHelper; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Created by Panagiotis Triantafyllou on 05/Αυγ/2022. | ||
| 17 | + */ | ||
| 18 | +public class WarplyProvider extends ContentProvider { | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public boolean onCreate() { | ||
| 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 | + } | ||
| 30 | +// ViewPump.init(ViewPump.builder() | ||
| 31 | +// .addInterceptor(new CalligraphyInterceptor( | ||
| 32 | +// new CalligraphyConfig.Builder() | ||
| 33 | +// .setDefaultFontPath("fonts/pf_square_sans_pro_regular.ttf") | ||
| 34 | +// .setFontAttrId(R.attr.fontPath) | ||
| 35 | +//// .setFontMapper(new FontMapper() { | ||
| 36 | +//// @Override | ||
| 37 | +//// public String map(String font) { | ||
| 38 | +//// return font; | ||
| 39 | +//// } | ||
| 40 | +//// }) | ||
| 41 | +// .build())) | ||
| 42 | +// .build()); | ||
| 43 | + | ||
| 44 | + return true; | ||
| 45 | + } | ||
| 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 | + | ||
| 59 | + @Nullable | ||
| 60 | + @Override | ||
| 61 | + public Cursor query(@NonNull Uri uri, @Nullable String[] strings, @Nullable String s, @Nullable String[] strings1, @Nullable String s1) { | ||
| 62 | + return null; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Nullable | ||
| 66 | + @Override | ||
| 67 | + public String getType(@NonNull Uri uri) { | ||
| 68 | + return null; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Nullable | ||
| 72 | + @Override | ||
| 73 | + public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) { | ||
| 74 | + return null; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public int delete(@NonNull Uri uri, @Nullable String s, @Nullable String[] strings) { | ||
| 79 | + return 0; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public int update(@NonNull Uri uri, @Nullable ContentValues contentValues, @Nullable String s, @Nullable String[] strings) { | ||
| 84 | + return 0; | ||
| 85 | + } | ||
| 86 | +} | 
- 
Please register or login to post a comment
