fix excerpt generation

This commit is contained in:
Andrew Dolgov 2011-09-09 14:09:06 +04:00
parent cf0c9b8c6c
commit c7a583a116
3 changed files with 5 additions and 6 deletions

View File

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:padding="3dip" android:id="@+id/headlines_row" android:orientation="horizontal">
android:padding="3dip" android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="match_parent">
<CheckBox android:paddingLeft="6dip" android:paddingRight="6dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/selected"></CheckBox>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:orientation="vertical" android:layout_width="match_parent">
<TextView android:id="@+id/title" android:textSize="16sp" android:layout_height="wrap_content" android:text="{Title...}" android:layout_width="match_parent"></TextView>
<TextView android:id="@+id/excerpt" android:textSize="13sp" android:layout_height="wrap_content" android:textColor="#909090" android:text="{Content excerpt...}" android:layout_width="match_parent"></TextView>
<TextView android:id="@+id/title" android:textSize="16sp" android:text="{Title...}" android:layout_width="match_parent" android:layout_height="match_parent"></TextView>
<TextView android:id="@+id/excerpt" android:textSize="13sp" android:textColor="#909090" android:text="{Content excerpt...}" android:layout_width="match_parent" android:layout_height="match_parent"></TextView>
</LinearLayout>
</LinearLayout>

View File

@ -68,7 +68,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener {
DatabaseHelper helper = new DatabaseHelper(getActivity());
m_db = helper.getReadableDatabase();
m_cursor = m_db.query("feeds_unread", null, "unread > 0", null, null, null, "unread DESC");
m_cursor = m_db.query("feeds_unread", null, "unread > 0", null, null, null, "title");
m_adapter = new FeedsListAdapter(getActivity(), R.layout.feeds_row, m_cursor,
new String[] { "title", "unread" }, new int[] { R.id.title, R.id.unread_counter }, 0);

View File

@ -260,7 +260,7 @@ public class MainActivity extends Activity {
String excerpt = Jsoup.parse(article.content).text();
if (excerpt.length() > 250) {
excerpt = excerpt.substring(250) + "...";
excerpt = excerpt.substring(0, 250) + "...";
}
if (c.getCount() != 0) {