Merge branch 'newgui' into develop. closes #407

Conflicts:
	res/layout/feedinfo.xml
This commit is contained in:
daniel oeh 2014-05-19 00:04:19 +02:00
commit 0f3b77ed8e
118 changed files with 6310 additions and 1853 deletions

View File

@ -45,28 +45,12 @@
<activity
android:name=".activity.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:launchMode="singleTask"
android:label="@string/app_name">
<meta-data
android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.SearchActivity"/>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name="de.danoeh.antennapod.activity.AddFeedActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/add_new_feed_label"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.MainActivity"/>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
@ -114,6 +98,18 @@
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
<activity
android:name="de.danoeh.antennapod.activity.AddFeedActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/add_new_feed_label"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.MainActivity"/>
</activity>
<activity
android:name="de.danoeh.antennapod.activity.FeedItemlistActivity"
@ -121,12 +117,6 @@
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.danoeh.antennapod.activity.MainActivity"/>
<meta-data
android:name="android.app.default_searchable"
android:value="de.danoeh.antennapod.activity.SearchActivity"/>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
<activity
android:name="de.danoeh.antennapod.activity.ItemviewActivity"
@ -295,19 +285,6 @@
android:name=".activity.OpmlFeedChooserActivity"
android:label="@string/opml_import_label">
</activity>
<activity
android:name=".activity.SearchActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/search_results_label"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.SEARCH"/>
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
<activity
android:name=".activity.MiroGuideMainActivity"
android:label="@string/miro_guide_label">

BIN
assets/Roboto-Light.ttf Normal file

Binary file not shown.

BIN
assets/Roboto.ttf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
res/drawable-hdpi/ic_new.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

BIN
res/drawable-hdpi/ic_new_dark.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
res/drawable-mdpi/ic_new.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

BIN
res/drawable-mdpi/ic_new_dark.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
res/drawable-xhdpi/ic_new.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

BIN
res/drawable-xxhdpi/ic_new.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,178 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/contentView"
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5" >
</FrameLayout>
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
<FrameLayout
android:id="@+id/contentView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5">
</FrameLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="?attr/non_transparent_background"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/navBar"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true">
<ImageButton
android:id="@+id/butNavLeft"
android:contentDescription="@string/show_shownotes_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="?attr/borderless_button"
android:padding="4dp"/>
<ImageButton
android:id="@+id/butNavRight"
android:contentDescription="@string/show_chapters_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:padding="4dp"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold"/>
<TextView
android:id="@+id/txtvFeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_small"/>
</RelativeLayout>
<View
android:id="@+id/navBarDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/navBar"
android:background="@color/bright_blue"/>
<RelativeLayout
android:id="@+id/player_control"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="?attr/overlay_background">
<ImageButton
android:id="@+id/butPlay"
android:contentDescription="@string/pause_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="?attr/borderless_button"
android:src="?attr/av_pause"/>
<ImageButton
android:id="@+id/butRev"
android:contentDescription="@string/rewind_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_rewind"/>
<ImageButton
android:id="@+id/butFF"
android:contentDescription="@string/fast_forward_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward"/>
<Button
android:id="@+id/butPlaybackSpeed"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butFF"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward"
android:textColor="@color/gray"
android:textSize="@dimen/text_size_medium"
android:visibility="gone"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/playtime_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/player_control"
android:layout_alignParentLeft="true"
android:background="?attr/overlay_drawable">
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"/>
<TextView
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"/>
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:layout_toLeftOf="@id/txtvLength"
android:layout_toRightOf="@id/txtvPosition"
android:max="500"/>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<ListView
android:id="@+id/nav_list"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="?attr/non_transparent_background"
android:orientation="vertical" >
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="?attr/nav_drawer_background"
android:scrollbarStyle="outsideOverlay"
android:paddingLeft="8dp"
android:paddingRight="8dp"/>
<RelativeLayout
android:id="@+id/navBar"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true" >
<ImageButton
android:id="@+id/butNavLeft"
android:contentDescription="@string/show_shownotes_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="?attr/borderless_button"
android:padding="4dp" />
<ImageButton
android:id="@+id/butNavRight"
android:contentDescription="@string/show_chapters_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:padding="4dp" />
<TextView
android:id="@+id/txtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium"
android:textStyle="bold" />
<TextView
android:id="@+id/txtvFeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_small" />
</RelativeLayout>
<View
android:id="@+id/navBarDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/navBar"
android:background="@color/bright_blue" />
<RelativeLayout
android:id="@+id/player_control"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="?attr/overlay_background" >
<ImageButton
android:id="@+id/butPlay"
android:contentDescription="@string/pause_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="?attr/borderless_button"
android:src="?attr/av_pause" />
<ImageButton
android:id="@+id/butRev"
android:contentDescription="@string/rewind_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_rewind" />
<ImageButton
android:id="@+id/butFF"
android:contentDescription="@string/fast_forward_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward" />
<Button
android:id="@+id/butPlaybackSpeed"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butFF"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward"
android:textColor="@color/gray"
android:textSize="@dimen/text_size_medium"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/playtime_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/player_control"
android:layout_alignParentLeft="true"
android:background="?attr/overlay_drawable" >
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
<TextView
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:layout_toLeftOf="@id/txtvLength"
android:layout_toRightOf="@id/txtvPosition"
android:max="500" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>

View File

@ -20,9 +20,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
android:textSize="@dimen/text_size_large"
android:textColor="@color/bright_blue"
android:textStyle="italic"
style="@style/AntennaPod.TextView.Heading"
android:text="@string/txtvfeedurl_label"/>
<EditText
@ -48,37 +46,34 @@
android:layout_height="wrap_content"
android:layout_below="@id/butConfirm"
android:layout_margin="8dp"
android:textSize="@dimen/text_size_large"
android:textColor="@color/bright_blue"
android:textStyle="italic"
style="@style/AntennaPod.TextView.Heading"
android:text="@string/podcastdirectories_label"/>
<TextView
android:id="@+id/txtvPodcastDirectoriesDescr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/podcastdirectories_descr"
android:textSize="@dimen/text_size_medium"
android:layout_below="@id/txtvPodcastDirectories"
android:layout_margin="8dp"/>
<Button
android:id="@+id/butBrowseGpoddernet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvPodcastDirectories"
android:layout_below="@id/txtvPodcastDirectoriesDescr"
android:layout_margin="8dp"
android:text="@string/gpodnet_main_label"/>
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/butBrowseGpoddernet"
android:layout_margin="8dp"
android:text="@string/miro_guide_label"/>
android:text="@string/browse_gpoddernet_label"/>
<TextView
android:id="@+id/txtvOpmlImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/butBrowseMiroguide"
android:layout_below="@id/butBrowseGpoddernet"
android:layout_margin="8dp"
android:textSize="@dimen/text_size_large"
android:textColor="@color/bright_blue"
android:textStyle="italic"
style="@style/AntennaPod.TextView.Heading"
android:text="@string/opml_import_label"/>
<TextView
@ -87,6 +82,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/txtvOpmlImport"
android:layout_margin="8dp"
android:textSize="@dimen/text_size_medium"
android:text="@string/opml_import_txtv_button_lable"/>
<Button

View File

@ -1,173 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/non_transparent_background"
android:orientation="vertical" >
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/navBar"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/non_transparent_background"
android:orientation="vertical">
<ImageButton
android:id="@+id/butNavLeft"
android:contentDescription="@string/show_shownotes_label"
android:layout_width="60dp"
android:layout_height="match_parent"
<RelativeLayout
android:id="@+id/navBar"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true">
<ImageButton
android:id="@+id/butNavLeft"
android:contentDescription="@string/show_shownotes_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="?attr/borderless_button"
android:padding="4dp"/>
<ImageButton
android:id="@+id/butNavRight"
android:contentDescription="@string/show_chapters_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:padding="4dp"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:fontFamily="sans-serif-light"
/>
</RelativeLayout>
<View
android:id="@+id/navBarDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/navBar"
android:background="@color/bright_blue"/>
<RelativeLayout
android:id="@+id/player_control"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="?attr/overlay_background">
<ImageButton
android:id="@+id/butPlay"
android:contentDescription="@string/pause_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="?attr/borderless_button"
android:src="?attr/av_pause"/>
<ImageButton
android:id="@+id/butRev"
android:contentDescription="@string/rewind_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_rewind"/>
<ImageButton
android:id="@+id/butFF"
android:contentDescription="@string/fast_forward_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward"/>
<Button
android:id="@+id/butPlaybackSpeed"
android:contentDescription="@string/set_playback_speed_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butFF"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward"
android:textColor="@color/gray"
android:textSize="@dimen/text_size_medium"
android:visibility="gone"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/playtime_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/player_control"
android:layout_alignParentLeft="true"
android:background="?attr/borderless_button"
android:padding="4dp" />
android:background="?attr/overlay_drawable">
<ImageButton
android:id="@+id/butNavRight"
android:contentDescription="@string/show_chapters_label"
android:layout_width="60dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:padding="4dp" />
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:fontFamily="sans-serif-light"
android:textSize="@dimen/text_size_micro"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_small"
android:textStyle="bold" />
<TextView
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:fontFamily="sans-serif-light"
android:textSize="@dimen/text_size_micro"/>
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:layout_toLeftOf="@id/txtvLength"
android:layout_toRightOf="@id/txtvPosition"
android:max="500"/>
</RelativeLayout>
<FrameLayout
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_above="@id/playtime_layout"
android:layout_below="@id/navBarDivider">
</FrameLayout>
<TextView
android:id="@+id/txtvFeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/butNavRight"
android:layout_toRightOf="@id/butNavLeft"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_small" />
</RelativeLayout>
<View
android:id="@+id/navBarDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/navBar"
android:background="@color/bright_blue" />
<ListView
android:id="@+id/nav_list"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="?attr/nav_drawer_background"
android:scrollbarStyle="outsideOverlay"
android:paddingLeft="8dp"
android:paddingRight="8dp"/>
<RelativeLayout
android:id="@+id/player_control"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="?attr/overlay_background" >
<ImageButton
android:id="@+id/butPlay"
android:contentDescription="@string/pause_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:background="?attr/borderless_button"
android:src="?attr/av_pause" />
<ImageButton
android:id="@+id/butRev"
android:contentDescription="@string/rewind_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_rewind" />
<ImageButton
android:id="@+id/butFF"
android:contentDescription="@string/fast_forward_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butPlay"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward" />
<Button
android:id="@+id/butPlaybackSpeed"
android:contentDescription="@string/set_playback_speed_label"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_toRightOf="@id/butFF"
android:background="?attr/borderless_button"
android:src="?attr/av_fast_forward"
android:textColor="@color/gray"
android:textSize="@dimen/text_size_medium"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/playtime_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/player_control"
android:layout_alignParentLeft="true"
android:background="?attr/overlay_drawable" >
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
<TextView
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
<SeekBar
android:id="@+id/sbPosition"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="16dp"
android:layout_toLeftOf="@id/txtvLength"
android:layout_toRightOf="@id/txtvPosition"
android:max="500" />
</RelativeLayout>
<FrameLayout
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_above="@id/playtime_layout"
android:layout_below="@id/navBarDivider" >
</FrameLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="8dp">
<ImageView
android:id="@+id/imgvImage"
android:contentDescription="@string/cover_label"
android:layout_width="@dimen/thumbnail_length_downloaded_item"
android:layout_height="@dimen/thumbnail_length_downloaded_item"
android:layout_alignParentLeft="true"
android:scaleType="centerCrop"/>
<TextView
android:id="@+id/txtvPublished"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="@id/imgvImage"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvPublished"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@id/imgvImage"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:lines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/txtvSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
</RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@drawable/vertical_divider"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<ImageButton
android:id="@+id/butSecondaryAction"
android:contentDescription="@string/remove_episode_lable"
android:focusable="false"
android:clickable="false"
android:focusableInTouchMode="false"
android:layout_width="@dimen/listview_secondary_button_width"
android:layout_height="match_parent"
android:background="?attr/borderless_button"
android:src="?attr/content_discard"
/>
</LinearLayout>

View File

@ -1,46 +1,89 @@
<?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" >
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/txtvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/txtvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:textSize="@dimen/text_size_small"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/txtvMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
android:lines="1"
android:ellipsize="end"/>
<ProgressBar
android:id="@+id/progProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp">
<TextView
android:id="@+id/txtvDownloaded"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_small"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/txtvPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_small"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@drawable/vertical_divider"
android:layout_marginTop="8dp"
android:textStyle="bold" />
<TextView
android:id="@+id/txtvMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
<ProgressBar
android:id="@+id/progProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_margin="8dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp" >
<TextView
android:id="@+id/txtvDownloaded"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/txtvPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
</RelativeLayout>
android:layout_marginBottom="8dp"/>
<ImageButton
android:id="@+id/butSecondaryAction"
android:contentDescription="@string/cancel_download_label"
android:focusable="false"
android:clickable="false"
android:focusableInTouchMode="false"
android:layout_width="@dimen/listview_secondary_button_width"
android:layout_height="match_parent"
android:background="?attr/borderless_button"
android:src="?attr/navigation_cancel"
/>
</LinearLayout>

View File

@ -18,7 +18,8 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="8dp"
android:textColor="?android:attr/textColorSecondary" />
android:textSize="@dimen/text_size_small"
android:textColor="?android:attr/textColorTertiary" />
<TextView
android:id="@+id/txtvTitle"
@ -27,26 +28,43 @@
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@id/txtvType"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium"
android:ellipsize="end"
android:maxLines="2" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
>
<TextView
android:id="@+id/txtvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
android:layout_marginRight="8dp"
android:lines="1"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_small"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/txtvStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
android:lines="1"
android:textSize="@dimen/text_size_small"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<TextView
android:id="@+id/txtvReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp" />

View File

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragmentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone" >
android:id="@+id/fragmentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:background="#AAAAAA" />
android:layout_height="2dp"
android:background="@color/bright_blue"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/layoutInfo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/borderless_button" >
android:background="?attr/borderless_button">
<ImageView
android:id="@+id/imgvCover"
@ -28,9 +28,10 @@
android:layout_width="@dimen/external_player_height"
android:layout_height="@dimen/external_player_height"
android:layout_alignParentLeft="true"
android:padding="4dp"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:scaleType="fitXY" />
android:scaleType="fitXY"/>
<TextView
android:id="@+id/txtvTitle"
@ -42,37 +43,9 @@
android:layout_marginTop="8dp"
android:layout_toRightOf="@id/imgvCover"
android:ellipsize="end"
android:maxLines="1"
android:textStyle="bold" />
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_toRightOf="@id/imgvCover"
android:maxLines="1"
android:textSize="@dimen/text_size_micro" />
<TextView
android:id="@+id/txtvStatus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/txtvTitle"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_toRightOf="@id/txtvPosition"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
android:maxLines="2"
android:textSize="18sp"
android:fontFamily="sans-serif-light"/>
</RelativeLayout>
<ImageButton
@ -80,7 +53,7 @@
android:contentDescription="@string/pause_label"
android:layout_width="@dimen/external_player_height"
android:layout_height="@dimen/external_player_height"
android:background="?attr/borderless_button" />
android:background="?attr/borderless_button"/>
</LinearLayout>
</LinearLayout>

View File

@ -28,9 +28,7 @@
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_toRightOf="@id/imgvCover"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary"/>
style="@style/AntennaPod.TextView.Heading"/>
<View
android:id="@+id/divider"
@ -101,12 +99,11 @@
<TextView
android:id="@+id/txtvSettings"
style="@style/AntennaPod.TextView.Heading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@string/podcast_settings_label"
android:textSize="@dimen/text_size_medium"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="24dp"/>
@ -187,13 +184,12 @@
</LinearLayout>
<TextView
style="@style/AntennaPod.TextView.Heading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="24dp"
android:textSize="@dimen/text_size_medium"
android:textColor="?android:attr/textColorPrimary"
android:text="@string/description_label"/>
<TextView

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:id="@+id/txtvTitle"
android:layout_alignParentTop="true"
style="@style/AntennaPod.Dialog.Title"/>
<View
android:id="@+id/title_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/txtvTitle"
android:background="@color/bright_blue"/>
<LinearLayout
android:id="@+id/header"
android:orientation="horizontal"
android:layout_below="@id/title_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:id="@+id/butAction1"
android:background="?attr/borderless_button"
tools:ignore="ContentDescription"/>
<ImageButton
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:id="@+id/butAction2"
android:background="?attr/borderless_button"
tools:ignore="ContentDescription"/>
<ImageButton
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:id="@+id/butMoreActions"
android:background="?attr/borderless_button"
android:src="?attr/ic_action_overflow"
android:contentDescription="@string/butAction_label"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/header"
android:background="@color/bright_blue"/>
<WebView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/divider"
android:layout_alignParentBottom="true"
android:id="@+id/webview"/>
</RelativeLayout>

View File

@ -1,56 +1,65 @@
<?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:background="?attr/borderless_button"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="de.danoeh.antennapod.activity.MainActivity">
<TextView
android:id="@+id/txtvHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="32dp"
android:layout_marginLeft="28dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
android:paddingLeft="8dp"
android:textAllCaps="true"
android:textColor="@color/dark_blue"
android:textSize="@dimen/text_size_large"
android:typeface="sans" />
<ImageView
android:id="@+id/imgvCover"
android:contentDescription="@string/cover_label"
android:layout_width="@dimen/thumbnail_length_onlinefeedview"
android:layout_height="@dimen/thumbnail_length_onlinefeedview"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="4dp"/>
<ImageButton
android:id="@+id/butAction"
android:contentDescription="@string/butAction_label"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:paddingLeft="24dp"
android:paddingRight="8dp"
android:paddingTop="16dp"
android:scaleType="fitEnd"
android:src="?attr/spinner_button" />
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/butShowInfo"
android:contentDescription="@string/show_info_label"
android:src="?attr/action_about"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="?attr/borderless_button"/>
<TextView
android:id="@+id/txtvNumItems"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/butAction"
android:textColor="@color/dark_blue"
android:textSize="@dimen/text_size_large"
android:textStyle="normal" />
</RelativeLayout>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="8dp"
android:id="@+id/butVisitWebsite"
android:contentDescription="@string/visit_website_label"
android:src="?attr/location_web_site"
android:layout_toLeftOf="@id/butShowInfo"
android:layout_alignParentBottom="true"
android:background="?attr/borderless_button"/>
</LinearLayout>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:layout_alignTop="@id/imgvCover"
android:layout_toRightOf="@id/imgvCover"
android:layout_alignParentRight="true"
android:lines="1"
style="@style/AntennaPod.TextView.Heading"
android:layout_margin="4dp"/>
<TextView
android:id="@+id/txtvAuthor"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_below="@id/txtvTitle"
android:layout_toRightOf="@id/imgvCover"
android:layout_toLeftOf="@id/butShowInfo"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_small"/>
</RelativeLayout>

View File

@ -1,155 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="4dp" >
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:layout_toLeftOf="@+id/butAction"
android:ellipsize="end"
android:lines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
android:visibility="gone" />
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedname"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/butAction"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvInPlaylist"
android:padding="2dp"
tools:ignore="ContentDescription"/>
<ImageView
android:id="@id/imgvInPlaylist"
android:contentDescription="@string/in_queue_label"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloaded"
android:padding="2dp"
android:src="?attr/stat_playlist"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloaded"
android:contentDescription="@string/status_downloaded_label"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@+id/imgvDownloading"
android:padding="2dp"
android:src="?attr/av_download"
android:visibility="visible" />
<ImageView
android:id="@id/imgvDownloading"
android:contentDescription="@string/downloading_label"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvPublished"
android:layout_toLeftOf="@id/butAction"
android:padding="2dp"
android:src="?attr/navigation_refresh"
android:visibility="visible" />
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvPublished"
android:maxLines="2"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro" />
<ProgressBar
android:id="@+id/pbar_episode_progress"
style="?android:attr/progressBarStyleHorizontal"
<RelativeLayout
android:layout_margin="8dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvPublished"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="2dp"
android:layout_toLeftOf="@id/imgvType"
android:layout_toRightOf="@id/txtvLenSize" />
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingLeft="4dp">
<TextView
android:id="@+id/txtvPublished"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="4dp"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
<TextView
android:id="@+id/txtvItemname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvPublished"
android:layout_marginBottom="8dp"
android:layout_marginRight="4dp"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"/>
<ImageView
android:id="@+id/imgvInPlaylist"
android:contentDescription="@string/in_queue_label"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:padding="2dp"
android:src="?attr/stat_playlist"
android:visibility="visible"/>
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/imgvInPlaylist"
android:padding="2dp"
tools:ignore="ContentDescription"/>
<TextView
android:id="@+id/txtvLenSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvItemname"
android:maxLines="2"
android:layout_marginBottom="2dp"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
<ProgressBar
android:id="@+id/pbar_episode_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="2dp"
android:layout_toLeftOf="@id/imgvType"
android:layout_toRightOf="@id/txtvLenSize"/>
<TextView
android:id="@+id/statusUnread"
android:contentDescription="@string/status_unread_label"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:background="@color/status_unread"
android:gravity="center"
android:minWidth="@dimen/status_indicator_width"
android:text="@string/new_label"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="@dimen/text_size_micro"
android:textStyle="bold"/>
</RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@drawable/vertical_divider"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<ImageButton
android:id="@id/butAction"
android:contentDescription="@string/butAction_label"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="?attr/borderless_button"
android:clickable="false"
android:id="@+id/butSecondaryAction"
android:focusable="false"
android:clickable="false"
android:focusableInTouchMode="false"
android:paddingLeft="24dp"
android:paddingRight="8dp"
android:paddingTop="16dp"
android:scaleType="fitEnd"
android:src="?attr/spinner_button" />
android:layout_width="@dimen/listview_secondary_button_width"
android:layout_height="match_parent"
android:background="?attr/borderless_button"
tools:ignore="ContentDescription"/>
<TextView
android:id="@+id/statusUnread"
android:contentDescription="@string/status_unread_label"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:background="@color/status_unread"
android:gravity="center"
android:minWidth="@dimen/status_indicator_width"
android:text="@string/new_label"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="@dimen/text_size_micro"
android:textStyle="bold" />
<ImageView
android:id="@+id/statusPlaying"
android:contentDescription="@string/status_playing_label"
android:layout_width="@dimen/status_indicator_width"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:background="@color/status_playing"
android:gravity="center"
android:padding="2dp"
android:src="@drawable/av_play_dark" />
</RelativeLayout>
</LinearLayout>

View File

@ -10,10 +10,8 @@
android:layout_height="wrap_content"
android:text="@string/gpodnetauth_login_title"
android:layout_alignParentTop="true"
android:textSize="@dimen/text_size_large"
android:layout_margin="16dp"
android:textColor="@color/bright_blue"
android:textStyle="italic"/>
style="@style/AntennaPod.TextView.Heading"/>
<TextView
android:id="@id/txtvDescription"

View File

@ -10,10 +10,8 @@
android:layout_height="wrap_content"
android:text="@string/gpodnetauth_device_title"
android:layout_alignParentTop="true"
android:textSize="@dimen/text_size_large"
android:layout_margin="16dp"
android:textColor="@color/bright_blue"
android:textStyle="italic"/>
style="@style/AntennaPod.TextView.Heading"/>
<TextView
android:id="@+id/txtvDescription"

View File

@ -10,10 +10,8 @@
android:layout_height="wrap_content"
android:text="@string/gpodnetauth_finish_title"
android:layout_alignParentTop="true"
android:textSize="@dimen/text_size_large"
android:layout_margin="16dp"
android:textColor="@color/bright_blue"
android:textStyle="italic"/>
style="@style/AntennaPod.TextView.Heading"/>
<TextView
android:id="@+id/txtvDescription"

View File

@ -1,21 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_view"
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/playerFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_above="@id/playerFragment"
android:layout_alignParentTop="true" >
</android.support.v4.view.ViewPager>
</RelativeLayout>
<FrameLayout
android:id="@+id/playerFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
<FrameLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_alignParentTop="true"
android:layout_above="@id/playerFragment"/>
</RelativeLayout>
<ListView
android:id="@+id/nav_list"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="?attr/nav_drawer_background"
android:scrollbarStyle="outsideOverlay"
android:paddingLeft="8dp"
android:paddingRight="8dp"/>
</android.support.v4.widget.DrawerLayout>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgvCover"
android:contentDescription="@string/cover_label"
android:layout_width="@dimen/thumbnail_length_navlist"
android:layout_height="@dimen/thumbnail_length_navlist"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:scaleType="fitXY"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"/>
<TextView
android:id="@+id/txtvTitle"
android:lines="1"
android:ellipsize="end"
android:layout_centerVertical="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_navdrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="14dp"
android:layout_marginRight="48dp"
android:layout_toRightOf="@id/imgvCover"
/>
</RelativeLayout>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgvCover"
android:contentDescription="@string/cover_label"
android:layout_width="@dimen/thumbnail_length_navlist"
android:layout_height="@dimen/thumbnail_length_navlist"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:scaleType="centerCrop"
android:padding="8dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"/>
<TextView
android:id="@+id/txtvTitle"
android:lines="1"
android:ellipsize="end"
android:layout_centerVertical="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_navdrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="14dp"
android:layout_marginRight="48dp"
android:layout_toRightOf="@id/imgvCover"
/>
</RelativeLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<TextView
android:id="@+id/txtvTitle"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_small"
android:typeface="sans"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="16dp"
android:paddingBottom="4dp"/>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@color/gray"/>
</RelativeLayout>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/swipeRefreshLayout">
<com.mobeta.android.dslv.DragSortListView
android:id="@android:id/list"
android:scrollbarStyle="outsideOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
dslv:collapsed_height="2dp"
dslv:drag_enabled="false"
dslv:drag_scroll_start="0.33"
dslv:float_alpha="0.6"
dslv:max_drag_scroll_speed="0.5"
dslv:remove_enabled="true"
dslv:remove_mode="flingRemove"
dslv:slide_shuffle_speed="0.3"
dslv:sort_enabled="false"
dslv:track_drag_sort="false"
dslv:float_background_color="?attr/dragview_float_background"
dslv:use_default_controller="true"/>
</android.support.v4.widget.SwipeRefreshLayout>
<TextView
android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_items_label"/>
<ProgressBar
android:id="@+id/progLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateOnly="true"
android:visibility="gone"/>
</FrameLayout>

View File

@ -0,0 +1,16 @@
<?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:padding="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAllCaps="true"
style="@style/AntennaPod.TextView.Heading"
android:text="@string/recently_published_episodes_label"/>
</LinearLayout>

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="8dp">
<ImageView
android:id="@+id/imgvImage"
android:contentDescription="@string/cover_label"
android:layout_width="@dimen/thumbnail_length_itemlist"
android:layout_height="@dimen/thumbnail_length_itemlist"
android:layout_alignParentLeft="true"
android:scaleType="centerCrop"/>
<TextView
android:id="@+id/txtvPublished"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="@id/imgvImage"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvPublished"
android:layout_marginLeft="8dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@id/imgvImage"
android:layout_alignParentRight="true"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/imgvImage"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@id/imgvInPlaylist"
android:contentDescription="@string/in_queue_label"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_alignParentRight="true"
android:src="?attr/stat_playlist"/>
<ProgressBar
android:id="@+id/pbar_download_progress"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/imgvInPlaylist"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/txtvDuration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/imgvInPlaylist"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentLeft="true"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_micro"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@drawable/vertical_divider"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<ImageButton
android:id="@+id/butSecondaryAction"
android:focusable="false"
android:clickable="false"
android:focusableInTouchMode="false"
android:layout_width="@dimen/listview_secondary_button_width"
android:layout_height="match_parent"
android:background="?attr/borderless_button"
tools:ignore="ContentDescription"/>
</LinearLayout>

View File

@ -23,8 +23,7 @@
android:layout_toRightOf="@id/imgvCover"
android:layout_alignParentRight="true"
android:lines="1"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_medium"
style="@style/AntennaPod.TextView.Heading"
android:layout_margin="4dp"/>
<TextView

View File

@ -0,0 +1,12 @@
<?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">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mobeta.android.dslv.DragSortListView
android:id="@android:id/list"
android:scrollbarStyle="outsideOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
dslv:collapsed_height="2dp"
dslv:drag_enabled="true"
dslv:drag_handle_id="@id/drag_handle"
dslv:drag_scroll_start="0.33"
dslv:float_alpha="0.6"
dslv:max_drag_scroll_speed="0.5"
dslv:remove_enabled="true"
dslv:remove_mode="flingRemove"
dslv:slide_shuffle_speed="0.3"
dslv:sort_enabled="true"
dslv:track_drag_sort="true"
dslv:float_background_color="?attr/dragview_float_background"
dslv:use_default_controller="true"/>
<TextView
android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_items_label"/>
<ProgressBar
android:id="@+id/progLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateOnly="true"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/undobar"
style="@style/UndoBar">
<TextView
android:id="@+id/undobar_message"
style="@style/UndoBarMessage"/>
<Button
android:id="@+id/undobar_button"
style="@style/UndoBarButton"/>
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent">
<ImageView
android:layout_width="24dp"
android:layout_height="match_parent"
android:id="@+id/drag_handle"
android:src="?attr/dragview_background"
android:scaleType="center"
android:layout_margin="8dp"
android:contentDescription="@string/drag_handle_content_description"/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="8dp">
<ImageView
android:id="@+id/imgvImage"
android:contentDescription="@string/cover_label"
android:layout_width="@dimen/thumbnail_length_queue_item"
android:layout_height="@dimen/thumbnail_length_queue_item"
android:layout_alignParentLeft="true"
android:scaleType="centerCrop"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_toRightOf="@id/imgvImage"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:lines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/queue_title_text_size"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/imgvImage"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/pbar_download_progress"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentLeft="true"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@drawable/vertical_divider"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
<ImageButton
android:id="@+id/butSecondaryAction"
android:focusable="false"
android:clickable="false"
android:focusableInTouchMode="false"
android:layout_width="@dimen/listview_secondary_button_width"
android:layout_height="match_parent"
android:background="?attr/borderless_button"
tools:ignore="ContentDescription"/>
</LinearLayout>

View File

@ -1,19 +1,16 @@
<?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"
android:padding="8dp" >
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgvFeedimage"
android:contentDescription="@string/cover_label"
android:layout_width="55dip"
android:layout_height="55dip"
android:layout_width="@dimen/thumbnail_length_itemlist"
android:layout_height="@dimen/thumbnail_length_itemlist"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="1dip"
android:layout_marginRight="4dip"
android:cropToPadding="true" />
android:scaleType="centerCrop"/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
@ -21,20 +18,27 @@
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/imgvFeedimage"
android:orientation="vertical" >
android:orientation="vertical">
<TextView
android:id="@+id/txtvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textStyle="bold" />
android:layout_margin="4dp"
android:lines="2"
android:ellipsize="end"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/txtvSubtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary" />
android:layout_margin="4dp"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorTertiary"
android:textSize="@dimen/text_size_small"/>
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto">
<item
android:id="@id/skip_episode_item"
android:title="@string/skip_episode_label"
custom:showAsAction="collapseActionView">
</item>
<item
android:id="@+id/mark_read_item"
custom:showAsAction="collapseActionView"
android:title="@string/mark_read_label">
</item>
<item
android:id="@+id/mark_unread_item"
custom:showAsAction="collapseActionView"
android:title="@string/mark_unread_label">
</item>
<item
android:id="@+id/add_to_queue_item"
custom:showAsAction="collapseActionView"
android:title="@string/add_to_queue_label">
</item>
<item
android:id="@+id/remove_from_queue_item"
custom:showAsAction="collapseActionView"
android:title="@string/remove_from_queue_label">
</item>
<item
android:id="@+id/share_link_item"
custom:showAsAction="collapseActionView"
android:title="@string/share_link_label">
</item>
<item
android:id="@+id/visit_website_item"
android:icon="?attr/location_web_site"
custom:showAsAction="ifRoom|collapseActionView"
android:title="@string/visit_website_label">
</item>
<item
android:id="@+id/support_item"
custom:showAsAction="collapseActionView"
android:title="@string/support_label">
</item>
</menu>

View File

@ -5,39 +5,30 @@
<item
android:id="@+id/refresh_item"
android:icon="?attr/navigation_refresh"
android:menuCategory="container"
custom:showAsAction="ifRoom|collapseActionView"
android:title="@string/refresh_label">
</item>
<item
android:id="@+id/mark_all_read_item"
android:menuCategory="container"
custom:showAsAction="collapseActionView"
android:title="@string/mark_all_read_label">
</item>
<item
android:id="@+id/show_info_item"
android:icon="?attr/action_about"
android:id="@+id/support_item"
android:menuCategory="container"
custom:showAsAction="collapseActionView"
android:title="@string/show_info_label">
android:title="@string/support_label"
android:visible="false">
</item>
<item
android:id="@+id/remove_item"
android:menuCategory="container"
android:icon="?attr/content_discard"
custom:showAsAction="collapseActionView"
android:title="@string/remove_feed_label"
android:visible="true">
</item>
<item
android:id="@+id/visit_website_item"
android:icon="?attr/location_web_site"
custom:showAsAction="collapseActionView"
android:title="@string/visit_website_label"
android:visible="true">
</item>
<item
android:id="@+id/support_item"
custom:showAsAction="collapseActionView"
android:title="@string/support_label"
android:visible="false">
</item>
</menu>

View File

@ -1,42 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/all_feed_refresh"
android:title="@string/refresh_label"
android:icon="?attr/navigation_refresh"
custom:showAsAction="ifRoom|collapseActionView">
</item>
<item
android:id="@+id/add_feed"
android:title="@string/add_feed_label"
android:icon="?attr/content_new"
custom:showAsAction="ifRoom|collapseActionView">
</item>
<item
android:id="@id/search_item"
android:icon="?attr/action_search"
android:title="@string/search_label"
custom:showAsAction="ifRoom|collapseActionView"
android:actionViewClass="android.support.v7.widget.SearchView"/>
<item
android:id="@+id/show_player"
android:title="@string/show_player_label"
android:icon="@drawable/av_play"
custom:showAsAction="collapseActionView"/>
<item
android:id="@+id/show_playback_history"
android:title="@string/playback_history_label"
custom:showAsAction="collapseActionView"/>
<item
android:id="@+id/show_downloads"
android:title="@string/downloads_label"
android:icon="@drawable/av_download"
custom:showAsAction="collapseActionView">
</item>
<item
android:id="@+id/show_preferences"
android:title="@string/settings_label"
android:menuCategory="system"
android:icon="?attr/action_settings"
custom:showAsAction="collapseActionView"/>

27
res/menu/new_episodes.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/mark_all_read_item"
android:title="@string/mark_all_read_label"
android:menuCategory="container"
custom:showAsAction="ifRoom|collapseActionView"
android:icon="?attr/navigation_accept"/>
<item
android:id="@+id/refresh_item"
android:title="@string/refresh_label"
android:menuCategory="container"
custom:showAsAction="ifRoom|collapseActionView"
android:icon="?attr/navigation_refresh"/>
<item
android:id="@+id/episode_filter_item"
android:title="@string/episode_filter_label"
android:menuCategory="container"
android:checkable="true"
custom:showAsAction="collapseActionView"/>
</menu>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/move_to_top_item"
android:menuCategory="container"
android:title="@string/move_to_top_label"/>
<item
android:id="@+id/move_to_bottom_item"
android:menuCategory="container"
android:title="@string/move_to_bottom_label"/>
</menu>

View File

@ -2,6 +2,7 @@
<resources>
<dimen name="thumbnail_length">170dp</dimen>
<dimen name="thumbnail_length_itemlist">70dp</dimen>
<dimen name="thumbnail_length_queue_item">80dp</dimen>
<dimen name="thumbnail_length_downloaded_item">80dp</dimen>
<dimen name="queue_title_text_size">@dimen/text_size_medium</dimen>
</resources>

17
res/values-v16/styles.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AntennaPod.TextView.Heading" parent="@android:style/TextAppearance.Medium">
<item name="android:textSize">@dimen/text_size_large</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="AntennaPod.Dialog.Title" parent="@android:style/TextAppearance.Medium">
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColor">@color/bright_blue</item>
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
<item name="android:fontFamily">sans-serif-light</item>
</style>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="selection_background_color_dark">#484B4D</color>
<color name="selection_background_color_light">#E3E3E3</color>
</resources>

View File

@ -1,39 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="action_about" format="reference" />
<attr name="action_search" format="reference" />
<attr name="action_settings" format="reference" />
<attr name="action_stream" format="reference" />
<attr name="av_download" format="reference" />
<attr name="av_fast_forward" format="reference" />
<attr name="av_pause" format="reference" />
<attr name="av_play" format="reference" />
<attr name="av_rewind" format="reference" />
<attr name="content_discard" format="reference" />
<attr name="content_new" format="reference" />
<attr name="default_cover" format="reference" />
<attr name="device_access_time" format="reference" />
<attr name="location_web_site" format="reference" />
<attr name="navigation_accept" format="reference" />
<attr name="navigation_cancel" format="reference" />
<attr name="navigation_expand" format="reference" />
<attr name="navigation_collapse" format="reference" />
<attr name="navigation_refresh" format="reference" />
<attr name="navigation_up" format="reference" />
<attr name="navigation_shownotes" format="reference" />
<attr name="navigation_chapters" format="reference" />
<attr name="social_share" format="reference" />
<attr name="stat_playlist" format="reference" />
<attr name="type_audio" format="reference" />
<attr name="type_video" format="reference" />
<attr name="borderless_button" format="reference" />
<attr name="spinner_button" format="reference" />
<attr name="overlay_drawable" format="reference" />
<attr name="dragview_background" format="reference" />
<attr name="dragview_float_background" format="reference" />
<attr name="action_about" format="reference"/>
<attr name="action_search" format="reference"/>
<attr name="action_settings" format="reference"/>
<attr name="action_stream" format="reference"/>
<attr name="av_download" format="reference"/>
<attr name="av_fast_forward" format="reference"/>
<attr name="av_pause" format="reference"/>
<attr name="av_play" format="reference"/>
<attr name="av_rewind" format="reference"/>
<attr name="content_discard" format="reference"/>
<attr name="content_new" format="reference"/>
<attr name="default_cover" format="reference"/>
<attr name="device_access_time" format="reference"/>
<attr name="location_web_site" format="reference"/>
<attr name="navigation_accept" format="reference"/>
<attr name="navigation_cancel" format="reference"/>
<attr name="navigation_expand" format="reference"/>
<attr name="navigation_collapse" format="reference"/>
<attr name="navigation_refresh" format="reference"/>
<attr name="navigation_up" format="reference"/>
<attr name="navigation_shownotes" format="reference"/>
<attr name="navigation_chapters" format="reference"/>
<attr name="social_share" format="reference"/>
<attr name="stat_playlist" format="reference"/>
<attr name="type_audio" format="reference"/>
<attr name="type_video" format="reference"/>
<attr name="borderless_button" format="reference"/>
<attr name="spinner_button" format="reference"/>
<attr name="overlay_drawable" format="reference"/>
<attr name="dragview_background" format="reference"/>
<attr name="dragview_float_background" format="reference"/>
<attr name="ic_action_overflow" format="reference"/>
<attr name="ic_new" format="reference"/>
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference" />
<attr name="overlay_background" format="color" />
<attr name="non_transparent_background" format="reference"/>
<attr name="overlay_background" format="color"/>
<attr name="nav_drawer_background" format="color"/>
<attr name="nav_drawer_toggle" format="reference"/>
</resources>

View File

@ -28,6 +28,9 @@
<color name="status_playing">#E0EE5F52</color>
<color name="overlay_dark">#262C31</color>
<color name="overlay_light">#DDDDDD</color>
<color name="swipe_refresh_secondary_color_light">#EDEDED</color>
<color name="swipe_refresh_secondary_color_dark">#060708</color>
<!-- Use Gingerbread-orange -->
<color name="selection_background_color_dark">#FEBB20</color>

View File

@ -4,13 +4,21 @@
<dimen name="widget_margin">8dp</dimen>
<dimen name="thumbnail_length">70dp</dimen>
<dimen name="dragview_length">54dp</dimen>
<dimen name="external_player_height">55dp</dimen>
<dimen name="external_player_height">70dp</dimen>
<dimen name="enc_icons_size">20dp</dimen>
<dimen name="text_size_micro">12sp</dimen>
<dimen name="text_size_small">14sp</dimen>
<dimen name="text_size_navdrawer">16sp</dimen>
<dimen name="text_size_medium">18sp</dimen>
<dimen name="text_size_large">22sp</dimen>
<dimen name="status_indicator_width">36dp</dimen>
<dimen name="status_indicator_width">32dp</dimen>
<dimen name="thumbnail_length_itemlist">80dp</dimen>
<dimen name="thumbnail_length_queue_item">70dp</dimen>
<dimen name="thumbnail_length_downloaded_item">70dp</dimen>
<dimen name="thumbnail_length_onlinefeedview">110dp</dimen>
<dimen name="thumbnail_length_navlist">42dp</dimen>
<dimen name="listview_secondary_button_width">48dp</dimen>
<dimen name="drawer_width">280dp</dimen>
<dimen name="queue_title_text_size">@dimen/text_size_small</dimen>
</resources>

View File

@ -4,22 +4,35 @@
tools:ignore="MissingTranslation"
>
<!-- Activitiy titles -->
<!-- Activitiy and fragment titles -->
<string name="app_name">AntennaPod</string>
<string name="feeds_label">Feeds</string>
<string name="podcasts_label">PODCASTS</string>
<string name="episodes_label">EPISODES</string>
<string name="new_episodes_label">New episodes</string>
<string name="all_episodes_label">All episodes</string>
<string name="new_label">New</string>
<string name="waiting_list_label">Waiting list</string>
<string name="settings_label">Settings</string>
<string name="add_new_feed_label">Add podcast</string>
<string name="downloads_label">Downloads</string>
<string name="downloads_running_label">Running</string>
<string name="downloads_completed_label">Completed</string>
<string name="downloads_log_label">Log</string>
<string name="cancel_download_label">Cancel Download</string>
<string name="download_log_label">Download log</string>
<string name="playback_history_label">Playback history</string>
<string name="gpodnet_main_label">gpodder.net</string>
<string name="gpodnet_auth_label">gpodder.net login</string>
<!-- New episodes fragment -->
<string name="recently_published_episodes_label">Recently published</string>
<string name="episode_filter_label">Show only new episodes</string>
<!-- Main activity -->
<string name="drawer_open">Open menu</string>
<string name="drawer_close">Close menu</string>
<!-- Webview actions -->
<string name="open_in_browser_label">Open in browser</string>
<string name="copy_url_label">Copy URL</string>
@ -59,12 +72,15 @@
<!-- 'Add Feed' Activity labels -->
<string name="feedurl_label">Feed URL</string>
<string name="txtvfeedurl_label">Add Podcast by URL</string>
<string name="podcastdirectories_label">Podcast directories</string>
<string name="podcastdirectories_label">Find podcast in directory</string>
<string name="podcastdirectories_descr">You can search for new podcasts by name, category or popularity in the gpodder.net directory.</string>
<string name="browse_gpoddernet_label">Browse gpodder.net</string>
<!-- Actions on feeds -->
<string name="mark_all_read_label">Mark all as read</string>
<string name="mark_all_read_msg">Marked all episodes as read</string>
<string name="show_info_label">Show information</string>
<string name="remove_feed_label">Remove Feed</string>
<string name="remove_feed_label">Remove podcast</string>
<string name="share_link_label">Share website link</string>
<string name="share_source_label">Share feed link</string>
<string name="feed_delete_confirmation_msg">Please confirm that you want to delete this feed and ALL episodes of this feed that you have downloaded.</string>
@ -76,6 +92,7 @@
<string name="pause_label">Pause</string>
<string name="stream_label">Stream</string>
<string name="remove_label">Remove</string>
<string name="remove_episode_lable">Remove episode</string>
<string name="mark_read_label">Mark as read</string>
<string name="mark_unread_label">Mark as unread</string>
<string name="add_to_queue_label">Add to Queue</string>
@ -87,8 +104,8 @@
<string name="skip_episode_label">Skip episode</string>
<!-- Download messages and labels -->
<string name="download_successful">Download successful</string>
<string name="download_failed">Download failed</string>
<string name="download_successful">successful</string>
<string name="download_failed">failed</string>
<string name="download_pending">Download pending</string>
<string name="download_running">Download running</string>
<string name="download_error_device_not_found">Storage device not found</string>
@ -353,10 +370,12 @@
<string name="status_playing_label">Episode is being played</string>
<string name="status_downloading_label">Episode is being downloaded</string>
<string name="status_downloaded_label">Episode is downloaded</string>
<string name="status_not_downloaded_label">Episode has not been downloaded yet</string>
<string name="status_unread_label">Item is new</string>
<string name="in_queue_label">Episode is in the queue</string>
<string name="new_episodes_count_label">Number of new episodes</string>
<string name="in_progress_episodes_count_label">Number of episodes you have started listening to</string>
<string name="drag_handle_content_description">Drag to change the position of this item</string>
<!-- Feed information screen -->
<string name="authentication_label">Authentication</string>

View File

@ -33,8 +33,12 @@
<item name="attr/overlay_background">@color/overlay_light</item>
<item name="attr/spinner_button">@drawable/spinner_button</item>
<item name="attr/overlay_drawable">@drawable/overlay_drawable</item>
<item name="attr/dragview_background">@drawable/dragview_background</item>
<item name="attr/dragview_background">@drawable/ic_drag_handle</item>
<item name="attr/dragview_float_background">@color/white</item>
<item name="attr/nav_drawer_background">@color/white</item>
<item name="attr/nav_drawer_toggle">@drawable/ic_drawer</item>
<item name="attr/ic_action_overflow">@drawable/ic_action_overflow</item>
<item name="attr/ic_new">@drawable/ic_new</item>
</style>
<style name="Theme.AntennaPod.Dark" parent="@style/Theme.AppCompat">
@ -69,43 +73,70 @@
<item name="attr/overlay_background">@color/overlay_dark</item>
<item name="attr/spinner_button">@drawable/spinner_button_dark</item>
<item name="attr/overlay_drawable">@drawable/overlay_drawable_dark</item>
<item name="attr/dragview_background">@drawable/dragview_background_dark</item>
<item name="attr/dragview_background">@drawable/ic_drag_handle_dark</item>
<item name="attr/dragview_float_background">@color/black</item>
<item name="attr/nav_drawer_background">#3B3B3B</item>
<item name="attr/nav_drawer_toggle">@drawable/ic_drawer_dark</item>
<item name="attr/ic_action_overflow">@drawable/ic_action_overflow_dark</item>
<item name="attr/ic_new">@drawable/ic_new_dark</item>
</style>
<style name="UndoBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_marginLeft">8dp</item>
<item name="android:layout_marginRight">8dp</item>
<item name="android:layout_marginBottom">16dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">@drawable/undobar</item>
<item name="android:clickable">true</item>
<item name="android:divider">@drawable/undobar_divider</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_marginLeft">8dp</item>
<item name="android:layout_marginRight">8dp</item>
<item name="android:layout_marginBottom">16dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">@drawable/undobar</item>
<item name="android:clickable">true</item>
<item name="android:divider">@drawable/undobar_divider</item>
</style>
<style name="UndoBarMessage">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">16dp</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_marginRight">16dp</item>
<item name="android:textAppearance">?android:textAppearanceMedium</item>
<item name="android:textColor">#fff</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">16dp</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_marginRight">16dp</item>
<item name="android:textAppearance">?android:textAppearanceMedium</item>
<item name="android:textColor">#fff</item>
</style>
<style name="UndoBarButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:background">@drawable/undobar_button</item>
<item name="android:drawableLeft">@drawable/ic_undobar_undo</item>
<item name="android:drawablePadding">12dp</item>
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#fff</item>
<item name="android:text">@string/undo</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:background">@drawable/undobar_button</item>
<item name="android:drawableLeft">@drawable/ic_undobar_undo</item>
<item name="android:drawablePadding">12dp</item>
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#fff</item>
<item name="android:text">@string/undo</item>
</style>
<style name="AntennaPod.TextView.Heading" parent="@android:style/TextAppearance.Medium">
<item name="android:textSize">@dimen/text_size_large</item>
<item name="android:textStyle">italic</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="AntennaPod.TextView.ListItemPrimaryTitle" parent="@android:style/TextAppearance.Small">
<item name="android:textSize">15sp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:lines">2</item>
<item name="android:ellipsize">end</item>
</style>
<style name="AntennaPod.Dialog.Title" parent="@android:style/TextAppearance.Medium">
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
</style>
</resources>

View File

@ -50,7 +50,6 @@ public class AddFeedActivity extends ActionBarActivity {
etxtFeedurl.setText(getIntent().getDataString());
}
butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide);
butBrowserGpoddernet = (Button) findViewById(R.id.butBrowseGpoddernet);
butOpmlImport = (Button) findViewById(R.id.butOpmlImport);
butConfirm = (Button) findViewById(R.id.butConfirm);

View File

@ -4,11 +4,15 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.ListFragment;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
@ -18,18 +22,20 @@ import android.widget.ImageView.ScaleType;
import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.ChapterListAdapter;
import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
import de.danoeh.antennapod.feed.Chapter;
import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.feed.SimpleChapter;
import de.danoeh.antennapod.feed.*;
import de.danoeh.antennapod.fragment.CoverFragment;
import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.service.playback.PlaybackService;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.util.playback.ExternalMedia;
import de.danoeh.antennapod.util.playback.Playable;
import java.util.List;
/**
* Activity for playing audio files.
*/
@ -44,6 +50,11 @@ public class AudioplayerActivity extends MediaplayerActivity {
private static final String PREF_KEY_SELECTED_FRAGMENT_POSITION = "selectedFragmentPosition";
private static final String PREF_PLAYABLE_ID = "playableId";
private DrawerLayout drawerLayout;
private NavListAdapter navAdapter;
private ListView navList;
private ActionBarDrawerToggle drawerToggle;
private Fragment[] detachedFragments;
private CoverFragment coverFragment;
@ -58,7 +69,6 @@ public class AudioplayerActivity extends MediaplayerActivity {
private int savedPosition = -1;
private TextView txtvTitle;
private TextView txtvFeed;
private Button butPlaybackSpeed;
private ImageButton butNavLeft;
private ImageButton butNavRight;
@ -108,6 +118,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
super.onStop();
if (BuildConfig.DEBUG)
Log.d(TAG, "onStop");
cancelLoadTask();
EventDistributor.getInstance().unregister(contentUpdate);
}
@ -142,6 +154,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
drawerToggle.onConfigurationChanged(newConfig);
}
@Override
@ -149,6 +162,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
// super.onSaveInstanceState(outState); would cause crash
if (BuildConfig.DEBUG)
Log.d(TAG, "onSaveInstanceState");
}
@Override
@ -193,7 +207,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
if (BuildConfig.DEBUG)
Log.d(TAG,
"Couldn't restore from preferences: savedPosition was -1 or saved identifier and playable identifier didn't match.\nsavedPosition: "
+ savedPosition + ", id: " + playableId);
+ savedPosition + ", id: " + playableId
);
}
return false;
@ -223,6 +238,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
switchToFragment(savedPosition);
}
EventDistributor.getInstance().register(contentUpdate);
loadData();
}
@Override
@ -233,7 +250,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
protected void onAwaitingVideoSurface() {
if (BuildConfig.DEBUG) Log.d(TAG, "onAwaitingVideoSurface was called in audio player -> switching to video player");
if (BuildConfig.DEBUG)
Log.d(TAG, "onAwaitingVideoSurface was called in audio player -> switching to video player");
startActivity(new Intent(this, VideoplayerActivity.class));
}
@ -297,7 +315,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
};
chapterFragment.setListAdapter(new ChapterListAdapter(
AudioplayerActivity.this, 0, media
.getChapters(), media));
.getChapters(), media
));
}
currentlyShownFragment = chapterFragment;
break;
@ -323,8 +342,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
private void updateNavButtonDrawable() {
final int[] buttonTexts = new int[] {R.string.show_shownotes_label,
R.string.show_chapters_label, R.string.show_cover_label};
final int[] buttonTexts = new int[]{R.string.show_shownotes_label,
R.string.show_chapters_label, R.string.show_cover_label};
final TypedArray drawables = obtainStyledAttributes(new int[]{
R.attr.navigation_shownotes, R.attr.navigation_chapters});
@ -382,12 +401,53 @@ public class AudioplayerActivity extends MediaplayerActivity {
protected void setupGUI() {
super.setupGUI();
resetFragmentView();
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navList = (ListView) findViewById(R.id.nav_list);
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
txtvFeed = (TextView) findViewById(R.id.txtvFeed);
butNavLeft = (ImageButton) findViewById(R.id.butNavLeft);
butNavRight = (ImageButton) findViewById(R.id.butNavRight);
butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed);
TypedArray typedArray = obtainStyledAttributes(new int[]{R.attr.nav_drawer_toggle});
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, typedArray.getResourceId(0, 0), R.string.drawer_open, R.string.drawer_close) {
String currentTitle = getSupportActionBar().getTitle().toString();
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
currentTitle = getSupportActionBar().getTitle().toString();
getSupportActionBar().setTitle(R.string.app_name);
supportInvalidateOptionsMenu();
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
getSupportActionBar().setTitle(currentTitle);
supportInvalidateOptionsMenu();
}
};
typedArray.recycle();
drawerToggle.setDrawerIndicatorEnabled(false);
navAdapter = new NavListAdapter(itemAccess, this);
navList.setAdapter(navAdapter);
navList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int viewType = parent.getAdapter().getItemViewType(position);
if (viewType != NavListAdapter.VIEW_TYPE_SECTION_DIVIDER) {
int relPos = (viewType == NavListAdapter.VIEW_TYPE_NAV) ? position : position - NavListAdapter.SUBSCRIPTION_OFFSET;
Intent intent = new Intent(AudioplayerActivity.this, MainActivity.class);
intent.putExtra(MainActivity.EXTRA_NAV_TYPE, viewType);
intent.putExtra(MainActivity.EXTRA_NAV_INDEX, relPos);
startActivity(intent);
}
drawerLayout.closeDrawer(navList);
}
});
drawerToggle.syncState();
butNavLeft.setOnClickListener(new OnClickListener() {
@Override
@ -466,11 +526,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
}
private void updateButPlaybackSpeed() {
if (controller == null
|| (controller.getCurrentPlaybackSpeedMultiplier() == -1)) {
butPlaybackSpeed.setVisibility(View.GONE);
} else {
butPlaybackSpeed.setVisibility(View.VISIBLE);
if (controller != null && controller.canSetPlaybackSpeed()) {
butPlaybackSpeed.setText(UserPreferences.getPlaybackSpeed());
}
}
@ -491,11 +547,10 @@ public class AudioplayerActivity extends MediaplayerActivity {
return false;
}
txtvTitle.setText(media.getEpisodeTitle());
txtvFeed.setText(media.getFeedTitle());
if (media.getChapters() != null) {
butNavRight.setVisibility(View.VISIBLE);
} else {
butNavRight.setVisibility(View.GONE);
butNavRight.setVisibility(View.INVISIBLE);
}
@ -508,6 +563,14 @@ public class AudioplayerActivity extends MediaplayerActivity {
((AudioplayerContentFragment) currentlyShownFragment)
.onDataSetChanged(media);
}
if (controller == null
|| !controller.canSetPlaybackSpeed()) {
butPlaybackSpeed.setVisibility(View.GONE);
} else {
butPlaybackSpeed.setVisibility(View.VISIBLE);
}
updateButPlaybackSpeed();
return true;
}
@ -551,4 +614,78 @@ public class AudioplayerActivity extends MediaplayerActivity {
return R.layout.audioplayer_activity;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (drawerToggle.onOptionsItemSelected(item)) {
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private List<Feed> feeds;
private AsyncTask<Void, Void, List<Feed>> loadTask;
private void loadData() {
loadTask = new AsyncTask<Void, Void, List<Feed>>() {
@Override
protected List<Feed> doInBackground(Void... params) {
return DBReader.getFeedList(AudioplayerActivity.this);
}
@Override
protected void onPostExecute(List<Feed> result) {
super.onPostExecute(result);
feeds = result;
if (navAdapter != null) {
navAdapter.notifyDataSetChanged();
}
}
};
loadTask.execute();
}
private void cancelLoadTask() {
if (loadTask != null) {
loadTask.cancel(true);
}
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((EventDistributor.FEED_LIST_UPDATE & arg) != 0) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Received contentUpdate Intent.");
loadData();
}
}
};
private final NavListAdapter.ItemAccess itemAccess = new NavListAdapter.ItemAccess() {
@Override
public int getCount() {
if (feeds != null) {
return feeds.size();
} else {
return 0;
}
}
@Override
public Feed getItem(int position) {
if (feeds != null && position < feeds.size()) {
return feeds.get(position);
} else {
return null;
}
}
@Override
public int getSelectedItemIndex() {
return -1;
}
};
}

View File

@ -180,8 +180,8 @@ public class DownloadActivity extends ActionBarActivity implements
@Override
public void onDownloadDataAvailable(List<Downloader> downloaderList) {
dla = new DownloadlistAdapter(DownloadActivity.this, 0,
downloaderList);
//dla = new DownloadlistAdapter(DownloadActivity.this, 0,
// downloaderList);
listview.setAdapter(dla);
dla.notifyDataSetChanged();
}

View File

@ -166,7 +166,7 @@ public class FeedItemlistActivity extends ActionBarActivity {
public boolean onOptionsItemSelected(MenuItem item) {
try {
if (FeedMenuHandler.onOptionsItemClicked(this, item, feed)) {
filf.getListAdapter().notifyDataSetChanged();
// filf.getListAdapter().notifyDataSetChanged();
} else {
switch (item.getItemId()) {
case R.id.remove_item:

View File

@ -1,164 +1,317 @@
package de.danoeh.antennapod.activity;
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.media.AudioManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ListView;
import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.fragment.EpisodesFragment;
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
import de.danoeh.antennapod.fragment.FeedlistFragment;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.fragment.*;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.service.download.DownloadService;
import de.danoeh.antennapod.service.playback.PlaybackService;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DBTasks;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.StorageUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* The activity that is shown when the user launches the app.
*/
public class MainActivity extends ActionBarActivity {
private static final String TAG = "MainActivity";
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED
| EventDistributor.DOWNLOAD_QUEUED;
| EventDistributor.DOWNLOAD_QUEUED
| EventDistributor.FEED_LIST_UPDATE
| EventDistributor.UNREAD_ITEMS_UPDATE;
private static final String PREF_NAME = "MainActivityPrefs";
private static final String PREF_IS_FIRST_LAUNCH = "prefMainActivityIsFirstLaunch";
public static final String EXTRA_NAV_INDEX = "nav_index";
public static final String EXTRA_NAV_TYPE = "nav_type";
public static final String EXTRA_FRAGMENT_ARGS = "fragment_args";
public static final int POS_NEW = 0,
POS_QUEUE = 1,
POS_DOWNLOADS = 2,
POS_HISTORY = 3,
POS_ADD = 4;
private ViewPager viewpager;
private TabsAdapter pagerAdapter;
private ExternalPlayerFragment externalPlayerFragment;
private DrawerLayout drawerLayout;
private ListView navList;
private NavListAdapter navAdapter;
private ActionBarDrawerToggle drawerToogle;
private CharSequence drawerTitle;
private CharSequence currentTitle;
private static boolean appLaunched = false;
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(UserPreferences.getTheme());
super.onCreate(savedInstanceState);
StorageUtils.checkStorageAvailability(this);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
StorageUtils.checkStorageAvailability(this);
setContentView(R.layout.main);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
drawerTitle = currentTitle = getTitle();
viewpager = (ViewPager) findViewById(R.id.viewpager);
pagerAdapter = new TabsAdapter(this, viewpager);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navList = (ListView) findViewById(R.id.nav_list);
viewpager.setAdapter(pagerAdapter);
TypedArray typedArray = obtainStyledAttributes(new int[]{R.attr.nav_drawer_toggle});
drawerToogle = new ActionBarDrawerToggle(this, drawerLayout, typedArray.getResourceId(0, 0), R.string.drawer_open, R.string.drawer_close) {
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
currentTitle = getSupportActionBar().getTitle();
getSupportActionBar().setTitle(drawerTitle);
supportInvalidateOptionsMenu();
}
ActionBar.Tab feedsTab = getSupportActionBar().newTab();
feedsTab.setText(R.string.podcasts_label);
ActionBar.Tab episodesTab = getSupportActionBar().newTab();
episodesTab.setText(R.string.episodes_label);
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
getSupportActionBar().setTitle(currentTitle);
supportInvalidateOptionsMenu();
pagerAdapter.addTab(feedsTab, FeedlistFragment.class, null);
pagerAdapter.addTab(episodesTab, EpisodesFragment.class, null);
}
};
typedArray.recycle();
drawerLayout.setDrawerListener(drawerToogle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
Fragment mainFragment = fm.findFragmentByTag("main");
if (mainFragment != null) {
transaction.replace(R.id.main_view, mainFragment);
} else {
loadFragment(NavListAdapter.VIEW_TYPE_NAV, POS_NEW, null);
}
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
externalPlayerFragment = new ExternalPlayerFragment();
transaction.replace(R.id.playerFragment, externalPlayerFragment);
transaction.commit();
// executed on application start
if (!appLaunched && getIntent().getAction() != null
&& getIntent().getAction().equals(Intent.ACTION_MAIN)) {
appLaunched = true;
if (DBReader.getNumberOfUnreadItems(this) > 0) {
// select 'episodes' tab
getSupportActionBar().setSelectedNavigationItem(1);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
navAdapter = new NavListAdapter(itemAccess, this);
navList.setAdapter(navAdapter);
navList.setOnItemClickListener(navListClickListener);
checkFirstLaunch();
}
private void checkFirstLaunch() {
SharedPreferences prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
if (prefs.getBoolean(PREF_IS_FIRST_LAUNCH, true)) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
drawerLayout.openDrawer(navList);
}
}, 1500);
SharedPreferences.Editor edit = prefs.edit();
edit.putBoolean(PREF_IS_FIRST_LAUNCH, false);
edit.commit();
}
}
public ActionBar getMainActivtyActionBar() {
return getSupportActionBar();
}
public List<Feed> getFeeds() {
return feeds;
}
private void loadFragment(int viewType, int relPos, Bundle args) {
FragmentManager fragmentManager = getSupportFragmentManager();
// clear back stack
for (int i = 0; i < fragmentManager.getBackStackEntryCount(); i++) {
fragmentManager.popBackStack();
}
FragmentTransaction fT = fragmentManager.beginTransaction();
Fragment fragment = null;
if (viewType == NavListAdapter.VIEW_TYPE_NAV) {
switch (relPos) {
case POS_NEW:
fragment = new NewEpisodesFragment();
break;
case POS_QUEUE:
fragment = new QueueFragment();
break;
case POS_DOWNLOADS:
fragment = new DownloadsFragment();
break;
case POS_HISTORY:
fragment = new PlaybackHistoryFragment();
break;
case POS_ADD:
fragment = new AddFeedFragment();
break;
}
currentTitle = getString(NavListAdapter.NAV_TITLES[relPos]);
selectedNavListIndex = relPos;
} else if (viewType == NavListAdapter.VIEW_TYPE_SUBSCRIPTION) {
Feed feed = itemAccess.getItem(relPos);
currentTitle = "";
fragment = ItemlistFragment.newInstance(feed.getId());
selectedNavListIndex = NavListAdapter.SUBSCRIPTION_OFFSET + relPos;
}
if (fragment != null) {
if (args != null) {
fragment.setArguments(args);
}
fT.replace(R.id.main_view, fragment, "main");
fragmentManager.popBackStack();
}
fT.commit();
getSupportActionBar().setTitle(currentTitle);
if (navAdapter != null) {
navAdapter.notifyDataSetChanged();
}
}
public void loadNavFragment(int position, Bundle args) {
loadFragment(NavListAdapter.VIEW_TYPE_NAV, position, args);
}
public void loadFeedFragment(long feedID) {
if (feeds != null) {
for (int i = 0; i < feeds.size(); i++) {
if (feeds.get(i).getId() == feedID) {
loadFragment(NavListAdapter.VIEW_TYPE_SUBSCRIPTION, i, null);
break;
}
}
}
if (savedInstanceState != null) {
getSupportActionBar().setSelectedNavigationItem(
savedInstanceState.getInt("tab", 0));
}
public void loadChildFragment(Fragment fragment) {
if (fragment == null) throw new IllegalArgumentException("fragment = null");
FragmentManager fm = getSupportFragmentManager();
fm.beginTransaction()
.replace(R.id.main_view, fragment, "main")
.addToBackStack(null)
.commit();
}
private AdapterView.OnItemClickListener navListClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
int viewType = parent.getAdapter().getItemViewType(position);
if (viewType != NavListAdapter.VIEW_TYPE_SECTION_DIVIDER && position != selectedNavListIndex) {
int relPos = (viewType == NavListAdapter.VIEW_TYPE_NAV) ? position : position - NavListAdapter.SUBSCRIPTION_OFFSET;
loadFragment(viewType, relPos, null);
selectedNavListIndex = position;
navAdapter.notifyDataSetChanged();
}
drawerLayout.closeDrawer(navList);
}
};
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
drawerToogle.syncState();
if (savedInstanceState != null) {
currentTitle = savedInstanceState.getString("title");
if (!drawerLayout.isDrawerOpen(navList)) {
getSupportActionBar().setTitle(currentTitle);
}
selectedNavListIndex = savedInstanceState.getInt("selectedNavIndex");
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
drawerToogle.onConfigurationChanged(newConfig);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("tab", getSupportActionBar()
.getSelectedNavigationIndex());
outState.putString("title", getSupportActionBar().getTitle().toString());
outState.putInt("selectedNavIndex", selectedNavListIndex);
}
@Override
protected void onPause() {
super.onPause();
EventDistributor.getInstance().unregister(contentUpdate);
}
@Override
protected void onResume() {
super.onResume();
StorageUtils.checkStorageAvailability(this);
updateProgressBarVisibility();
EventDistributor.getInstance().register(contentUpdate);
Intent intent = getIntent();
if (StringUtils.equals(intent.getAction(), Intent.ACTION_SEND)) {
String extra = intent.getStringExtra(Intent.EXTRA_TEXT);
if (extra != null) {
Bundle args = new Bundle();
args.putString(AddFeedFragment.ARG_FEED_URL, extra);
loadFragment(NavListAdapter.VIEW_TYPE_NAV, POS_ADD, args);
selectedNavListIndex = POS_ADD;
navAdapter.notifyDataSetChanged();
}
} else if (feeds != null && intent.hasExtra(EXTRA_NAV_INDEX) && intent.hasExtra(EXTRA_NAV_TYPE)) {
handleNavIntent();
}
loadData();
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((EVENTS & arg) != 0) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Received contentUpdate Intent.");
updateProgressBarVisibility();
}
}
};
private void updateProgressBarVisibility() {
if (DownloadService.isRunning
&& DownloadRequester.getInstance().isDownloadingFeeds()) {
setSupportProgressBarIndeterminateVisibility(true);
} else {
setSupportProgressBarIndeterminateVisibility(false);
}
supportInvalidateOptionsMenu();
@Override
protected void onStop() {
super.onStop();
cancelLoadTask();
EventDistributor.getInstance().unregister(contentUpdate);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (drawerToogle.onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()) {
case R.id.add_feed:
startActivity(new Intent(this, AddFeedActivity.class));
return true;
case R.id.all_feed_refresh:
DBTasks.refreshAllFeeds(this, null);
return true;
case R.id.show_downloads:
startActivity(new Intent(this, DownloadActivity.class));
return true;
case R.id.show_preferences:
startActivity(new Intent(this, PreferenceActivity.class));
return true;
case R.id.show_player:
startActivity(PlaybackService.getPlayerActivityIntent(this));
return true;
case R.id.show_playback_history:
startActivity(new Intent(this, PlaybackHistoryActivity.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
@ -167,13 +320,7 @@ public class MainActivity extends ActionBarActivity {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
MenuItem refreshAll = menu.findItem(R.id.all_feed_refresh);
if (DownloadService.isRunning
&& DownloadRequester.getInstance().isDownloadingFeeds()) {
refreshAll.setVisible(false);
} else {
refreshAll.setVisible(true);
}
return true;
}
@ -182,104 +329,96 @@ public class MainActivity extends ActionBarActivity {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
MenuItem searchItem = menu.findItem(R.id.search_item);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
if (searchView == null) {
MenuItemCompat.setActionView(searchItem, new SearchView(this));
searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
}
searchView.setIconifiedByDefault(true);
SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
return true;
}
public static class TabsAdapter extends FragmentPagerAdapter implements
ActionBar.TabListener, ViewPager.OnPageChangeListener {
private final Context mContext;
private final ActionBar mActionBar;
private final ViewPager mViewPager;
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
static final class TabInfo {
private final Class<?> clss;
private final Bundle args;
TabInfo(Class<?> _class, Bundle _args) {
clss = _class;
args = _args;
}
}
public TabsAdapter(MainActivity activity, ViewPager pager) {
super(activity.getSupportFragmentManager());
mContext = activity;
mActionBar = activity.getSupportActionBar();
mViewPager = pager;
mViewPager.setAdapter(this);
mViewPager.setOnPageChangeListener(this);
}
public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
TabInfo info = new TabInfo(clss, args);
tab.setTag(info);
tab.setTabListener(this);
mTabs.add(info);
mActionBar.addTab(tab);
notifyDataSetChanged();
}
private List<Feed> feeds;
private AsyncTask<Void, Void, List<Feed>> loadTask;
private int selectedNavListIndex = 0;
private NavListAdapter.ItemAccess itemAccess = new NavListAdapter.ItemAccess() {
@Override
public int getCount() {
return mTabs.size();
}
@Override
public Fragment getItem(int position) {
TabInfo info = mTabs.get(position);
return Fragment.instantiate(mContext, info.clss.getName(),
info.args);
}
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mActionBar.setSelectedNavigationItem(position);
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
Object tag = tab.getTag();
for (int i = 0; i < mTabs.size(); i++) {
if (mTabs.get(i) == tag) {
mViewPager.setCurrentItem(i);
}
if (feeds != null) {
return feeds.size();
} else {
return 0;
}
}
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
public Feed getItem(int position) {
if (feeds != null && position < feeds.size()) {
return feeds.get(position);
} else {
return null;
}
}
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
public int getSelectedItemIndex() {
return selectedNavListIndex;
}
};
private void loadData() {
cancelLoadTask();
loadTask = new AsyncTask<Void, Void, List<Feed>>() {
@Override
protected List<Feed> doInBackground(Void... params) {
return DBReader.getFeedList(MainActivity.this);
}
@Override
protected void onPostExecute(List<Feed> result) {
super.onPostExecute(result);
boolean handleIntent = (feeds == null);
feeds = result;
navAdapter.notifyDataSetChanged();
if (handleIntent) {
handleNavIntent();
}
}
};
loadTask.execute();
}
private void cancelLoadTask() {
if (loadTask != null) {
loadTask.cancel(true);
}
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((EVENTS & arg) != 0) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Received contentUpdate Intent.");
loadData();
}
}
};
private void handleNavIntent() {
Intent intent = getIntent();
if (intent.hasExtra(EXTRA_NAV_INDEX) && intent.hasExtra(EXTRA_NAV_TYPE)) {
int index = intent.getIntExtra(EXTRA_NAV_INDEX, 0);
int type = intent.getIntExtra(EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV);
Bundle args = intent.getBundleExtra(EXTRA_FRAGMENT_ARGS);
loadFragment(type, index, args);
}
setIntent(new Intent(MainActivity.this, MainActivity.class)); // to avoid handling the intent twice when the configuration changes
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
}

View File

@ -58,7 +58,7 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI
txtvStatus = (TextView) findViewById(android.R.id.empty);
listView.setOnItemClickListener(this);
searchAdapter = new SearchlistAdapter(this, 0, new ArrayList<SearchResult>());
//searchAdapter = new SearchlistAdapter(this, 0, new ArrayList<SearchResult>());
listView.setAdapter(searchAdapter);
listView.setEmptyView(txtvStatus);
}
@ -131,7 +131,7 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI
@SuppressLint({"NewApi", "NewApi"})
private void handleSearchRequest(final String query) {
if (searchAdapter != null) {
searchAdapter.clear();
// searchAdapter.clear();
searchAdapter.notifyDataSetChanged();
}
txtvStatus.setText(R.string.search_status_searching);
@ -154,9 +154,9 @@ public class SearchActivity extends ActionBarActivity implements AdapterView.OnI
Log.d(TAG, "Found " + result.size()
+ " results");
searchAdapter.clear();
// searchAdapter.clear();
for (SearchResult s : result) {
searchAdapter.add(s);
// searchAdapter.add(s);
}
searchAdapter.notifyDataSetChanged();
txtvStatus

View File

@ -0,0 +1,67 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.view.View;
import android.widget.ImageButton;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.storage.DownloadRequester;
/**
* Utility methods for the action button that is displayed on the right hand side
* of a listitem.
*/
public class ActionButtonUtils {
private final int[] labels;
private final TypedArray drawables;
private final Context context;
public ActionButtonUtils(Context context) {
if (context == null) throw new IllegalArgumentException("context = null");
this.context = context;
drawables = context.obtainStyledAttributes(new int[]{
R.attr.av_play, R.attr.navigation_cancel, R.attr.av_download, R.attr.navigation_chapters});
labels = new int[]{R.string.play_label, R.string.cancel_download_label, R.string.download_label};
}
/**
* Sets the displayed bitmap and content description of the given
* action button so that it matches the state of the FeedItem.
*/
public void configureActionButton(ImageButton butSecondary, FeedItem item) {
if (butSecondary == null || item == null) throw new IllegalArgumentException("butSecondary or item was null");
final FeedMedia media = item.getMedia();
if (media != null) {
final boolean isDownloadingMedia = DownloadRequester.getInstance().isDownloadingFile(media);
if (!media.isDownloaded()) {
if (isDownloadingMedia) {
// item is being downloaded
butSecondary.setVisibility(View.VISIBLE);
butSecondary.setImageDrawable(drawables
.getDrawable(1));
butSecondary.setContentDescription(context.getString(labels[1]));
} else {
// item is not downloaded and not being downloaded
butSecondary.setVisibility(View.VISIBLE);
butSecondary.setImageDrawable(drawables.getDrawable(2));
butSecondary.setContentDescription(context.getString(labels[2]));
}
} else {
// item is not being downloaded
butSecondary.setVisibility(View.VISIBLE);
if (media.isPlaying()) {
butSecondary.setImageDrawable(drawables.getDrawable(3));
} else {
butSecondary
.setImageDrawable(drawables.getDrawable(0));
}
butSecondary.setContentDescription(context.getString(labels[0]));
}
} else {
butSecondary.setVisibility(View.INVISIBLE);
}
}
}

View File

@ -0,0 +1,49 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.widget.Toast;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.storage.DBTasks;
import de.danoeh.antennapod.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequester;
/**
* Default implementation of an ActionButtonCallback
*/
public class DefaultActionButtonCallback implements ActionButtonCallback {
private static final String TAG = "DefaultActionButtonCallback";
private final Context context;
public DefaultActionButtonCallback(Context context) {
if (context == null) throw new IllegalArgumentException("context = null");
this.context = context;
}
@Override
public void onActionButtonPressed(final FeedItem item) {
final FeedMedia media = item.getMedia();
if (media == null) {
return;
}
boolean isDownloading = DownloadRequester.getInstance().isDownloadingFile(media);
if (!isDownloading && !media.isDownloaded()) {
try {
DBTasks.downloadFeedItems(context, item);
Toast.makeText(context, R.string.status_downloading_label, Toast.LENGTH_SHORT).show();
} catch (DownloadRequestException e) {
e.printStackTrace();
DownloadRequestErrorDialogCreator.newRequestErrorDialog(context, e.getMessage());
}
} else if (isDownloading) {
DownloadRequester.getInstance().cancelDownload(context, media);
Toast.makeText(context, R.string.download_cancelled_msg, Toast.LENGTH_SHORT).show();
} else { // media is downloaded
DBTasks.playMedia(context, media, true, true, false);
}
}
}

View File

@ -1,129 +0,0 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.util.Converter;
public class DefaultFeedItemlistAdapter extends BaseAdapter {
ItemAccess itemAccess;
private Context context;
public DefaultFeedItemlistAdapter(Context context, ItemAccess itemAccess) {
super();
this.context = context;
if (itemAccess == null) {
throw new IllegalArgumentException("itemAccess must not be null");
}
this.itemAccess = itemAccess;
}
@Override
public int getCount() {
return itemAccess.getCount();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public FeedItem getItem(int position) {
return itemAccess.getItem(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = getItem(position);
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.default_feeditemlist_item, null);
holder.title = (TextView) convertView
.findViewById(R.id.txtvItemname);
holder.lenSize = (TextView) convertView
.findViewById(R.id.txtvLenSize);
holder.published = (TextView) convertView
.findViewById(R.id.txtvPublished);
holder.type = (ImageView) convertView.findViewById(R.id.imgvType);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
convertView.setVisibility(View.VISIBLE);
holder.title.setText(item.getTitle());
holder.published.setText(convertView.getResources().getString(
R.string.published_prefix)
+ DateUtils.getRelativeTimeSpanString(
item.getPubDate().getTime(),
System.currentTimeMillis(), 0, 0));
if (item.getMedia() == null) {
holder.type.setVisibility(View.GONE);
holder.lenSize.setVisibility(View.GONE);
} else {
holder.lenSize.setVisibility(View.VISIBLE);
holder.lenSize.setText(convertView.getResources().getString(
R.string.size_prefix)
+ Converter.byteToString(item.getMedia().getSize()));
TypedArray typeDrawables = context
.obtainStyledAttributes(new int[] { R.attr.type_audio,
R.attr.type_video });
MediaType mediaType = item.getMedia().getMediaType();
if (mediaType == MediaType.AUDIO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(0));
holder.type.setContentDescription(context.getString(R.string.media_type_audio_label));
holder.type.setVisibility(View.VISIBLE);
} else if (mediaType == MediaType.VIDEO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(1));
holder.type.setContentDescription(context.getString(R.string.media_type_video_label));
holder.type.setVisibility(View.VISIBLE);
} else {
holder.type.setImageBitmap(null);
holder.type.setVisibility(View.GONE);
}
}
} else {
convertView.setVisibility(View.GONE);
}
return convertView;
}
protected static class Holder {
TextView title;
TextView published;
TextView lenSize;
ImageView type;
}
public static interface ItemAccess {
int getCount();
FeedItem getItem(int position);
}
protected Context getContext() {
return context;
}
}

View File

@ -0,0 +1,119 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.util.Converter;
/**
* Shows a list of downloaded episodes
*/
public class DownloadedEpisodesListAdapter extends BaseAdapter {
private final Context context;
private final ItemAccess itemAccess;
public DownloadedEpisodesListAdapter(Context context, ItemAccess itemAccess) {
super();
this.context = context;
this.itemAccess = itemAccess;
}
@Override
public int getCount() {
return itemAccess.getCount();
}
@Override
public FeedItem getItem(int position) {
return itemAccess.getItem(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = (FeedItem) getItem(position);
if (item == null) return null;
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.downloaded_episodeslist_item,
null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.pubDate = (TextView) convertView
.findViewById(R.id.txtvPublished);
holder.butSecondary = (ImageButton) convertView
.findViewById(R.id.butSecondaryAction);
holder.imageView = (ImageView) convertView.findViewById(R.id.imgvImage);
holder.txtvSize = (TextView) convertView.findViewById(R.id.txtvSize);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.title.setText(item.getTitle());
holder.pubDate.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_SHOW_DATE));
holder.txtvSize.setText(Converter.byteToString(item.getMedia().getSize()));
FeedItem.State state = item.getState();
if (state == FeedItem.State.PLAYING) {
holder.butSecondary.setEnabled(false);
} else {
holder.butSecondary.setEnabled(true);
}
holder.butSecondary.setFocusable(false);
holder.butSecondary.setTag(item);
holder.butSecondary.setOnClickListener(secondaryActionListener);
ImageLoader.getInstance().loadThumbnailBitmap(
item,
holder.imageView,
(int) convertView.getResources().getDimension(
R.dimen.thumbnail_length)
);
return convertView;
}
private View.OnClickListener secondaryActionListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();
itemAccess.onFeedItemSecondaryAction(item);
}
};
static class Holder {
TextView title;
TextView pubDate;
ImageView imageView;
TextView txtvSize;
ImageButton butSecondary;
}
public interface ItemAccess {
int getCount();
FeedItem getItem(int position);
void onFeedItemSecondaryAction(FeedItem item);
}
}

View File

@ -4,7 +4,8 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TextView;
import de.danoeh.antennapod.R;
@ -14,86 +15,128 @@ import de.danoeh.antennapod.service.download.Downloader;
import de.danoeh.antennapod.util.Converter;
import de.danoeh.antennapod.util.ThemeUtils;
import java.util.List;
public class DownloadlistAdapter extends BaseAdapter {
public class DownloadlistAdapter extends ArrayAdapter<Downloader> {
private int selectedItemIndex;
public static final int SELECTION_NONE = -1;
public static final int SELECTION_NONE = -1;
private int selectedItemIndex;
private ItemAccess itemAccess;
private Context context;
public DownloadlistAdapter(Context context, int textViewResourceId,
List<Downloader> objects) {
super(context, textViewResourceId, objects);
this.selectedItemIndex = SELECTION_NONE;
}
public DownloadlistAdapter(Context context,
ItemAccess itemAccess) {
super();
this.selectedItemIndex = SELECTION_NONE;
this.context = context;
this.itemAccess = itemAccess;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
DownloadRequest request = getItem(position).getDownloadRequest();
// Inflate layout
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.downloadlist_item, null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.message = (TextView) convertView
.findViewById(R.id.txtvMessage);
holder.downloaded = (TextView) convertView
.findViewById(R.id.txtvDownloaded);
holder.percent = (TextView) convertView
.findViewById(R.id.txtvPercent);
holder.progbar = (ProgressBar) convertView
.findViewById(R.id.progProgress);
@Override
public int getCount() {
return itemAccess.getCount();
}
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
@Override
public Downloader getItem(int position) {
return itemAccess.getItem(position);
}
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources().getColor(
ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}
holder.title.setText(request.getTitle());
if (request.getStatusMsg() != 0) {
holder.message.setText(request.getStatusMsg());
}
String strDownloaded = Converter.byteToString(request.getSoFar());
if (request.getSize() != DownloadStatus.SIZE_UNKNOWN) {
strDownloaded += " / " + Converter.byteToString(request.getSize());
holder.percent.setText(request.getProgressPercent() + "%");
holder.progbar.setProgress(request.getProgressPercent());
holder.percent.setVisibility(View.VISIBLE);
} else {
holder.progbar.setProgress(0);
holder.percent.setVisibility(View.INVISIBLE);
}
@Override
public long getItemId(int position) {
return position;
}
holder.downloaded.setText(strDownloaded);
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
Downloader downloader = getItem(position);
DownloadRequest request = downloader.getDownloadRequest();
// Inflate layout
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.downloadlist_item, null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.message = (TextView) convertView
.findViewById(R.id.txtvMessage);
holder.downloaded = (TextView) convertView
.findViewById(R.id.txtvDownloaded);
holder.percent = (TextView) convertView
.findViewById(R.id.txtvPercent);
holder.progbar = (ProgressBar) convertView
.findViewById(R.id.progProgress);
holder.butSecondary = (ImageButton) convertView
.findViewById(R.id.butSecondaryAction);
return convertView;
}
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
static class Holder {
TextView title;
TextView message;
TextView downloaded;
TextView percent;
ProgressBar progbar;
}
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources().getColor(
ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}
public int getSelectedItemIndex() {
return selectedItemIndex;
}
holder.title.setText(request.getTitle());
if (request.getStatusMsg() != 0) {
holder.message.setText(request.getStatusMsg());
}
String strDownloaded = Converter.byteToString(request.getSoFar());
if (request.getSize() != DownloadStatus.SIZE_UNKNOWN) {
strDownloaded += " / " + Converter.byteToString(request.getSize());
holder.percent.setText(request.getProgressPercent() + "%");
holder.progbar.setProgress(request.getProgressPercent());
holder.percent.setVisibility(View.VISIBLE);
} else {
holder.progbar.setProgress(0);
holder.percent.setVisibility(View.INVISIBLE);
}
public void setSelectedItemIndex(int selectedItemIndex) {
this.selectedItemIndex = selectedItemIndex;
notifyDataSetChanged();
}
holder.downloaded.setText(strDownloaded);
holder.butSecondary.setFocusable(false);
holder.butSecondary.setTag(downloader);
holder.butSecondary.setOnClickListener(butSecondaryListener);
return convertView;
}
private View.OnClickListener butSecondaryListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Downloader downloader = (Downloader) v.getTag();
itemAccess.onSecondaryActionClick(downloader);
}
};
static class Holder {
TextView title;
TextView message;
TextView downloaded;
TextView percent;
ProgressBar progbar;
ImageButton butSecondary;
}
public int getSelectedItemIndex() {
return selectedItemIndex;
}
public void setSelectedItemIndex(int selectedItemIndex) {
this.selectedItemIndex = selectedItemIndex;
notifyDataSetChanged();
}
public interface ItemAccess {
public int getCount();
public Downloader getItem(int position);
public void onSecondaryActionClick(Downloader downloader);
}
}

View File

@ -227,10 +227,10 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.feeditemlist_header, null);
TextView headerTitle = (TextView) convertView
.findViewById(R.id.txtvHeaderTitle);
.findViewById(0);
ImageButton actionButton = (ImageButton) convertView
.findViewById(R.id.butAction);
TextView numItems = (TextView) convertView.findViewById(R.id.txtvNumItems);
TextView numItems = (TextView) convertView.findViewById(0);
String headerString = null;
int childrenCount = 0;

View File

@ -0,0 +1,243 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.*;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.Converter;
import de.danoeh.antennapod.util.ThemeUtils;
/**
* List adapter for items of feeds that the user has already subscribed to.
*/
public class FeedItemlistAdapter extends BaseAdapter {
private ActionButtonCallback callback;
private final ItemAccess itemAccess;
private final Context context;
private boolean showFeedtitle;
private int selectedItemIndex;
private final ActionButtonUtils actionButtonUtils;
public static final int SELECTION_NONE = -1;
public FeedItemlistAdapter(Context context,
ItemAccess itemAccess,
ActionButtonCallback callback, boolean showFeedtitle) {
super();
this.callback = callback;
this.context = context;
this.itemAccess = itemAccess;
this.showFeedtitle = showFeedtitle;
this.selectedItemIndex = SELECTION_NONE;
this.actionButtonUtils = new ActionButtonUtils(context);
}
@Override
public int getCount() {
return itemAccess.getCount();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public FeedItem getItem(int position) {
return itemAccess.getItem(position);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = getItem(position);
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.feeditemlist_item, null);
holder.title = (TextView) convertView
.findViewById(R.id.txtvItemname);
holder.lenSize = (TextView) convertView
.findViewById(R.id.txtvLenSize);
holder.butAction = (ImageButton) convertView
.findViewById(R.id.butSecondaryAction);
holder.published = (TextView) convertView
.findViewById(R.id.txtvPublished);
holder.inPlaylist = (ImageView) convertView
.findViewById(R.id.imgvInPlaylist);
holder.type = (ImageView) convertView.findViewById(R.id.imgvType);
holder.statusUnread = (View) convertView
.findViewById(R.id.statusUnread);
holder.episodeProgress = (ProgressBar) convertView
.findViewById(R.id.pbar_episode_progress);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
convertView.setVisibility(View.VISIBLE);
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources()
.getColor(ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}
StringBuilder buffer = new StringBuilder(item.getTitle());
if (showFeedtitle) {
buffer.append("(");
buffer.append(item.getFeed().getTitle());
buffer.append(")");
}
holder.title.setText(buffer.toString());
FeedItem.State state = item.getState();
switch (state) {
case PLAYING:
holder.statusUnread.setVisibility(View.GONE);
holder.episodeProgress.setVisibility(View.VISIBLE);
break;
case IN_PROGRESS:
holder.statusUnread.setVisibility(View.GONE);
holder.episodeProgress.setVisibility(View.VISIBLE);
break;
case NEW:
holder.statusUnread.setVisibility(View.VISIBLE);
break;
default:
holder.statusUnread.setVisibility(View.GONE);
break;
}
holder.published.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_SHOW_DATE));
FeedMedia media = item.getMedia();
if (media == null) {
holder.episodeProgress.setVisibility(View.GONE);
holder.inPlaylist.setVisibility(View.INVISIBLE);
holder.type.setVisibility(View.INVISIBLE);
holder.lenSize.setVisibility(View.INVISIBLE);
} else {
if (state == FeedItem.State.PLAYING
|| state == FeedItem.State.IN_PROGRESS) {
if (media.getDuration() > 0) {
holder.episodeProgress
.setProgress((int) (((double) media
.getPosition()) / media.getDuration() * 100));
holder.lenSize.setText(Converter
.getDurationStringLong(media.getDuration()
- media.getPosition()));
}
} else if (!media.isDownloaded()) {
holder.lenSize.setText(context.getString(
R.string.size_prefix)
+ Converter.byteToString(media.getSize()));
} else {
holder.lenSize.setText(context.getString(
R.string.length_prefix)
+ Converter.getDurationStringLong(media
.getDuration()));
}
holder.lenSize.setVisibility(View.VISIBLE);
if (((ItemAccess) itemAccess).isInQueue(item)) {
holder.inPlaylist.setVisibility(View.VISIBLE);
} else {
holder.inPlaylist.setVisibility(View.INVISIBLE);
}
if (DownloadRequester.getInstance().isDownloadingFile(
item.getMedia())) {
holder.episodeProgress.setVisibility(View.VISIBLE);
holder.episodeProgress.setProgress(((ItemAccess) itemAccess).getItemDownloadProgressPercent(item));
} else if (!(state == FeedItem.State.IN_PROGRESS
|| state == FeedItem.State.PLAYING)) {
holder.episodeProgress.setVisibility(View.GONE);
}
TypedArray typeDrawables = context.obtainStyledAttributes(
new int[]{R.attr.type_audio, R.attr.type_video});
final int[] labels = new int[]{R.string.media_type_audio_label, R.string.media_type_video_label};
MediaType mediaType = item.getMedia().getMediaType();
if (mediaType == MediaType.AUDIO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(0));
holder.type.setContentDescription(context.getString(labels[0]));
holder.type.setVisibility(View.VISIBLE);
} else if (mediaType == MediaType.VIDEO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(1));
holder.type.setContentDescription(context.getString(labels[1]));
holder.type.setVisibility(View.VISIBLE);
} else {
holder.type.setImageBitmap(null);
holder.type.setVisibility(View.GONE);
}
}
actionButtonUtils.configureActionButton(holder.butAction, item);
holder.butAction.setFocusable(false);
holder.butAction.setTag(item);
holder.butAction.setOnClickListener(butActionListener);
} else {
convertView.setVisibility(View.GONE);
}
return convertView;
}
private final OnClickListener butActionListener = new OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();
callback.onActionButtonPressed(item);
}
};
static class Holder {
TextView title;
TextView published;
TextView lenSize;
ImageView type;
ImageView inPlaylist;
ImageButton butAction;
View statusUnread;
ProgressBar episodeProgress;
}
public int getSelectedItemIndex() {
return selectedItemIndex;
}
public void setSelectedItemIndex(int selectedItemIndex) {
this.selectedItemIndex = selectedItemIndex;
notifyDataSetChanged();
}
public static interface ItemAccess {
public boolean isInQueue(FeedItem item);
int getItemDownloadProgressPercent(FeedItem item);
int getCount();
FeedItem getItem(int position);
}
}

View File

@ -1,230 +0,0 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.*;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.Converter;
import de.danoeh.antennapod.util.ThemeUtils;
/** List adapter for items of feeds that the user has already subscribed to. */
public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter {
private ActionButtonCallback callback;
private boolean showFeedtitle;
private int selectedItemIndex;
public static final int SELECTION_NONE = -1;
public InternalFeedItemlistAdapter(Context context,
ItemAccess itemAccess,
ActionButtonCallback callback, boolean showFeedtitle) {
super(context, itemAccess);
this.callback = callback;
this.showFeedtitle = showFeedtitle;
this.selectedItemIndex = SELECTION_NONE;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = getItem(position);
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.feeditemlist_item, null);
holder.title = (TextView) convertView
.findViewById(R.id.txtvItemname);
holder.lenSize = (TextView) convertView
.findViewById(R.id.txtvLenSize);
holder.butAction = (ImageButton) convertView
.findViewById(R.id.butAction);
holder.published = (TextView) convertView
.findViewById(R.id.txtvPublished);
holder.inPlaylist = (ImageView) convertView
.findViewById(R.id.imgvInPlaylist);
holder.downloaded = (ImageView) convertView
.findViewById(R.id.imgvDownloaded);
holder.type = (ImageView) convertView.findViewById(R.id.imgvType);
holder.downloading = (ImageView) convertView
.findViewById(R.id.imgvDownloading);
if (showFeedtitle) {
holder.feedtitle = (TextView) convertView
.findViewById(R.id.txtvFeedname);
}
holder.statusPlaying = (View) convertView
.findViewById(R.id.statusPlaying);
holder.statusUnread = (View) convertView
.findViewById(R.id.statusUnread);
holder.episodeProgress = (ProgressBar) convertView
.findViewById(R.id.pbar_episode_progress);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
convertView.setVisibility(View.VISIBLE);
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources()
.getColor(ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}
holder.title.setText(item.getTitle());
if (showFeedtitle) {
holder.feedtitle.setVisibility(View.VISIBLE);
holder.feedtitle.setText(item.getFeed().getTitle());
}
FeedItem.State state = item.getState();
switch (state) {
case PLAYING:
holder.statusPlaying.setVisibility(View.VISIBLE);
holder.statusUnread.setVisibility(View.GONE);
holder.episodeProgress.setVisibility(View.VISIBLE);
break;
case IN_PROGRESS:
holder.statusPlaying.setVisibility(View.GONE);
holder.statusUnread.setVisibility(View.GONE);
holder.episodeProgress.setVisibility(View.VISIBLE);
break;
case NEW:
holder.statusPlaying.setVisibility(View.GONE);
holder.statusUnread.setVisibility(View.VISIBLE);
holder.episodeProgress.setVisibility(View.GONE);
break;
default:
holder.statusPlaying.setVisibility(View.GONE);
holder.statusUnread.setVisibility(View.GONE);
holder.episodeProgress.setVisibility(View.GONE);
break;
}
holder.published.setText(convertView.getResources().getString(
R.string.published_prefix)
+ DateUtils.getRelativeTimeSpanString(
item.getPubDate().getTime(),
System.currentTimeMillis(), 0, 0));
FeedMedia media = item.getMedia();
if (media == null) {
holder.downloaded.setVisibility(View.GONE);
holder.downloading.setVisibility(View.GONE);
holder.inPlaylist.setVisibility(View.GONE);
holder.type.setVisibility(View.GONE);
holder.lenSize.setVisibility(View.GONE);
} else {
if (state == FeedItem.State.PLAYING
|| state == FeedItem.State.IN_PROGRESS) {
if (media.getDuration() > 0) {
holder.episodeProgress
.setProgress((int) (((double) media
.getPosition()) / media.getDuration() * 100));
holder.lenSize.setText(Converter
.getDurationStringLong(media.getDuration()
- media.getPosition()));
}
} else if (!media.isDownloaded()) {
holder.lenSize.setText(getContext().getString(
R.string.size_prefix)
+ Converter.byteToString(media.getSize()));
} else {
holder.lenSize.setText(getContext().getString(
R.string.length_prefix)
+ Converter.getDurationStringLong(media
.getDuration()));
}
holder.lenSize.setVisibility(View.VISIBLE);
if (((ItemAccess) itemAccess).isInQueue(item)) {
holder.inPlaylist.setVisibility(View.VISIBLE);
} else {
holder.inPlaylist.setVisibility(View.GONE);
}
if (item.getMedia().isDownloaded()) {
holder.downloaded.setVisibility(View.VISIBLE);
} else {
holder.downloaded.setVisibility(View.GONE);
}
if (DownloadRequester.getInstance().isDownloadingFile(
item.getMedia())) {
holder.downloading.setVisibility(View.VISIBLE);
} else {
holder.downloading.setVisibility(View.GONE);
}
TypedArray typeDrawables = getContext().obtainStyledAttributes(
new int[] { R.attr.type_audio, R.attr.type_video });
final int[] labels = new int[] {R.string.media_type_audio_label, R.string.media_type_video_label};
MediaType mediaType = item.getMedia().getMediaType();
if (mediaType == MediaType.AUDIO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(0));
holder.type.setContentDescription(getContext().getString(labels[0]));
holder.type.setVisibility(View.VISIBLE);
} else if (mediaType == MediaType.VIDEO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(1));
holder.type.setContentDescription(getContext().getString(labels[1]));
holder.type.setVisibility(View.VISIBLE);
} else {
holder.type.setImageBitmap(null);
holder.type.setVisibility(View.GONE);
}
}
holder.butAction.setFocusable(false);
holder.butAction.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
callback.onActionButtonPressed(item);
}
});
} else {
convertView.setVisibility(View.GONE);
}
return convertView;
}
static class Holder extends DefaultFeedItemlistAdapter.Holder {
TextView feedtitle;
ImageView inPlaylist;
ImageView downloaded;
ImageView downloading;
ImageButton butAction;
View statusUnread;
View statusPlaying;
ProgressBar episodeProgress;
}
public int getSelectedItemIndex() {
return selectedItemIndex;
}
public void setSelectedItemIndex(int selectedItemIndex) {
this.selectedItemIndex = selectedItemIndex;
notifyDataSetChanged();
}
public static interface ItemAccess extends DefaultFeedItemlistAdapter.ItemAccess {
public boolean isInQueue(FeedItem item);
}
}

View File

@ -0,0 +1,198 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.feed.Feed;
/**
* BaseAdapter for the navigation drawer
*/
public class NavListAdapter extends BaseAdapter {
public static final int VIEW_TYPE_COUNT = 3;
public static final int VIEW_TYPE_NAV = 0;
public static final int VIEW_TYPE_SECTION_DIVIDER = 1;
public static final int VIEW_TYPE_SUBSCRIPTION = 2;
public static final int[] NAV_TITLES = {R.string.all_episodes_label, R.string.queue_label, R.string.downloads_label, R.string.playback_history_label, R.string.add_feed_label};
private final Drawable[] drawables;
public static final int SUBSCRIPTION_OFFSET = 1 + NAV_TITLES.length;
private ItemAccess itemAccess;
private Context context;
public NavListAdapter(ItemAccess itemAccess, Context context) {
this.itemAccess = itemAccess;
this.context = context;
TypedArray ta = context.obtainStyledAttributes(new int[] {R.attr.ic_new, R.attr.stat_playlist,
R.attr.av_download, R.attr.device_access_time, R.attr.content_new});
drawables = new Drawable[] {ta.getDrawable(0), ta.getDrawable(1), ta.getDrawable(2),
ta.getDrawable(3), ta.getDrawable(4)};
ta.recycle();
}
@Override
public int getCount() {
return NAV_TITLES.length + 1 + itemAccess.getCount();
}
@Override
public Object getItem(int position) {
int viewType = getItemViewType(position);
if (viewType == VIEW_TYPE_NAV) {
return context.getString(NAV_TITLES[position]);
} else if (viewType == VIEW_TYPE_SECTION_DIVIDER) {
return context.getString(R.string.podcasts_label);
} else {
return itemAccess.getItem(position);
}
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
if (0 <= position && position < NAV_TITLES.length) {
return VIEW_TYPE_NAV;
} else if (position < NAV_TITLES.length + 1) {
return VIEW_TYPE_SECTION_DIVIDER;
} else {
return VIEW_TYPE_SUBSCRIPTION;
}
}
@Override
public int getViewTypeCount() {
return VIEW_TYPE_COUNT;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int viewType = getItemViewType(position);
View v = null;
if (viewType == VIEW_TYPE_NAV) {
v = getNavView((String) getItem(position), position, convertView, parent);
} else if (viewType == VIEW_TYPE_SECTION_DIVIDER) {
v = getSectionDividerView((String) getItem(position), position, convertView, parent);
} else {
v = getFeedView(position - SUBSCRIPTION_OFFSET, convertView, parent);
}
if (v != null) {
TextView txtvTitle = (TextView) v.findViewById(R.id.txtvTitle);
if (position == itemAccess.getSelectedItemIndex()) {
txtvTitle.setTypeface(null, Typeface.BOLD);
} else {
txtvTitle.setTypeface(null, Typeface.NORMAL);
}
}
return v;
}
private View getNavView(String title, int position, View convertView, ViewGroup parent) {
NavHolder holder;
if (convertView == null) {
holder = new NavHolder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.nav_listitem, null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.image = (ImageView) convertView.findViewById(R.id.imgvCover);
convertView.setTag(holder);
} else {
holder = (NavHolder) convertView.getTag();
}
holder.title.setText(title);
holder.image.setImageDrawable(drawables[position]);
return convertView;
}
private View getSectionDividerView(String title, int position, View convertView, ViewGroup parent) {
SectionHolder holder;
if (convertView == null) {
holder = new SectionHolder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.nav_section_item, null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
convertView.setTag(holder);
} else {
holder = (SectionHolder) convertView.getTag();
}
holder.title.setText(title);
convertView.setEnabled(false);
convertView.setOnClickListener(null);
return convertView;
}
private View getFeedView(int feedPos, View convertView, ViewGroup parent) {
FeedHolder holder;
Feed feed = itemAccess.getItem(feedPos);
if (convertView == null) {
holder = new FeedHolder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.nav_feedlistitem, null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.image = (ImageView) convertView.findViewById(R.id.imgvCover);
convertView.setTag(holder);
} else {
holder = (FeedHolder) convertView.getTag();
}
holder.title.setText(feed.getTitle());
ImageLoader.getInstance().loadThumbnailBitmap(feed.getImage(), holder.image, (int) context.getResources().getDimension(R.dimen.thumbnail_length_navlist));
return convertView;
}
static class NavHolder {
TextView title;
ImageView image;
}
static class SectionHolder {
TextView title;
}
static class FeedHolder {
TextView title;
ImageView image;
}
public interface ItemAccess {
public int getCount();
public Feed getItem(int position);
public int getSelectedItemIndex();
}
}

View File

@ -0,0 +1,160 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.Converter;
/**
* List adapter for the list of new episodes
*/
public class NewEpisodesListAdapter extends BaseAdapter {
private final Context context;
private final ItemAccess itemAccess;
private final ActionButtonCallback actionButtonCallback;
private final ActionButtonUtils actionButtonUtils;
public NewEpisodesListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) {
super();
this.context = context;
this.itemAccess = itemAccess;
this.actionButtonUtils = new ActionButtonUtils(context);
this.actionButtonCallback = actionButtonCallback;
}
@Override
public int getCount() {
return itemAccess.getCount();
}
@Override
public Object getItem(int position) {
return itemAccess.getItem(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = (FeedItem) getItem(position);
if (item == null) return null;
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.new_episodes_listitem,
null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.pubDate = (TextView) convertView
.findViewById(R.id.txtvPublished);
holder.butSecondary = (ImageButton) convertView
.findViewById(R.id.butSecondaryAction);
holder.queueStatus = (ImageView) convertView
.findViewById(R.id.imgvInPlaylist);
holder.downloadProgress = (ProgressBar) convertView
.findViewById(R.id.pbar_download_progress);
holder.imageView = (ImageView) convertView.findViewById(R.id.imgvImage);
holder.txtvDuration = (TextView) convertView.findViewById(R.id.txtvDuration);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.title.setText(item.getTitle());
holder.pubDate.setText(DateUtils.formatDateTime(context, item.getPubDate().getTime(), DateUtils.FORMAT_SHOW_DATE));
FeedMedia media = item.getMedia();
if (media != null) {
final boolean isDownloadingMedia = DownloadRequester.getInstance().isDownloadingFile(media);
if (media.getDuration() > 0) {
holder.txtvDuration.setText(Converter.getDurationStringLong(media.getDuration()));
} else {
holder.txtvDuration.setText("");
}
if (isDownloadingMedia) {
holder.downloadProgress.setVisibility(View.VISIBLE);
holder.txtvDuration.setVisibility(View.GONE);
} else {
holder.txtvDuration.setVisibility(View.VISIBLE);
holder.downloadProgress.setVisibility(View.GONE);
}
if (!media.isDownloaded()) {
if (isDownloadingMedia) {
// item is being downloaded
holder.downloadProgress.setProgress(itemAccess.getItemDownloadProgressPercent(item));
}
}
}
if (itemAccess.isInQueue(item)) {
holder.queueStatus.setVisibility(View.VISIBLE);
} else {
holder.queueStatus.setVisibility(View.INVISIBLE);
}
actionButtonUtils.configureActionButton(holder.butSecondary, item);
holder.butSecondary.setFocusable(false);
holder.butSecondary.setTag(item);
holder.butSecondary.setOnClickListener(secondaryActionListener);
ImageLoader.getInstance().loadThumbnailBitmap(
item,
holder.imageView,
(int) convertView.getResources().getDimension(
R.dimen.thumbnail_length)
);
return convertView;
}
private View.OnClickListener secondaryActionListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();
actionButtonCallback.onActionButtonPressed(item);
}
};
static class Holder {
TextView title;
TextView pubDate;
ImageView queueStatus;
ImageView imageView;
ProgressBar downloadProgress;
TextView txtvDuration;
ImageButton butSecondary;
}
public interface ItemAccess {
int getCount();
FeedItem getItem(int position);
int getItemDownloadProgressPercent(FeedItem item);
boolean isInQueue(FeedItem item);
}
}

View File

@ -0,0 +1,130 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.storage.DownloadRequester;
/**
* List adapter for the queue.
*/
public class QueueListAdapter extends BaseAdapter {
private final Context context;
private final ItemAccess itemAccess;
private final ActionButtonCallback actionButtonCallback;
private final ActionButtonUtils actionButtonUtils;
public QueueListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) {
super();
this.context = context;
this.itemAccess = itemAccess;
this.actionButtonUtils = new ActionButtonUtils(context);
this.actionButtonCallback = actionButtonCallback;
}
@Override
public int getCount() {
return itemAccess.getCount();
}
@Override
public Object getItem(int position) {
return itemAccess.getItem(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = (FeedItem) getItem(position);
if (item == null) return null;
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.queue_listitem,
null);
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
holder.butSecondary = (ImageButton) convertView
.findViewById(R.id.butSecondaryAction);
holder.downloadProgress = (ProgressBar) convertView
.findViewById(R.id.pbar_download_progress);
holder.imageView = (ImageView) convertView.findViewById(R.id.imgvImage);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.title.setText(item.getTitle());
FeedMedia media = item.getMedia();
if (media != null) {
final boolean isDownloadingMedia = DownloadRequester.getInstance().isDownloadingFile(media);
if (isDownloadingMedia) {
holder.downloadProgress.setVisibility(View.VISIBLE);
} else {
holder.downloadProgress.setVisibility(View.GONE);
}
if (!media.isDownloaded()) {
if (isDownloadingMedia) {
// item is being downloaded
holder.downloadProgress.setProgress(itemAccess.getItemDownloadProgressPercent(item));
}
}
}
actionButtonUtils.configureActionButton(holder.butSecondary, item);
holder.butSecondary.setFocusable(false);
holder.butSecondary.setTag(item);
holder.butSecondary.setOnClickListener(secondaryActionListener);
ImageLoader.getInstance().loadThumbnailBitmap(
item,
holder.imageView,
(int) convertView.getResources().getDimension(
R.dimen.thumbnail_length)
);
return convertView;
}
private View.OnClickListener secondaryActionListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
FeedItem item = (FeedItem) v.getTag();
actionButtonCallback.onActionButtonPressed(item);
}
};
static class Holder {
TextView title;
ImageView imageView;
ProgressBar downloadProgress;
ImageButton butSecondary;
}
public interface ItemAccess {
int getCount();
FeedItem getItem(int position);
int getItemDownloadProgressPercent(FeedItem item);
}
}

View File

@ -5,6 +5,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import de.danoeh.antennapod.R;
@ -17,14 +18,32 @@ import de.danoeh.antennapod.feed.SearchResult;
import java.util.List;
/** List adapter for search activity. */
public class SearchlistAdapter extends ArrayAdapter<SearchResult> {
public class SearchlistAdapter extends BaseAdapter {
public SearchlistAdapter(Context context, int textViewResourceId,
List<SearchResult> objects) {
super(context, textViewResourceId, objects);
}
private final Context context;
private final ItemAccess itemAccess;
@Override
public SearchlistAdapter(Context context, ItemAccess itemAccess) {
this.context = context;
this.itemAccess = itemAccess;
}
@Override
public int getCount() {
return itemAccess.getCount();
}
@Override
public SearchResult getItem(int position) {
return itemAccess.getItem(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final Holder holder;
SearchResult result = getItem(position);
@ -33,7 +52,7 @@ public class SearchlistAdapter extends ArrayAdapter<SearchResult> {
// Inflate Layout
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) getContext()
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.searchlist_item, null);
@ -78,4 +97,9 @@ public class SearchlistAdapter extends ArrayAdapter<SearchResult> {
TextView subtitle;
}
public static interface ItemAccess {
int getCount();
SearchResult getItem(int position);
}
}

View File

@ -23,9 +23,9 @@ public class DownloadObserver {
/**
* Time period between update notifications.
*/
public static final int WAITING_INTERVAL_MS = 1000;
public static final int WAITING_INTERVAL_MS = 3000;
private final Activity activity;
private volatile Activity activity;
private final Handler handler;
private final Callback callback;
@ -57,19 +57,31 @@ public class DownloadObserver {
public void onResume() {
if (BuildConfig.DEBUG) Log.d(TAG, "DownloadObserver resumed");
activity.registerReceiver(contentChangedReceiver, new IntentFilter(DownloadService.ACTION_DOWNLOADS_CONTENT_CHANGED));
activity.bindService(new Intent(activity, DownloadService.class), mConnection, 0);
connectToDownloadService();
}
public void onPause() {
if (BuildConfig.DEBUG) Log.d(TAG, "DownloadObserver paused");
activity.unregisterReceiver(contentChangedReceiver);
activity.unbindService(mConnection);
try {
activity.unregisterReceiver(contentChangedReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
try {
activity.unbindService(mConnection);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
stopRefresher();
}
private BroadcastReceiver contentChangedReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// reconnect to DownloadService if connection has been closed
if (downloadService == null) {
connectToDownloadService();
}
callback.onContentChanged();
startRefresher();
}
@ -81,6 +93,10 @@ public class DownloadObserver {
void onDownloadDataAvailable(List<Downloader> downloaderList);
}
private void connectToDownloadService() {
activity.bindService(new Intent(activity, DownloadService.class), mConnection, 0);
}
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceDisconnected(ComponentName className) {
downloadService = null;
@ -138,13 +154,21 @@ public class DownloadObserver {
@Override
public void run() {
callback.onContentChanged();
List<Downloader> downloaderList = downloadService.getDownloads();
if (downloaderList == null || downloaderList.isEmpty()) {
Thread.currentThread().interrupt();
if (downloadService != null) {
List<Downloader> downloaderList = downloadService.getDownloads();
if (downloaderList == null || downloaderList.isEmpty()) {
Thread.currentThread().interrupt();
}
}
}
});
}
}
public void setActivity(Activity activity) {
if (activity == null) throw new IllegalArgumentException("activity = null");
this.activity = activity;
}
}

View File

@ -0,0 +1,398 @@
package de.danoeh.antennapod.dialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.PopupMenu;
import android.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.DefaultActionButtonCallback;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.storage.DBTasks;
import de.danoeh.antennapod.storage.DBWriter;
import de.danoeh.antennapod.storage.DownloadRequestException;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.QueueAccess;
import de.danoeh.antennapod.util.ShownotesProvider;
import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler;
import org.apache.commons.lang3.StringEscapeUtils;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
/**
* Shows information about a specific FeedItem and provides actions like playing, downloading, etc.
*/
public class FeedItemDialog extends Dialog {
private static final String TAG = "FeedItemDialog";
private FeedItem item;
private QueueAccess queue;
private View header;
private TextView txtvTitle;
private WebView webvDescription;
private ImageButton butAction1;
private ImageButton butAction2;
private ImageButton butMore;
private PopupMenu popupMenu;
public static FeedItemDialog newInstance(Context context, FeedItemDialogSavedInstance savedInstance) {
if (savedInstance == null) throw new IllegalArgumentException("savedInstance = null");
FeedItemDialog dialog = newInstance(context, savedInstance.item, savedInstance.queueAccess);
if (savedInstance.isShowing) {
dialog.show();
}
return dialog;
}
public static FeedItemDialog newInstance(Context context, FeedItem item, QueueAccess queue) {
if (useDarkThemeWorkAround()) {
return new FeedItemDialog(context, R.style.Theme_AntennaPod_Dark, item, queue);
} else {
return new FeedItemDialog(context, item, queue);
}
}
public FeedItemDialog(Context context, int theme, FeedItem item, QueueAccess queue) {
super(context, theme);
if (item == null) throw new IllegalArgumentException("item = null");
if (queue == null) throw new IllegalArgumentException("queue = null");
this.item = item;
this.queue = queue;
}
private FeedItemDialog(Context context, FeedItem item, QueueAccess queue) {
this(context, 0, item, queue);
}
/**
* Returns true if the dialog should use a dark theme. This has to be done on Gingerbread devices
* because dialogs are only available in a dark theme.
*/
private static boolean useDarkThemeWorkAround() {
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1
&& UserPreferences.getTheme() != R.style.Theme_AntennaPod_Dark;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.feeditem_dialog);
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
header = findViewById(R.id.header);
webvDescription = (WebView) findViewById(R.id.webview);
butAction1 = (ImageButton) findViewById(R.id.butAction1);
butAction2 = (ImageButton) findViewById(R.id.butAction2);
butMore = (ImageButton) findViewById(R.id.butMoreActions);
popupMenu = new PopupMenu(getContext(), butMore);
webvDescription.setWebViewClient(new WebViewClient());
txtvTitle.setText(item.getTitle());
if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
if (Build.VERSION.SDK_INT >= 11
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
webvDescription.setBackgroundColor(getContext().getResources().getColor(
R.color.black));
}
webvDescription.getSettings().setUseWideViewPort(false);
webvDescription.getSettings().setLayoutAlgorithm(
WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webvDescription.getSettings().setLoadWithOverviewMode(true);
webvDescription.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
try {
getContext().startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
return false;
}
return true;
}
});
loadDescriptionWebview(item);
butAction1.setOnClickListener(new View.OnClickListener() {
DefaultActionButtonCallback actionButtonCallback = new DefaultActionButtonCallback(getContext());
@Override
public void onClick(View v) {
FeedMedia media = item.getMedia();
if (media == null) {
return;
}
actionButtonCallback.onActionButtonPressed(item);
}
}
);
butAction2.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
FeedMedia media = item.getMedia();
if (media == null) {
return;
}
if (!media.isDownloaded()) {
DBTasks.playMedia(getContext(), media, true, true, true);
dismiss();
} else {
DBWriter.deleteFeedMediaOfItem(getContext(), media.getId());
}
}
}
);
butMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupMenu.getMenu().clear();
popupMenu.inflate(R.menu.feeditem_dialog);
FeedItemMenuHandler.onPrepareMenu(popupMenuInterface, item, true, queue);
popupMenu.show();
}
}
);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
try {
return FeedItemMenuHandler.onMenuItemClicked(getContext(), menuItem.getItemId(), item);
} catch (DownloadRequestException e) {
e.printStackTrace();
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
return true;
}
}
}
);
updateMenuAppearance();
}
private final FeedItemMenuHandler.MenuInterface popupMenuInterface = new FeedItemMenuHandler.MenuInterface() {
@Override
public void setItemVisibility(int id, boolean visible) {
MenuItem item = popupMenu.getMenu().findItem(id);
if (item != null) {
item.setVisible(visible);
}
}
};
public void updateMenuAppearance() {
if (item == null || queue == null) {
Log.w(TAG, "UpdateMenuAppearance called while item or queue was null");
return;
}
FeedMedia media = item.getMedia();
if (media == null) {
header.setVisibility(View.GONE);
} else {
header.setVisibility(View.VISIBLE);
boolean isDownloading = DownloadRequester.getInstance().isDownloadingFile(media);
TypedArray drawables = getContext().obtainStyledAttributes(new int[]{R.attr.av_play,
R.attr.av_download, R.attr.action_stream, R.attr.content_discard, R.attr.navigation_cancel});
if (!media.isDownloaded()) {
butAction2.setImageDrawable(drawables.getDrawable(2));
butAction2.setContentDescription(getContext().getString(R.string.stream_label));
} else {
butAction2.setImageDrawable(drawables.getDrawable(3));
butAction2.setContentDescription(getContext().getString(R.string.remove_episode_lable));
}
if (isDownloading) {
butAction1.setImageDrawable(drawables.getDrawable(4));
butAction1.setContentDescription(getContext().getString(R.string.cancel_download_label));
} else if (media.isDownloaded()) {
butAction1.setImageDrawable(drawables.getDrawable(0));
butAction1.setContentDescription(getContext().getString(R.string.play_label));
} else {
butAction1.setImageDrawable(drawables.getDrawable(1));
butAction1.setContentDescription(getContext().getString(R.string.download_label));
}
drawables.recycle();
}
}
private void loadDescriptionWebview(final ShownotesProvider shownotesProvider) {
AsyncTask<Void, Void, Void> loadTask = new AsyncTask<Void, Void, Void>() {
String data;
private String applyWebviewStyle(String textColor, String data) {
final String WEBVIEW_STYLE = "<html><head><style type=\"text/css\"> @font-face { font-family: 'Roboto-Light'; src: url('file:///android_asset/Roboto-Light.ttf'); } * { color: %s; font-family: roboto-Light; font-size: 11pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; } img { display: block; margin: 10 auto; max-width: %s; height: auto; } body { margin: %dpx %dpx %dpx %dpx; }</style></head><body>%s</body></html>";
final int pageMargin = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 8, getContext().getResources()
.getDisplayMetrics()
);
return String.format(WEBVIEW_STYLE, textColor, "100%", pageMargin,
pageMargin, pageMargin, pageMargin, data);
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// /webvDescription.loadData(url, "text/html", "utf-8");
if (FeedItemDialog.this.isShowing() && webvDescription != null) {
webvDescription.loadDataWithBaseURL(null, data, "text/html",
"utf-8", "about:blank");
if (BuildConfig.DEBUG)
Log.d(TAG, "Webview loaded");
}
}
@Override
protected Void doInBackground(Void... params) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Loading Webview");
try {
Callable<String> shownotesLoadTask = shownotesProvider.loadShownotes();
final String shownotes = shownotesLoadTask.call();
data = StringEscapeUtils.unescapeHtml4(shownotes);
TypedArray res = getContext()
.getTheme()
.obtainStyledAttributes(
new int[]{android.R.attr.textColorPrimary});
int colorResource;
if (useDarkThemeWorkAround()) {
colorResource = getContext().getResources().getColor(R.color.black);
} else {
colorResource = res.getColor(0, 0);
}
String colorString = String.format("#%06X",
0xFFFFFF & colorResource);
Log.i(TAG, "text color: " + colorString);
res.recycle();
data = applyWebviewStyle(colorString, data);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
};
loadTask.execute();
}
/**
* Convenience method that calls setQueue() and setItemFromCollection() with
* the given arguments.
*
* @return true if one of the calls to setItemFromCollection returned true,
* false otherwise.
*/
public boolean updateContent(QueueAccess queue, List<FeedItem>... collections) {
setQueue(queue);
boolean setItemFromCollectionResult = false;
if (collections != null) {
for (List<FeedItem> list : collections) {
setItemFromCollectionResult |= setItemFromCollection(list);
}
}
if (isShowing()) {
updateMenuAppearance();
}
return setItemFromCollectionResult;
}
public void setItem(FeedItem item) {
if (item == null) throw new IllegalArgumentException("item = null");
this.item = item;
}
/**
* Finds the FeedItem of this dialog in a collection and updates its state from that
* collection.
*
* @return true if the FeedItem was found, false otherwise.
*/
public boolean setItemFromCollection(Collection<FeedItem> items) {
for (FeedItem item : items) {
if (item.getId() == this.item.getId()) {
setItem(item);
return true;
}
}
return false;
}
public void setQueue(QueueAccess queue) {
if (queue == null) throw new IllegalArgumentException("queue = null");
this.queue = queue;
}
public FeedItem getItem() {
return item;
}
public QueueAccess getQueue() {
return queue;
}
public FeedItemDialogSavedInstance save() {
return new FeedItemDialogSavedInstance(item, queue, isShowing());
}
/**
* Used to save the FeedItemDialog's state across configuration changes
* */
public static class FeedItemDialogSavedInstance {
final FeedItem item;
final QueueAccess queueAccess;
final boolean isShowing;
private FeedItemDialogSavedInstance(FeedItem item, QueueAccess queueAccess, boolean isShowing) {
this.item = item;
this.queueAccess = queueAccess;
this.isShowing = isShowing;
}
}
}

View File

@ -0,0 +1,76 @@
package de.danoeh.antennapod.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.activity.OpmlImportFromPathActivity;
import de.danoeh.antennapod.fragment.gpodnet.GpodnetMainFragment;
/**
* Provides actions for adding new podcast subscriptions
*/
public class AddFeedFragment extends Fragment {
private static final String TAG = "AddFeedFragment";
/**
* Preset value for url text field.
*/
public static final String ARG_FEED_URL = "feedurl";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View root = inflater.inflate(R.layout.addfeed, container, false);
final EditText etxtFeedurl = (EditText) root.findViewById(R.id.etxtFeedurl);
Bundle args = getArguments();
if (args != null && args.getString(ARG_FEED_URL) != null) {
etxtFeedurl.setText(args.getString(ARG_FEED_URL));
}
Button butBrowserGpoddernet = (Button) root.findViewById(R.id.butBrowseGpoddernet);
Button butOpmlImport = (Button) root.findViewById(R.id.butOpmlImport);
Button butConfirm = (Button) root.findViewById(R.id.butConfirm);
final MainActivity activity = (MainActivity) getActivity();
activity.getMainActivtyActionBar().setTitle(R.string.add_feed_label);
butBrowserGpoddernet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.loadChildFragment(new GpodnetMainFragment());
}
});
butOpmlImport.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getActivity(),
OpmlImportFromPathActivity.class));
}
});
butConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), DefaultOnlineFeedViewActivity.class);
intent.putExtra(OnlineFeedViewActivity.ARG_FEEDURL, etxtFeedurl.getText().toString());
intent.putExtra(OnlineFeedViewActivity.ARG_TITLE, getString(R.string.add_feed_label));
startActivity(intent);
}
});
return root;
}
}

View File

@ -0,0 +1,195 @@
package de.danoeh.antennapod.fragment;
import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.ListView;
import de.danoeh.antennapod.adapter.DownloadedEpisodesListAdapter;
import de.danoeh.antennapod.dialog.FeedItemDialog;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.storage.DBReader;
import de.danoeh.antennapod.storage.DBWriter;
import de.danoeh.antennapod.util.QueueAccess;
import java.util.List;
/**
* Displays all running downloads and provides a button to delete them
*/
public class CompletedDownloadsFragment extends ListFragment {
private static final int EVENTS =
EventDistributor.DOWNLOAD_HANDLED |
EventDistributor.DOWNLOADLOG_UPDATE |
EventDistributor.QUEUE_UPDATE |
EventDistributor.UNREAD_ITEMS_UPDATE;
private List<FeedItem> items;
private QueueAccess queue;
private DownloadedEpisodesListAdapter listAdapter;
private boolean viewCreated = false;
private boolean itemsLoaded = false;
private FeedItemDialog feedItemDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startItemLoader();
}
@Override
public void onStart() {
super.onStart();
EventDistributor.getInstance().register(contentUpdate);
}
@Override
public void onStop() {
super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
stopItemLoader();
}
@Override
public void onDetach() {
super.onDetach();
stopItemLoader();
}
@Override
public void onDestroyView() {
super.onDestroyView();
listAdapter = null;
viewCreated = false;
feedItemDialog = null;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (viewCreated && itemsLoaded) {
onFragmentLoaded();
}
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewCreated = true;
if (itemsLoaded && getActivity() != null) {
onFragmentLoaded();
}
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
FeedItem item = listAdapter.getItem(position - l.getHeaderViewsCount());
if (item != null) {
feedItemDialog = FeedItemDialog.newInstance(getActivity(), item, queue);
feedItemDialog.show();
}
}
private void onFragmentLoaded() {
if (listAdapter == null) {
listAdapter = new DownloadedEpisodesListAdapter(getActivity(), itemAccess);
setListAdapter(listAdapter);
}
listAdapter.notifyDataSetChanged();
if (feedItemDialog != null) {
boolean res = feedItemDialog.updateContent(queue, items);
if (!res && feedItemDialog.isShowing()) {
feedItemDialog.dismiss();
}
}
}
private DownloadedEpisodesListAdapter.ItemAccess itemAccess = new DownloadedEpisodesListAdapter.ItemAccess() {
@Override
public int getCount() {
return (items != null) ? items.size() : 0;
}
@Override
public FeedItem getItem(int position) {
return (items != null) ? items.get(position) : null;
}
@Override
public void onFeedItemSecondaryAction(FeedItem item) {
DBWriter.deleteFeedMediaOfItem(getActivity(), item.getMedia().getId());
}
};
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EventDistributor.DOWNLOAD_QUEUED) != 0) {
if (feedItemDialog != null && feedItemDialog.isShowing()) {
feedItemDialog.updateMenuAppearance();
}
} else if ((arg & EVENTS) != 0) {
startItemLoader();
}
}
};
private ItemLoader itemLoader;
private void startItemLoader() {
if (itemLoader != null) {
itemLoader.cancel(true);
}
itemLoader = new ItemLoader();
itemLoader.execute();
}
private void stopItemLoader() {
if (itemLoader != null) {
itemLoader.cancel(true);
}
}
private class ItemLoader extends AsyncTask<Void, Void, Object[]> {
@Override
protected void onPreExecute() {
super.onPreExecute();
if (!itemsLoaded && viewCreated) {
setListShown(false);
}
}
@Override
protected void onPostExecute(Object[] results) {
super.onPostExecute(results);
setListShown(true);
if (results != null) {
items = (List<FeedItem>) results[0];
queue = (QueueAccess) results[1];
itemsLoaded = true;
if (viewCreated && getActivity() != null) {
onFragmentLoaded();
}
}
}
@Override
protected Object[] doInBackground(Void... params) {
Context context = getActivity();
if (context != null) {
return new Object[]{DBReader.getDownloadedItems(context),
QueueAccess.IDListAccess(DBReader.getQueueIDList(context))};
}
return null;
}
}
}

View File

@ -0,0 +1,121 @@
package de.danoeh.antennapod.fragment;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.View;
import de.danoeh.antennapod.adapter.DownloadLogAdapter;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.service.download.DownloadStatus;
import de.danoeh.antennapod.storage.DBReader;
import java.util.List;
/**
* Shows the download log
*/
public class DownloadLogFragment extends ListFragment {
private List<DownloadStatus> downloadLog;
private DownloadLogAdapter adapter;
private boolean viewsCreated = false;
private boolean itemsLoaded = false;
@Override
public void onStart() {
super.onStart();
EventDistributor.getInstance().register(contentUpdate);
startItemLoader();
}
@Override
public void onStop() {
super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
stopItemLoader();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewsCreated = true;
if (itemsLoaded) {
onFragmentLoaded();
}
}
private void onFragmentLoaded() {
if (adapter == null) {
adapter = new DownloadLogAdapter(getActivity(), itemAccess);
setListAdapter(adapter);
}
setListShown(true);
adapter.notifyDataSetChanged();
}
private DownloadLogAdapter.ItemAccess itemAccess = new DownloadLogAdapter.ItemAccess() {
@Override
public int getCount() {
return (downloadLog != null) ? downloadLog.size() : 0;
}
@Override
public DownloadStatus getItem(int position) {
return (downloadLog != null) ? downloadLog.get(position) : null;
}
};
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EventDistributor.DOWNLOADLOG_UPDATE) != 0) {
startItemLoader();
}
}
};
private ItemLoader itemLoader;
private void startItemLoader() {
if (itemLoader != null) {
itemLoader.cancel(true);
}
itemLoader = new ItemLoader();
itemLoader.execute();
}
private void stopItemLoader() {
if (itemLoader != null) {
itemLoader.cancel(true);
}
}
private class ItemLoader extends AsyncTask<Void, Void, List<DownloadStatus>> {
@Override
protected void onPostExecute(List<DownloadStatus> downloadStatuses) {
super.onPostExecute(downloadStatuses);
if (downloadStatuses != null) {
downloadLog = downloadStatuses;
itemsLoaded = true;
if (viewsCreated) {
onFragmentLoaded();
}
}
}
@Override
protected List<DownloadStatus> doInBackground(Void... params) {
Context context = getActivity();
if (context != null) {
return DBReader.getDownloadLog(context);
}
return null;
}
}
}

View File

@ -0,0 +1,145 @@
package de.danoeh.antennapod.fragment;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
/**
* Shows the CompletedDownloadsFragment and the RunningDownloadsFragment
*/
public class DownloadsFragment extends Fragment {
public static final String ARG_SELECTED_TAB = "selected_tab";
public static final int POS_RUNNING = 0;
public static final int POS_COMPLETED = 1;
public static final int POS_LOG = 2;
private ViewPager pager;
private MainActivity activity;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View root = inflater.inflate(R.layout.pager_fragment, container, false);
pager = (ViewPager) root.findViewById(R.id.pager);
DownloadsPagerAdapter pagerAdapter = new DownloadsPagerAdapter(getChildFragmentManager(), getResources());
pager.setAdapter(pagerAdapter);
final ActionBar actionBar = activity.getMainActivtyActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.TabListener tabListener = new ActionBar.TabListener() {
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
pager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
};
actionBar.removeAllTabs();
actionBar.addTab(actionBar.newTab()
.setText(R.string.downloads_running_label)
.setTabListener(tabListener));
actionBar.addTab(actionBar.newTab()
.setText(R.string.downloads_completed_label)
.setTabListener(tabListener));
actionBar.addTab(actionBar.newTab()
.setText(R.string.downloads_log_label)
.setTabListener(tabListener));
pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
actionBar.setSelectedNavigationItem(position);
}
});
return root;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getArguments() != null) {
int tab = getArguments().getInt(ARG_SELECTED_TAB);
pager.setCurrentItem(tab, false);
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
this.activity = (MainActivity) activity;
}
@Override
public void onDetach() {
super.onDetach();
activity.getMainActivtyActionBar().removeAllTabs();
activity.getMainActivtyActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
public class DownloadsPagerAdapter extends FragmentPagerAdapter {
Resources resources;
public DownloadsPagerAdapter(FragmentManager fm, Resources resources) {
super(fm);
this.resources = resources;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case POS_RUNNING:
return new RunningDownloadsFragment();
case POS_COMPLETED:
return new CompletedDownloadsFragment();
case POS_LOG:
return new DownloadLogFragment();
default:
return null;
}
}
@Override
public int getCount() {
return 3;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case POS_RUNNING:
return resources.getString(R.string.downloads_running_label);
case POS_COMPLETED:
return resources.getString(R.string.downloads_completed_label);
case POS_LOG:
return resources.getString(R.string.downloads_log_label);
default:
return super.getPageTitle(position);
}
}
}
}

View File

@ -29,8 +29,6 @@ public class ExternalPlayerFragment extends Fragment {
private ImageView imgvCover;
private ViewGroup layoutInfo;
private TextView txtvTitle;
private TextView txtvPosition;
private TextView txtvStatus;
private ImageButton butPlay;
private PlaybackController controller;
@ -48,9 +46,7 @@ public class ExternalPlayerFragment extends Fragment {
imgvCover = (ImageView) root.findViewById(R.id.imgvCover);
layoutInfo = (ViewGroup) root.findViewById(R.id.layoutInfo);
txtvTitle = (TextView) root.findViewById(R.id.txtvTitle);
txtvPosition = (TextView) root.findViewById(R.id.txtvPosition);
butPlay = (ImageButton) root.findViewById(R.id.butPlay);
txtvStatus = (TextView) root.findViewById(R.id.txtvStatus);
layoutInfo.setOnClickListener(new OnClickListener() {
@ -84,12 +80,6 @@ public class ExternalPlayerFragment extends Fragment {
@Override
public void onPositionObserverUpdate() {
int duration = controller.getDuration();
int position = controller.getPosition();
if (duration != PlaybackController.INVALID_TIME
&& position != PlaybackController.INVALID_TIME) {
txtvPosition.setText(getPositionString(position, duration));
}
}
@Override
@ -127,12 +117,10 @@ public class ExternalPlayerFragment extends Fragment {
@Override
public void postStatusMsg(int msg) {
txtvStatus.setText(msg);
}
@Override
public void clearStatusMsg() {
txtvStatus.setText("");
}
@Override
@ -223,8 +211,6 @@ public class ExternalPlayerFragment extends Fragment {
(int) getActivity().getResources().getDimension(
R.dimen.external_player_height));
txtvPosition.setText(getPositionString(media.getPosition(),
media.getDuration()));
fragmentLayout.setVisibility(View.VISIBLE);
if (controller.isPlayingVideo()) {
butPlay.setVisibility(View.GONE);

View File

@ -236,7 +236,7 @@ public class ItemDescriptionFragment extends Fragment {
* value is inserted directly into the CSS String.
*/
private String applyWebviewStyle(String textColor, String data) {
final String WEBVIEW_STYLE = "<html><head><style type=\"text/css\"> * { color: %s; font-family: Helvetica; line-height: 1.5em; font-size: 11pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; } img { display: block; margin: 10 auto; max-width: %s; height: auto; } body { margin: %dpx %dpx %dpx %dpx; }</style></head><body>%s</body></html>";
final String WEBVIEW_STYLE = "<html><head><style type=\"text/css\"> @font-face { font-family: 'Roboto-Light'; src: url('file:///android_asset/Roboto-Light.ttf'); } * { color: %s; font-family: roboto-Light; font-size: 11pt; } a { font-style: normal; text-decoration: none; font-weight: normal; color: #00A8DF; } img { display: block; margin: 10 auto; max-width: %s; height: auto; } body { margin: %dpx %dpx %dpx %dpx; }</style></head><body>%s</body></html>";
final int pageMargin = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
.getDisplayMetrics());

Some files were not shown because too many files have changed in this diff Show More