private void addBookmark() { final Bookmark bookmark = SerializerUtil.deserializeBookmark(getIntent().getStringExtra(FBReader.BOOKMARK_KEY)); if (bookmark != null) { myCollection.saveBookmark(bookmark); myThisBookAdapter.add(bookmark); myAllBooksAdapter.add(bookmark); } }
public JSONObject getContentSocialData(User user, String contentGooruOid) throws JSONException { JSONObject socialDataJSON = new JSONObject(); Integer contentUserRating = ratingService.getContentRatingForUser(user.getPartyUid(), contentGooruOid); boolean isContentAlreadySubscribed = this.getShelfService().hasContentSubscribed(user, contentGooruOid); List<HashMap<String, String>> subscriptions = this.getSubscribtionUserList(contentGooruOid); Rating rating = ratingService.findByContent(contentGooruOid); socialDataJSON.put(CONTENT_USER_RATING, contentUserRating); socialDataJSON.put(IS_CONTENT_ALREADY_SUBSCRIBED, isContentAlreadySubscribed); socialDataJSON.put(CONTENT_RATING, new JSONObject(rating).put(VOTE_UP, rating.getVotesUp())); socialDataJSON.put(SUBSCRIPTION_COUNT, subscriptions.size()); socialDataJSON.put( SUBSCRIPTION_LIST, new JSONArray(SerializerUtil.serializeToJson(subscriptions))); return socialDataJSON; }
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); Thread.setDefaultUncaughtExceptionHandler( new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this)); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_NO_TITLE); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); final SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE); manager.setOnCancelListener(null); final TabHost host = getTabHost(); LayoutInflater.from(this).inflate(R.layout.bookmarks, host.getTabContentView(), true); myBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(FBReader.BOOK_KEY)); }