Added navigation drawer to audio player, fixed DownloadService notification

This commit is contained in:
daniel oeh 2014-04-21 19:33:14 +02:00
parent 15c333ed39
commit e68482e1b8
10 changed files with 767 additions and 514 deletions

View File

@ -40,6 +40,7 @@
<activity
android:name=".activity.MainActivity"
android:configChanges="keyboardHidden|orientation"
android:launchMode="singleTask"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

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

@ -1,173 +1,193 @@
<?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="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/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="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: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: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

@ -28,7 +28,7 @@
<ListView
android:id="@+id/nav_list"
android:layout_width="280dp"
android:layout_width="@dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"

View File

@ -16,4 +16,5 @@
<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>
</resources>

View File

@ -4,11 +4,16 @@ 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.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
@ -18,18 +23,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 +51,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;
@ -108,6 +120,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
super.onStop();
if (BuildConfig.DEBUG)
Log.d(TAG, "onStop");
cancelLoadTask();
EventDistributor.getInstance().unregister(contentUpdate);
}
@ -142,6 +156,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
drawerToggle.onConfigurationChanged(newConfig);
}
@Override
@ -149,6 +164,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
// super.onSaveInstanceState(outState); would cause crash
if (BuildConfig.DEBUG)
Log.d(TAG, "onSaveInstanceState");
}
@Override
@ -223,6 +239,8 @@ public class AudioplayerActivity extends MediaplayerActivity {
switchToFragment(savedPosition);
}
EventDistributor.getInstance().register(contentUpdate);
loadData();
}
@Override
@ -382,12 +400,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
@ -551,4 +610,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

@ -1,10 +1,8 @@
package de.danoeh.antennapod.activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.media.AudioManager;
import android.os.AsyncTask;
import android.os.Bundle;
@ -17,10 +15,11 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.*;
import android.widget.*;
import android.widget.AdapterView;
import android.widget.ListView;
import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.ImageLoader;
import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.feed.EventDistributor;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.fragment.*;
@ -41,6 +40,10 @@ public class MainActivity extends ActionBarActivity {
| EventDistributor.FEED_LIST_UPDATE
| EventDistributor.UNREAD_ITEMS_UPDATE;
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,
@ -157,11 +160,13 @@ public class MainActivity extends ActionBarActivity {
}
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) {
@ -172,6 +177,10 @@ public class MainActivity extends ActionBarActivity {
fragmentManager.popBackStack();
}
fT.commit();
getSupportActionBar().setTitle(currentTitle);
if (navAdapter != null) {
navAdapter.notifyDataSetChanged();
}
}
public void loadNavFragment(int position, Bundle args) {
@ -260,6 +269,8 @@ public class MainActivity extends ActionBarActivity {
selectedNavListIndex = POS_ADD;
navAdapter.notifyDataSetChanged();
}
} else if (feeds != null && intent.hasExtra(EXTRA_NAV_INDEX) && intent.hasExtra(EXTRA_NAV_TYPE)) {
handleNavIntent();
}
}
@ -303,7 +314,7 @@ public class MainActivity extends ActionBarActivity {
private AsyncTask<Void, Void, List<Feed>> loadTask;
private int selectedNavListIndex = 0;
private ItemAccess itemAccess = new ItemAccess() {
private NavListAdapter.ItemAccess itemAccess = new NavListAdapter.ItemAccess() {
@Override
public int getCount() {
if (feeds != null) {
@ -340,8 +351,14 @@ public class MainActivity extends ActionBarActivity {
@Override
protected void onPostExecute(List<Feed> result) {
super.onPostExecute(result);
boolean handleIntent = (feeds == null);
feeds = result;
navAdapter.notifyDataSetChanged();
if (handleIntent) {
handleNavIntent();
}
}
};
loadTask.execute();
@ -365,173 +382,20 @@ public class MainActivity extends ActionBarActivity {
}
};
private static class NavListAdapter extends BaseAdapter {
static final int VIEW_TYPE_COUNT = 3;
static final int VIEW_TYPE_NAV = 0;
static final int VIEW_TYPE_SECTION_DIVIDER = 1;
static final int VIEW_TYPE_SUBSCRIPTION = 2;
static final int[] NAV_TITLES = {R.string.new_episodes_label, R.string.queue_label, R.string.downloads_label, R.string.playback_history_label, R.string.add_feed_label};
static final int SUBSCRIPTION_OFFSET = 1 + NAV_TITLES.length;
private ItemAccess itemAccess;
private Context context;
private NavListAdapter(ItemAccess itemAccess, Context context) {
this.itemAccess = itemAccess;
this.context = context;
}
@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);
convertView.setTag(holder);
} else {
holder = (NavHolder) convertView.getTag();
}
holder.title.setText(title);
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;
}
static class SectionHolder {
TextView title;
}
static class FeedHolder {
TextView title;
ImageView image;
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
}
public interface ItemAccess {
int getCount();
Feed getItem(int position);
int getSelectedItemIndex();
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
}

View File

@ -0,0 +1,186 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.graphics.Typeface;
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.new_episodes_label, R.string.queue_label, R.string.downloads_label, R.string.playback_history_label, R.string.add_feed_label};
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;
}
@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);
convertView.setTag(holder);
} else {
holder = (NavHolder) convertView.getTag();
}
holder.title.setText(title);
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;
}
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

@ -20,6 +20,11 @@ import de.danoeh.antennapod.activity.MainActivity;
*/
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;
@ -70,6 +75,15 @@ public class DownloadsFragment extends Fragment {
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);
@ -85,9 +99,7 @@ public class DownloadsFragment extends Fragment {
public class DownloadsPagerAdapter extends FragmentPagerAdapter {
private final int POS_RUNNING = 0;
private final int POS_COMPLETED = 1;
private final int POS_LOG = 2;
Resources resources;

View File

@ -13,6 +13,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
@ -23,7 +24,10 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DownloadActivity;
import de.danoeh.antennapod.activity.DownloadAuthenticationActivity;
import de.danoeh.antennapod.activity.DownloadLogActivity;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.NavListAdapter;
import de.danoeh.antennapod.feed.*;
import de.danoeh.antennapod.fragment.DownloadsFragment;
import de.danoeh.antennapod.storage.*;
import de.danoeh.antennapod.syndication.handler.FeedHandler;
import de.danoeh.antennapod.syndication.handler.UnsupportedFeedtypeException;
@ -274,11 +278,18 @@ public class DownloadService extends Service {
@SuppressLint("NewApi")
private void setupNotificationBuilders() {
PendingIntent pIntent = PendingIntent.getActivity(this, 0, new Intent(
this, DownloadActivity.class),
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra(MainActivity.EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV);
intent.putExtra(MainActivity.EXTRA_NAV_INDEX, MainActivity.POS_DOWNLOADS);
Bundle args = new Bundle();
args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_RUNNING);
intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT
);
Bitmap icon = BitmapFactory.decodeResource(getResources(),
R.drawable.stat_notify_sync);
@ -490,6 +501,13 @@ public class DownloadService extends Service {
if (createReport) {
if (BuildConfig.DEBUG)
Log.d(TAG, "Creating report");
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra(MainActivity.EXTRA_NAV_TYPE, NavListAdapter.VIEW_TYPE_NAV);
intent.putExtra(MainActivity.EXTRA_NAV_INDEX, MainActivity.POS_DOWNLOADS);
Bundle args = new Bundle();
args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_LOG);
intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args);
// create notification object
Notification notification = new NotificationCompat.Builder(this)
.setTicker(
@ -507,8 +525,7 @@ public class DownloadService extends Service {
R.drawable.stat_notify_sync)
)
.setContentIntent(
PendingIntent.getActivity(this, 0, new Intent(this,
DownloadLogActivity.class), 0)
PendingIntent.getActivity(this, 0, intent, 0)
)
.setAutoCancel(true).getNotification();
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);