Implemented the CardContentLoader

- Implemented the CardContentLoader
- Refactored the CardLoader and increased the code readable
- Added try-with-resource
- Removed all custom card codes
- Modified ContextualCardManager to add CardContentLoaderCallbacks

Bug: 112521307
Test: robotest
Change-Id: Ieb9cdeaacdfb8fdae9747c60395206d15af034c1
This commit is contained in:
Sunny Shao
2018-08-29 17:53:59 +08:00
committed by Fan Zhang
parent d67668a1c3
commit a87e4cb227
5 changed files with 127 additions and 26 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.homepage;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
@@ -190,4 +191,12 @@ public class CardDatabaseHelper extends SQLiteOpenHelper {
}
return sCardDatabaseHelper;
}
Cursor getAllContextualCards() {
final SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(CARD_TABLE, null /* columns */, null /* selection */,
null /* selectionArgs */, null /* groupBy */, null /* having */,
null /* orderBy */);
return cursor;
}
}