Android Open Source - RssReader Rss Item Details Activity






From Project

Back to project page RssReader.

License

The source code is released under:

MIT License

If you think the Android project RssReader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.vicmns.rssreader.activities;
// w  w  w.j ava  2s . co  m
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.vicmns.rssreader.R;
import com.vicmns.rssreader.models.RssItem;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v4.app.TaskStackBuilder;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;

public class RssItemDetailsActivity extends ActionBarActivity {
  private ImageView rssItemImageIV;
  private TextView rssItemDescriptionTV;
  
  private RssItem rssItem;
  
  protected ImageLoader imageLoader = ImageLoader.getInstance();
  private DisplayImageOptions options;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    options = new DisplayImageOptions.Builder()
    .showImageOnLoading(R.color.grey)
    .showImageForEmptyUri(R.color.grey)
    .cacheInMemory(true)
    .cacheOnDisc(true)
    .considerExifParams(true)
    .bitmapConfig(Bitmap.Config.ARGB_8888)
    .build();
        
    Bundle bundle = getIntent().getExtras();
    if(bundle != null) {
      rssItem = bundle.getParcelable("RssItem");
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      setContentView(R.layout.activity_rss_item_details);
      initializeViews();
      setViews();
    } else
      finish();
    
  }
  
  private void initializeViews() {
    rssItemImageIV = (ImageView) findViewById(R.id.rss_item_details_imageView);
    rssItemDescriptionTV = (TextView) findViewById(R.id.rss_item_details_description_textView);
  }
  
  private void setViews() {
    imageLoader.displayImage( rssItem.getImageURL(), rssItemImageIV, options);
    rssItemDescriptionTV.setText(rssItem.getDescription());
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem menuItem) {
      switch (menuItem.getItemId()) {
      case android.R.id.home:
        Intent upIntent = NavUtils.getParentActivityIntent(this);
          if (NavUtils.shouldUpRecreateTask(this, upIntent) || getIntent().getAction() != null) {
              TaskStackBuilder.create(this)
                      // Add all of this activity's parents to the back stack
                      .addNextIntentWithParentStack(upIntent)
                      // Navigate up to the closest parent
                      .startActivities();
          } else {
              // This activity is part of this app's task, so simply
              // navigate up to the logical parent activity.
              NavUtils.navigateUpTo(this, upIntent);
          }
          return true;
          
          /*
           * Intent homeIntent = new Intent(this, HomeActivity.class);
           * homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
           * startActivity(homeIntent);
           * finish();
           */
      }
    return (super.onOptionsItemSelected(menuItem));
  }
  
}




Java Source Code List

com.vicmns.rssreader.activities.MainActivity.java
com.vicmns.rssreader.activities.RssItemDetailsActivity.java
com.vicmns.rssreader.adapters.RssItemsAdapter.java
com.vicmns.rssreader.app.RssReaderApplication.java
com.vicmns.rssreader.http.GetRssItems.java
com.vicmns.rssreader.http.GetWidgetRssItems.java
com.vicmns.rssreader.http.SimpleXmlRequest.java
com.vicmns.rssreader.interfaces.GetRssItemsCallbacks.java
com.vicmns.rssreader.interfaces.HttpConsumerCallbacks.java
com.vicmns.rssreader.interfaces.ListOverlayLayoutCallbacks.java
com.vicmns.rssreader.models.RssItem.java
com.vicmns.rssreader.models.RssItems.java
com.vicmns.rssreader.services.GetRssItemsService.java
com.vicmns.rssreader.views.ListOverlayLayoutView.java
com.vicmns.rssreader.views.SquareImageView.java
com.vicmns.rssreader.widget.WidgetListProvider.java
com.vicmns.rssreader.widget.WidgetProvider.java
com.vicmns.rssreader.widget.WidgetService.java
fr.castorflex.android.smoothprogressbar.ColorsShape.java
fr.castorflex.android.smoothprogressbar.ContentLoadingSmoothProgressBar.java
fr.castorflex.android.smoothprogressbar.SmoothProgressBarUtils.java
fr.castorflex.android.smoothprogressbar.SmoothProgressBar.java
fr.castorflex.android.smoothprogressbar.SmoothProgressDrawable.java
org.robolectric.shadows.ShadowSupportMenuInflater.java