more interface stuff, allow marking headlines as checked

This commit is contained in:
Andrew Dolgov 2011-11-24 14:51:23 +03:00
parent e9c02c8eca
commit 1fe01350a5
16 changed files with 85 additions and 197 deletions

View File

@ -3,7 +3,7 @@
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="-1280"
android:valueFrom="1280"
android:valueTo="0"
android:duration="500"/>
</set>

View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:duration="500"
android:valueFrom="0"
android:valueTo="-400"
android:valueType="intType"/>
</set>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:propertyName="x"
android:valueType="floatType"
android:valueFrom="0"
android:valueTo="1280"
android:duration="500"/>
</set>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16.000000px"
height="16.000000px"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.48.1 "
sodipodi:docname="mark_set.svg"
inkscape:export-filename="mark_set.png"
inkscape:export-xdpi="302.63"
inkscape:export-ydpi="302.63"
version="1.1">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0000000"
inkscape:pageshadow="2"
inkscape:zoom="31.678384"
inkscape:cx="6.9004349"
inkscape:cy="7.415554"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="1600"
inkscape:window-height="1131"
inkscape:window-x="0"
inkscape:window-y="25"
showguides="true"
inkscape:guide-bbox="true"
showgrid="false"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="opacity:1.0000000;fill:#a8cdfd;fill-opacity:1.0000000;stroke:#4f9dfd;stroke-width:0.99999938;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dasharray:none;stroke-opacity:1.0000000"
id="path1306"
sodipodi:sides="5"
sodipodi:cx="7.3551731"
sodipodi:cy="1.6684607"
sodipodi:r1="6.3745561"
sodipodi:r2="3.1872780"
sodipodi:arg1="0.78539816"
sodipodi:arg2="1.4137167"
inkscape:flatsided="false"
inkscape:rounded="0.0000000"
inkscape:randomized="0.0000000"
d="M 11.862665,6.1759525 L 7.8537732,4.8164981 L 4.4611852,7.3482318 L 4.5152876,3.1154547 L 1.0590984,0.67126048 L 5.1014272,-0.58528520 L 6.3579728,-4.6276140 L 8.8021671,-1.1714248 L 13.034944,-1.2255272 L 10.503210,2.1670609 L 11.862665,6.1759525 z "
transform="matrix(-0.707107,-0.707107,0.707107,-0.707107,12.02111,14.98939)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16.000000px"
height="16.000000px"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.48.1 "
sodipodi:docname="mark_unset.svg"
inkscape:export-filename="mark_unset.png"
inkscape:export-xdpi="302.63"
inkscape:export-ydpi="302.63"
version="1.1">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0000000"
inkscape:pageshadow="2"
inkscape:zoom="31.678384"
inkscape:cx="1.9759413"
inkscape:cy="7.415554"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="1600"
inkscape:window-height="1131"
inkscape:window-x="0"
inkscape:window-y="25"
showguides="true"
inkscape:guide-bbox="true"
showgrid="false"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="opacity:1;fill:#ffffff;fill-opacity:0;stroke:#cce4ff;stroke-width:0.99999938000000022;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path1306"
sodipodi:sides="5"
sodipodi:cx="7.3551731"
sodipodi:cy="1.6684607"
sodipodi:r1="6.3745561"
sodipodi:r2="3.1872780"
sodipodi:arg1="0.78539816"
sodipodi:arg2="1.4137167"
inkscape:flatsided="false"
inkscape:rounded="0.0000000"
inkscape:randomized="0.0000000"
d="M 11.862665,6.1759525 L 7.8537732,4.8164981 L 4.4611852,7.3482318 L 4.5152876,3.1154547 L 1.0590984,0.67126048 L 5.1014272,-0.58528520 L 6.3579728,-4.6276140 L 8.8021671,-1.1714248 L 13.034944,-1.2255272 L 10.503210,2.1670609 L 11.862665,6.1759525 z "
transform="matrix(-0.707107,-0.707107,0.707107,-0.707107,12.02111,14.98939)"
inkscape:export-xdpi="302.63"
inkscape:export-ydpi="302.63" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,6 +1,6 @@
<LinearLayout android:id="@+id/article_fragment" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal">
<ImageView android:layout_weight="0" android:background="?articleDivider" android:layout_width="wrap_content" android:paddingLeft="2dip" android:layout_height="match_parent"></ImageView>
<ImageView android:layout_weight="0" android:background="?articleDivider" android:layout_width="wrap_content" android:paddingLeft="4dip" android:layout_height="match_parent"></ImageView>
<LinearLayout
android:id="@+id/linerLayout2"
android:layout_width="match_parent"

View File

@ -3,7 +3,7 @@
android:layout_width="fill_parent"
android:gravity="center_vertical"
android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
<ImageView android:background="?feedsSelectedBackground" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView>
<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">

View File

@ -2,9 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:gravity="center_vertical"
android:background="?headlinesSelectedBackground"
android:padding="3dip" android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
<ImageView android:background="?feedsSelectedBackground" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView>
android:background="?headlineSelectedBackground"
android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
<ImageView android:background="?headlineSeparatorSelected" 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>

View File

@ -2,9 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:gravity="center_vertical"
android:background="@android:color/white"
android:padding="3dip" android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
<ImageView android:background="?feedsSelectedBackground" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView>
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>

View File

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

View File

@ -6,6 +6,10 @@
<attr name="headlinesBackground" format="reference|color" />
<attr name="articleHeader" format="reference|color" />
<attr name="articleDivider" format="reference|color" />
<attr name="headlinesSelectedBackground" format="reference|color" />
<attr name="headlineSelectedBackground" format="reference|color" />
<attr name="headlineUnreadBackground" format="reference|color" />
<attr name="feedsSelectedBackground" format="reference|color" />
<attr name="headlineSeparatorUnread" format="reference|color" />
<attr name="headlineSeparatorSelected" format="reference|color" />
<attr name="headlineSeparatorNormal" format="reference|color" />
</resources>

View File

@ -6,8 +6,12 @@
<item name="headlinesBackground">#ffffff</item>
<item name="articleDivider">#96c5ff</item>
<item name="articleHeader">#ffffff</item>
<item name="headlinesSelectedBackground">#fff7d5</item>
<item name="headlineSelectedBackground">#fff7d5</item>
<item name="headlineUnreadBackground">#ffffff</item>
<item name="feedsSelectedBackground">#96C5FF</item>
<item name="headlineSeparatorUnread">#96C5FF</item>
<item name="headlineSeparatorNormal">#909090</item>
<item name="headlineSeparatorSelected">#DBC981</item>
</style>
<style name="DarkTheme" parent="android:Theme.Holo">
@ -17,8 +21,13 @@
<item name="headlinesBackground">#000000</item>
<item name="articleDivider">#303030</item>
<item name="articleHeader">#101010</item>
<item name="headlinesSelectedBackground">#303060</item>
<item name="headlineSelectedBackground">#303060</item>
<item name="headlineUnreadBackground">#303030</item>
<item name="feedsSelectedBackground">#303060</item>
<item name="headlineSeparatorUnread">#303060</item>
<item name="headlineSeparatorNormal">#303060</item>
<item name="headlineSeparatorSelected">#303060</item>
</style>
</resources>

View File

@ -14,4 +14,5 @@ public class Article {
int feed_id;
List<String> tags;
String content;
boolean _selected;
}

View File

@ -16,12 +16,16 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ListView;
import android.widget.TextView;
@ -210,7 +214,20 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
public static final int VIEW_SELECTED = 2;
public static final int VIEW_COUNT = VIEW_SELECTED+1;
private ArrayList<Article> m_selectedArticles = new ArrayList<Article>();
/* private class ArticleCheckListener implements OnCheckedChangeListener {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
Log.d(TAG, "onCheckedChanged: " + buttonView + "/" + getContext());
}
} */
public ArticleListAdapter(Context context, int textViewResourceId, ArrayList<Article> items) {
super(context, textViewResourceId, items);
this.items = items;
@ -238,8 +255,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
View v = convertView;
Article article = items.get(position);
final Article article = items.get(position);
if (v == null) {
int layoutId = R.layout.headlines_row;
@ -281,6 +298,28 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
dv.setText(df.format(d));
}
CheckBox cb = (CheckBox) v.findViewById(R.id.selected);
if (cb != null) {
cb.setChecked(m_selectedArticles.contains(article));
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (isChecked) {
m_selectedArticles.add(article);
} else {
m_selectedArticles.remove(article);
}
Log.d(TAG, "num selected: " + m_selectedArticles.size());
}
});
}
return v;
}
}

View File

@ -103,12 +103,9 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
ft.replace(R.id.feeds_fragment, new FeedsFragment());
ft.replace(R.id.headlines_fragment, hf);
ft.replace(R.id.article_fragment, af);
//ft.hide(hf);
//ft.hide(af);
ft.commit();
findViewById(R.id.article_fragment).setVisibility(View.GONE);
//findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
LoginRequest ar = new LoginRequest();
ar.setApi(m_prefs.getString("ttrss_url", null));
@ -232,9 +229,6 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
setLoadingStatus(R.string.loading_message, true);
//FragmentManager fm = getFragmentManager();
//FeedsFragment ff = (FeedsFragment) fm.findFragmentById(R.id.feeds_fragment);
ViewFlipper vf = (ViewFlipper) findViewById(R.id.main_flipper);
if (vf != null) {
@ -245,6 +239,7 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.feeds_fragment, frag);
ft.show(frag);
ft.commit();
if (m_refreshTask != null) {
@ -293,7 +288,6 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
m_activeFeed = feed;
HeadlinesFragment hf = new HeadlinesFragment();
//hf.initialize(m_sessionId, feed.id, m_prefs);
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
@ -301,8 +295,6 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
ft.replace(R.id.headlines_fragment, hf);
ft.addToBackStack(null);
ft.commit();
findViewById(R.id.headlines_fragment).setVisibility(View.VISIBLE);
}
public Article getSelectedArticle() {
@ -319,13 +311,14 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
//ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right);
ft.show(getFragmentManager().findFragmentById(R.id.article_fragment));
//ft.hide(getFragmentManager().findFragmentById(R.id.feeds_fragment));
ft.replace(R.id.article_fragment, frag);
ft.addToBackStack(null);
ft.commit();
findViewById(R.id.article_fragment).setVisibility(View.VISIBLE);
}
public Feed getActiveFeed() {