Created
January 15, 2017 15:00
-
-
Save madhu314/5e2a25d91fa87e52943dcd34c8760ae4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void handleEvent(String eventName, Object data) { | |
if (HorizontalArticlesFragment.ITEM_CLICKED.equals(eventName)) { | |
Article article = (Article) data; | |
getHorizontalArticlesFragment().removeArticle(article.dupe()); | |
getArticleGridFragment().addArticle(article.dupe()); | |
} else if (ArticleGridFragment.ITEM_CLICKED.equals(eventName)) { | |
Article article = (Article) data; | |
getArticleGridFragment().removeArticle(article.dupe()); | |
getHorizontalArticlesFragment().addArticle(article.dupe()); | |
} | |
} | |
//somewhere else in the fragment | |
public void addArticle(Article article) { | |
dataset.add(article); | |
} | |
public void removeArticle(Article article) { | |
dataset.remove(article); | |
} | |
//somewhere else in the dataset | |
public void remove(Article article) { | |
sortedList.beginBatchedUpdates(); | |
sortedList.remove(article); | |
sortedList.endBatchedUpdates(); | |
} | |
public void add(Article article) { | |
sortedList.beginBatchedUpdates(); | |
sortedList.add(article); | |
sortedList.endBatchedUpdates(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment