private void _displayCard(String cardID) { try { card = learnApiImplements._getCardByID(cardID); setTitle(card.getQuestion()); // if (itemFavorite != null) { // //load favorite // if (card.getStatus() == 1) { // itemFavorite.setIcon(LazzyBeeShare.getDraweble(context, // R.drawable.ic_action_important)); // itemFavorite.setTitle(context.getString(R.string.action_favorite)); // } else { // itemFavorite.setIcon(LazzyBeeShare.getDraweble(context, // R.drawable.ic_action_not_important)); // itemFavorite.setTitle(context.getString(R.string.action_not_favorite)); // } // } PackageCardPageAdapter packageCardPageAdapter = new PackageCardPageAdapter(context, card); mViewPager.setAdapter(packageCardPageAdapter); mSlidingTabLayout.setViewPager(mViewPager); } catch (Exception e) { LazzyBeeShare.showErrorOccurred(context, "_displayCard", e); } }
@Override public void processFinish(Card card) { try { if (card != null) { // Update Success reload data this.card.setAnswers(card.getAnswers()); this.card.setL_vn(card.getL_vn()); this.card.setL_en(card.getL_en()); // Update Success reload data // Set Adapter PackageCardPageAdapter packageCardPageAdapter = new PackageCardPageAdapter(context, this.card); mViewPager.setAdapter(packageCardPageAdapter); mSlidingTabLayout.setViewPager(mViewPager); // Update Card form DB learnApiImplements._updateCardFormServer(card); Toast.makeText( context, getString(R.string.message_update_card_successful), Toast.LENGTH_SHORT) .show(); // set Result code for updated List card setResult( getResources().getInteger(R.integer.code_card_details_updated), new Intent(this, this.getIntent().getComponent().getClass())); } else { Toast.makeText(context, getString(R.string.message_update_card_fails), Toast.LENGTH_SHORT) .show(); } } catch (Exception e) { LazzyBeeShare.showErrorOccurred(context, "processFinish", e); } }