Skip to content

Commit 78ed8c5

Browse files
committed
Rss feed application reworked
1 parent c8797de commit 78ed8c5

File tree

13 files changed

+95
-20
lines changed

13 files changed

+95
-20
lines changed
-1.72 KB
Binary file not shown.
-481 Bytes
Loading
3.13 KB
Loading
2.35 KB
Loading

com.example.android.rssfeed/res/layout-port/activity_rssfeed.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
android:id="@+id/listFragment"
99
android:layout_width="match_parent"
1010
android:layout_height="match_parent"
11-
android:layout_marginTop="?android:attr/actionBarSize"
1211
class="com.example.android.rssfeed.MyListFragment" ></fragment>
1312

1413
</LinearLayout>

com.example.android.rssfeed/res/layout/activity_rssfeed.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
android:layout_width="0dp"
1010
android:layout_weight="1"
1111
android:layout_height="match_parent"
12-
android:layout_marginTop="?android:attr/actionBarSize"
1312
class="com.example.android.rssfeed.MyListFragment" ></fragment>
1413
<fragment
1514
android:id="@+id/detailFragment"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:layout_width="match_parent"
3+
android:layout_height="?android:attr/listPreferredItemHeight"
4+
android:padding="6dip" >
5+
6+
<ImageView
7+
android:id="@+id/icon"
8+
android:layout_width="wrap_content"
9+
android:layout_height="match_parent"
10+
android:layout_marginRight="6dip"
11+
android:src="@drawable/rssfeeds" />
12+
13+
<LinearLayout
14+
android:layout_width="0dip"
15+
android:layout_height="match_parent"
16+
android:layout_weight="1"
17+
android:orientation="vertical" >
18+
19+
<TextView
20+
android:id="@+id/rsstitle"
21+
android:layout_width="match_parent"
22+
android:layout_height="0dip"
23+
android:layout_weight="1"
24+
android:ellipsize="marquee"
25+
android:gravity="left"
26+
android:singleLine="true"
27+
android:text="RSS Title" />
28+
29+
<TextView
30+
android:id="@+id/rssurl"
31+
android:layout_width="match_parent"
32+
android:layout_height="0dip"
33+
android:layout_weight="1"
34+
android:ellipsize="marquee"
35+
android:singleLine="true"
36+
android:text="RSS URL " />
37+
</LinearLayout>
38+
39+
</LinearLayout>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.example.android.rssfeed;
2+
3+
import android.app.Fragment;
4+
import android.os.Bundle;
5+
6+
public class HeadlessFragment extends Fragment {
7+
8+
@Override
9+
public void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setRetainInstance(true);
12+
}
13+
14+
}

com.example.android.rssfeed/src/com/example/android/rssfeed/MyListFragment.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public void onReceive(Context context, Intent intent) {
2929
public void onCreate(Bundle savedInstanceState) {
3030
super.onCreate(savedInstanceState);
3131
List<RssItem> list = RssApplication.list;
32-
MyAdapter adapter = new MyAdapter(getActivity(),
33-
android.R.layout.simple_list_item_1, list);
32+
RssItemListAdapter adapter = new RssItemListAdapter(getActivity(), list);
3433
setListAdapter(adapter);
3534
// setRetainInstance(true);
3635

@@ -42,7 +41,6 @@ public void onResume() {
4241
getActivity().registerReceiver(receiver,
4342
new IntentFilter(RssDownloadService.NOTIFICATION));
4443
}
45-
4644

4745
@Override
4846
public void onStop() {

com.example.android.rssfeed/src/com/example/android/rssfeed/RssApplication.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,15 @@
99

1010
public class RssApplication extends Application {
1111
public static List<RssItem> list = new ArrayList<RssItem>();
12+
13+
@Override
14+
public void onLowMemory() {
15+
super.onLowMemory();
16+
}
17+
@Override
18+
public void onTrimMemory(int level) {
19+
// TODO Auto-generated method stub
20+
super.onTrimMemory(level);
21+
}
22+
1223
}

0 commit comments

Comments
 (0)