implement different resources for selected and selected+unread headlines

(refs #595)
This commit is contained in:
Andrew Dolgov 2013-03-19 14:44:11 +04:00
parent 0be7d5eac5
commit ef8fb0f7e8
11 changed files with 400 additions and 11 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="142" android:versionCode="143"
android:versionName="1.19" > android:versionName="1.20" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

View File

@ -15,7 +15,6 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="3dip" > android:padding="3dip" >
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -25,7 +24,7 @@
android:text="There are many variations of passages of Lorem Ipsum available" android:text="There are many variations of passages of Lorem Ipsum available"
android:textColor="?headlineSelectedTextColor" android:textColor="?headlineSelectedTextColor"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="normal" />
<TextView <TextView
android:id="@+id/feed_title" android:id="@+id/feed_title"

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?headlineSelectedBackgroundSolid"
android:gravity="center_vertical"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:padding="3dip" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:singleLine="false"
android:text="There are many variations of passages of Lorem Ipsum available"
android:textColor="?headlineSelectedTextColor"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/feed_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:ellipsize="end"
android:gravity="right"
android:singleLine="true"
android:text="{Feed title...}"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="10sp" />
<TextView
android:id="@+id/excerpt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" />
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center"
android:orientation="horizontal"
android:paddingRight="4dp" >
<CheckBox
android:id="@+id/selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:focusable="false" />
<TextView
android:id="@+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Jan 01, 00:00"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="10sp"
android:textStyle="italic" />
<ImageView
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:clickable="true"
android:src="@android:drawable/star_off" />
<ImageView
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -30,7 +30,6 @@
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -40,7 +39,7 @@
android:text="{Title...}" android:text="{Title...}"
android:textColor="?headlineSelectedTextColor" android:textColor="?headlineSelectedTextColor"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" > android:textStyle="normal" >
</TextView> </TextView>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?headlineSelectedBackgroundSolid"
android:padding="4sp"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:paddingLeft="6dip"
android:paddingRight="6dip" >
</CheckBox>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:singleLine="false"
android:text="{Title...}"
android:textColor="?headlineSelectedTextColor"
android:textSize="16sp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/excerpt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="{Content excerpt...}"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" >
</TextView>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingRight="15px" >
<ImageView
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@android:drawable/star_off" />
<ImageView
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -39,7 +39,7 @@
android:text="{Title...}" android:text="{Title...}"
android:textColor="?headlineSelectedTextColor" android:textColor="?headlineSelectedTextColor"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" > android:textStyle="normal" >
</TextView> </TextView>
<TextView <TextView

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?headlineSelectedBackground"
android:padding="4sp"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:paddingLeft="6dip"
android:paddingRight="6dip" >
</CheckBox>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:singleLine="false"
android:text="{Title...}"
android:textColor="?headlineSelectedTextColor"
android:textSize="16sp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/excerpt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="{Content excerpt...}"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" >
</TextView>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jan 01"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="11sp"
android:textStyle="italic" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingRight="15px" >
<ImageView
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@android:drawable/star_off" />
<ImageView
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -41,7 +41,7 @@
android:text="{Title...}" android:text="{Title...}"
android:textColor="?headlineSelectedTextColor" android:textColor="?headlineSelectedTextColor"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" > android:textStyle="normal" >
</TextView> </TextView>

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?headlineSelectedBackgroundSolid"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:paddingLeft="6dip"
android:paddingRight="6dip" >
</CheckBox>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:padding="3dp" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:singleLine="false"
android:text="{Title...}"
android:textColor="?headlineSelectedTextColor"
android:textSize="16sp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/feed_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center_horizontal|right"
android:singleLine="true"
android:text="{Feed title...}"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="10sp" />
<TextView
android:id="@+id/excerpt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="{Content excerpt...}"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="13sp" >
</TextView>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Jan 01"
android:textColor="?headlineSelectedExcerptTextColor"
android:textSize="10sp"
android:textStyle="italic" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingRight="6dp" >
<ImageView
android:id="@+id/marked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@android:drawable/star_off" />
<ImageView
android:id="@+id/published"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/ic_rss_bw" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -525,7 +525,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
public static final int VIEW_NORMAL = 0; public static final int VIEW_NORMAL = 0;
public static final int VIEW_UNREAD = 1; public static final int VIEW_UNREAD = 1;
public static final int VIEW_SELECTED = 2; public static final int VIEW_SELECTED = 2;
public static final int VIEW_LOADMORE = 3; public static final int VIEW_SELECTED_UNREAD = 3;
public static final int VIEW_LOADMORE = 4;
public static final int VIEW_COUNT = VIEW_LOADMORE+1; public static final int VIEW_COUNT = VIEW_LOADMORE+1;
@ -544,6 +545,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (a.id == -1) { if (a.id == -1) {
return VIEW_LOADMORE; return VIEW_LOADMORE;
} else if (m_activeArticle != null && a.id == m_activeArticle.id && a.unread) {
return VIEW_SELECTED_UNREAD;
} else if (m_activeArticle != null && a.id == m_activeArticle.id) { } else if (m_activeArticle != null && a.id == m_activeArticle.id) {
return VIEW_SELECTED; return VIEW_SELECTED;
} else if (a.unread) { } else if (a.unread) {
@ -573,6 +576,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
case VIEW_SELECTED: case VIEW_SELECTED:
layoutId = R.layout.headlines_row_selected; layoutId = R.layout.headlines_row_selected;
break; break;
case VIEW_SELECTED_UNREAD:
layoutId = R.layout.headlines_row_selected_unread;
break;
} }
LayoutInflater vi = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater vi = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View File

@ -378,7 +378,8 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
public static final int VIEW_NORMAL = 0; public static final int VIEW_NORMAL = 0;
public static final int VIEW_UNREAD = 1; public static final int VIEW_UNREAD = 1;
public static final int VIEW_SELECTED = 2; public static final int VIEW_SELECTED = 2;
public static final int VIEW_LOADMORE = 3; public static final int VIEW_SELECTED_UNREAD = 3;
public static final int VIEW_LOADMORE = 4;
public static final int VIEW_COUNT = VIEW_LOADMORE+1; public static final int VIEW_COUNT = VIEW_LOADMORE+1;
@ -393,7 +394,9 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
//Log.d(TAG, "@gIVT " + position + " " + c.getInt(0) + " vs " + m_activeArticleId); //Log.d(TAG, "@gIVT " + position + " " + c.getInt(0) + " vs " + m_activeArticleId);
if (c.getInt(0) == m_activeArticleId) { if (c.getInt(0) == m_activeArticleId && c.getInt(c.getColumnIndex("unread")) == 1) {
return VIEW_SELECTED_UNREAD;
} else if (c.getInt(0) == m_activeArticleId) {
return VIEW_SELECTED; return VIEW_SELECTED;
} else if (c.getInt(c.getColumnIndex("unread")) == 1) { } else if (c.getInt(c.getColumnIndex("unread")) == 1) {
return VIEW_UNREAD; return VIEW_UNREAD;
@ -420,6 +423,9 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
case VIEW_UNREAD: case VIEW_UNREAD:
layoutId = R.layout.headlines_row_unread; layoutId = R.layout.headlines_row_unread;
break; break;
case VIEW_SELECTED_UNREAD:
layoutId = R.layout.headlines_row_selected_unread;
break;
case VIEW_SELECTED: case VIEW_SELECTED:
layoutId = R.layout.headlines_row_selected; layoutId = R.layout.headlines_row_selected;
break; break;