use proper layout separation for normal and large screens
This commit is contained in:
parent
20a66a8dc2
commit
97c20e0c32
@ -1,10 +1,9 @@
|
|||||||
<?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="24"
|
android:versionCode="25"
|
||||||
android:versionName="0.1.23">
|
android:versionName="0.1.24">
|
||||||
<uses-sdk android:minSdkVersion="8" />
|
<uses-sdk android:minSdkVersion="8" />
|
||||||
<!-- <supports-screens android:smallScreens="false" android:normalScreens="false" /> -->
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
45
res/layout-large/headlines_row.xml
Normal file
45
res/layout-large/headlines_row.xml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="?headlineNormalBackground"
|
||||||
|
android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
|
||||||
|
<ImageView android:background="?headlineSeparatorNormal" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView>
|
||||||
|
<CheckBox android:focusable="false"
|
||||||
|
android:paddingLeft="6dip" android:paddingRight="6dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/selected"></CheckBox>
|
||||||
|
<LinearLayout android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||||
|
<TextView android:singleLine="true" android:ellipsize="end" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/title" android:text="{Title...}" android:textSize="16sp"></TextView>
|
||||||
|
<TextView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/excerpt" android:text="{Content excerpt...}" android:textSize="13sp" android:textColor="#909090"></TextView>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linerLayout3"
|
||||||
|
android:layout_width="wrap_content" android:gravity="center" android:padding="3dip"
|
||||||
|
android:layout_height="wrap_content" android:orientation="vertical">
|
||||||
|
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#909090" android:textSize="13sp" android:id="@+id/date" android:text="Jan 01"></TextView>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingRight="2sp"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/published"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@drawable/ic_rss_bw" >
|
||||||
|
</ImageView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
95
res/layout-large/headlines_row_selected.xml
Normal file
95
res/layout-large/headlines_row_selected.xml
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?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:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?headlineSeparatorSelected"
|
||||||
|
android:paddingRight="4dip" >
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
|
<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="true"
|
||||||
|
android:text="{Title...}"
|
||||||
|
android:textSize="16sp" >
|
||||||
|
</TextView>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/excerpt"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="{Content excerpt...}"
|
||||||
|
android:textColor="#909090"
|
||||||
|
android:textSize="13sp" >
|
||||||
|
</TextView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linerLayout3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="3dip" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Jan 01"
|
||||||
|
android:textColor="#909090"
|
||||||
|
android:textSize="13sp" >
|
||||||
|
</TextView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingRight="2sp"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/published"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@drawable/ic_rss_bw" >
|
||||||
|
</ImageView>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
47
res/layout-large/headlines_row_unread.xml
Normal file
47
res/layout-large/headlines_row_unread.xml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="?headlineUnreadBackground"
|
||||||
|
android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
|
||||||
|
<ImageView android:background="?headlineSeparatorUnread" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView>
|
||||||
|
<CheckBox android:focusable="false"
|
||||||
|
android:paddingLeft="6dip" android:paddingRight="6dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/selected"></CheckBox>
|
||||||
|
|
||||||
|
<LinearLayout android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:orientation="vertical" android:layout_width="match_parent">
|
||||||
|
<TextView android:singleLine="true" android:ellipsize="end" 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
|
||||||
|
android:id="@+id/linerLayout3"
|
||||||
|
android:layout_width="wrap_content" android:gravity="center" android:padding="3dip"
|
||||||
|
android:layout_height="wrap_content" android:orientation="vertical">
|
||||||
|
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#909090" android:textSize="13sp" android:id="@+id/date" android:text="Jan 01"></TextView>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingRight="2sp"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/published"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@drawable/ic_rss_bw" >
|
||||||
|
</ImageView>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -31,24 +31,11 @@
|
|||||||
|
|
||||||
<group android:id="@+id/menu_group_headlines" >
|
<group android:id="@+id/menu_group_headlines" >
|
||||||
|
|
||||||
<!-- <item
|
|
||||||
android:id="@+id/load_more_articles"
|
|
||||||
android:icon="@android:drawable/ic_menu_more"
|
|
||||||
android:showAsAction="ifRoom|withText"
|
|
||||||
android:title="@string/load_more_articles"/> -->
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/headlines_mark_as_read"
|
android:id="@+id/headlines_mark_as_read"
|
||||||
android:icon="@android:drawable/ic_menu_tick"
|
android:icon="@drawable/ic_menu_tick"
|
||||||
android:showAsAction="ifRoom|withText"
|
|
||||||
android:title="@string/headlines_mark_as_read"/>
|
android:title="@string/headlines_mark_as_read"/>
|
||||||
|
|
||||||
<!-- <item
|
|
||||||
android:id="@+id/show_all_articles"
|
|
||||||
android:icon="@android:drawable/ic_menu_agenda"
|
|
||||||
android:showAsAction=""
|
|
||||||
android:title="@string/show_all_articles"/> -->
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/headlines_select"
|
android:id="@+id/headlines_select"
|
||||||
android:icon="@drawable/ic_menu_database"
|
android:icon="@drawable/ic_menu_database"
|
||||||
|
@ -50,8 +50,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
private ArticleList m_selectedArticles = new ArticleList();
|
private ArticleList m_selectedArticles = new ArticleList();
|
||||||
|
|
||||||
private ArticleOps m_articleOps;
|
private ArticleOps m_articleOps;
|
||||||
private boolean m_smallScreenMode = false;
|
|
||||||
private boolean m_portraitMode = false;
|
|
||||||
|
|
||||||
public ArticleList getSelectedArticles() {
|
public ArticleList getSelectedArticles() {
|
||||||
return m_selectedArticles;
|
return m_selectedArticles;
|
||||||
@ -78,14 +76,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
m_portraitMode = getActivity().getWindowManager().getDefaultDisplay().getOrientation() % 2 == 0;
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
m_feed = savedInstanceState.getParcelable("feed");
|
m_feed = savedInstanceState.getParcelable("feed");
|
||||||
m_articles = savedInstanceState.getParcelable("articles");
|
m_articles = savedInstanceState.getParcelable("articles");
|
||||||
m_activeArticleId = savedInstanceState.getInt("activeArticleId");
|
m_activeArticleId = savedInstanceState.getInt("activeArticleId");
|
||||||
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
m_selectedArticles = savedInstanceState.getParcelable("selectedArticles");
|
||||||
m_smallScreenMode = savedInstanceState.getBoolean("smallScreenMode");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
|
View view = inflater.inflate(R.layout.headlines_fragment, container, false);
|
||||||
@ -110,7 +105,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
public void onAttach(Activity activity) {
|
public void onAttach(Activity activity) {
|
||||||
super.onAttach(activity);
|
super.onAttach(activity);
|
||||||
m_feed = ((MainActivity)activity).getActiveFeed();
|
m_feed = ((MainActivity)activity).getActiveFeed();
|
||||||
m_smallScreenMode = ((MainActivity)activity).getSmallScreenMode();
|
|
||||||
m_articleOps = (ArticleOps) activity;
|
m_articleOps = (ArticleOps) activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +170,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
out.putParcelable("articles", m_articles);
|
out.putParcelable("articles", m_articles);
|
||||||
out.putInt("activeArticleId", m_activeArticleId);
|
out.putInt("activeArticleId", m_activeArticleId);
|
||||||
out.putParcelable("selectedArticles", m_selectedArticles);
|
out.putParcelable("selectedArticles", m_selectedArticles);
|
||||||
out.putBoolean("smallScreenMode", m_smallScreenMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoadingStatus(int status, boolean showProgress) {
|
public void setLoadingStatus(int status, boolean showProgress) {
|
||||||
@ -295,14 +288,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
|||||||
final Article article = items.get(position);
|
final Article article = items.get(position);
|
||||||
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
int layoutId = (m_smallScreenMode && m_portraitMode) ? R.layout.headlines_row_small : R.layout.headlines_row;
|
int layoutId = R.layout.headlines_row;
|
||||||
|
|
||||||
switch (getItemViewType(position)) {
|
switch (getItemViewType(position)) {
|
||||||
case VIEW_UNREAD:
|
case VIEW_UNREAD:
|
||||||
layoutId = (m_smallScreenMode && m_portraitMode) ? R.layout.headlines_row_small_unread : R.layout.headlines_row_unread;
|
layoutId = R.layout.headlines_row_unread;
|
||||||
break;
|
break;
|
||||||
case VIEW_SELECTED:
|
case VIEW_SELECTED:
|
||||||
layoutId = (m_smallScreenMode && m_portraitMode) ? R.layout.headlines_row_small_selected : R.layout.headlines_row_selected;
|
layoutId = R.layout.headlines_row_selected;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user