// Path: app/src/main/java/org/attentiveness/news/base/BaseFragment.java
// public class BaseFragment extends Fragment {
// 
//     public BaseFragment() {
//         // Required empty public constructor
//     }
// 
//     protected void showMessage(View anchorView, String message) {
//         Snackbar.make(anchorView, message, Snackbar.LENGTH_SHORT).show();
//     }
// 
// }
// 
// Path: app/src/main/java/org/attentiveness/news/data/Story.java
// public class Story {
// 
//     private int id;
//     private String title;
// 
//     @SerializedName("images")
//     private List<String> imageList;
// 
//     public Story() {
// 
//     }
// 
//     public Story(int id, String title) {
//         this.id = id;
//         this.title = title;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public List<String> getImageList() {
//         return imageList;
//     }
// 
//     public void setImageList(List<String> imageList) {
//         this.imageList = imageList;
//     }
// }
// 
// Path: app/src/main/java/org/attentiveness/news/detail/StoryDetailActivity.java
// public class StoryDetailActivity extends BaseActivity {
// 
//     private static final String INSTANCE_STORY_ID = "story_id";
// 
//     private int mStoryId;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_story_detail);
//         ButterKnife.bind(this);
//         setup();
// 
//         if (savedInstanceState == null) {
//             this.mStoryId = getIntent().getIntExtra(StoryListFragment.EXTRA_ID, 0);
//         } else {
//             this.mStoryId = savedInstanceState.getInt(INSTANCE_STORY_ID);
//         }
// 
//         StoryDetailFragment storyDetailFragment = (StoryDetailFragment) getSupportFragmentManager().findFragmentById(R.id.fl_container);
//         if (storyDetailFragment == null) {
//             storyDetailFragment = StoryDetailFragment.newInstance();
//             addFragment(getSupportFragmentManager(), R.id.fl_container, storyDetailFragment);
//         }
//         StoriesDataRepository repository = StoriesDataRepository.getInstance(
//                 RemoteStoriesDataSource.getInstance(this), LocalStoriesDataSource.getInstance(this));
//         StoryDetailPresenter presenter = new StoryDetailPresenter(this.mStoryId, repository, storyDetailFragment);
//     }
// 
//     @Override
//     protected void onSaveInstanceState(Bundle outState) {
//         super.onSaveInstanceState(outState);
//         outState.putInt(INSTANCE_STORY_ID, this.mStoryId);
//     }
// }
// 
// Path: app/src/main/java/org/attentiveness/news/util/DateUtil.java
// public class DateUtil {
// 
//     public static String getToday() {
//         Calendar calendar = Calendar.getInstance();
//         calendar.add(Calendar.DAY_OF_YEAR, 1);
//         SimpleDateFormat simpleDateFormat = getDataFormat();
//         return simpleDateFormat.format(calendar.getTime());
//     }
// 
//     public static String getDate(int before) {
//         Calendar calendar = Calendar.getInstance();
//         calendar.add(Calendar.DAY_OF_YEAR, 1 - before);
//         SimpleDateFormat simpleDateFormat = getDataFormat();
//         return simpleDateFormat.format(calendar.getTime());
//     }
// 
//     private static SimpleDateFormat getDataFormat() {
//         return new SimpleDateFormat("yyyyMMdd", Locale.US);
//     }
// 
// }


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.attentiveness.news.R;
import org.attentiveness.news.base.BaseFragment;
import org.attentiveness.news.data.Story;
import org.attentiveness.news.detail.StoryDetailActivity;
import org.attentiveness.news.util.DateUtil;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
                mSwipeRefreshLayout.setRefreshing(active);
            }
        });
    }

    @Override
    public void showStoryList(List<Story> storyList) {
        this.mStoriesView.setVisibility(View.VISIBLE);
        this.mStoriesAdapter.setItemList(storyList);
    }

    @Override
    public void appendStoryList(List<Story> storyList) {
        this.mStoriesView.setVisibility(View.VISIBLE);
        this.mStoriesAdapter.addItemList(storyList);
    }

    @Override
    public void hideStoryList() {
        this.mStoriesView.setVisibility(View.GONE);
    }

    @Override
    public boolean isActive() {
        return isAdded();
    }

    @Override
    public void onStoryClicked(Story story) {
        if (story != null && story.getId() > 0) {
// Path: app/src/main/java/org/attentiveness/news/base/BaseFragment.java
// public class BaseFragment extends Fragment {
// 
//     public BaseFragment() {
//         // Required empty public constructor
//     }
// 
//     protected void showMessage(View anchorView, String message) {
//         Snackbar.make(anchorView, message, Snackbar.LENGTH_SHORT).show();
//     }
// 
// }
// 
// Path: app/src/main/java/org/attentiveness/news/data/Story.java
// public class Story {
// 
//     private int id;
//     private String title;
// 
//     @SerializedName("images")
//     private List<String> imageList;
// 
//     public Story() {
// 
//     }
// 
//     public Story(int id, String title) {
//         this.id = id;
//         this.title = title;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public List<String> getImageList() {
//         return imageList;
//     }
// 
//     public void setImageList(List<String> imageList) {
//         this.imageList = imageList;
//     }
// }
// 
// Path: app/src/main/java/org/attentiveness/news/detail/StoryDetailActivity.java
// public class StoryDetailActivity extends BaseActivity {
// 
//     private static final String INSTANCE_STORY_ID = "story_id";
// 
//     private int mStoryId;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_story_detail);
//         ButterKnife.bind(this);
//         setup();
// 
//         if (savedInstanceState == null) {
//             this.mStoryId = getIntent().getIntExtra(StoryListFragment.EXTRA_ID, 0);
//         } else {
//             this.mStoryId = savedInstanceState.getInt(INSTANCE_STORY_ID);
//         }
// 
//         StoryDetailFragment storyDetailFragment = (StoryDetailFragment) getSupportFragmentManager().findFragmentById(R.id.fl_container);
//         if (storyDetailFragment == null) {
//             storyDetailFragment = StoryDetailFragment.newInstance();
//             addFragment(getSupportFragmentManager(), R.id.fl_container, storyDetailFragment);
//         }
//         StoriesDataRepository repository = StoriesDataRepository.getInstance(
//                 RemoteStoriesDataSource.getInstance(this), LocalStoriesDataSource.getInstance(this));
//         StoryDetailPresenter presenter = new StoryDetailPresenter(this.mStoryId, repository, storyDetailFragment);
//     }
// 
//     @Override
//     protected void onSaveInstanceState(Bundle outState) {
//         super.onSaveInstanceState(outState);
//         outState.putInt(INSTANCE_STORY_ID, this.mStoryId);
//     }
// }
// 
// Path: app/src/main/java/org/attentiveness/news/util/DateUtil.java
// public class DateUtil {
// 
//     public static String getToday() {
//         Calendar calendar = Calendar.getInstance();
//         calendar.add(Calendar.DAY_OF_YEAR, 1);
//         SimpleDateFormat simpleDateFormat = getDataFormat();
//         return simpleDateFormat.format(calendar.getTime());
//     }
// 
//     public static String getDate(int before) {
//         Calendar calendar = Calendar.getInstance();
//         calendar.add(Calendar.DAY_OF_YEAR, 1 - before);
//         SimpleDateFormat simpleDateFormat = getDataFormat();
//         return simpleDateFormat.format(calendar.getTime());
//     }
// 
//     private static SimpleDateFormat getDataFormat() {
//         return new SimpleDateFormat("yyyyMMdd", Locale.US);
//     }
// 
// }


// Path: app/src/main/java/org/attentiveness/news/list/StoryListFragment.java
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.attentiveness.news.R;
import org.attentiveness.news.base.BaseFragment;
import org.attentiveness.news.data.Story;
import org.attentiveness.news.detail.StoryDetailActivity;
import org.attentiveness.news.util.DateUtil;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

                mSwipeRefreshLayout.setRefreshing(active);
            }
        });
    }

    @Override
    public void showStoryList(List<Story> storyList) {
        this.mStoriesView.setVisibility(View.VISIBLE);
        this.mStoriesAdapter.setItemList(storyList);
    }

    @Override
    public void appendStoryList(List<Story> storyList) {
        this.mStoriesView.setVisibility(View.VISIBLE);
        this.mStoriesAdapter.addItemList(storyList);
    }

    @Override
    public void hideStoryList() {
        this.mStoriesView.setVisibility(View.GONE);
    }

    @Override
    public boolean isActive() {
        return isAdded();
    }

    @Override
    public void onStoryClicked(Story story) {
        if (story != null && story.getId() > 0) {
            Intent intent = new Intent(this.getActivity(), StoryDetailActivity.class);