diff options
Diffstat (limited to 'app/src/main/java/org/rssin/android/ArticleActivity.java')
-rw-r--r-- | app/src/main/java/org/rssin/android/ArticleActivity.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/app/src/main/java/org/rssin/android/ArticleActivity.java b/app/src/main/java/org/rssin/android/ArticleActivity.java new file mode 100644 index 0000000..0cc9055 --- /dev/null +++ b/app/src/main/java/org/rssin/android/ArticleActivity.java @@ -0,0 +1,59 @@ +package org.rssin.android; + +import android.content.Intent; +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ScrollView; +import android.widget.TextView; + +import org.rssin.rss.FeedItem; +import org.rssin.rssin.R; + +public class ArticleActivity extends ActionBarActivity { + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_article); + Intent intent = getIntent(); + Bundle arguments = intent.getExtras(); + FeedItem item = (FeedItem) arguments.getSerializable("Feed item"); + + TextView title = (TextView) findViewById(R.id.article_title); + title.setText(item.getTitle()); + TextView description = (TextView) findViewById(R.id.article_description); + description.setText(Html.fromHtml(item.getDescription())); + TextView author = (TextView) findViewById(R.id.article_author); + author.setText("Written by: " + item.getAuthor()); + TextView date = (TextView) findViewById(R.id.article_date); + date.setText("Published on: " + item.getPubDate().toString()); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_article, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} |