use of org.liberty.android.fantastischmemo.utils.CardTTSUtil in project AnyMemo by helloworld1.
the class CardPlayerService method onBind.
// Note, it is recommended for service binding in a thread different
// from UI thread. The initialization like DAO creation is quite heavy
@Override
public IBinder onBind(Intent intent) {
handler = new Handler();
Bundle extras = intent.getExtras();
assert extras != null : "dbpath is not passed to AMTTSService.";
dbPath = extras.getString(EXTRA_DBPATH);
final int cardId = extras.getInt(EXTRA_CURRENT_CARD_ID);
cardTTSUtil = new CardTTSUtil(appComponents().applicationContext(), dbPath);
dbOpenHelper = AnyMemoDBOpenHelperManager.getHelper(this, dbPath);
// Assign a value to the cardPlayerContext so we do not need to check
// null for every player methods. The initial STOPPED state will help
// skipToPrev/skipToNext method to callback the event handler.
reset();
cardPlayerContext.setCurrentCard(dbOpenHelper.getCardDao().queryForId(cardId));
return binder;
}
Aggregations