Merge branch 'issue-39' into develop

Conflicts:
	res/values/ids.xml
This commit is contained in:
daniel oeh 2013-02-22 23:10:13 +01:00
commit 4fca178972
18 changed files with 658 additions and 242 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "submodules/ViewPagerIndicator"]
path = submodules/ViewPagerIndicator
url = git://github.com/JakeWharton/Android-ViewPagerIndicator.git
[submodule "submodules/dslv"]
path = submodules/dslv
url = git://github.com/bauerca/drag-sort-listview.git

View File

@ -228,6 +228,7 @@
<activity
android:name=".activity.DirectoryChooserActivity"
android:label="@string/choose_data_directory" />
<activity android:label="@string/organize_queue_label" android:name=".activity.OrganizeQueueActivity" android:configChanges="orientation"></activity>
</application>
</manifest>

View File

@ -55,5 +55,7 @@
by The Apache Software Foundation, licensed under the Apache 2.0 license
<h2>flattr4j <a href="http://www.shredzone.org/projects/flattr4j/wiki">(Link)</a></h2>
licensed under the Apache 2.0 license
<h2>drag-sort-listview <a href="https://github.com/bauerca/drag-sort-listview">(Link)</a></h2>
licensed under the Apache 2.0 license
</body>
</html>

460
pom.xml
View File

@ -1,235 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.danoeh</groupId>
<artifactId>antennapod</artifactId>
<packaging>apk</packaging>
<version>0.9.6.4</version>
<name>AntennaPod</name>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.danoeh</groupId>
<artifactId>antennapod</artifactId>
<packaging>apk</packaging>
<version>0.9.6.4</version>
<name>AntennaPod</name>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.shredzone.flattr4j</groupId>
<artifactId>flattr4j-core</artifactId>
<version>2.4</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>4.1.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.viewpagerindicator</groupId>
<artifactId>library</artifactId>
<version>2.3.1</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>annotations</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.shredzone.flattr4j</groupId>
<artifactId>flattr4j-core</artifactId>
<version>2.4</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>4.1.0</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.viewpagerindicator</groupId>
<artifactId>library</artifactId>
<version>2.3.1</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>annotations</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.mobeta.android.dslv</groupId>
<artifactId>drag-sort-listview</artifactId>
<version>0.6.1-SNAPSHOT</version>
<type>apklib</type>
</dependency>
</dependencies>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>17</platform>
</sdk>
<manifest>
<debuggable>true</debuggable>
</manifest>
</configuration>
<extensions>true</extensions>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>17</platform>
</sdk>
<manifest>
<debuggable>true</debuggable>
</manifest>
</configuration>
<extensions>true</extensions>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>development</id>
<!-- using this since activeByDefault does not work well with multiple
profiles -->
<activation>
<property>
<name>environment</name>
<value>!production</value>
</property>
</activation>
<properties>
<deployment.stage>In Development</deployment.stage>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
<deployment.stage>In Production</deployment.stage>
</properties>
</profile>
<profile>
<id>release</id>
<!-- via this activation the profile is automatically used when the release
is done with the maven release plugin -->
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory />
<includes>
<include>${project.build.directory}/${project.artifactId}-${project.version}.apk</include>
</includes>
<keystore>${sign.keystore}</keystore>
<alias>${sign.alias}</alias>
<storepass>${sign.storepass}</storepass>
<keypass>${sign.keypass}</keypass>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
<!-- the signed apk then needs to be zipaligned and we activate proguard
and we run the manifest update -->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<skip>false</skip>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk
</outputApk>
</zipalign>
<manifest>
<debuggable>false</debuggable>
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
</manifest>
<proguard>
<skip>true</skip>
</proguard>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</file>
<type>apk</type>
<classifier>signed-aligned</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/proguard/mapping.txt</file>
<type>map</type>
<classifier>release</classifier>
</artifact>
</artifacts>
</configuration>
<executions>
<execution>
<id>attach-signed-aligned</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<profiles>
<profile>
<id>development</id>
<!-- using this since activeByDefault does not work well with multiple
profiles -->
<activation>
<property>
<name>environment</name>
<value>!production</value>
</property>
</activation>
<properties>
<deployment.stage>In Development</deployment.stage>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
<deployment.stage>In Production</deployment.stage>
</properties>
</profile>
<profile>
<id>release</id>
<!-- via this activation the profile is automatically used when the release
is done with the maven release plugin -->
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory />
<includes>
<include>${project.build.directory}/${project.artifactId}-${project.version}.apk</include>
</includes>
<keystore>${sign.keystore}</keystore>
<alias>${sign.alias}</alias>
<storepass>${sign.storepass}</storepass>
<keypass>${sign.keypass}</keypass>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
<!-- the signed apk then needs to be zipaligned and we activate proguard
and we run the manifest update -->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<skip>false</skip>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk
</outputApk>
</zipalign>
<manifest>
<debuggable>false</debuggable>
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
</manifest>
<proguard>
<skip>true</skip>
</proguard>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</file>
<type>apk</type>
<classifier>signed-aligned</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/proguard/mapping.txt</file>
<type>map</type>
<classifier>release</classifier>
</artifact>
</artifacts>
</configuration>
<executions>
<execution>
<id>attach-signed-aligned</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -12,3 +12,4 @@ proguard.config=proguard.cfg
target=android-17
android.library.reference.1=submodules/ActionBarSherlock/library
android.library.reference.2=submodules/ViewPagerIndicator/library
android.library.reference.3=submodules/dslv/library

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="10dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#ECECEC" />
</shape>
</item>
<item android:top="20dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="30dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#ECECEC" />
</shape>
</item>
<item android:top="40dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
<item android:top="50dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#ECECEC" />
</shape>
</item>
<item android:top="60dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#D2D2D2" />
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
<item android:top="10dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#242A30" />
</shape>
</item>
<item android:top="20dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
<item android:top="30dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#242A30" />
</shape>
</item>
<item android:top="40dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
<item android:top="50dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#242A30" />
</shape>
</item>
<item android:top="60dp">
<shape android:shape="rectangle" >
<corners android:radius="3dp" />
<solid android:color="#BEBEBE" />
</shape>
</item>
</layer-list>

View File

@ -0,0 +1,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res/de.danoeh.antennapod"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.mobeta.android.dslv.DragSortListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
dslv:collapsed_height="2dp"
dslv:drag_enabled="true"
dslv:drag_handle_id="@id/drag_handle"
dslv:drag_scroll_start="0.33"
dslv:drag_start_mode="onDown"
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="false"
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_feeds_label" />
</LinearLayout>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imgvFeedimage"
android:layout_width="@dimen/thumbnail_length"
android:layout_height="@dimen/thumbnail_length"
android:layout_alignParentLeft="true"
android:scaleType="centerCrop" />
<View
android:id="@id/drag_handle"
android:layout_width="@dimen/dragview_length"
android:layout_height="@dimen/dragview_length"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:background="?attr/dragview_background"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_toLeftOf="@id/drag_handle"
android:layout_toRightOf="@id/imgvFeedimage"
android:ellipsize="end"
android:lines="2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="@dimen/text_size_small" />
<TextView
android:id="@+id/txtvFeedname"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@id/drag_handle"
android:layout_toRightOf="@id/imgvFeedimage"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro" />
</RelativeLayout>

View File

@ -30,6 +30,7 @@
<attr name="borderless_button" format="reference" />
<attr name="spinner_button" format="reference" />
<attr name="overlay_drawable" format="reference" />
<attr name="dragview_background" format="reference" />
<!-- Used in itemdescription -->
<attr name="non_transparent_background" format="reference" />
<attr name="overlay_background" format="color" />

View File

@ -3,6 +3,7 @@
<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="enc_icons_size">20dp</dimen>
<dimen name="text_size_micro">12sp</dimen>

View File

@ -12,5 +12,7 @@
<item name="open_in_browser_item" type="id"/>
<item name="copy_url_item" type="id"/>
<item name="share_url_item" type="id"/>
<item name="organize_queue_item" type="id"/>
<item name="drag_handle" type="id"/>
</resources>

View File

@ -118,9 +118,8 @@
<string name="show_player_label">Show player</string>
<!-- Queue operations -->
<string name="move_up_label">Move up</string>
<string name="move_down_label">Move down</string>
<string name="clear_queue_label">Clear queue</string>
<string name="organize_queue_label">Organize queue</string>
<!-- Flattr -->
<string name="flattr_auth_label">Flattr sign-in</string>

View File

@ -34,11 +34,10 @@
<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>
</style>
<style name="AntennaPod.TabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:dividerPadding">10dp</item>
<item name="android:showDividers">middle</item>
<item name="android:paddingTop">16dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
@ -84,6 +83,7 @@
<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>
</style>
<style name="AntennaPod.DarkTabPageIndicator" parent="AntennaPod.TabPageIndicator">

View File

@ -0,0 +1,177 @@
package de.danoeh.antennapod.activity;
import java.util.List;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.mobeta.android.dslv.DragSortListView;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FeedImageLoader;
import de.danoeh.antennapod.feed.FeedItem;
import de.danoeh.antennapod.feed.FeedManager;
public class OrganizeQueueActivity extends SherlockListActivity {
private static final String TAG = "OrganizeQueueActivity";
private static final int MENU_ID_ACCEPT = 2;
private OrganizeAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(PodcastApp.getThemeResourceId());
super.onCreate(savedInstanceState);
setContentView(R.layout.organize_queue);
DragSortListView listView = (DragSortListView) getListView();
listView.setDropListener(dropListener);
listView.setRemoveListener(removeListener);
adapter = new OrganizeAdapter(this, 0, FeedManager.getInstance()
.getQueue());
setListAdapter(adapter);
}
@Override
protected void onPause() {
super.onPause();
try {
unregisterReceiver(contentUpdate);
} catch (IllegalArgumentException e) {
}
}
@Override
protected void onResume() {
super.onResume();
IntentFilter filter = new IntentFilter(FeedManager.ACTION_QUEUE_UPDATE);
filter.addAction(FeedManager.ACTION_FEED_LIST_UPDATE);
registerReceiver(contentUpdate, filter);
}
private BroadcastReceiver contentUpdate = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
};
private DragSortListView.DropListener dropListener = new DragSortListView.DropListener() {
@Override
public void drop(int from, int to) {
FeedManager manager = FeedManager.getInstance();
manager.moveQueueItem(OrganizeQueueActivity.this, from, to, false);
adapter.notifyDataSetChanged();
}
};
private DragSortListView.RemoveListener removeListener = new DragSortListView.RemoveListener() {
@Override
public void remove(int which) {
FeedManager manager = FeedManager.getInstance();
manager.removeQueueItem(OrganizeQueueActivity.this,
(FeedItem) getListAdapter().getItem(which));
}
};
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
TypedArray drawables = obtainStyledAttributes(new int[] { R.attr.navigation_accept });
menu.add(Menu.NONE, MENU_ID_ACCEPT, Menu.NONE, R.string.confirm_label)
.setIcon(drawables.getDrawable(0))
.setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_ID_ACCEPT:
finish();
return true;
default:
return false;
}
}
private static class OrganizeAdapter extends ArrayAdapter<FeedItem> {
private Context context;
public OrganizeAdapter(Context context, int textViewResourceId,
List<FeedItem> objects) {
super(context, textViewResourceId, objects);
this.context = context;
}
@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.organize_queue_listitem, null);
holder.title = (TextView) convertView
.findViewById(R.id.txtvTitle);
holder.feedTitle = (TextView) convertView
.findViewById(R.id.txtvFeedname);
holder.feedImage = (ImageView) convertView
.findViewById(R.id.imgvFeedimage);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.title.setText(item.getTitle());
holder.feedTitle.setText(item.getFeed().getTitle());
holder.feedImage.setTag(item.getFeed().getImage());
FeedImageLoader.getInstance().loadThumbnailBitmap(
item.getFeed().getImage(),
holder.feedImage,
(int) convertView.getResources().getDimension(
R.dimen.thumbnail_length));
return convertView;
}
static class Holder {
TextView title;
TextView feedTitle;
ImageView feedImage;
}
}
}

View File

@ -765,16 +765,29 @@ public class FeedManager {
}
}
public void moveQueueItem(final Context context, FeedItem item, int delta) {
/**
* Moves the queue item at the specified index to another position. If the
* indices are out of range, no operation will be performed.
*
* @param from
* index of the item that is going to be moved
* @param to
* destination index of item
* @param broadcastUpdate
* true if the method should send a queue update broadcast after
* the operation has been performed. This should be set to false
* if the order of the queue is changed through drag & drop
* reordering to avoid visual glitches.
*/
public void moveQueueItem(final Context context, int from, int to,
boolean broadcastUpdate) {
if (AppConfig.DEBUG)
Log.d(TAG, "Moving queue item");
int itemIndex = queue.indexOf(item);
int newIndex = itemIndex + delta;
if (newIndex >= 0 && newIndex < queue.size()) {
FeedItem oldItem = queue.set(newIndex, item);
queue.set(itemIndex, oldItem);
Log.d(TAG, "Moving queue item from index " + from + " to index "
+ to);
if (from >= 0 && from < queue.size() && to >= 0 && to < queue.size()) {
FeedItem item = queue.remove(from);
queue.add(to, item);
dbExec.execute(new Runnable() {
@Override
public void run() {
PodDBAdapter adapter = new PodDBAdapter(context);
@ -783,9 +796,10 @@ public class FeedManager {
adapter.close();
}
});
if (broadcastUpdate) {
sendQueueUpdateBroadcast(context, item);
}
}
sendQueueUpdateBroadcast(context, item);
}
public boolean isInQueue(FeedItem item) {

View File

@ -21,6 +21,7 @@ import com.actionbarsherlock.view.Menu;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.ItemviewActivity;
import de.danoeh.antennapod.activity.OrganizeQueueActivity;
import de.danoeh.antennapod.adapter.ActionButtonCallback;
import de.danoeh.antennapod.adapter.ExternalEpisodesListAdapter;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
@ -60,8 +61,11 @@ public class EpisodesFragment extends SherlockFragment {
filter.addAction(FeedManager.ACTION_QUEUE_UPDATE);
filter.addAction(FeedManager.ACTION_UNREAD_ITEMS_UPDATE);
filter.addAction(FeedManager.ACTION_FEED_LIST_UPDATE);
getActivity().registerReceiver(contentUpdate, filter);
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
@Override
@ -158,6 +162,8 @@ public class EpisodesFragment extends SherlockFragment {
}, selectedItem, false);
} else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) {
menu.add(Menu.NONE, R.id.organize_queue_item, Menu.NONE,
R.string.organize_queue_label);
menu.add(Menu.NONE, R.id.clear_queue_item, Menu.NONE, getActivity()
.getString(R.string.clear_queue_label));
menu.add(Menu.NONE, R.id.download_all_item, Menu.NONE,
@ -187,6 +193,10 @@ public class EpisodesFragment extends SherlockFragment {
} else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) {
handled = true;
switch (item.getItemId()) {
case R.id.organize_queue_item:
startActivity(new Intent(getActivity(),
OrganizeQueueActivity.class));
break;
case R.id.clear_queue_item:
manager.clearQueue(getActivity());
break;

1
submodules/dslv Submodule

@ -0,0 +1 @@
Subproject commit c5f07d473a48325d0f12994025fce525c3027e20