Skip to content

Commit

Permalink
Cycle through top 10 news headlines.
Browse files Browse the repository at this point in the history
  • Loading branch information
sokris95 committed Mar 20, 2016
1 parent eb3955f commit 3f7a830
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ protected String doInBackground(Void... params) {
String url = "http://feeds.bbci.co.uk/news/world/rss.xml?edition=uk";
try {
RSSFeed feed = rssReader.load(url);
return feed.getItems().get(0).getTitle();
String headline = feed.getItems().get(0).getTitle();
for (int i = 1; i < 10; ++i) {
headline += " " + feed.getItems().get(i).getTitle();
}
return headline;
} catch (RSSReaderException e) {
Log.e("NewsModule", "Error parsing RSS");
return null;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_mirror.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

<TextView
android:id="@+id/news_headline"
style="@style/MirrorListText"
style="@style/MirrorMarqueeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
<item name="android:paddingBottom">@dimen/item_margin</item>
</style>

<style name="MirrorMarqueeText" parent="MirrorListText">
<item name="android:gravity"/>
</style>

<style name="ConfigurationItemText">
<item name="android:fontFamily" tools:targetApi="jelly_bean">sans-serif</item>
<item name="android:textSize">@dimen/configuration_text_size</item>
Expand Down

0 comments on commit 3f7a830

Please sign in to comment.