Skip to content

Commit 88f266f

Browse files
committed
Update rssfeed
1 parent 0d525e2 commit 88f266f

13 files changed

Lines changed: 19 additions & 32 deletions

File tree

com.example.android.rssfeed/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<application
1313
android:name="RssApplication"
1414
android:allowBackup="false"
15-
android:icon="@drawable/ic_launcher"
15+
android:icon="@drawable/launcher"
1616
android:label="@string/app_name"
1717
android:theme="@style/AppTheme" >
1818
<activity
-3.42 KB
Binary file not shown.
-1.72 KB
Binary file not shown.
2.3 KB
Loading
-4.51 KB
Binary file not shown.
2.3 KB
Loading

com.example.android.rssfeed/res/xml/myprefs.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,13 @@ public void onStop() {
4747
super.onStop();
4848
getActivity().unregisterReceiver(receiver);
4949
}
50+
5051
@Override
5152
public void onListItemClick(ListView l, View v, int position, long id) {
5253
RssItem item = (RssItem) getListAdapter().getItem(position);
5354
updateDetail(item);
5455
}
5556

56-
public void updateListContent() {
57-
Intent intent = new Intent(getActivity(), RssDownloadService.class);
58-
intent.putExtra("url", "http://www.vogella.com/article.rss");
59-
getActivity().startService(intent);
60-
}
61-
6257
public void setListContent(List<RssItem> result) {
6358
@SuppressWarnings("unchecked")
6459
ArrayAdapter<RssItem> listAdapter = (ArrayAdapter<RssItem>) getListAdapter();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.example.android.rssfeedlibrary.RssItem;
1111

1212
public class RssDownloadService extends IntentService {
13+
1314
public static String NOTIFICATION = "rssfeedupdated";
1415
public RssDownloadService() {
1516
super("RssDownloadService");

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ public class RssfeedActivity extends Activity implements
1919
public void onCreate(Bundle savedInstanceState) {
2020
super.onCreate(savedInstanceState);
2121
setContentView(R.layout.activity_rssfeed);
22-
FragmentManager manager = getFragmentManager();
23-
HeadlessFragment headlessFragment = (HeadlessFragment) manager.findFragmentByTag(HEADLESS);
24-
25-
if (headlessFragment==null) {
26-
FragmentTransaction transaction = manager.beginTransaction();
27-
transaction.add(new HeadlessFragment(), HEADLESS);
28-
transaction.commit();
29-
}
3022

3123
}
3224

@@ -52,11 +44,12 @@ public boolean onOptionsItemSelected(MenuItem item) {
5244
switch (item.getItemId()) {
5345

5446
case R.id.action_refresh:
55-
MyListFragment fragment = (MyListFragment) getFragmentManager()
56-
.findFragmentById(R.id.listFragment);
47+
5748
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
58-
String url = preferences.getString("url", "");
59-
fragment.updateListContent();
49+
String url = preferences.getString("url", "http://www.vogella.com/article.rss");
50+
Intent i = new Intent(this, RssDownloadService.class);
51+
i.putExtra("url", url);
52+
startService(i);
6053
break;
6154
case R.id.action_settings:
6255
Intent intent = new Intent(this, SettingsActivity.class);

0 commit comments

Comments
 (0)