mark articles as read when reading

This commit is contained in:
Andrew Dolgov 2011-11-24 15:16:07 +03:00
parent 4776a5d439
commit fb86971ca8
2 changed files with 24 additions and 5 deletions

View File

@ -1,17 +1,17 @@
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android" <ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/main_flipper"> android:layout_height="fill_parent" android:id="@+id/main_flipper">
<LinearLayout android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
<FrameLayout android:layout_height="match_parent" android:layout_width="300dp" android:layout_weight="0" android:id="@+id/feeds_fragment"></FrameLayout>
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/headlines_fragment"></FrameLayout>
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/article_fragment"></FrameLayout>
</LinearLayout>
<FrameLayout android:layout_gravity="center_vertical" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/sync_splash"> <FrameLayout android:layout_gravity="center_vertical" android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/sync_splash">
<LinearLayout android:layout_width="match_parent" android:gravity="center" android:layout_height="match_parent" android:id="@+id/linearLayout1"> <LinearLayout android:layout_width="match_parent" android:gravity="center" android:layout_height="match_parent" android:id="@+id/linearLayout1">
<ProgressBar android:layout_height="wrap_content" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge" android:id="@+id/loading_progress"></ProgressBar> <ProgressBar android:layout_height="wrap_content" android:layout_width="wrap_content" style="?android:attr/progressBarStyleLarge" android:id="@+id/loading_progress"></ProgressBar>
<TextView android:id="@+id/loading_message" android:text="@string/loading_message" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView> <TextView android:id="@+id/loading_message" android:text="@string/loading_message" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<LinearLayout android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/main" android:layout_width="fill_parent">
<FrameLayout android:layout_height="match_parent" android:layout_width="300dp" android:layout_weight="0" android:id="@+id/feeds_fragment"></FrameLayout>
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/headlines_fragment"></FrameLayout>
<FrameLayout android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="0.5" android:id="@+id/article_fragment"></FrameLayout>
</LinearLayout>
</ViewFlipper> </ViewFlipper>

View File

@ -108,6 +108,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
article.unread = false; article.unread = false;
m_selectedArticleId = article.id; m_selectedArticleId = article.id;
m_adapter.notifyDataSetChanged(); m_adapter.notifyDataSetChanged();
catchupArticle(article);
} }
} }
@ -206,6 +208,23 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
} }
} }
public void catchupArticle(final Article article) {
ApiRequest ar = new ApiRequest();
ar.setApi(m_prefs.getString("ttrss_url", null));
HashMap<String,String> map = new HashMap<String,String>() {
{
put("sid", m_sessionId);
put("op", "updateArticle");
put("article_ids", String.valueOf(article.id));
put("mode", "0");
put("field", "2");
}
};
ar.execute(map);
}
private class ArticleListAdapter extends ArrayAdapter<Article> { private class ArticleListAdapter extends ArrayAdapter<Article> {
private ArrayList<Article> items; private ArrayList<Article> items;