use of com.israelferrer.effectiveandroid.entities.Article in project EffectiveAndroid by rallat.
the class TopArticleListModelImpl method processTweets.
@NonNull
private List<Article> processTweets(Result<List<Tweet>> result) {
final List<Article> items = new ArrayList<>();
for (Tweet tweet : result.data) {
if (tweet.entities != null && tweet.entities.urls != null && tweet.entities.urls.size() > 0 && isEligibleDomain(tweet.entities.urls)) {
items.add(Article.create(tweet));
}
}
Collections.sort(items);
return items;
}
use of com.israelferrer.effectiveandroid.entities.Article in project EffectiveAndroid by rallat.
the class ArticleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
Article article = extras.getParcelable(EXTRA_ARTICLE);
setContentView(R.layout.activity_article);
ButterKnife.bind(this);
View innerContainer = cardView.findViewById(R.id.container_inner_item);
ViewCompat.setTransitionName(innerContainer, TRANSITION_SHARED_ELEMENT);
if (article != null) {
titleView.setText(article.getTitle());
retweetView.setText(article.getRetweetCount());
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(article.getUrl());
} else {
finish();
}
}
use of com.israelferrer.effectiveandroid.entities.Article in project EffectiveAndroid by rallat.
the class TopArticleListActivity method onClick.
private void onClick(View view) {
int position = recyclerView.getChildLayoutPosition(view);
Article data = adapter.getItem(position);
View innerContainer = view.findViewById(R.id.container_inner_item);
Intent startIntent = new Intent(this, ArticleActivity.class);
startIntent.putExtra(ArticleActivity.EXTRA_ARTICLE, data);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, innerContainer, ArticleActivity.TRANSITION_SHARED_ELEMENT);
ActivityCompat.startActivity(this, startIntent, options.toBundle());
}
use of com.israelferrer.effectiveandroid.entities.Article in project EffectiveAndroid by rallat.
the class ArticleRecyclerView method onBindViewHolder.
@Override
public void onBindViewHolder(ArticleViewHolder holder, int position) {
final Article article = items.get(position);
holder.title.setText(article.getTitle());
holder.retweet.setText(article.getRetweetCount());
if (!TextUtils.isEmpty(article.getMediaUrl())) {
holder.media.setVisibility(View.VISIBLE);
Picasso.with(holder.media.getContext()).load(article.getMediaUrl()).into(holder.media);
} else {
holder.media.setVisibility(View.GONE);
}
}
Aggregations