Added search, taglist, pocdasttaglist etc.

This commit is contained in:
daniel oeh 2013-08-24 14:23:31 +02:00
parent 1376b52848
commit 74b9bfdcc3
22 changed files with 952 additions and 343 deletions

View File

@ -2,64 +2,67 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.danoeh.antennapod" package="de.danoeh.antennapod"
android:versionCode="31" android:versionCode="31"
android:versionName="0.9.7.4" > android:versionName="0.9.7.4">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk <uses-sdk
android:minSdkVersion="10" android:minSdkVersion="10"
android:targetSdkVersion="18" /> android:targetSdkVersion="18"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<supports-screens <supports-screens
android:anyDensity="true" android:anyDensity="true"
android:largeScreens="true" android:largeScreens="true"
android:normalScreens="true" android:normalScreens="true"
android:smallScreens="true" android:smallScreens="true"
android:xlargeScreens="true" /> android:xlargeScreens="true"/>
<uses-feature <uses-feature
android:name="android.hardware.screen.portrait" android:name="android.hardware.screen.portrait"
android:required="false" /> android:required="false"/>
<uses-feature <uses-feature
android:name="android.hardware.touchscreen" android:name="android.hardware.touchscreen"
android:required="false" /> android:required="false"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application <application
android:name="de.danoeh.antennapod.PodcastApp" android:name="de.danoeh.antennapod.PodcastApp"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:logo="@drawable/ic_launcher" android:logo="@drawable/ic_launcher"
android:theme="@style/Theme.AntennaPod.Light" > android:theme="@style/Theme.AntennaPod.Light">
<activity <activity
android:name=".activity.MainActivity" android:name=".activity.MainActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name" > android:label="@string/app_name">
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.SearchActivity" /> android:value="de.danoeh.antennapod.activity.SearchActivity"/>
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/searchable" /> android:resource="@xml/searchable"/>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="de.danoeh.antennapod.activity.AddFeedActivity" android:name="de.danoeh.antennapod.activity.AddFeedActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="@string/add_new_feed_label" android:label="@string/add_new_feed_label"
android:windowSoftInputMode="adjustResize" > android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http"/> <data android:scheme="http"/>
<data android:scheme="https"/> <data android:scheme="https"/>
<data android:host="*"/> <data android:host="*"/>
@ -69,8 +72,10 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http"/> <data android:scheme="http"/>
<data android:scheme="https"/> <data android:scheme="https"/>
<data android:host="feeds.feedburner.com"/> <data android:host="feeds.feedburner.com"/>
@ -81,8 +86,10 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http"/> <data android:scheme="http"/>
<data android:scheme="https"/> <data android:scheme="https"/>
<data android:mimeType="text/xml"/> <data android:mimeType="text/xml"/>
@ -91,255 +98,290 @@
<data android:mimeType="application/xml"/> <data android:mimeType="application/xml"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" /> <data android:mimeType="text/plain"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name="de.danoeh.antennapod.activity.FeedItemlistActivity" android:name="de.danoeh.antennapod.activity.FeedItemlistActivity"
android:configChanges="orientation|screenSize" > android:configChanges="orientation|screenSize">
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.SearchActivity" /> android:value="de.danoeh.antennapod.activity.SearchActivity"/>
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/searchable" /> android:resource="@xml/searchable"/>
</activity> </activity>
<activity <activity
android:name="de.danoeh.antennapod.activity.ItemviewActivity" android:name="de.danoeh.antennapod.activity.ItemviewActivity"
android:configChanges="keyboard|orientation" /> android:configChanges="keyboard|orientation"/>
<activity <activity
android:name="de.danoeh.antennapod.activity.DownloadActivity" android:name="de.danoeh.antennapod.activity.DownloadActivity"
android:label="@string/downloads_label" /> android:label="@string/downloads_label"/>
<activity <activity
android:name=".activity.AudioplayerActivity" android:name=".activity.AudioplayerActivity"
android:launchMode="singleTop" > android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="file" /> <data android:scheme="file"/>
<data android:mimeType="audio/*" /> <data android:mimeType="audio/*"/>
</intent-filter> </intent-filter>
</activity> </activity>
<service <service
android:name=".service.download.DownloadService" android:name=".service.download.DownloadService"
android:enabled="true" /> android:enabled="true"/>
<service <service
android:name="de.danoeh.antennapod.service.PlaybackService" android:name="de.danoeh.antennapod.service.PlaybackService"
android:enabled="true" > android:enabled="true">
</service> </service>
<activity <activity
android:name=".activity.PreferenceActivity" android:name=".activity.PreferenceActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="@string/settings_label" > android:label="@string/settings_label">
</activity> </activity>
<activity <activity
android:name=".activity.DownloadLogActivity" android:name=".activity.DownloadLogActivity"
android:label="@string/download_log_label" > android:label="@string/download_log_label">
</activity> </activity>
<receiver <receiver
android:name=".receiver.MediaButtonReceiver" android:name=".receiver.MediaButtonReceiver"
android:exported="true" > android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" /> <action android:name="android.intent.action.MEDIA_BUTTON"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="de.danoeh.antennapod.NOTIFY_BUTTON_RECEIVER" /> <action android:name="de.danoeh.antennapod.NOTIFY_BUTTON_RECEIVER"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<activity android:name=".activity.FeedInfoActivity" > <activity android:name=".activity.FeedInfoActivity">
</activity> </activity>
<service <service
android:name=".service.PlayerWidgetService" android:name=".service.PlayerWidgetService"
android:enabled="true" android:enabled="true"
android:exported="false" > android:exported="false">
</service> </service>
<receiver android:name=".receiver.PlayerWidget" > <receiver android:name=".receiver.PlayerWidget">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="de.danoeh.antennapod.FORCE_WIDGET_UPDATE" /> <action android:name="de.danoeh.antennapod.FORCE_WIDGET_UPDATE"/>
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/player_widget_info" /> android:resource="@xml/player_widget_info"/>
<intent-filter> <intent-filter>
<action android:name="de.danoeh.antennapod.STOP_WIDGET_UPDATE" /> <action android:name="de.danoeh.antennapod.STOP_WIDGET_UPDATE"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receiver.FeedUpdateReceiver" > <receiver android:name=".receiver.FeedUpdateReceiver">
<intent-filter> <intent-filter>
<action android:name="de.danoeh.antennapod.feedupdatereceiver.refreshFeeds" /> <action android:name="de.danoeh.antennapod.feedupdatereceiver.refreshFeeds"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<activity android:name=".activity.StorageErrorActivity" > <activity android:name=".activity.StorageErrorActivity">
</activity> </activity>
<activity <activity
android:name=".activity.FlattrAuthActivity" android:name=".activity.FlattrAuthActivity"
android:label="@string/flattr_auth_label" > android:label="@string/flattr_auth_label">
<intent-filter> <intent-filter>
<action android:name=".activities.FlattrAuthActivity" /> <action android:name=".activities.FlattrAuthActivity"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE"/>
<data <data
android:host="de.danoeh.antennapod" android:host="de.danoeh.antennapod"
android:scheme="flattr4j" /> android:scheme="flattr4j"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.AboutActivity" android:name=".activity.AboutActivity"
android:label="@string/about_pref" > android:label="@string/about_pref">
</activity> </activity>
<activity <activity
android:name=".activity.OpmlImportFromPathActivity" android:name=".activity.OpmlImportFromPathActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="@string/opml_import_label" > android:label="@string/opml_import_label">
</activity> </activity>
<activity <activity
android:name=".activity.OpmlImportFromIntentActivity" android:name=".activity.OpmlImportFromIntentActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="@string/opml_import_label" > android:label="@string/opml_import_label">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE"/>
<data <data
android:host="*" android:host="*"
android:mimeType="*/*" android:mimeType="*/*"
android:pathPattern=".*\\.opml" android:pathPattern=".*\\.opml"
android:scheme="file" /> android:scheme="file"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE"/>
<data <data
android:host="*" android:host="*"
android:pathPattern=".*\\.opml" android:pathPattern=".*\\.opml"
android:scheme="file" android:scheme="file"
android:mimeType="text/x-opml" /> android:mimeType="text/x-opml"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.OpmlFeedChooserActivity" android:name=".activity.OpmlFeedChooserActivity"
android:label="@string/opml_import_label" > android:label="@string/opml_import_label">
</activity> </activity>
<activity <activity
android:name=".activity.SearchActivity" android:name=".activity.SearchActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="@string/search_results_label" android:label="@string/search_results_label"
android:launchMode="singleTop" > android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH"/>
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/searchable" /> android:resource="@xml/searchable"/>
</activity> </activity>
<activity <activity
android:name=".activity.MiroGuideMainActivity" android:name=".activity.MiroGuideMainActivity"
android:label="@string/miro_guide_label" > android:label="@string/miro_guide_label">
<meta-data <meta-data
android:name="android.app.default_searchable" android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.MiroGuideSearchActivity" /> android:value="de.danoeh.antennapod.activity.MiroGuideSearchActivity"/>
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/miroguide_searchable" /> android:resource="@xml/miroguide_searchable"/>
</activity> </activity>
<activity <activity
android:name=".activity.MiroGuideSearchActivity" android:name=".activity.MiroGuideSearchActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:launchMode="singleTop" > android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH"/>
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.app.searchable" android:name="android.app.searchable"
android:resource="@xml/miroguide_searchable" /> android:resource="@xml/miroguide_searchable"/>
</activity> </activity>
<activity <activity
android:name=".activity.MiroGuideCategoryActivity" android:name=".activity.MiroGuideCategoryActivity"
android:configChanges="keyboardHidden|orientation" > android:configChanges="keyboardHidden|orientation">
</activity> </activity>
<activity <activity
android:name=".activity.MiroGuideChannelViewActivity" android:name=".activity.MiroGuideChannelViewActivity"
android:configChanges="keyboard|orientation" android:configChanges="keyboard|orientation"
android:label="@string/miro_guide_label" > android:label="@string/miro_guide_label">
</activity> </activity>
<activity <activity
android:name=".activity.VideoplayerActivity" android:name=".activity.VideoplayerActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" > android:screenOrientation="landscape">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="file" /> <data android:scheme="file"/>
<data android:mimeType="video/*" /> <data android:mimeType="video/*"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.PlaybackHistoryActivity" android:name=".activity.PlaybackHistoryActivity"
android:label="@string/playback_history_label" /> android:label="@string/playback_history_label"/>
<activity <activity
android:name=".activity.DirectoryChooserActivity" android:name=".activity.DirectoryChooserActivity"
android:label="@string/choose_data_directory" /> android:label="@string/choose_data_directory"/>
<activity <activity
android:name=".activity.OrganizeQueueActivity" android:name=".activity.OrganizeQueueActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:label="@string/organize_queue_label" > android:label="@string/organize_queue_label">
</activity> </activity>
<activity <activity
android:name=".activity.gpoddernet.GpodnetMainActivity" android:name=".activity.gpoddernet.GpodnetMainActivity"
android:configChanges="orientation" android:configChanges="orientation"
android:label="@string/gpodnet_main_label"/> android:label="@string/gpodnet_main_label">
<receiver android:name=".receiver.ConnectivityActionReceiver" > <meta-data
android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.gpoddernet.GpodnetSearchActivity"/>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/gpodnet_searchable"/>
</activity>
<activity
android:name=".activity.gpoddernet.GpodnetTagActivity"
android:configChanges="orientation">
<meta-data
android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.gpoddernet.GpodnetSearchActivity"/>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/gpodnet_searchable"/>
</activity>
<activity
android:name=".activity.gpoddernet.GpodnetSearchActivity"
android:configChanges="orientation"
android:label="@string/search_label"
android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> <action android:name="android.intent.action.SEARCH"/>
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/gpodnet_searchable"/>
</activity>
<activity
android:name=".activity.DefaultOnlineFeedViewActivity"
android:configChanges="orientation"/>
<receiver android:name=".receiver.ConnectivityActionReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver android:name=".receiver.AlarmUpdateReceiver" > <receiver android:name=".receiver.AlarmUpdateReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" /> <action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data <data
android:path="de.danoeh.antennapod" android:path="de.danoeh.antennapod"
android:scheme="package" /> android:scheme="package"/>
</intent-filter> </intent-filter>
</receiver> </receiver>
</application> </application>

View File

@ -1,12 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/toplist_fragment"/> android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1">
<android.support.v4.view.PagerTabStrip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top" />
</android.support.v4.view.ViewPager>
</LinearLayout> </LinearLayout>

View File

@ -5,8 +5,8 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView <ImageView
android:id="@+id/imgvCover" android:id="@+id/imgvCover"
android:layout_width="@dimen/thumbnail_length" android:layout_width="@dimen/thumbnail_length_itemlist"
android:layout_height="@dimen/thumbnail_length" android:layout_height="@dimen/thumbnail_length_itemlist"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="4dip" android:layout_marginRight="4dip"
@ -16,7 +16,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/thumbnail_length" android:layout_height="@dimen/thumbnail_length_itemlist"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@id/imgvCover" android:layout_toRightOf="@id/imgvCover"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/searchListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/taglistFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/txtvTitle"
android:layout_margin="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/txtvDescription"
android:layout_margin="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="3"
android:ellipsize="end"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
</LinearLayout>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgvCover"
android:layout_width="@dimen/thumbnail_length_itemlist"
android:layout_height="@dimen/thumbnail_length_itemlist"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="4dp"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="0dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:layout_alignTop="@id/imgvCover"
android:layout_alignBottom="@id/imgvCover"
android:layout_toRightOf="@id/imgvCover"
android:layout_alignParentRight="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_large"
android:layout_margin="4dp"/>
<TextView
android:id="@+id/txtvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/imgvCover"
android:maxLines="3"
android:ellipsize="end"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"
android:layout_margin="4dp"/>
</RelativeLayout>

View File

@ -28,6 +28,7 @@
<color name="status_playing">#E0EE5F52</color> <color name="status_playing">#E0EE5F52</color>
<color name="overlay_dark">#262C31</color> <color name="overlay_dark">#262C31</color>
<color name="overlay_light">#DDDDDD</color> <color name="overlay_light">#DDDDDD</color>
<color name="default_image_color">#858585</color>
<!-- Use Gingerbread-orange --> <!-- Use Gingerbread-orange -->
<color name="selection_background_color_dark">#FEBB20</color> <color name="selection_background_color_dark">#FEBB20</color>

View File

@ -238,6 +238,11 @@
<string name="add_feed_label">Add feed</string> <string name="add_feed_label">Add feed</string>
<string name="miro_feed_added">Feed is being added</string> <string name="miro_feed_added">Feed is being added</string>
<!-- gpodder.net -->
<string name="gpodnet_taglist_header">CATEGORIES</string>
<string name="gpodnet_toplist_header">TOP PODCASTS</string>
<string name="gpodnet_search_hint">Search gpodder.net</string>
<!-- Directory chooser --> <!-- Directory chooser -->
<string name="selected_folder_label">Selected folder:</string> <string name="selected_folder_label">Selected folder:</string>
<string name="create_folder_label">Create folder</string> <string name="create_folder_label">Create folder</string>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android" android:hint="@string/gpodnet_search_hint" android:label="@string/app_name" android:icon="@drawable/ic_launcher">
</searchable>

View File

@ -0,0 +1,46 @@
package de.danoeh.antennapod.activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter;
import de.danoeh.antennapod.asynctask.ImageDiskCache;
import de.danoeh.antennapod.feed.Feed;
/**
* Created by daniel on 24.08.13.
*/
public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
@Override
protected void showFeedInformation(Feed feed) {
super.showFeedInformation(feed);
setContentView(R.layout.listview_activity);
ListView listView = (ListView) findViewById(R.id.listview);
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View header = inflater.inflate(R.layout.onlinefeedview_header, null);
listView.addHeaderView(header);
listView.setAdapter(new FeedItemlistDescriptionAdapter(this, 0, feed.getItems()));
ImageView cover = (ImageView) header.findViewById(R.id.imgvCover);
TextView title = (TextView) header.findViewById(R.id.txtvTitle);
TextView description = (TextView) header.findViewById(R.id.txtvDescription);
if (feed.getImage() != null) {
ImageDiskCache.getDefaultInstance().loadThumbnailBitmap(feed.getImage().getDownload_url(), cover, (int) getResources().getDimension(
R.dimen.thumbnail_length));
}
title.setText(feed.getTitle());
description.setText(feed.getDescription());
}
}

View File

@ -1,23 +1,15 @@
package de.danoeh.antennapod.activity; package de.danoeh.antennapod.activity;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import javax.xml.parsers.ParserConfigurationException;
import android.support.v7.app.ActionBarActivity;
import org.xml.sax.SAXException;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnCancelListener;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.Feed; import de.danoeh.antennapod.feed.Feed;
@ -25,7 +17,6 @@ import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.service.download.DownloadRequest; import de.danoeh.antennapod.service.download.DownloadRequest;
import de.danoeh.antennapod.service.download.DownloadStatus; import de.danoeh.antennapod.service.download.DownloadStatus;
import de.danoeh.antennapod.service.download.Downloader; import de.danoeh.antennapod.service.download.Downloader;
import de.danoeh.antennapod.service.download.DownloaderCallback;
import de.danoeh.antennapod.service.download.HttpDownloader; import de.danoeh.antennapod.service.download.HttpDownloader;
import de.danoeh.antennapod.syndication.handler.FeedHandler; import de.danoeh.antennapod.syndication.handler.FeedHandler;
import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException; import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException;
@ -33,18 +24,27 @@ import de.danoeh.antennapod.util.DownloadError;
import de.danoeh.antennapod.util.FileNameGenerator; import de.danoeh.antennapod.util.FileNameGenerator;
import de.danoeh.antennapod.util.StorageUtils; import de.danoeh.antennapod.util.StorageUtils;
import de.danoeh.antennapod.util.URLChecker; import de.danoeh.antennapod.util.URLChecker;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.util.Date;
/** /**
* Downloads a feed from a feed URL and parses it. Subclasses can display the * Downloads a feed from a feed URL and parses it. Subclasses can display the
* feed object that was parsed. This activity MUST be started with a given URL * feed object that was parsed. This activity MUST be started with a given URL
* or an Exception will be thrown. * or an Exception will be thrown.
* * <p/>
* If the feed cannot be downloaded or parsed, an error dialog will be displayed * If the feed cannot be downloaded or parsed, an error dialog will be displayed
* and the activity will finish as soon as the error dialog is closed. * and the activity will finish as soon as the error dialog is closed.
*/ */
public abstract class OnlineFeedViewActivity extends ActionBarActivity { public abstract class OnlineFeedViewActivity extends ActionBarActivity {
private static final String TAG = "OnlineFeedViewActivity"; private static final String TAG = "OnlineFeedViewActivity";
private static final String ARG_FEEDURL = "arg.feedurl"; public static final String ARG_FEEDURL = "arg.feedurl";
/** Optional argument: specify a title for the actionbar. */
public static final String ARG_TITLE = "title";
public static final int RESULT_ERROR = 2; public static final int RESULT_ERROR = 2;
@ -55,6 +55,11 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
protected void onCreate(Bundle arg0) { protected void onCreate(Bundle arg0) {
setTheme(UserPreferences.getTheme()); setTheme(UserPreferences.getTheme());
super.onCreate(arg0); super.onCreate(arg0);
if (getIntent() != null && getIntent().hasExtra(ARG_TITLE)) {
getSupportActionBar().setTitle(getIntent().getStringExtra(ARG_TITLE));
}
StorageUtils.checkStorageAvailability(this); StorageUtils.checkStorageAvailability(this);
final String feedUrl = getIntent().getStringExtra(ARG_FEEDURL); final String feedUrl = getIntent().getStringExtra(ARG_FEEDURL);
if (feedUrl == null) { if (feedUrl == null) {
@ -75,13 +80,13 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
} }
} }
private DownloaderCallback downloaderCallback = new DownloaderCallback() {
@Override private void onDownloadCompleted(final Downloader downloader) {
public void onDownloadCompleted(final Downloader downloader) {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (AppConfig.DEBUG) Log.d(TAG, "Download was completed");
DownloadStatus status = downloader.getResult(); DownloadStatus status = downloader.getResult();
if (status != null) { if (status != null) {
if (!status.isCancelled()) { if (!status.isCancelled()) {
@ -107,7 +112,6 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
}); });
} }
};
private void startFeedDownload(String url) { private void startFeedDownload(String url) {
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
@ -118,30 +122,38 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
FileNameGenerator.generateFileName(feed.getDownload_url())) FileNameGenerator.generateFileName(feed.getDownload_url()))
.toString(); .toString();
feed.setFile_url(fileUrl); feed.setFile_url(fileUrl);
DownloadRequest request = new DownloadRequest(feed.getFile_url(), final DownloadRequest request = new DownloadRequest(feed.getFile_url(),
feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED); feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED);
/* TODO update downloader = new HttpDownloader(
HttpDownloader httpDownloader = new HttpDownloader(downloaderCallback,
request); request);
httpDownloader.start(); new Thread() {
*/ @Override
public void run() {
downloader.call();
onDownloadCompleted(downloader);
}
}.start();
} }
/** Displays a progress indicator. */ /**
* Displays a progress indicator.
*/
private void setLoadingLayout() { private void setLoadingLayout() {
LinearLayout ll = new LinearLayout(this); RelativeLayout rl = new RelativeLayout(this);
LinearLayout.LayoutParams llLayoutParams = new LinearLayout.LayoutParams( RelativeLayout.LayoutParams rlLayoutParams = new RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams.MATCH_PARENT);
ProgressBar pb = new ProgressBar(this); ProgressBar pb = new ProgressBar(this);
pb.setIndeterminate(true); pb.setIndeterminate(true);
LinearLayout.LayoutParams pbLayoutParams = new LinearLayout.LayoutParams( RelativeLayout.LayoutParams pbLayoutParams = new RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams.WRAP_CONTENT);
pbLayoutParams.gravity = Gravity.CENTER; pbLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
ll.addView(pb, pbLayoutParams); rl.addView(pb, pbLayoutParams);
addContentView(ll, llLayoutParams); addContentView(rl, rlLayoutParams);
} }
private void parseFeed() { private void parseFeed() {
@ -185,7 +197,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
showFeedInformation(); showFeedInformation(feed);
} }
}); });
} else { } else {
@ -206,8 +218,10 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
thread.start(); thread.start();
} }
/** Called when feed parsed successfully */ /**
protected void showFeedInformation() { * Called when feed parsed successfully
*/
protected void showFeedInformation(Feed feed) {
} }

View File

@ -0,0 +1,44 @@
package de.danoeh.antennapod.activity.gpoddernet;
import android.app.SearchManager;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuItem;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.preferences.UserPreferences;
/**
* Created by daniel on 23.08.13.
*/
public class GpodnetActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
.setIcon(
obtainStyledAttributes(
new int[]{R.attr.action_search})
.getDrawable(0)),
MenuItem.SHOW_AS_ACTION_IF_ROOM);
MenuItemCompat.setActionView(menu.findItem(R.id.search_item), new SearchView(this));
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search_item));
searchView.setIconifiedByDefault(true);
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
return true;
}
}

View File

@ -1,25 +1,67 @@
package de.danoeh.antennapod.activity.gpoddernet; package de.danoeh.antennapod.activity.gpoddernet;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.PodcastTopListFragment; import de.danoeh.antennapod.fragment.gpodnet.PodcastTopListFragment;
import de.danoeh.antennapod.fragment.gpodnet.TagListFragment;
/** /**
* Created by daniel on 22.08.13. * Created by daniel on 22.08.13.
*/ */
public class GpodnetMainActivity extends ActionBarActivity { public class GpodnetMainActivity extends GpodnetActivity {
private static final String TAG = "GPodnetMainActivity";
private static final int POS_TAGS = 0;
private static final int POS_TOPLIST = 1;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.gpodnet_main); setContentView(R.layout.gpodnet_main);
FragmentTransaction transaction = getSupportFragmentManager() ViewPager viewpager = (ViewPager) findViewById(R.id.viewpager);
.beginTransaction(); viewpager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
PodcastTopListFragment topListFragment = new PodcastTopListFragment(); }
transaction.replace(R.id.toplist_fragment, topListFragment);
transaction.commit(); private class PagerAdapter extends FragmentStatePagerAdapter {
private static final int NUM_PAGES = 2;
public PagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int i) {
switch (i) {
case POS_TAGS:
return new TagListFragment();
case POS_TOPLIST:
return new PodcastTopListFragment();
default:
return null;
}
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case POS_TAGS:
return getString(R.string.gpodnet_taglist_header);
case POS_TOPLIST:
return getString(R.string.gpodnet_toplist_header);
default:
return super.getPageTitle(position);
}
}
@Override
public int getCount() {
return NUM_PAGES;
}
} }
} }

View File

@ -0,0 +1,50 @@
package de.danoeh.antennapod.activity.gpoddernet;
import android.app.SearchManager;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.SearchListFragment;
import org.apache.commons.lang3.StringUtils;
/**
* Created by daniel on 23.08.13.
*/
public class GpodnetSearchActivity extends GpodnetActivity {
private SearchListFragment searchFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gpodnet_search);
}
@Override
protected void onResume() {
super.onResume();
Intent intent = getIntent();
if (StringUtils.equals(intent.getAction(), Intent.ACTION_SEARCH)) {
handleSearchRequest(intent.getStringExtra(SearchManager.QUERY));
}
}
@Override
protected void onNewIntent(Intent intent) {
setIntent(intent);
}
private void handleSearchRequest(String query) {
getSupportActionBar().setSubtitle(getString(R.string.search_term_label) + query);
if (searchFragment == null) {
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
searchFragment = SearchListFragment.newInstance(query);
transaction.replace(R.id.searchListFragment, searchFragment);
transaction.commit();
} else {
searchFragment.changeQuery(query);
}
}
}

View File

@ -0,0 +1,51 @@
package de.danoeh.antennapod.activity.gpoddernet;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.fragment.gpodnet.PodcastListFragment;
import de.danoeh.antennapod.fragment.gpodnet.SearchListFragment;
import de.danoeh.antennapod.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast;
import de.danoeh.antennapod.gpoddernet.model.GpodnetTag;
import java.util.List;
/**
* Created by daniel on 23.08.13.
*/
public class GpodnetTagActivity extends GpodnetActivity{
private static final int PODCAST_COUNT = 50;
public static final String ARG_TAGNAME = "tagname";
private GpodnetTag tag;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gpodnet_tag_activity);
if (!getIntent().hasExtra(ARG_TAGNAME)) {
throw new IllegalArgumentException("No tagname argument");
}
tag = new GpodnetTag(getIntent().getStringExtra(ARG_TAGNAME));
getSupportActionBar().setTitle(tag.getName());
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
Fragment taglistFragment = new TaglistFragment();
transaction.replace(R.id.taglistFragment, taglistFragment);
transaction.commit();
}
private class TaglistFragment extends PodcastListFragment {
@Override
protected List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException {
return service.getPodcastsForTag(tag, PODCAST_COUNT);
}
}
}

View File

@ -0,0 +1,55 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem;
import java.util.List;
/**
* Created by daniel on 24.08.13.
*/
public class FeedItemlistDescriptionAdapter extends ArrayAdapter<FeedItem> {
public FeedItemlistDescriptionAdapter(Context context, int resource, List<FeedItem> objects) {
super(context, resource, objects);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
FeedItem item = getItem(position);
// Inflate layout
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.itemdescription_listitem, null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.description = (TextView) convertView.findViewById(R.id.txtvDescription);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.title.setText(item.getTitle());
if (item.getDescription() != null) {
holder.description.setText(item.getDescription());
}
return convertView;
}
static class Holder {
TextView title;
TextView description;
}
}

View File

@ -49,11 +49,16 @@ public class ImageDiskCache {
if (path == null) { if (path == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
if (cacheSingletons.containsKey(path)) {
return cacheSingletons.get(path);
}
ImageDiskCache cache = cacheSingletons.get(path); ImageDiskCache cache = cacheSingletons.get(path);
if (cache == null) { if (cache == null) {
cache = new ImageDiskCache(path, maxCacheSize); cache = new ImageDiskCache(path, maxCacheSize);
cacheSingletons.put(new File(path).getAbsolutePath(), cache); cacheSingletons.put(new File(path).getAbsolutePath(), cache);
} }
cacheSingletons.put(path, cache);
return cache; return cache;
} }
@ -75,7 +80,7 @@ public class ImageDiskCache {
} }
executor = Executors.newFixedThreadPool(Runtime.getRuntime() executor = Executors.newFixedThreadPool(Runtime.getRuntime()
.availableProcessors()); .availableProcessors() * 2);
} }
private synchronized void initCacheFolder() { private synchronized void initCacheFolder() {
@ -189,10 +194,11 @@ public class ImageDiskCache {
} }
} }
target.setTag(R.id.image_disk_cache_key, url); target.setTag(R.id.image_disk_cache_key, url);
target.setImageResource(R.color.default_image_color);
executor.submit(new ImageDownloader(url) { executor.submit(new ImageDownloader(url) {
@Override @Override
protected void onImageLoaded(DiskCacheObject diskCacheObject) { protected void onImageLoaded(DiskCacheObject diskCacheObject) {
if (target.getTag(R.id.image_disk_cache_key) == url) { if (target.getTag(R.id.image_disk_cache_key).equals(url)) {
il.loadThumbnailBitmap(diskCacheObject.loadImage(), target, length); il.loadThumbnailBitmap(diskCacheObject.loadImage(), target, length);
} }
} }
@ -215,10 +221,11 @@ public class ImageDiskCache {
} }
} }
target.setTag(R.id.image_disk_cache_key, url); target.setTag(R.id.image_disk_cache_key, url);
target.setImageResource(R.color.default_image_color);
executor.submit(new ImageDownloader(url) { executor.submit(new ImageDownloader(url) {
@Override @Override
protected void onImageLoaded(DiskCacheObject diskCacheObject) { protected void onImageLoaded(DiskCacheObject diskCacheObject) {
if (target.getTag(R.id.image_disk_cache_key) == url) { if (target.getTag(R.id.image_disk_cache_key).equals(url)) {
il.loadCoverBitmap(diskCacheObject.loadImage(), target, length); il.loadCoverBitmap(diskCacheObject.loadImage(), target, length);
} }
} }

View File

@ -1,9 +1,11 @@
package de.danoeh.antennapod.fragment.gpodnet; package de.danoeh.antennapod.fragment.gpodnet;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -11,7 +13,10 @@ import android.widget.AdapterView;
import android.widget.GridView; import android.widget.GridView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.adapter.gpodnet.PodcastListAdapter; import de.danoeh.antennapod.adapter.gpodnet.PodcastListAdapter;
import de.danoeh.antennapod.gpoddernet.GpodnetService; import de.danoeh.antennapod.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.gpoddernet.GpodnetServiceException;
@ -49,11 +54,17 @@ public abstract class PodcastListFragment extends Fragment {
return root; return root;
} }
protected abstract void onPodcastSelected(GpodnetPodcast selection); protected void onPodcastSelected(GpodnetPodcast selection) {
if (AppConfig.DEBUG) Log.d(TAG, "Selected podcast: " + selection.toString());
Intent intent = new Intent(getActivity(), DefaultOnlineFeedViewActivity.class);
intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, selection.getUrl());
intent.putExtra(DefaultOnlineFeedViewActivity.ARG_TITLE, getString(R.string.gpodnet_main_label));
startActivity(intent);
}
protected abstract List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException; protected abstract List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException;
private void loadData() { protected final void loadData() {
AsyncTask<Void, Void, List<GpodnetPodcast>> loaderTask = new AsyncTask<Void, Void, List<GpodnetPodcast>>() { AsyncTask<Void, Void, List<GpodnetPodcast>> loaderTask = new AsyncTask<Void, Void, List<GpodnetPodcast>>() {
volatile Exception exception = null; volatile Exception exception = null;
@ -95,7 +106,7 @@ public abstract class PodcastListFragment extends Fragment {
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
super.onPreExecute(); super.onPreExecute();
// gridView.setVisibility(View.GONE); gridView.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
} }
}; };

View File

@ -15,11 +15,6 @@ public class PodcastTopListFragment extends PodcastListFragment {
private static final String TAG = "PodcastTopListFragment"; private static final String TAG = "PodcastTopListFragment";
private static final int PODCAST_COUNT = 50; private static final int PODCAST_COUNT = 50;
@Override
protected void onPodcastSelected(GpodnetPodcast selection) {
if (AppConfig.DEBUG) Log.d(TAG, "Selected: " + selection.getTitle());
}
@Override @Override
protected List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException { protected List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException {
return service.getPodcastToplist(PODCAST_COUNT); return service.getPodcastToplist(PODCAST_COUNT);

View File

@ -0,0 +1,48 @@
package de.danoeh.antennapod.fragment.gpodnet;
import android.os.Bundle;
import de.danoeh.antennapod.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.gpoddernet.model.GpodnetPodcast;
import java.util.List;
/**
* Created by daniel on 23.08.13.
*/
public class SearchListFragment extends PodcastListFragment {
private static final String ARG_QUERY = "query";
private String query;
public static SearchListFragment newInstance(String query) {
SearchListFragment fragment = new SearchListFragment();
Bundle args = new Bundle();
args.putString(ARG_QUERY, query);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null && getArguments().containsKey(ARG_QUERY)) {
this.query = getArguments().getString(ARG_QUERY);
} else {
this.query = "";
}
}
@Override
protected List<GpodnetPodcast> loadPodcastData(GpodnetService service) throws GpodnetServiceException {
return service.searchPodcasts(query, 0);
}
public void changeQuery(String query) {
if (query == null) {
throw new NullPointerException();
}
this.query = query;
loadData();
}
}

View File

@ -0,0 +1,96 @@
package de.danoeh.antennapod.fragment.gpodnet;
import android.R;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import de.danoeh.antennapod.activity.gpoddernet.GpodnetTagActivity;
import de.danoeh.antennapod.gpoddernet.GpodnetService;
import de.danoeh.antennapod.gpoddernet.GpodnetServiceException;
import de.danoeh.antennapod.gpoddernet.model.GpodnetTag;
import java.util.ArrayList;
import java.util.List;
public class TagListFragment extends ListFragment {
private static final String TAG = "TagListFragment";
private static final int COUNT = 50;
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setRetainInstance(true);
getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String selectedTag = (String) getListAdapter().getItem(position);
Intent intent = new Intent(getActivity(), GpodnetTagActivity.class);
intent.putExtra(GpodnetTagActivity.ARG_TAGNAME, selectedTag);
startActivity(intent);
}
});
loadData();
}
private void loadData() {
AsyncTask<Void, Void, List<GpodnetTag>> task = new AsyncTask<Void, Void, List<GpodnetTag>>() {
private Exception exception;
@Override
protected List<GpodnetTag> doInBackground(Void... params) {
GpodnetService service = new GpodnetService();
try {
return service.getTopTags(COUNT);
} catch (GpodnetServiceException e) {
e.printStackTrace();
exception = e;
return null;
} finally {
service.shutdown();
}
}
@Override
protected void onPreExecute() {
super.onPreExecute();
setListShown(false);
}
@Override
protected void onPostExecute(List<GpodnetTag> gpodnetTags) {
super.onPostExecute(gpodnetTags);
final Context context = getActivity();
if (context != null) {
if (gpodnetTags != null) {
List<String> tagNames = new ArrayList<String>();
for (GpodnetTag tag : gpodnetTags) {
tagNames.add(tag.getName());
}
setListAdapter(new ArrayAdapter<String>(context, R.layout.simple_list_item_1, tagNames));
setListShown(true);
} else if (exception != null) {
TextView txtvError = new TextView(getActivity());
txtvError.setText(exception.getMessage());
getListView().setEmptyView(txtvError);
} else {
setListShown(true);
}
}
}
};
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
task.execute();
}
}
}