Merge branch 'release-0975'
This commit is contained in:
commit
cef7772a90
5
.gitignore
vendored
5
.gitignore
vendored
@ -12,9 +12,12 @@
|
||||
bin/
|
||||
gen/
|
||||
target/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
gradle.properties
|
||||
.gradle
|
||||
build.xml
|
||||
|
||||
# Backup files
|
||||
@ -27,6 +30,7 @@ build.xml
|
||||
.idea
|
||||
*.iml
|
||||
gen-external-apklibs
|
||||
out
|
||||
#transifex downloads
|
||||
changelog
|
||||
description
|
||||
@ -37,3 +41,4 @@ proguard
|
||||
libs
|
||||
*.DS_Store
|
||||
src/de/danoeh/antennapod/util/flattr/FlattrConfig.java
|
||||
gradle.properties
|
||||
|
8
.gitmodules
vendored
8
.gitmodules
vendored
@ -1,9 +1,3 @@
|
||||
[submodule "submodules/ActionBarSherlock"]
|
||||
path = submodules/ActionBarSherlock
|
||||
url = git://github.com/JakeWharton/ActionBarSherlock.git
|
||||
[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
|
||||
url = git://github.com/danieloeh/drag-sort-listview.git
|
||||
|
@ -21,6 +21,7 @@ trans.ru-RU = res/values-ru/strings.xml
|
||||
trans.ru_RU = res/values-ru/strings.xml
|
||||
trans.uk_UA = res/values-uk-rUA/strings.xml
|
||||
trans.zh_CN = res/values-zh-rCN/strings.xml
|
||||
trans.sv_SE = res/values-sv-rSE/strings.xml
|
||||
|
||||
[antennapod.description]
|
||||
file_filter = description/<lang>.txt
|
||||
|
@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.danoeh.antennapod"
|
||||
android:versionCode="31"
|
||||
android:versionName="0.9.7.4" >
|
||||
android:versionCode="32"
|
||||
android:versionName="0.9.7.5" >
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="10"
|
||||
android:targetSdkVersion="17" />
|
||||
android:targetSdkVersion="18" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
@ -40,15 +40,16 @@
|
||||
android:name=".activity.MainActivity"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.SearchActivity" />
|
||||
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"
|
||||
@ -60,6 +61,7 @@
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="http"/>
|
||||
<data android:scheme="https"/>
|
||||
<data android:host="*"/>
|
||||
<data android:pathPattern=".*\\.xml"/>
|
||||
<data android:pathPattern=".*\\.rss"/>
|
||||
@ -70,6 +72,7 @@
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="http"/>
|
||||
<data android:scheme="https"/>
|
||||
<data android:host="feeds.feedburner.com"/>
|
||||
<data android:host="feedproxy.google.com"/>
|
||||
<data android:host="feeds2.feedburner.com"/>
|
||||
@ -81,6 +84,7 @@
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
<data android:scheme="http"/>
|
||||
<data android:scheme="https"/>
|
||||
<data android:mimeType="text/xml"/>
|
||||
<data android:mimeType="application/rss+xml"/>
|
||||
<data android:mimeType="application/atom+xml"/>
|
||||
@ -99,7 +103,10 @@
|
||||
android:configChanges="orientation|screenSize" >
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.SearchActivity" />
|
||||
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"
|
||||
@ -256,16 +263,16 @@
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/searchable" />
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.SearchActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.MiroGuideMainActivity"
|
||||
android:label="@string/miro_guide_label" >
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.MiroGuideSearchActivity" />
|
||||
android:value="de.danoeh.antennapod.activity.MiroGuideSearchActivity" />
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/miroguide_searchable" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.MiroGuideSearchActivity"
|
||||
@ -278,9 +285,6 @@
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/miroguide_searchable" />
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.MiroGuideSearchActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.MiroGuideCategoryActivity"
|
||||
|
@ -1,6 +1,14 @@
|
||||
Change Log
|
||||
==========
|
||||
|
||||
Version 0.9.7.5
|
||||
---------------
|
||||
* Reduced application startup time
|
||||
* Reduced memory usage
|
||||
* Added option to change the playback speed
|
||||
* Added Swedish translation
|
||||
* Several bugfixes and improvements
|
||||
|
||||
Version 0.9.7.4
|
||||
---------------
|
||||
* Episode cache size can now be set to unlimited
|
||||
|
@ -7,6 +7,7 @@ ortylp
|
||||
LatinSuD
|
||||
wseemann
|
||||
hzulla
|
||||
andrewgaul
|
||||
|
||||
Translations:
|
||||
|
||||
@ -23,4 +24,5 @@ French: lacouture, e2jk
|
||||
Italian (Italy): m.chinni
|
||||
Czech(Czech Republic): elich
|
||||
Azerbaijani: phoenixar
|
||||
Portuguese: smarquespt
|
||||
Portuguese: smarquespt
|
||||
Swedish: nilso, Bio, TwoD, bpnilsson
|
||||
|
@ -1,61 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<style type="text/css">
|
||||
|
||||
* {
|
||||
font-family: Helvetica
|
||||
}
|
||||
header {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-bottom: 500px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
versiontag {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 15pt;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 13pt;
|
||||
}
|
||||
|
||||
a {
|
||||
font-size: 14px;
|
||||
color: #00A8DF;
|
||||
text-decoration: none;
|
||||
}
|
||||
* {
|
||||
font-family: Helvetica
|
||||
}
|
||||
header {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-bottom: 500px;
|
||||
|
||||
</style>
|
||||
<title>About AntennaPod</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" align="center">
|
||||
<img src="logo.png" alt="Logo" width="100px" height="100px"/>
|
||||
<p>AntennaPod, Version 0.9.7.4</p>
|
||||
<p>Copyright © 2012 Daniel Oeh</p>
|
||||
<p>Licensed under the MIT License <a href="LICENSE.html">(View)</a></p>
|
||||
</div>
|
||||
<h1>Used libraries</h1>
|
||||
<h2>ActionBarSherlock <a href="http://actionbarsherlock.com" title="Link">(Link)</a></h2>
|
||||
by Jake Wharton, licensed under the Apache 2.0 license
|
||||
|
||||
<h2>Android-ViewPagerIndicator <a href="http://viewpagerindicator.com">(Link)</a></h2>
|
||||
by Jake Wharton, licensed under the Apache 2.0 license
|
||||
|
||||
<h2>Apache Commons <a href="http://commons.apache.org/">(Link)</a></h2>
|
||||
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>
|
||||
|
||||
}
|
||||
|
||||
versiontag {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 15pt;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 13pt;
|
||||
}
|
||||
|
||||
a {
|
||||
font-size: 14px;
|
||||
color: #00A8DF;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
<title>About AntennaPod</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" align="center">
|
||||
<img src="logo.png" alt="Logo" width="100px" height="100px"/>
|
||||
|
||||
<p>AntennaPod, Version 0.9.7.5</p>
|
||||
|
||||
<p>Copyright © 2012 Daniel Oeh</p>
|
||||
|
||||
<p>Licensed under the MIT License <a href="LICENSE.html">(View)</a></p>
|
||||
</div>
|
||||
<h1>Used libraries</h1>
|
||||
|
||||
<h2>NineOldAndroids <a href="http://nineoldandroids.com">(Link)</a></h2>
|
||||
by Jake Wharton, licensed under the Apache 2.0 license
|
||||
|
||||
<h2>Apache Commons <a href="http://commons.apache.org/">(Link)</a></h2>
|
||||
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
|
||||
<h2>Presto Client <a href="http://www.aocate.com/presto/">(Link)</a></h2>
|
||||
licensed under the Apache 2.0 license
|
||||
</body>
|
||||
</html>
|
||||
|
97
build.gradle
Normal file
97
build.gradle
Normal file
@ -0,0 +1,97 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.5.6'
|
||||
}
|
||||
}
|
||||
apply plugin: 'android'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
def libsdir = new File('libs');
|
||||
if (!libsdir.exists()) {
|
||||
println "Creating libs directory"
|
||||
libsdir.mkdir()
|
||||
}
|
||||
def prestoLib = new File('libs/presto_client-0.8.5.jar')
|
||||
if (!prestoLib.exists()) {
|
||||
println "Downloading presto library into libs folder"
|
||||
new URL('http://www.aocate.com/presto/client/presto_client-0.8.5.jar').withInputStream{ i -> prestoLib.withOutputStream{ it << i }}
|
||||
}
|
||||
|
||||
compile 'com.android.support:appcompat-v7:18.0.+'
|
||||
compile 'org.apache.commons:commons-lang3:3.1'
|
||||
compile ('org.shredzone.flattr4j:flattr4j-core:2.7') {
|
||||
exclude group: 'org.apache.httpcomponents', module: 'httpcore'
|
||||
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
|
||||
exclude group: 'org.json', module: 'json'
|
||||
}
|
||||
compile 'commons-io:commons-io:2.4'
|
||||
compile 'com.nineoldandroids:library:2.4.0'
|
||||
compile project(':submodules:dslv:library')
|
||||
compile files('libs/presto_client-0.8.5.jar')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 18
|
||||
buildToolsVersion "17"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 10
|
||||
targetSdkVersion 18
|
||||
testPackageName "de.test.antennapod"
|
||||
testInstrumentationRunner "instrumentationTest.de.test.antennapod.AntennaPodTestRunner"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
releaseConfig {
|
||||
if (project.hasProperty('releaseStoreFile')) {
|
||||
storeFile file(releaseStoreFile)
|
||||
} else {
|
||||
storeFile file('keystore')
|
||||
}
|
||||
if (project.hasProperty('releaseStorePassword')) {
|
||||
storePassword releaseStorePassword
|
||||
} else {
|
||||
storePassword "password"
|
||||
}
|
||||
if (project.hasProperty('releaseKeyAlias')) {
|
||||
keyAlias releaseKeyAlias
|
||||
} else {
|
||||
keyAlias "alias"
|
||||
}
|
||||
if (project.hasProperty('releaseKeyPassword')) {
|
||||
keyPassword releaseKeyPassword
|
||||
} else {
|
||||
keyPassword "password"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['src']
|
||||
aidl.srcDirs = ['src']
|
||||
renderscript.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
packageNameSuffix ".debug"
|
||||
}
|
||||
release {
|
||||
runProguard true
|
||||
proguardFile 'proguard.cfg'
|
||||
signingConfig signingConfigs.releaseConfig
|
||||
}
|
||||
}
|
||||
}
|
488
pom.xml
488
pom.xml
@ -1,246 +1,268 @@
|
||||
<?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.7.4</version>
|
||||
<name>AntennaPod</name>
|
||||
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.7.5</version>
|
||||
<name>AntennaPod</name>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>android.support</groupId>
|
||||
<artifactId>compatibility-v4</artifactId>
|
||||
<version>18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>android.support</groupId>
|
||||
<artifactId>compatibility-v7-appcompat</artifactId>
|
||||
<version>18</version>
|
||||
<type>apklib</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>android.support</groupId>
|
||||
<artifactId>compatibility-v7-appcompat</artifactId>
|
||||
<version>18</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android-test</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<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.7</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.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>
|
||||
<dependency>
|
||||
<groupId>com.nineoldandroids</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aocate</groupId>
|
||||
<artifactId>presto_client</artifactId>
|
||||
<version>0.8.5</version>
|
||||
<type>jar</type>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/presto_client-0.8.5.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<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>
|
||||
<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.6.1</version>
|
||||
<configuration>
|
||||
<sdk>
|
||||
<path>${env.ANDROID_HOME}</path>
|
||||
<platform>18</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.6.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>
|
||||
<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>
|
||||
<arguments>
|
||||
<argument>-sigalg</argument><argument>MD5withRSA</argument>
|
||||
<argument>-digestalg</argument><argument>SHA1</argument>
|
||||
</arguments>
|
||||
</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>false</versionCodeAutoIncrement>
|
||||
</manifest>
|
||||
<proguard>
|
||||
</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>
|
||||
<config>proguard.cfg</config>
|
||||
</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>
|
||||
<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>false</versionCodeAutoIncrement>
|
||||
</manifest>
|
||||
<proguard>
|
||||
<skip>false</skip>
|
||||
<config>proguard-mvn.cfg</config>
|
||||
</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>
|
||||
|
66
proguard-mvn.cfg
Normal file
66
proguard-mvn.cfg
Normal file
@ -0,0 +1,66 @@
|
||||
-printmapping out.map
|
||||
-renamesourcefileattribute SourceFile
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
-dontpreverify
|
||||
-repackageclasses ''
|
||||
-allowaccessmodification
|
||||
-optimizations !code/simplification/arithmetic
|
||||
-keepattributes *Annotation*
|
||||
|
||||
-injars libs/presto_client-0.8.5.jar
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
|
||||
-keep public class * extends android.view.View {
|
||||
public <init>(android.content.Context);
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
public void set*(...);
|
||||
}
|
||||
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
|
||||
-keepclassmembers class * extends android.content.Context {
|
||||
public void *(android.view.View);
|
||||
public void *(android.view.MenuItem);
|
||||
}
|
||||
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
static android.os.Parcelable$Creator CREATOR;
|
||||
}
|
||||
|
||||
-keepclassmembers class **.R$* {
|
||||
public static <fields>;
|
||||
}
|
||||
|
||||
-keep class android.support.v4.** { *; }
|
||||
-keep interface android.support.v4.** { *; }
|
||||
-keep class android.support.v7.** { *; }
|
||||
-keep interface android.support.v7.** { *; }
|
||||
-dontwarn android.support.v4.**
|
||||
-dontwarn android.support.v7.**
|
||||
|
||||
-keepattributes *Annotation*
|
||||
|
||||
-keep class org.shredzone.flattr4j.** { *; }
|
||||
-dontwarn org.shredzone.flattr4j.**
|
||||
|
||||
-keep class org.apache.commons.** { *; }
|
||||
|
||||
-dontskipnonpubliclibraryclassmembers
|
15
proguard.cfg
15
proguard.cfg
@ -8,10 +8,7 @@
|
||||
-optimizations !code/simplification/arithmetic
|
||||
-keepattributes *Annotation*
|
||||
|
||||
#-libraryjars libs/android-support-v4.jar
|
||||
#-libraryjars libs/commons-lang3-3.1.jar
|
||||
#-libraryjars libs/flattr4j-core-2.4.jar
|
||||
#-libraryjars libs/commons-io-2.4.jar
|
||||
#-injars libs/presto_client-0.8.5.jar
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
@ -52,10 +49,12 @@
|
||||
public static <fields>;
|
||||
}
|
||||
|
||||
-keep class android.support.v4.app.** { *; }
|
||||
-keep interface android.support.v4.app.** { *; }
|
||||
-keep class com.actionbarsherlock.** { *; }
|
||||
-keep interface com.actionbarsherlock.** { *; }
|
||||
-keep class android.support.v4.** { *; }
|
||||
-keep interface android.support.v4.** { *; }
|
||||
-keep class android.support.v7.** { *; }
|
||||
-keep interface android.support.v7.** { *; }
|
||||
-dontwarn android.support.v4.**
|
||||
-dontwarn android.support.v7.**
|
||||
|
||||
-keepattributes *Annotation*
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
# Project target.
|
||||
proguard.config=proguard.cfg
|
||||
target=android-17
|
||||
target=android-18
|
||||
android.library.reference.1=submodules/ActionBarSherlock/library
|
||||
android.library.reference.2=submodules/ViewPagerIndicator/library
|
||||
android.library.reference.3=submodules/dslv/library
|
||||
|
@ -92,14 +92,12 @@
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="?attr/borderless_button"
|
||||
android:src="?attr/av_pause" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butRev"
|
||||
android:layout_width="80dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toLeftOf="@id/butPlay"
|
||||
android:background="?attr/borderless_button"
|
||||
@ -107,11 +105,22 @@
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/butFF"
|
||||
android:layout_width="80dp"
|
||||
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
|
||||
|
@ -19,7 +19,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_feeds_label" />
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
@ -79,8 +79,6 @@
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:background="?attr/borderless_button"
|
||||
android:src="?attr/av_pause" />
|
||||
|
||||
@ -99,6 +97,17 @@
|
||||
android:layout_toRightOf="@id/butPlay"
|
||||
android:background="?attr/borderless_button"
|
||||
android:src="?attr/av_fast_forward" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/butPlaybackSpeed"
|
||||
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
|
||||
|
@ -16,7 +16,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_items_label" />
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
@ -15,7 +15,5 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/no_feeds_label" />
|
||||
|
||||
android:layout_gravity="center"/>
|
||||
</LinearLayout>
|
12
res/layout/listview_activity.xml
Normal file
12
res/layout/listview_activity.xml
Normal 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">
|
||||
<ListView
|
||||
android:id="@+id/listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
@ -5,17 +5,15 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<com.viewpagerindicator.TabPageIndicator
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="1">
|
||||
<android.support.v4.view.PagerTabStrip
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top" />
|
||||
</android.support.v4.view.ViewPager>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:dslv="http://schemas.android.com/apk/res/de.danoeh.antennapod"
|
||||
xmlns:dslv="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
|
@ -1,17 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/all_feed_refresh" android:title="@string/refresh_label" android:icon="?attr/navigation_refresh" android:showAsAction="ifRoom|collapseActionView">
|
||||
</item><item
|
||||
<item
|
||||
android:id="@+id/all_feed_refresh"
|
||||
android:title="@string/refresh_label"
|
||||
android:icon="?attr/navigation_refresh"
|
||||
android:showAsAction="ifRoom|collapseActionView">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/add_feed"
|
||||
android:title="@string/add_feed_label"
|
||||
android:icon="?attr/content_new"
|
||||
android:showAsAction="ifRoom|collapseActionView">
|
||||
</item>
|
||||
|
||||
|
||||
|
||||
<item android:id="@id/search_item" android:icon="?attr/action_search" android:title="@string/search_label" android:showAsAction="ifRoom|collapseActionView"></item><item android:id="@+id/show_player" android:title="@string/show_player_label" android:icon="@drawable/av_play" android:showAsAction="collapseActionView"></item><item android:id="@+id/show_playback_history" android:title="@string/playback_history_label" android:showAsAction="collapseActionView"></item><item android:id="@+id/show_downloads" android:title="@string/downloads_label" android:icon="@drawable/av_download" android:showAsAction="collapseActionView">
|
||||
</item><item android:id="@+id/show_preferences" android:title="@string/settings_label" android:icon="?attr/action_settings" android:showAsAction="collapseActionView"></item>
|
||||
|
||||
|
||||
|
||||
|
||||
<item
|
||||
android:id="@id/search_item"
|
||||
android:icon="?attr/action_search"
|
||||
android:title="@string/search_label"
|
||||
android: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"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
<item
|
||||
android:id="@+id/show_playback_history"
|
||||
android:title="@string/playback_history_label"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
<item
|
||||
android:id="@+id/show_downloads"
|
||||
android:title="@string/downloads_label"
|
||||
android:icon="@drawable/av_download"
|
||||
android:showAsAction="collapseActionView">
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/show_preferences"
|
||||
android:title="@string/settings_label"
|
||||
android:icon="?attr/action_settings"
|
||||
android:showAsAction="collapseActionView"/>
|
||||
|
||||
|
||||
</menu>
|
||||
|
@ -129,6 +129,7 @@
|
||||
<string name="access_revoked_info">AntennaPod\'un keçid tokeni uğurlu ləğv olundu.</string>
|
||||
<string name="flattr_click_success">Flattrma uğurludur</string>
|
||||
<string name="flattring_label">Flattrləmə</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Siyahıda heç nə yoxdur</string>
|
||||
<string name="no_feeds_label">Hələ heç bir kanala yazilmadınız</string>
|
||||
@ -140,7 +141,7 @@
|
||||
<string name="pref_followQueue_sum">Oynatma başa çatanda növbədə irəlidəki epizodu oynat</string>
|
||||
<string name="playback_pref">Oynatma</string>
|
||||
<string name="network_pref">Şəbəkə</string>
|
||||
<string name="pref_autoUpdateIntervall_title">Təzələmə intervali</string>
|
||||
<string name="pref_autoUpdateIntervall_title">Təzələmə intervalı</string>
|
||||
<string name="pref_autoUpdateIntervall_sum">Kanalın avtomatik təzələməsinin intervalını seç ya da keçir onu</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Təkçə Wi-Fi vasitəsiilə yüklə</string>
|
||||
<string name="pref_followQueue_title">Fasiləsiz oynatma</string>
|
||||
@ -214,7 +215,7 @@
|
||||
<string name="miro_search_hint">MiroGuide\'da axtar</string>
|
||||
<string name="popular_label">Populyar</string>
|
||||
<string name="best_rating_label">Ən reytinqli</string>
|
||||
<string name="add_feed_label">Kanalı əlavə et</string>
|
||||
<string name="add_feed_label">Kanal əlavə et</string>
|
||||
<string name="miro_feed_added">Kanal əlavə olundu</string>
|
||||
<!--Directory chooser-->
|
||||
<string name="selected_folder_label">Seçilən qovluq:</string>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">S\'està processant</string>
|
||||
<string name="loading_label">S\'està carregant...</string>
|
||||
<string name="image_of_prefix">Imatge de:\u0020</string>
|
||||
<string name="close_label">Tanca</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">Enllaç del canal</string>
|
||||
<string name="txtvfeedurl_label">Escriviu l\'enllaç del canal aquí:</string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">El testimoni d\'accés a Flattr de l\'AntennaPod s\'ha revocat correctament. Per completar el procés, heu de suprimir aquesta aplicació de la llista d\'aplicacions aprovades que trobareu a l\'apartat de configuració del compte de la plana web de Flattr.</string>
|
||||
<string name="flattr_click_success">S\'ha compartit el contingut a través de Flattr</string>
|
||||
<string name="flattring_label">S\'està compartint amb Flattr</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Baixa el connector</string>
|
||||
<string name="no_playback_plugin_title">Connector no instal·lat</string>
|
||||
<string name="no_playback_plugin_msg">Per a què funcioni la velocitat de reproducció variable, cal instal·lar una biblioteca addicional.\n\nFeu un toc a «Baixa el connector» per baixar-vos el connector gratuït des de la Play Store.\n\nQualsevol problema que sorgeixi en utilitzar aquest connector no és culpa de l\'AntennaPod. Cal informar-ne, doncs, al propietari del connector.</string>
|
||||
<string name="set_playback_speed_label">Velocitats de reproducció</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">No hi ha elements a la llista.</string>
|
||||
<string name="no_feeds_label">No us heu subscrit a cap canal.</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">hores</string>
|
||||
<string name="pref_update_interval_hours_singular">hora</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<string name="pref_playback_speed_title">Velocitats de reproducció</string>
|
||||
<string name="pref_playback_speed_sum">Personalitzeu les velocitats disponibles per a una velocitat de reproducció d\'àudio variable</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Cerca canals o episodis</string>
|
||||
<string name="found_in_shownotes_label">Trobat a notes del programa</string>
|
||||
|
@ -129,6 +129,7 @@
|
||||
<string name="access_revoked_info">Úspěšně revokován přístup AntennPodu k vašemu účtu. Pro dokončení tohoto procesu je ještě zapotřebí na stránkách flattru odebrat z vašeho účtu AntennaPod ze seznamu povolených aplikací.</string>
|
||||
<string name="flattr_click_success">Úspěšně flattrováno!</string>
|
||||
<string name="flattring_label">Flattruji</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Žádné položky v seznamu.</string>
|
||||
<string name="no_feeds_label">Zatím nebyly přidány žádné zdroje.</string>
|
||||
|
@ -129,6 +129,7 @@
|
||||
<string name="access_revoked_info">Du har succesfuldt tilbagekaldt AntennaPods adgangs polet til din konto. For at fuldføre processen skal du fjerne denne app fra listen af godkendte applikationer i din kontos indstillinger på flattr\'s hjemmeside.</string>
|
||||
<string name="flattr_click_success">Det er lykkedes at flattr dette emne!</string>
|
||||
<string name="flattring_label">Flattere</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Der er ingen emner i denne liste.</string>
|
||||
<string name="no_feeds_label">Du har endnu ikke abonneret til nogle feeds.</string>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<string name="error_label">Fehler</string>
|
||||
<string name="error_msg_prefix">Ein Fehler ist aufgetreten:</string>
|
||||
<string name="refresh_label">Aktualisieren</string>
|
||||
<string name="external_storage_error_msg">Der externe Speicher ist nicht verfügbar. Bitte stelle sicher, dass das externe Speichermedium eingelegt ist, damit die App funktioniert.</string>
|
||||
<string name="external_storage_error_msg">Der externe Speicher ist nicht verfügbar. Bitte stelle sicher, dass das externe Speichermedium eingelegt ist, damit die Anwendung funktioniert.</string>
|
||||
<string name="chapters_label">Kapitel</string>
|
||||
<string name="shownotes_label">Notizen</string>
|
||||
<string name="most_recent_prefix">Letzte Episode:\u0020</string>
|
||||
@ -38,8 +38,9 @@
|
||||
<string name="length_prefix">Länge:\u0020</string>
|
||||
<string name="size_prefix">Größe:\u0020</string>
|
||||
<string name="processing_label">Verarbeite</string>
|
||||
<string name="loading_label">Lade...</string>
|
||||
<string name="loading_label">Lade ...</string>
|
||||
<string name="image_of_prefix">Bild von:\u0020</string>
|
||||
<string name="close_label">Schließen</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">Feed URL</string>
|
||||
<string name="txtvfeedurl_label">Gib die URL des Feeds hier ein:</string>
|
||||
@ -67,7 +68,7 @@
|
||||
<string name="skip_episode_label">Episode überspringen</string>
|
||||
<!--Download messages and labels-->
|
||||
<string name="download_successful">Download erfolgreich</string>
|
||||
<string name="download_failed">Download fehlgeschlagen</string>
|
||||
<string name="download_failed">Herunterladen fehlgeschlagen</string>
|
||||
<string name="download_pending">Download anstehend</string>
|
||||
<string name="download_running">Download läuft</string>
|
||||
<string name="download_error_device_not_found">Speichermedium nicht gefunden</string>
|
||||
@ -119,16 +120,21 @@
|
||||
<string name="flattr_auth_explanation">Drücke den Button unten um den Authentifizierungsprozess zu starten. Du wirst dann zur Flattr-Anmeldeseite weitergeleitet, wo du gefragt wirst, AntennaPod die Erlaubnis zu geben, Dinge zu flattrn. Nachdem du die Erlaubnis erteilt hast, kehrst du automatisch zu diesem Bildschirm zurück.</string>
|
||||
<string name="authenticate_label">Authentifizieren</string>
|
||||
<string name="return_home_label">Zur Hauptseite zurückkehren</string>
|
||||
<string name="flattr_auth_success">Die Authentifizierung war erfolgreich! Du kannst nun in der App Flattr verwenden.</string>
|
||||
<string name="flattr_auth_success">Die Authentifizierung war erfolgreich! Du kannst nun in der Anwendung Flattr verwenden.</string>
|
||||
<string name="no_flattr_token_title">Kein Flattr Token gefunden</string>
|
||||
<string name="no_flattr_token_msg">Dein Flattr Account scheint nicht mit AntennaPod verbunden zu sein. Du kannst entweder deinen Account mit AntennaPod verbinden, um direkt in der App Flattr zu verwenden, oder du kannst die Flattr-Seite der Sache im Web besuchen.</string>
|
||||
<string name="no_flattr_token_msg">Dein Flattr Account scheint nicht mit AntennaPod verbunden zu sein. Du kannst entweder deinen Account mit AntennaPod verbinden, um direkt in der Anwendung Flattr zu verwenden, oder du kannst die Flattr-Seite der Sache im Netz besuchen.</string>
|
||||
<string name="authenticate_now_label">Authentifizieren</string>
|
||||
<string name="action_forbidden_title">Aktion verboten</string>
|
||||
<string name="action_forbidden_msg">AntennaPod besitzt keine Erlaubnis für diese Aktion. Der Grund dafür könnte sein, dass AntennaPods Zugangstoken aufgehoben worden ist. Du kannst dich entweder erneut authentifizieren oder die Flattr-Seite der Sache im Web besuchen.</string>
|
||||
<string name="access_revoked_title">Zugriff widerrufen</string>
|
||||
<string name="access_revoked_info">Du hast AntennaPod das Zugangstoken zu deinem Account entzogen. Um diesen Prozess abzuschließen, musst du diese App aus der Liste der zugelassenen Anwendungen in deinen Account Einstellungen auf der Flattr Webseite entfernen.</string>
|
||||
<string name="access_revoked_info">Du hast AntennaPod das Zugangstoken zu deinem Account entzogen. Um diesen Prozess abzuschließen, musst du diese Anwendung aus der Liste der zugelassenen Anwendungen in deinen Account Einstellungen auf der Flattr Webseite entfernen.</string>
|
||||
<string name="flattr_click_success">Du hast erfolgreich diese Sache mit Flattr unterstützt!</string>
|
||||
<string name="flattring_label">Flattre diese Sache</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Plugin herunterladen</string>
|
||||
<string name="no_playback_plugin_title">Plugin nicht installiert</string>
|
||||
<string name="no_playback_plugin_msg">Um die Wiedergabegeschwindigkeit zu verändern, muss eine Drittanbieter-Bibliothek heruntegeladen werden.\n\nDrücke auf \"Plugin herunterladen\", um ein kostenloses Plugin aus dem Play Store zu installieren.\n\nProbleme, die bei der Benutzung des Plugins auftreten, sollten dem Entwickler des Plugins gemeldet werden.</string>
|
||||
<string name="set_playback_speed_label">Wiedergabegeschwindigkeiten</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Es sind keine Einträge in dieser Liste.</string>
|
||||
<string name="no_feeds_label">Du hast noch keine Feeds abonniert.</string>
|
||||
@ -146,16 +152,16 @@
|
||||
<string name="pref_followQueue_title">Durchgehendes Abspielen</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">WiFi Medien-Download</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_title">Kopfhörer-Trennung</string>
|
||||
<string name="pref_mobileUpdate_title">Mobile Updates</string>
|
||||
<string name="pref_mobileUpdate_sum">Erlaube Updates über die mobile Datenverbindung</string>
|
||||
<string name="pref_mobileUpdate_title">Mobile Aktualisierungen</string>
|
||||
<string name="pref_mobileUpdate_sum">Erlaube Aktualisierungen über die mobile Datenverbindung</string>
|
||||
<string name="refreshing_label">Aktualisiere</string>
|
||||
<string name="flattr_settings_label">Flattr Einstellungen</string>
|
||||
<string name="pref_flattr_auth_title">Flattr Anmeldung</string>
|
||||
<string name="pref_flattr_auth_sum">Melde dich mit deinem Flattr Account an, um direkt in der App zu flattrn.</string>
|
||||
<string name="pref_flattr_this_app_title">Flattr diese App</string>
|
||||
<string name="pref_flattr_auth_sum">Melde dich mit deinem Flattr Account an, um direkt in der Anwendung zu flattrn.</string>
|
||||
<string name="pref_flattr_this_app_title">Flattr diese Anwendung</string>
|
||||
<string name="pref_flattr_this_app_sum">Unterstütze die Entwicklung von AntennaPod mit Flattr. Danke!</string>
|
||||
<string name="pref_revokeAccess_title">Zugriff entziehen</string>
|
||||
<string name="pref_revokeAccess_sum">Entziehe dieser App die Zugriffserlaubnis für deinen Flattr account</string>
|
||||
<string name="pref_revokeAccess_sum">Entziehe dieser Anwendung die Zugriffserlaubnis für deinen Flattr Account.</string>
|
||||
<string name="pref_display_only_episodes_title">Nur Episoden anzeigen</string>
|
||||
<string name="pref_display_only_episodes_sum">Zeige nur Feed-Einträge mit Episoden an.</string>
|
||||
<string name="user_interface_label">Benutzeroberfläche</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">Stunden</string>
|
||||
<string name="pref_update_interval_hours_singular">Stunde</string>
|
||||
<string name="pref_update_interval_hours_manual">Manuell</string>
|
||||
<string name="pref_playback_speed_title">Wiedergabegeschwindigkeiten</string>
|
||||
<string name="pref_playback_speed_sum">Lege die verfügbaren Werte für die Veränderung der Wiedergabeschwindigkeit fest</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Suche nach Feeds oder Episoden</string>
|
||||
<string name="found_in_shownotes_label">In Sendungsnotizen gefunden</string>
|
||||
@ -200,10 +208,10 @@
|
||||
<string name="opml_export_success_title">OPML Export erfolgreich</string>
|
||||
<string name="opml_export_success_sum">Die .opml Datei wurde unter dem folgenden Pfad gespeichert:\u0020</string>
|
||||
<!--Sleep timer-->
|
||||
<string name="set_sleeptimer_label">Sleep timer setzen</string>
|
||||
<string name="disable_sleeptimer_label">Sleep Timer deaktivieren</string>
|
||||
<string name="set_sleeptimer_label">Schlummerfunktion</string>
|
||||
<string name="disable_sleeptimer_label">Schlummerfunktion deaktivieren</string>
|
||||
<string name="enter_time_here_label">Zeit eingeben</string>
|
||||
<string name="sleep_timer_label">Sleep timer</string>
|
||||
<string name="sleep_timer_label">Schlummerfunktion</string>
|
||||
<string name="time_left_label">Zeit übrig:\u0020</string>
|
||||
<string name="time_dialog_invalid_input">Ungültige Eingabe, Zeit muss eine Ganzzahl sein</string>
|
||||
<!--Miro Guide-->
|
||||
|
@ -126,6 +126,7 @@
|
||||
<string name="access_revoked_info">Ha revocado el token de acceso de AntennaPod a su cuenta. Para completar el proceso debe eliminar esta aplicación de la lista de aplicaciones aprobadas, en los ajustes de Flattr.</string>
|
||||
<string name="flattr_click_success">Ha valorado esto en Flattr.</string>
|
||||
<string name="flattring_label">Valoración en Flattr</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Esta lista no tiene elementos.</string>
|
||||
<string name="no_feeds_label">No se ha suscrito a ningún canal.</string>
|
||||
|
@ -12,14 +12,14 @@
|
||||
<string name="downloads_label">Descargas</string>
|
||||
<string name="cancel_download_label">Cancelar descarga</string>
|
||||
<string name="download_log_label">Registro de descargas</string>
|
||||
<string name="playback_history_label">Historial de reproducción</string>
|
||||
<string name="playback_history_label">Histórico de reproducción</string>
|
||||
<!--Webview actions-->
|
||||
<string name="open_in_browser_label">Abrir en el navegador</string>
|
||||
<string name="copy_url_label">Copiar URL</string>
|
||||
<string name="share_url_label">Compartir URL</string>
|
||||
<string name="copied_url_msg">URL copiada al portapapeles.</string>
|
||||
<!--Playback history-->
|
||||
<string name="clear_history_label">Limpiar el historial</string>
|
||||
<string name="clear_history_label">Vaciar el histórico</string>
|
||||
<!--Other-->
|
||||
<string name="confirm_label">Confirmar</string>
|
||||
<string name="cancel_label">Cancelar</string>
|
||||
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">Procesando</string>
|
||||
<string name="loading_label">Cargando...</string>
|
||||
<string name="image_of_prefix">Imagen de:\u0020</string>
|
||||
<string name="close_label">Cerrar</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">URL del canal</string>
|
||||
<string name="txtvfeedurl_label">Escriba aquí la URL del canal:</string>
|
||||
@ -64,7 +65,7 @@
|
||||
<string name="support_label">Añadir a Flattr</string>
|
||||
<string name="enqueue_all_new">Ponerlos todos en cola</string>
|
||||
<string name="download_all">Descargarlos todos</string>
|
||||
<string name="skip_episode_label">Saltar episodio</string>
|
||||
<string name="skip_episode_label">Omitir episodio</string>
|
||||
<!--Download messages and labels-->
|
||||
<string name="download_successful">Descarga exitosa</string>
|
||||
<string name="download_failed">Descarga errónea</string>
|
||||
@ -82,9 +83,9 @@
|
||||
<string name="cancel_all_downloads_label">Cancelar todas las descargas</string>
|
||||
<string name="download_cancelled_msg">Descarga cancelada</string>
|
||||
<string name="download_report_title">Descargas completadas</string>
|
||||
<string name="download_error_malformed_url">URL malformada</string>
|
||||
<string name="download_error_malformed_url">URL con formato incorrecto</string>
|
||||
<string name="download_error_io_error">Error de E/S</string>
|
||||
<string name="download_error_request_error">Error de petición</string>
|
||||
<string name="download_error_request_error">Error de solicitud</string>
|
||||
<string name="downloads_left">\u0020descargas restantes</string>
|
||||
<string name="download_notification_title">Descargando datos del podcast</string>
|
||||
<string name="download_report_content">%1$d descargas exitosas, %2$d fallidas</string>
|
||||
@ -110,7 +111,7 @@
|
||||
<string name="show_download_log">Mostrar el registro</string>
|
||||
<string name="show_player_label">Mostrar el reproductor</string>
|
||||
<!--Queue operations-->
|
||||
<string name="clear_queue_label">Limpiar la cola</string>
|
||||
<string name="clear_queue_label">Vaciar la cola</string>
|
||||
<string name="organize_queue_label">Organizar cola</string>
|
||||
<string name="undo">Deshacer</string>
|
||||
<string name="removed_from_queue">Artículo eliminado</string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">Ha revocado el token de acceso de AntennaPod a su cuenta. Para completar el proceso debe eliminar esta aplicación de la lista de aplicaciones aprobadas, en los ajustes de Flattr.</string>
|
||||
<string name="flattr_click_success">Ha valorado esto en Flattr.</string>
|
||||
<string name="flattring_label">Valoración en Flattr</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Descargar complemento</string>
|
||||
<string name="no_playback_plugin_title">Complemento no instalado</string>
|
||||
<string name="no_playback_plugin_msg">Para que la reproducción a velocidad variable funcione, es necesario instalar un complemento adicional.\n\nPulse «Descargar complemento» para descargar un complemento gratuito de la Play Store.\n\nSi aparece cualquier problema durante la utilización del complemento, informe de él al propietario, pues éste no es responsabilidad de AntennaPod.</string>
|
||||
<string name="set_playback_speed_label">Velocidades de reproducción</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Esta lista no tiene elementos.</string>
|
||||
<string name="no_feeds_label">No se ha suscrito a ningún canal.</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">horas</string>
|
||||
<string name="pref_update_interval_hours_singular">hora</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<string name="pref_playback_speed_title">Velocidades de reproducción</string>
|
||||
<string name="pref_playback_speed_sum">Personalice las velocidades disponibles para la reproducción de audio a velocidad variable</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Buscar canales o episodios</string>
|
||||
<string name="found_in_shownotes_label">Encontrado en las notas del programa</string>
|
||||
@ -190,7 +198,7 @@
|
||||
<string name="opml_directory_error">¡ERROR!</string>
|
||||
<string name="reading_opml_label">Leyendo el archivo OPML</string>
|
||||
<string name="opml_reader_error">Ha ocurrido un error al leer el archivo OPML</string>
|
||||
<string name="opml_import_error_dir_empty">El directorio de importación está vacío</string>
|
||||
<string name="opml_import_error_dir_empty">El directorio de importación está vacío.</string>
|
||||
<string name="select_all_label">Seleccionar todo</string>
|
||||
<string name="deselect_all_label">Deseleccionar todo</string>
|
||||
<string name="choose_file_to_import_label">Elegir qué archivo importar</string>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<string name="external_storage_error_msg">Aucun stockage externe n\'est disponible. Merci de connecter un volume de stockage externe pour que l\'application puisse fonctionner correctement.</string>
|
||||
<string name="chapters_label">Chapitres</string>
|
||||
<string name="shownotes_label">Notes d\'épisode</string>
|
||||
<string name="most_recent_prefix">Episode le plus récent :\u0020</string>
|
||||
<string name="most_recent_prefix">Épisode le plus récent :\u0020</string>
|
||||
<string name="episodes_suffix">\u0020épisodes</string>
|
||||
<string name="published_prefix">Publié :\u0020</string>
|
||||
<string name="length_prefix">Durée :\u0020</string>
|
||||
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">Traitement en cours</string>
|
||||
<string name="loading_label">En chargement...</string>
|
||||
<string name="image_of_prefix">Image :\u0020</string>
|
||||
<string name="close_label">Fermer</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">URL du flux</string>
|
||||
<string name="txtvfeedurl_label">Entrez l\'URL du flux ici :</string>
|
||||
@ -117,7 +118,7 @@
|
||||
<!--Flattr-->
|
||||
<string name="flattr_auth_label">Connecter à Flattr</string>
|
||||
<string name="flattr_auth_explanation">Appuyez sur le bouton ci-dessous pour vous authentifier. Vous serez envoyés à l\'écran de connexion Flattr dans le navigateur, et il vous sera demandé de donner à AntennaPod la permission de flattr. Une fois ceci fait, vous reviendrez automatiquement à cet écran.</string>
|
||||
<string name="authenticate_label">Authentifier</string>
|
||||
<string name="authenticate_label">S\'authentifier</string>
|
||||
<string name="return_home_label">Revenir au départ</string>
|
||||
<string name="flattr_auth_success">L\'authentification a réussi. Vous pouvez maintenant flattr depuis cette application.</string>
|
||||
<string name="no_flattr_token_title">Aucun jeton Flattr trouvé.</string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">Vous avez révoqué le jeton d\'accès d\'AntennaPod à votre compte. Pour terminer cette opération, vous devez retirer AntennaPod de la liste des applications autorisées sur le site web de Flattr.</string>
|
||||
<string name="flattr_click_success">Flattr réussi !</string>
|
||||
<string name="flattring_label">Flattr en cours</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Télécharger une extension</string>
|
||||
<string name="no_playback_plugin_title">Extension non installée</string>
|
||||
<string name="no_playback_plugin_msg">Pour pouvoir changer la vitesse de lecture il est nécessaire d\'installer une librairie tierce.\n\nSélectionnez \"Télécharger une extension\" pour télécharger une extension gratuite depuis le Play Store\n\nLes problèmes concernant les extensions sont de la responsabilité de leur créateur et non d\'AntennaPod. Veillez à notifier le créateur de l\'extension de tout problème.</string>
|
||||
<string name="set_playback_speed_label">Vitesses de lecture</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Cette liste est vide.</string>
|
||||
<string name="no_feeds_label">Vous n\'êtes encore abonné à aucun flux.</string>
|
||||
@ -136,18 +142,18 @@
|
||||
<string name="other_pref">Autres</string>
|
||||
<string name="about_pref">À propos</string>
|
||||
<string name="queue_label">Liste</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_sum">Interrompre la lecture lorsque le casque est débranché.</string>
|
||||
<string name="pref_followQueue_sum">Après la fin d\'un épisode, passer au suivant.</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_sum">Interrompre la lecture lorsque le casque est débranché</string>
|
||||
<string name="pref_followQueue_sum">Après la fin d\'un épisode, passer au suivant</string>
|
||||
<string name="playback_pref">Lecture</string>
|
||||
<string name="network_pref">Réseau</string>
|
||||
<string name="pref_autoUpdateIntervall_title">Intervalle de mise à jour</string>
|
||||
<string name="pref_autoUpdateIntervall_sum">Indiquer un intervalle de mise à jour automatique des flux, ou le désactiver</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Ne télécharger les épisodes que par WiFi</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Ne télécharger les épisodes que par Wi-Fi</string>
|
||||
<string name="pref_followQueue_title">Lecture continue</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">Téléchargement en WiFi</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">Téléchargement en Wi-Fi</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_title">Déconnexion du casque</string>
|
||||
<string name="pref_mobileUpdate_title">Mise à jour mobile</string>
|
||||
<string name="pref_mobileUpdate_sum">Autoriser les mises à jour à travers la connexion de données mobile.</string>
|
||||
<string name="pref_mobileUpdate_sum">Autoriser les mises à jour à travers la connexion de données mobile</string>
|
||||
<string name="refreshing_label">Mise à jour en cours</string>
|
||||
<string name="flattr_settings_label">Paramètres Flattr</string>
|
||||
<string name="pref_flattr_auth_title">Connexion à Flattr</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">heures</string>
|
||||
<string name="pref_update_interval_hours_singular">heure</string>
|
||||
<string name="pref_update_interval_hours_manual">Manuel</string>
|
||||
<string name="pref_playback_speed_title">Vitesses de lecture</string>
|
||||
<string name="pref_playback_speed_sum">Modifier la liste des vitesses disponibles pour la lecture audio</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Chercher des flux ou épisodes</string>
|
||||
<string name="found_in_shownotes_label">Trouvé dans les notes</string>
|
||||
@ -184,13 +192,13 @@
|
||||
<string name="found_in_title_label">Trouvé dans le titre</string>
|
||||
<!--OPML import and export-->
|
||||
<string name="opml_import_txtv_button_lable">Vous pouvez aussi importer un fichier OPML. Ces fichiers permettent de transférer les flux d\'un podcatcher à un autre :</string>
|
||||
<string name="opml_import_explanation">Pour importer un fichier OPML, copiez-le dans le répertoire suivant, et appuyez sur le bouton ci-dessous pour l\'importer. </string>
|
||||
<string name="opml_import_explanation">Pour importer un fichier OPML, copiez-le dans le répertoire suivant, et appuyez sur le bouton ci-dessous pour l\'importer.</string>
|
||||
<string name="start_import_label">Démarrer l\'importation</string>
|
||||
<string name="opml_import_label">Importation OPML</string>
|
||||
<string name="opml_directory_error">ERREUR !</string>
|
||||
<string name="reading_opml_label">Lecture du fichier OPML</string>
|
||||
<string name="reading_opml_label">Lecture du fichier OPML en cours</string>
|
||||
<string name="opml_reader_error">Une erreur s\'est produite à la lecture du document OPML :</string>
|
||||
<string name="opml_import_error_dir_empty">Le répertoire d\'import est vide.</string>
|
||||
<string name="opml_import_error_dir_empty">Le répertoire d\'importation est vide.</string>
|
||||
<string name="select_all_label">Tout choisir</string>
|
||||
<string name="deselect_all_label">Ne rien choisir</string>
|
||||
<string name="choose_file_to_import_label">Choisir le fichier à importer</string>
|
||||
@ -201,7 +209,7 @@
|
||||
<string name="opml_export_success_sum">Le fichier .opml a été écrit ici :\u0020</string>
|
||||
<!--Sleep timer-->
|
||||
<string name="set_sleeptimer_label">Définir le minuteur d\'arrêt automatique</string>
|
||||
<string name="disable_sleeptimer_label">Désactiver l\'arrêt automatique</string>
|
||||
<string name="disable_sleeptimer_label">Désactiver le minuteur d\'arrêt automatique</string>
|
||||
<string name="enter_time_here_label">Entrer l\'heure</string>
|
||||
<string name="sleep_timer_label">Arrêt automatique</string>
|
||||
<string name="time_left_label">Durée restante :\u0020</string>
|
||||
@ -220,8 +228,8 @@
|
||||
<string name="selected_folder_label">Répertoire choisi :</string>
|
||||
<string name="create_folder_label">Créer répertoire</string>
|
||||
<string name="choose_data_directory">Choisir le répertoire</string>
|
||||
<string name="create_folder_msg">Créer un répertoire nommé \"%1$s\"?</string>
|
||||
<string name="create_folder_success">Répertoire créé avec succès</string>
|
||||
<string name="create_folder_msg">Créer un répertoire nommé \"%1$s\" ?</string>
|
||||
<string name="create_folder_success">Répertoire créé</string>
|
||||
<string name="create_folder_error_no_write_access">Impossible d\'écrire dans ce répertoire</string>
|
||||
<string name="create_folder_error_already_exists">Le répertoire existe déjà</string>
|
||||
<string name="create_folder_error">Impossible de créer le répertoire</string>
|
||||
|
@ -129,6 +129,7 @@
|
||||
<string name="access_revoked_info">Hai revocato l\'accesso di AntennaPod al tuo account. Al fine di completare il processo devi rimuovere l\'app dalla lista delle applicazioni autorizzare nelle impostazioni del tuo account sul sito di flattr.</string>
|
||||
<string name="flattr_click_success">Flattr eseguito con successo!</string>
|
||||
<string name="flattring_label">Flattr in corso</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Non ci sono oggetti in questa lista.</string>
|
||||
<string name="no_feeds_label">Non sei ancora abbonato a nessun feed.</string>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.MediaPlayer" parent="@style/Theme.Sherlock.Light.ForceOverflow">
|
||||
<style name="Theme.MediaPlayer" parent="@style/Theme.AppCompat.Light">
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
</style>
|
||||
</resources>
|
@ -29,9 +29,10 @@
|
||||
<string name="error_label">Erro</string>
|
||||
<string name="error_msg_prefix">Um erro ocorreu:</string>
|
||||
<string name="refresh_label">Atualizar</string>
|
||||
<string name="external_storage_error_msg">Não há dispositivos de armazenamento disponíveis. Por favor, certifique-se de que um dispositivo de armazenamento externo está montado para que o aplicativo possa funcionar adequadamente.</string>
|
||||
<string name="external_storage_error_msg">Não há dispositivos de armazenamento externo disponíveis. Por favor, certifique-se de que um dispositivo de armazenamento externo está montado para que o aplicativo possa funcionar adequadamente.</string>
|
||||
<string name="chapters_label">Capítulos</string>
|
||||
<string name="shownotes_label">Notas do podcast</string>
|
||||
<string name="most_recent_prefix">Episódio mais recente:\u0020</string>
|
||||
<string name="episodes_suffix">\u0020episódios</string>
|
||||
<string name="published_prefix">Publicado:\u0020</string>
|
||||
<string name="length_prefix">Duração:\u0020</string>
|
||||
@ -66,7 +67,7 @@
|
||||
<string name="skip_episode_label">Pular episódio</string>
|
||||
<!--Download messages and labels-->
|
||||
<string name="download_successful">Download com sucesso</string>
|
||||
<string name="download_failed">Download falhou</string>
|
||||
<string name="download_failed">Falha no download</string>
|
||||
<string name="download_pending">Download pendente</string>
|
||||
<string name="download_running">Download em execução</string>
|
||||
<string name="download_error_device_not_found">Dispositivo de armazenamento não encontrado</string>
|
||||
@ -111,6 +112,8 @@
|
||||
<!--Queue operations-->
|
||||
<string name="clear_queue_label">Limpar fila</string>
|
||||
<string name="organize_queue_label">Organizar fila</string>
|
||||
<string name="undo">Desfazer</string>
|
||||
<string name="removed_from_queue">Item removido</string>
|
||||
<!--Flattr-->
|
||||
<string name="flattr_auth_label">Logar no Flattr</string>
|
||||
<string name="flattr_auth_explanation">Pressione o botão abaixo para iniciar o processo de autenticação. Você será direcionado para a tela de login do Flattr, que pedirá autorização para que o AntennaPod utilize o Flattr. Após conceder a permissão, você retornará a esta tela automaticamente.</string>
|
||||
@ -126,22 +129,23 @@
|
||||
<string name="access_revoked_info">Você revogou o token de acesso do AntennaPod com sucesso. Para finalizar o processo, você deve remover esta app da lista de aplicativos aprovados nas configurações de sua conta no website do Flattr.</string>
|
||||
<string name="flattr_click_success">Registrado no Flattr com sucesso!</string>
|
||||
<string name="flattring_label">Registrando no Flattr</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Não existem itens nesta lista.</string>
|
||||
<string name="no_feeds_label">Você ainda não assinou nenhum feed.</string>
|
||||
<!--Preferences-->
|
||||
<string name="other_pref">Outro</string>
|
||||
<string name="other_pref">Outros</string>
|
||||
<string name="about_pref">Sobre</string>
|
||||
<string name="queue_label">Fila</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_sum">Interromper a reprodução quando o fone de ouvido for desconectado</string>
|
||||
<string name="pref_followQueue_sum">Pular para próximo item da fila quando a reprodução terminar</string>
|
||||
<string name="playback_pref">Playback</string>
|
||||
<string name="playback_pref">Reprodução</string>
|
||||
<string name="network_pref">Rede</string>
|
||||
<string name="pref_autoUpdateIntervall_title">Intervalo de atualização</string>
|
||||
<string name="pref_autoUpdateIntervall_sum">Especifica o intervalo em que os feeds serão atualizados automaticamente ou desabilita esta funcionalidade</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Baixar arquivo apenas com WiFi</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Fazer download dos arquivos apenas via rede WiFi</string>
|
||||
<string name="pref_followQueue_title">Reprodução contínua</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">Baixar mídia via WiFi</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">Download de mídia via WiFi</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_title">Fones de ouvido desconectados</string>
|
||||
<string name="pref_mobileUpdate_title">Atualizações via Rede de Dados Celular</string>
|
||||
<string name="pref_mobileUpdate_sum">Permite atualizações quando conectado na rede de dados celular</string>
|
||||
@ -163,6 +167,12 @@
|
||||
<string name="pref_autodl_wifi_filter_title">Habilitar filtro Wi-Fi</string>
|
||||
<string name="pref_autodl_wifi_filter_sum">Permitir download automático somente pelas redes Wi-Fi selecionadas.</string>
|
||||
<string name="pref_episode_cache_title">Cache de episódios</string>
|
||||
<string name="pref_theme_title_light">Claro</string>
|
||||
<string name="pref_theme_title_dark">Escuro</string>
|
||||
<string name="pref_episode_cache_unlimited">Ilimitado</string>
|
||||
<string name="pref_update_interval_hours_plural">horas</string>
|
||||
<string name="pref_update_interval_hours_singular">hora</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Procurar por Feeds ou Episódios</string>
|
||||
<string name="found_in_shownotes_label">Encontrado nas notas do podcast</string>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">A processar...</string>
|
||||
<string name="loading_label">A carregar...</string>
|
||||
<string name="image_of_prefix">Imagem de:\u0020</string>
|
||||
<string name="close_label">Fechar</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">URL da fonte</string>
|
||||
<string name="txtvfeedurl_label">Introduza o URL da fonte:</string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">Você revogou o token de acesso do AntennaPod à sua conta. Para concluir o processo, tem que remover esta aplicação da lista de aplicações presentes nas definições de conta no sítio web do flattr.</string>
|
||||
<string name="flattr_click_success">Flattered com sucesso!</string>
|
||||
<string name="flattring_label">Flattring</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Transferir extra</string>
|
||||
<string name="no_playback_plugin_title">Extra não instalado</string>
|
||||
<string name="no_playback_plugin_msg">Para melhorar a reprodução, deve transferir e instalar um biblioteca de terceiros.\nClique Transferir extra para transferir o extra através da loja Google..\n\nSe encontrar problemas ao utilizar esta biblioteca, os programadores do AntennaPod não podem ser responsabilizados e deve contactar o programador do extra.</string>
|
||||
<string name="set_playback_speed_label">Velocidades de reprodução</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Não existem itens na lista.</string>
|
||||
<string name="no_feeds_label">Ainda não possui quaisquer fontes.</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">horas</string>
|
||||
<string name="pref_update_interval_hours_singular">hora</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<string name="pref_playback_speed_title">Velocidades de reprodução</string>
|
||||
<string name="pref_playback_speed_sum">Personalize as velocidades de reprodução disponíveis.</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Procurar fontes ou episódios</string>
|
||||
<string name="found_in_shownotes_label">Encontrado nas notas</string>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">Procesează</string>
|
||||
<string name="loading_label">Încărcare...</string>
|
||||
<string name="image_of_prefix">Imagine a:\u0020</string>
|
||||
<string name="close_label">închide</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">Adresă feed</string>
|
||||
<string name="txtvfeedurl_label">Scrieți adresa feedului aici:</string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">Ați revocat cu succes accesul AntennaPod la contul vostru. Pentru a completa acest proces trebuie să ștergeți aplicația din lista de aplicații aprobate din setările contului de pe site-ul flattr.</string>
|
||||
<string name="flattr_click_success">Ați flattr cu succes!</string>
|
||||
<string name="flattring_label">Flattring</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Descarcă plugin</string>
|
||||
<string name="no_playback_plugin_title">Plugin neinstalat</string>
|
||||
<string name="no_playback_plugin_msg">Pentru ca viteza variabilă de ascultare să funcționeze este necesară o librărie externă.\n\nApăsați \'Descarcă Plugin\' pentru a descărca un plugin gratuit din Play Store\n\nOrice probleme găsite folosind acest plugin nu sunt responsabilitatea AntennaPod și trebuie raportate autorului pluginului.</string>
|
||||
<string name="set_playback_speed_label">Viteze de ascultare</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Nu sunt elemente în listă.</string>
|
||||
<string name="no_feeds_label">Nu v-ați abonat la nici un feed momentan.</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">ore</string>
|
||||
<string name="pref_update_interval_hours_singular">oră</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<string name="pref_playback_speed_title">Viteze de ascutare</string>
|
||||
<string name="pref_playback_speed_sum">Modifică vitezele disponibile pentru viteza de ascultare.</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Caută feeduri sau episoade</string>
|
||||
<string name="found_in_shownotes_label">Găsit în notițe</string>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<string name="error_label">Ошибка</string>
|
||||
<string name="error_msg_prefix">Произошла ошибка:</string>
|
||||
<string name="refresh_label">Обновить</string>
|
||||
<string name="external_storage_error_msg">Внешний носитель недоступен. Убедитесь что внешний носитель смонтирован, иначе приложение не сможет нормально работать.</string>
|
||||
<string name="external_storage_error_msg">Внешний носитель недоступен. Убедитесь что внешний носитель установлен, иначе приложение не сможет нормально работать.</string>
|
||||
<string name="chapters_label">Разделы</string>
|
||||
<string name="shownotes_label">Описание</string>
|
||||
<string name="most_recent_prefix">Следующий эпизод:\u0020</string>
|
||||
@ -49,7 +49,7 @@
|
||||
<string name="remove_feed_label">Удалить канал</string>
|
||||
<string name="share_link_label">Поделиться ссылкой на сайт</string>
|
||||
<string name="share_source_label">Поделиться ссылкой на канал</string>
|
||||
<string name="feed_delete_confirmation_msg">Подтвердите удаление канала и ВСЕХ закачанных выпусков этого канала.</string>
|
||||
<string name="feed_delete_confirmation_msg">Подтвердите удаление канала и ВСЕХ загруженных с этого канала выпусков.</string>
|
||||
<!--actions on feeditems-->
|
||||
<string name="download_label">Загрузить</string>
|
||||
<string name="play_label">Воспроизвести</string>
|
||||
@ -71,7 +71,7 @@
|
||||
<string name="download_pending">Загрузка в ожидании</string>
|
||||
<string name="download_running">Загрузка в процессе</string>
|
||||
<string name="download_error_device_not_found">Устройство хранения не найдено</string>
|
||||
<string name="download_error_insufficient_space">Недостаточно свободного места</string>
|
||||
<string name="download_error_insufficient_space">Недостаточно памяти</string>
|
||||
<string name="download_error_file_error">Ошибка файла</string>
|
||||
<string name="download_error_http_data_error">Ошибка протокола HTTP</string>
|
||||
<string name="download_error_error_unknown">Неизвестная ошибка</string>
|
||||
@ -116,19 +116,20 @@
|
||||
<string name="removed_from_queue">Удален</string>
|
||||
<!--Flattr-->
|
||||
<string name="flattr_auth_label">Авторизоваться в Flattr</string>
|
||||
<string name="flattr_auth_explanation">Нажмите кнопку чтобы начать процесс авторизации. Вы будете перенаправлены на сайт Flattr где вам нужно будет подключить AntennaPod к вашему аккаунту. После этого вы автоматически будете перенаправлены обратно.</string>
|
||||
<string name="flattr_auth_explanation">Нажмите кнопку, чтобы начать процесс авторизации. Вы будете перенаправлены на сайт Flattr, где вам нужно будет разрешить AntennaPod использовать ваш аккаунт. После этого вы автоматически будете перенаправлены обратно.</string>
|
||||
<string name="authenticate_label">Авторизовать</string>
|
||||
<string name="return_home_label">Вернуться к началу</string>
|
||||
<string name="flattr_auth_success">Успешная авторизация! Теперь вы можете использовать Flattr прямо из приложения.</string>
|
||||
<string name="no_flattr_token_title">Токен Flattr не найден</string>
|
||||
<string name="no_flattr_token_msg">Похоже что ваш аккаунт Flattr не подключен к AntennaPod. Можно подключить аккаунт к AntennaPod или посетить сайт канала чтобы использовать Flattr прямо на сайте.</string>
|
||||
<string name="no_flattr_token_msg">Кажется, ваш аккаунт Flattr не подключен к AntennaPod. Вы можете подключить аккаунт к AntennaPod или посетить сайт канала, чтобы пожертвовать через Flattr прямо на сайте.</string>
|
||||
<string name="authenticate_now_label">Авторизоваться</string>
|
||||
<string name="action_forbidden_title">Действие запрещено</string>
|
||||
<string name="action_forbidden_msg">AntennaPod не имеет прав для выполнения этого действия. Возможно потому что доступ к вашему аккаунту был отозван. Вы можете авторизоваться заново или попробовать посетить сайт.</string>
|
||||
<string name="action_forbidden_msg">AntennaPod не имеет прав для выполнения этого действия. Возможно, доступ к вашему аккаунту был отозван. Вы можете авторизоваться заново или посетить сайт, которому вы пожертвовали через Flattr.</string>
|
||||
<string name="access_revoked_title">Доступ отозван</string>
|
||||
<string name="access_revoked_info">Вы успешно отключили AntennaPod от вашего аккаунта в Flattr. Чтобы завершить этот процесс вам нужно удалить AntennaPod из списка приложений подключенных к вашему аккаунту на сайте Flattr.</string>
|
||||
<string name="flattr_click_success">Поддержка через Flattr прошла успешно!</string>
|
||||
<string name="flattring_label">Отправляется запрос на Flattr</string>
|
||||
<!--Variable Speed-->
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Список пуст</string>
|
||||
<string name="no_feeds_label">Вы еще не подписаны ни на один канал</string>
|
||||
@ -142,7 +143,7 @@
|
||||
<string name="network_pref">Сеть</string>
|
||||
<string name="pref_autoUpdateIntervall_title">Интервал обновлений</string>
|
||||
<string name="pref_autoUpdateIntervall_sum">Укажите интервал через который каналы обновляются автоматически, или отключите его</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Загружать файлы только по Wi-Fi</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Загружать файлы только через Wi-Fi</string>
|
||||
<string name="pref_followQueue_title">Непрерывное воспроизведение</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">Загрузка по Wi-Fi</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_title">Наушники отсоединены</string>
|
||||
@ -153,14 +154,14 @@
|
||||
<string name="pref_flattr_auth_title">Авторизация Flattr</string>
|
||||
<string name="pref_flattr_auth_sum">Авторизуйтесь в Flattr чтобы поддерживать каналы прямо из приложения</string>
|
||||
<string name="pref_flattr_this_app_title">Поддержать это приложение в Flattr</string>
|
||||
<string name="pref_flattr_this_app_sum">Поддержать разработку AntennaPod через Flattr. Спасибо!</string>
|
||||
<string name="pref_flattr_this_app_sum">Поддержите разработку AntennaPod через Flattr. Спасибо!</string>
|
||||
<string name="pref_revokeAccess_title">Отозвать доступ</string>
|
||||
<string name="pref_revokeAccess_sum">Отменить доступ этого приложения к вашему аккаунту Flattr.</string>
|
||||
<string name="pref_display_only_episodes_title">Показывать только выпуски</string>
|
||||
<string name="pref_display_only_episodes_sum">Показывать только те элементы списка, которые содержат выпуски</string>
|
||||
<string name="user_interface_label">Интерфейс</string>
|
||||
<string name="pref_set_theme_title">Выбор темы</string>
|
||||
<string name="pref_set_theme_sum">Изменить тему оформление AntennaPod</string>
|
||||
<string name="pref_set_theme_sum">Изменить тему оформления AntennaPod</string>
|
||||
<string name="pref_automatic_download_title">Автоматическая загрузка</string>
|
||||
<string name="pref_automatic_download_sum">Настроить автоматическую загрузку выпусков.</string>
|
||||
<string name="pref_autodl_wifi_filter_title">Включить фильтр Wi-Fi</string>
|
||||
|
239
res/values-sv-rSE/strings.xml
Normal file
239
res/values-sv-rSE/strings.xml
Normal file
@ -0,0 +1,239 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<resources>
|
||||
<!--Activitiy titles-->
|
||||
<string name="app_name">AntennaPod</string>
|
||||
<string name="feeds_label">Flöden</string>
|
||||
<string name="podcasts_label">PODCASTS</string>
|
||||
<string name="episodes_label">AVSNITT</string>
|
||||
<string name="new_label">Ny</string>
|
||||
<string name="waiting_list_label">Väntelista</string>
|
||||
<string name="settings_label">Inställningar</string>
|
||||
<string name="add_new_feed_label">Lägg till nytt flöde</string>
|
||||
<string name="downloads_label">Nedladdningar</string>
|
||||
<string name="cancel_download_label">Avbryt nedladdnin</string>
|
||||
<string name="download_log_label">Nedladdningslogg</string>
|
||||
<string name="playback_history_label">Uppspelningshistorik</string>
|
||||
<!--Webview actions-->
|
||||
<string name="open_in_browser_label">Öppna i webbläsare</string>
|
||||
<string name="copy_url_label">Kopiera URL</string>
|
||||
<string name="share_url_label">Dela URL</string>
|
||||
<string name="copied_url_msg">Kopierade URL till clipboard.</string>
|
||||
<!--Playback history-->
|
||||
<string name="clear_history_label">Rensa historik</string>
|
||||
<!--Other-->
|
||||
<string name="confirm_label">Bekräfta</string>
|
||||
<string name="cancel_label">Avbryt</string>
|
||||
<string name="author_label">Skapare</string>
|
||||
<string name="language_label">Språk</string>
|
||||
<string name="cover_label">Omslag</string>
|
||||
<string name="error_label">Fel</string>
|
||||
<string name="error_msg_prefix">Ett fel inträffade:</string>
|
||||
<string name="refresh_label">Uppdatera</string>
|
||||
<string name="external_storage_error_msg">Ingen extern lagring är tillgänglig. Se till att montera en extern lagringsenhet så att appen kan fungera korrekt.</string>
|
||||
<string name="chapters_label">Kapitel</string>
|
||||
<string name="shownotes_label">Shownotes</string>
|
||||
<string name="most_recent_prefix">Senaste avsnittet:\u0020</string>
|
||||
<string name="episodes_suffix">\u0020episoder</string>
|
||||
<string name="published_prefix">Publicerad:\u0020</string>
|
||||
<string name="length_prefix">Längd:\u0020</string>
|
||||
<string name="size_prefix">Storlek:\u0020</string>
|
||||
<string name="processing_label">Bearbetar</string>
|
||||
<string name="loading_label">Laddar...</string>
|
||||
<string name="image_of_prefix">Bild av:\u0020</string>
|
||||
<string name="close_label">Stäng</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">Flöde URL</string>
|
||||
<string name="txtvfeedurl_label">Skriv in webbadressen till flödet här:</string>
|
||||
<!--Actions on feeds-->
|
||||
<string name="mark_all_read_label">Markera alla som lästa</string>
|
||||
<string name="show_info_label">Visa information</string>
|
||||
<string name="remove_feed_label">Ta bort flöde</string>
|
||||
<string name="share_link_label">Dela hemsidans länk</string>
|
||||
<string name="share_source_label">Dela flödeslänk</string>
|
||||
<string name="feed_delete_confirmation_msg">Bekräfta att du vill ta bort denna feed och ALLA avsnitt av denna feed som du har hämtat.</string>
|
||||
<!--actions on feeditems-->
|
||||
<string name="download_label">Ladda ned</string>
|
||||
<string name="play_label">Spela</string>
|
||||
<string name="pause_label">Pausa</string>
|
||||
<string name="stream_label">Stream</string>
|
||||
<string name="remove_label">Ta bort</string>
|
||||
<string name="mark_read_label">Markera som läst</string>
|
||||
<string name="mark_unread_label">Markera som oläst</string>
|
||||
<string name="add_to_queue_label">Lägg till i kön</string>
|
||||
<string name="remove_from_queue_label">Ta bort från Kön</string>
|
||||
<string name="visit_website_label">Besök websidan</string>
|
||||
<string name="support_label">Flattr det här</string>
|
||||
<string name="enqueue_all_new">Ställ alla i kö</string>
|
||||
<string name="download_all">Ladda ner alla</string>
|
||||
<string name="skip_episode_label">Hoppa över avsnitt</string>
|
||||
<!--Download messages and labels-->
|
||||
<string name="download_successful">Nedladdning framgångsrik</string>
|
||||
<string name="download_failed">Nedladdning misslyckades</string>
|
||||
<string name="download_pending">Avvaktar nerladdning</string>
|
||||
<string name="download_running">Nerladdning pågår</string>
|
||||
<string name="download_error_device_not_found">Lagringsenhet hittades inte</string>
|
||||
<string name="download_error_insufficient_space">Otillräckligt utrymme</string>
|
||||
<string name="download_error_file_error">Filfel</string>
|
||||
<string name="download_error_http_data_error">HTTP data fel</string>
|
||||
<string name="download_error_error_unknown">Okänt fel</string>
|
||||
<string name="download_error_parser_exception">Parserfel</string>
|
||||
<string name="download_error_unsupported_type">Flödestyp utan stöd</string>
|
||||
<string name="download_error_connection_error">Anslutningsfel</string>
|
||||
<string name="download_error_unknown_host">Okänd värd</string>
|
||||
<string name="cancel_all_downloads_label">Avbryt alla nedladdningar</string>
|
||||
<string name="download_cancelled_msg">Nerladdning avbruten</string>
|
||||
<string name="download_report_title">Nerladdningar färdiga</string>
|
||||
<string name="download_error_malformed_url">Felaktig webbadress</string>
|
||||
<string name="download_error_io_error">IO fel</string>
|
||||
<string name="download_error_request_error">Request fel</string>
|
||||
<string name="downloads_left">\u0020Nedladdningar kvar</string>
|
||||
<string name="download_notification_title">Laddar ner podcastdata</string>
|
||||
<string name="download_report_content">%1$d nedladdningar lyckades, %2$d misslyckades</string>
|
||||
<string name="download_log_title_unknown">Okänd titel</string>
|
||||
<string name="download_type_feed">Flöde</string>
|
||||
<string name="download_type_media">Mediafil</string>
|
||||
<string name="download_type_image">Bild</string>
|
||||
<string name="download_request_error_dialog_message_prefix">Ett fel uppstod vid försöket att ladda ner filen:\u0020</string>
|
||||
<!--Mediaplayer messages-->
|
||||
<string name="player_error_msg">Fel! </string>
|
||||
<string name="player_stopped_msg">Inget media spelar</string>
|
||||
<string name="player_preparing_msg">Förbereder</string>
|
||||
<string name="player_ready_msg">Beredd</string>
|
||||
<string name="player_seeking_msg">Söker</string>
|
||||
<string name="playback_error_server_died">Servern dog</string>
|
||||
<string name="playback_error_unknown">Okänt fel</string>
|
||||
<string name="no_media_playing_label">Inget media spelar</string>
|
||||
<string name="position_default_label">00:00:00</string>
|
||||
<string name="player_buffering_msg">Buffrar</string>
|
||||
<string name="playbackservice_notification_title">Spelar podcast</string>
|
||||
<string name="playbackservice_notification_content">Tryck här för mer information</string>
|
||||
<!--Navigation-->
|
||||
<string name="show_download_log">Visa log</string>
|
||||
<string name="show_player_label">Visa spelare</string>
|
||||
<!--Queue operations-->
|
||||
<string name="clear_queue_label">Rensa kön</string>
|
||||
<string name="organize_queue_label">Organisera kö</string>
|
||||
<string name="undo">Ångra</string>
|
||||
<string name="removed_from_queue">Föremålet avlägsnades</string>
|
||||
<!--Flattr-->
|
||||
<string name="flattr_auth_label">Flattr inloggning</string>
|
||||
<string name="flattr_auth_explanation">Tryck på knappen nedan för att starta autentiseringen. Du kommer att vidarebefordras till Flattrs inloggningsskärm i din webbläsare och uppmanas att ge AntennaPod tillstånd att Flattra saker. Efter att du har gett tillstånd, kommer du automatiskt tillbaka till den här skärmen.</string>
|
||||
<string name="authenticate_label">Autentisera</string>
|
||||
<string name="return_home_label">Återgå till Startsidan</string>
|
||||
<string name="flattr_auth_success">Autentiseringen lyckades! Du kan nu Flattra saker i appen.</string>
|
||||
<string name="no_flattr_token_title">Ingen Flattr token hittades</string>
|
||||
<string name="no_flattr_token_msg">Ditt Flattr konto verkar inte vara ansluten till AntennaPod. Du kan antingen ansluta ditt konto till AntennaPod att Flattr saker i app eller så kan du besöka webbplatsen för att Flattr det där.</string>
|
||||
<string name="authenticate_now_label">Autentisera</string>
|
||||
<string name="action_forbidden_title">Åtgärd förbjuden</string>
|
||||
<string name="action_forbidden_msg">AntennaPod saknar behörighet för den här åtgärden. Anledningen till detta kan vara att AntennaPods tillgång till ditt konto har återkallats. Du kan antingen åter autentisera AntennaPod eller besöka hemsidan istället.</string>
|
||||
<string name="access_revoked_title">Tillgång återkallad</string>
|
||||
<string name="access_revoked_info">Du har nu återkallat AntennaPods tillgång till ditt konto. För att slutföra processen, måste du ta bort den här appen från listan godkända appar i dina kontoinställningar på Flattrs hemsida.</string>
|
||||
<string name="flattr_click_success">Framgångsrikt flattrat denna sak!</string>
|
||||
<string name="flattring_label">Flattrar</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Ladda ner tillägg</string>
|
||||
<string name="no_playback_plugin_title">Tillägg ej installerat</string>
|
||||
<string name="no_playback_plugin_msg">För att variabel uppspelningshastighet skall fungera måste ett tredjepartstillägg installeras.\n\nTryck på \'Ladda ner tillägg\' för att ladda ner ett gratis tilläg från Play store.\n\nAntennaPod ansvarar inte för problem med detta tillägg och de bör rapporteras till tilläggets skapare.\n</string>
|
||||
<string name="set_playback_speed_label">Uppspelningshastigheter</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Det finns inget i denna lista.</string>
|
||||
<string name="no_feeds_label">Du har inte prenumererat på något flöde ännu.</string>
|
||||
<!--Preferences-->
|
||||
<string name="other_pref">Annat</string>
|
||||
<string name="about_pref">Om</string>
|
||||
<string name="queue_label">Kö</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_sum">Pausa uppspelningen när hörlurarna bortkopplas</string>
|
||||
<string name="pref_followQueue_sum">Hoppa till nästa i kön när uppspelningen är klar</string>
|
||||
<string name="playback_pref">Uppspelning</string>
|
||||
<string name="network_pref">Nätverk </string>
|
||||
<string name="pref_autoUpdateIntervall_title">Uppdateringsintervall</string>
|
||||
<string name="pref_autoUpdateIntervall_sum">Ange ett intervall för att automatiskt uppdatera flödet eller avaktivera det</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_sum">Hämta mediefiler endast över WiFi</string>
|
||||
<string name="pref_followQueue_title">Kontinuerlig uppspelning</string>
|
||||
<string name="pref_downloadMediaOnWifiOnly_title">WiFi nedladdning</string>
|
||||
<string name="pref_pauseOnHeadsetDisconnect_title">Hörlurar bortkopplade</string>
|
||||
<string name="pref_mobileUpdate_title">Mobila uppdateringar</string>
|
||||
<string name="pref_mobileUpdate_sum">Tillåt uppdateringar via mobil dataanslutning</string>
|
||||
<string name="refreshing_label">Uppdatera</string>
|
||||
<string name="flattr_settings_label">Flattr inställningar</string>
|
||||
<string name="pref_flattr_auth_title">Flattr inloggning</string>
|
||||
<string name="pref_flattr_auth_sum">För att Flattra saker direkt från appen, logga in på ditt Flattr-konto.</string>
|
||||
<string name="pref_flattr_this_app_title">Flattra den här appen</string>
|
||||
<string name="pref_flattr_this_app_sum">Stöd utvecklingen av AntennaPod genom att flattra den. Tack!</string>
|
||||
<string name="pref_revokeAccess_title">Återkalla åtkomst</string>
|
||||
<string name="pref_revokeAccess_sum">Återkalla behörigheten till ditt Flattr-konto för denna app.</string>
|
||||
<string name="pref_display_only_episodes_title">Visa endast episoder</string>
|
||||
<string name="pref_display_only_episodes_sum">Visa endast objekt som har minst ett avsnitt.</string>
|
||||
<string name="user_interface_label">Användargränssnitt</string>
|
||||
<string name="pref_set_theme_title">Välj tema</string>
|
||||
<string name="pref_set_theme_sum">Ändra utseendet på AntennaPod.</string>
|
||||
<string name="pref_automatic_download_title">Automatisk nedladdning</string>
|
||||
<string name="pref_automatic_download_sum">Konfigurera automatisk nedladdning av episoder.</string>
|
||||
<string name="pref_autodl_wifi_filter_title">Aktivera WiFi filtrering</string>
|
||||
<string name="pref_autodl_wifi_filter_sum">Tillåt automatisk nedladdning endast för utvalda WiFi-nätverk.</string>
|
||||
<string name="pref_episode_cache_title">Avsnittscache</string>
|
||||
<string name="pref_theme_title_light">Ljust</string>
|
||||
<string name="pref_theme_title_dark">Mörkt</string>
|
||||
<string name="pref_episode_cache_unlimited">Obegränsat</string>
|
||||
<string name="pref_update_interval_hours_plural">timmar</string>
|
||||
<string name="pref_update_interval_hours_singular">timme</string>
|
||||
<string name="pref_update_interval_hours_manual">Manuell</string>
|
||||
<string name="pref_playback_speed_title">Uppspelningshastigheter</string>
|
||||
<string name="pref_playback_speed_sum">Anpassa de tillgängliga hastigheterna för variabel uppspelningshastighet.</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Sök efter flöden eller avsnitt</string>
|
||||
<string name="found_in_shownotes_label">Hittad i shownotes</string>
|
||||
<string name="found_in_chapters_label">Hittad i kapitel</string>
|
||||
<string name="search_status_searching">Söker... </string>
|
||||
<string name="search_status_no_results">Inga resultat hittades</string>
|
||||
<string name="search_results_label">Sökresultat</string>
|
||||
<string name="search_term_label">du sökte:\u0020</string>
|
||||
<string name="search_label">Sök</string>
|
||||
<string name="found_in_title_label">Hittad i titeln</string>
|
||||
<!--OPML import and export-->
|
||||
<string name="opml_import_txtv_button_lable">Du kan också importera en OPML-fil. Med OPML-filer kan du flytta dina podcasts från en podcatcher till en annan:</string>
|
||||
<string name="opml_import_explanation">Om du vill importera en OPML-fil, måste du placera den i följande katalog och tryck på knappen nedan för att starta importen.</string>
|
||||
<string name="start_import_label">Börja import</string>
|
||||
<string name="opml_import_label">OPML import</string>
|
||||
<string name="opml_directory_error">FEL! </string>
|
||||
<string name="reading_opml_label">Läser OPML fil</string>
|
||||
<string name="opml_reader_error">Ett fel har skett vid iläsning av opml dokumentet:</string>
|
||||
<string name="opml_import_error_dir_empty">Katalogen är tom.</string>
|
||||
<string name="select_all_label">Välj alla</string>
|
||||
<string name="deselect_all_label">Avmarkera alla</string>
|
||||
<string name="choose_file_to_import_label">Välj fil att importera</string>
|
||||
<string name="opml_export_label">OPML export</string>
|
||||
<string name="exporting_label">Exporterar...</string>
|
||||
<string name="export_error_label">Exporteringsfel</string>
|
||||
<string name="opml_export_success_title">OPML export lyckades</string>
|
||||
<string name="opml_export_success_sum">.opml filen skrevs till:\u0020</string>
|
||||
<!--Sleep timer-->
|
||||
<string name="set_sleeptimer_label">Ställ in sömntimer</string>
|
||||
<string name="disable_sleeptimer_label">Stäng av sömntimer</string>
|
||||
<string name="enter_time_here_label">Ange tid</string>
|
||||
<string name="sleep_timer_label">Sömntimer</string>
|
||||
<string name="time_left_label">Återstående tid:\u0020</string>
|
||||
<string name="time_dialog_invalid_input">Ogiltigt tal, tiden måste vara ett heltal</string>
|
||||
<!--Miro Guide-->
|
||||
<string name="loading_categories_label">Laddar kategorier...</string>
|
||||
<string name="browse_miroguide_label">Bläddra i Miro Guide</string>
|
||||
<string name="txtv_browse_miroguide_label">Eller bläddra i Miro Guide:</string>
|
||||
<string name="miro_guide_label">Miro Guide</string>
|
||||
<string name="miro_search_hint">Leta i Miro Guide</string>
|
||||
<string name="popular_label">Populärt</string>
|
||||
<string name="best_rating_label">Bästa betyg</string>
|
||||
<string name="add_feed_label">Lägg till flöde</string>
|
||||
<string name="miro_feed_added">Flödet läggs till</string>
|
||||
<!--Directory chooser-->
|
||||
<string name="selected_folder_label">Vald mapp:</string>
|
||||
<string name="create_folder_label">Skapa mapp</string>
|
||||
<string name="choose_data_directory">Välj mapp</string>
|
||||
<string name="create_folder_msg">Skapa ny mapp med namnet \"%1$s\"?</string>
|
||||
<string name="create_folder_success">Skapade ny mapp</string>
|
||||
<string name="create_folder_error_no_write_access">Kan inte skriva till den här mappen</string>
|
||||
<string name="create_folder_error_already_exists">Mappen finns redan</string>
|
||||
<string name="create_folder_error">Kunde inte skapa mapp</string>
|
||||
<string name="folder_not_empty_dialog_title">Mappen är inte tom</string>
|
||||
<string name="folder_not_empty_dialog_msg">Den mapp du har valt är inte tom. Filer kommer att placeras direkt i denna mapp. Fortsätt ändå?</string>
|
||||
<string name="set_to_default_folder">Välj standardmapp</string>
|
||||
</resources>
|
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">Обробка</string>
|
||||
<string name="loading_label">Завантаження категорій ...</string>
|
||||
<string name="image_of_prefix">Зображення:\u0020</string>
|
||||
<string name="close_label">Закрити</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">Посилання на канал</string>
|
||||
<string name="txtvfeedurl_label">Введіть адресу URL каналу тут:</string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">Ви відкликали доступ AntennaPod до облікового запису. Для закінчення процессу вам потрібно видалити додаток з затвержденного списку в вашому облікову запису на сайті flattr</string>
|
||||
<string name="flattr_click_success">Успішно flattr це</string>
|
||||
<string name="flattring_label">Йде flattr</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">Завантажити Plugin</string>
|
||||
<string name="no_playback_plugin_title">Plugin не встановлено</string>
|
||||
<string name="no_playback_plugin_msg">Для керування швидкістю програвання потрібно встановити plugin\nНатисніть \"Завантажити Plugin\" для завантаження безкоштовного plugin з Play Store\nЯкщо при використанні plugin будуть які небудь проблеми це відповідальність автору plugin, а не автору AntennaPod</string>
|
||||
<string name="set_playback_speed_label">Швидкість програвання</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">Нічного в цьому списку</string>
|
||||
<string name="no_feeds_label">Немає підписаних каналів </string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">годин</string>
|
||||
<string name="pref_update_interval_hours_singular">година</string>
|
||||
<string name="pref_update_interval_hours_manual">Інструкція</string>
|
||||
<string name="pref_playback_speed_title">Швидкість програвання</string>
|
||||
<string name="pref_playback_speed_sum">Налаштування швідкості доступно для змінної швидкості програвання</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">Пошук каналів та епізодів</string>
|
||||
<string name="found_in_shownotes_label">Знайдено у примітках</string>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="processing_label">处理中</string>
|
||||
<string name="loading_label">加载中...</string>
|
||||
<string name="image_of_prefix">图片:\u0020</string>
|
||||
<string name="close_label">关闭</string>
|
||||
<!--'Add Feed' Activity labels-->
|
||||
<string name="feedurl_label">订阅 URL</string>
|
||||
<string name="txtvfeedurl_label">输入订阅 URL: </string>
|
||||
@ -129,6 +130,11 @@
|
||||
<string name="access_revoked_info">您已经成功撤销 AntennaPod 对账户令牌的访问. 为了完成这个过程, 您必须到 Flattr 网站 \"账户设置->已批准应用\" 列表内删除本应用.</string>
|
||||
<string name="flattr_click_success">Flattr 成功!</string>
|
||||
<string name="flattring_label">Flattring</string>
|
||||
<!--Variable Speed-->
|
||||
<string name="download_plugin_label">插件下载</string>
|
||||
<string name="no_playback_plugin_title">插件没有安装</string>
|
||||
<string name="no_playback_plugin_msg">安装第三方库后播放速度设置起作用.\n点击 \'插件下载\' 从 \'Pay 商店\' 下载免费插件.\n使用这些插件中碰到的任何问题请报告给插件作者, 跟 AntennaPod 无关.</string>
|
||||
<string name="set_playback_speed_label">播放速度</string>
|
||||
<!--Empty list labels-->
|
||||
<string name="no_items_label">列表为空.</string>
|
||||
<string name="no_feeds_label">还没有任何订阅.</string>
|
||||
@ -172,6 +178,8 @@
|
||||
<string name="pref_update_interval_hours_plural">小时</string>
|
||||
<string name="pref_update_interval_hours_singular">时</string>
|
||||
<string name="pref_update_interval_hours_manual">手动</string>
|
||||
<string name="pref_playback_speed_title">播放速度</string>
|
||||
<string name="pref_playback_speed_sum">自定义音频播放速度</string>
|
||||
<!--Search-->
|
||||
<string name="search_hint">搜索订阅或者曲目</string>
|
||||
<string name="found_in_shownotes_label">笔记中查找</string>
|
||||
|
@ -1,6 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="update_intervall_options">
|
||||
<item>Manual</item>
|
||||
<item>1 hour</item>
|
||||
<item>2 hours</item>
|
||||
<item>4 hours</item>
|
||||
<item>8 hours</item>
|
||||
<item>12 hours</item>
|
||||
<item>24 hours</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="update_intervall_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
@ -28,6 +38,50 @@
|
||||
<item>80</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
<string-array name="playback_speed_values">
|
||||
<item>1.0</item>
|
||||
<item>1.05</item>
|
||||
<item>1.10</item>
|
||||
<item>1.15</item>
|
||||
<item>1.20</item>
|
||||
<item>1.25</item>
|
||||
<item>1.30</item>
|
||||
<item>1.35</item>
|
||||
<item>1.40</item>
|
||||
<item>1.45</item>
|
||||
<item>1.50</item>
|
||||
<item>1.55</item>
|
||||
<item>1.60</item>
|
||||
<item>1.65</item>
|
||||
<item>1.70</item>
|
||||
<item>1.75</item>
|
||||
<item>1.80</item>
|
||||
<item>1.85</item>
|
||||
<item>1.90</item>
|
||||
<item>1.95</item>
|
||||
<item>2.00</item>
|
||||
<item>2.10</item>
|
||||
<item>2.20</item>
|
||||
<item>2.30</item>
|
||||
<item>2.40</item>
|
||||
<item>2.50</item>
|
||||
<item>2.60</item>
|
||||
<item>2.70</item>
|
||||
<item>2.80</item>
|
||||
<item>2.90</item>
|
||||
<item>3.00</item>
|
||||
<item>3.10</item>
|
||||
<item>3.20</item>
|
||||
<item>3.30</item>
|
||||
<item>3.40</item>
|
||||
<item>3.50</item>
|
||||
<item>3.60</item>
|
||||
<item>3.70</item>
|
||||
<item>3.80</item>
|
||||
<item>3.90</item>
|
||||
<item>4.00</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="autodl_select_networks_default_entries">
|
||||
<item>N/A</item>
|
||||
</string-array>
|
||||
@ -42,5 +96,6 @@
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
</resources>
|
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<resources
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="MissingTranslation"
|
||||
>
|
||||
|
||||
<!-- Activitiy titles -->
|
||||
<string name="app_name">AntennaPod</string>
|
||||
@ -44,6 +47,8 @@
|
||||
<string name="processing_label">Processing</string>
|
||||
<string name="loading_label">Loading...</string>
|
||||
<string name="image_of_prefix">Image of:\u0020</string>
|
||||
<string name="close_label">Close</string>
|
||||
|
||||
|
||||
<!-- 'Add Feed' Activity labels -->
|
||||
<string name="feedurl_label">Feed URL</string>
|
||||
@ -140,6 +145,12 @@
|
||||
<string name="access_revoked_info">You have successfully revoked AntennaPod\'s access token to your account. In order to complete the process, you have to remove this app from the list of approved applications in your account settings on the flattr website.</string>
|
||||
<string name="flattr_click_success">Successfully flattred this thing!</string>
|
||||
<string name="flattring_label">Flattring</string>
|
||||
|
||||
<!-- Variable Speed -->
|
||||
<string name="download_plugin_label">Download Plugin</string>
|
||||
<string name="no_playback_plugin_title">Plugin Not Installed</string>
|
||||
<string name="no_playback_plugin_msg">For variable speed playback to work, a third party library must be installed.\n\nTap \'Download Plugin\' to download a free plugin from the Play Store\n\nAny problems found using this plugin are not the responsibility of AntennaPod and should be reported to the plugin owner.</string>
|
||||
<string name="set_playback_speed_label">Playback Speeds</string>
|
||||
|
||||
<!-- Empty list labels -->
|
||||
<string name="no_items_label">There are no items in this list.</string>
|
||||
@ -182,9 +193,11 @@
|
||||
<string name="pref_theme_title_light">Light</string>
|
||||
<string name="pref_theme_title_dark">Dark</string>
|
||||
<string name="pref_episode_cache_unlimited">Unlimited</string>
|
||||
<string name="pref_update_interval_hours_plural">hours</string>
|
||||
<string name="pref_update_interval_hours_singular">hour</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<string name="pref_update_interval_hours_plural">hours</string>
|
||||
<string name="pref_update_interval_hours_singular">hour</string>
|
||||
<string name="pref_update_interval_hours_manual">Manual</string>
|
||||
<string name="pref_playback_speed_title">Playback Speeds</string>
|
||||
<string name="pref_playback_speed_sum">Customize the speeds available for variable speed audio playback</string>
|
||||
|
||||
|
||||
<!-- Search -->
|
||||
@ -248,4 +261,4 @@
|
||||
<string name="folder_not_empty_dialog_msg">The folder you have selected is not empty. Media downloads and other files will be placed directly in this folder. Continue anyway?</string>
|
||||
<string name="set_to_default_folder">Choose default folder</string>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<style name="Theme.AntennaPod.Light" parent="@style/Theme.Sherlock.Light.ForceOverflow">
|
||||
<item name="vpiTabPageIndicatorStyle">@style/AntennaPod.LightTabPageIndicator</item>
|
||||
<style name="Theme.AntennaPod.Light" parent="@style/Theme.AppCompat.Light">
|
||||
<item name="attr/action_about">@drawable/action_about</item>
|
||||
<item name="attr/action_search">@drawable/action_search</item>
|
||||
<item name="attr/action_settings">@drawable/action_settings</item>
|
||||
@ -38,21 +37,7 @@
|
||||
<item name="attr/dragview_float_background">@color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="AntennaPod.TabPageIndicator" parent="Widget.TabPageIndicator">
|
||||
<item name="android:paddingTop">16dp</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
<item name="android:paddingRight">8dp</item>
|
||||
<item name="android:paddingBottom">16dp</item>
|
||||
<item name="android:textSize">12sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="AntennaPod.LightTabPageIndicator" parent="AntennaPod.TabPageIndicator">
|
||||
<item name="android:textColor">@color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AntennaPod.Dark" parent="@style/Theme.Sherlock.ForceOverflow">
|
||||
<item name="vpiTabPageIndicatorStyle">@style/AntennaPod.DarkTabPageIndicator</item>
|
||||
<style name="Theme.AntennaPod.Dark" parent="@style/Theme.AppCompat">
|
||||
<item name="attr/action_about">@drawable/action_about_dark</item>
|
||||
<item name="attr/action_search">@drawable/action_search_dark</item>
|
||||
<item name="attr/action_settings">@drawable/action_settings_dark</item>
|
||||
@ -88,10 +73,6 @@
|
||||
<item name="attr/dragview_float_background">@color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="AntennaPod.DarkTabPageIndicator" parent="AntennaPod.TabPageIndicator">
|
||||
<item name="android:textColor">#FFFFFF</item>
|
||||
</style>
|
||||
|
||||
<style name="UndoBar">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">48dp</item>
|
||||
@ -102,9 +83,7 @@
|
||||
<item name="android:orientation">horizontal</item>
|
||||
<item name="android:background">@drawable/undobar</item>
|
||||
<item name="android:clickable">true</item>
|
||||
<item name="android:showDividers">middle</item>
|
||||
<item name="android:divider">@drawable/undobar_divider</item>
|
||||
<item name="android:dividerPadding">10dp</item>
|
||||
</style>
|
||||
<style name="UndoBarMessage">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
@ -125,7 +104,6 @@
|
||||
<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:textAllCaps">true</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">#fff</item>
|
||||
<item name="android:text">@string/undo</item>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<PreferenceCategory android:title="@string/user_interface_label">
|
||||
<CheckBoxPreference android:title="@string/pref_display_only_episodes_title" android:summary="@string/pref_display_only_episodes_sum" android:key="prefDisplayOnlyEpisodes"/>
|
||||
<!--<CheckBoxPreference android:title="@string/pref_display_only_episodes_title" android:summary="@string/pref_display_only_episodes_sum" android:key="prefDisplayOnlyEpisodes" android:visibility="gone"/>-->
|
||||
<ListPreference android:entryValues="@array/theme_values" android:entries="@array/theme_options" android:title="@string/pref_set_theme_title" android:key="prefTheme" android:summary="@string/pref_set_theme_sum" android:defaultValue="0"/>
|
||||
</PreferenceCategory><PreferenceCategory android:title="@string/playback_pref" >
|
||||
<CheckBoxPreference
|
||||
@ -17,6 +17,10 @@
|
||||
android:key="prefFollowQueue"
|
||||
android:summary="@string/pref_followQueue_sum"
|
||||
android:title="@string/pref_followQueue_title" />
|
||||
<Preference
|
||||
android:key="prefPlaybackSpeedLauncher"
|
||||
android:summary="@string/pref_playback_speed_sum"
|
||||
android:title="@string/pref_playback_speed_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/network_pref" >
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android" android:hint="@string/search_hint" android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
||||
|
||||
|
||||
</searchable>
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:hint="@string/search_hint"
|
||||
android:label="@string/app_name"/>
|
1
settings.gradle
Normal file
1
settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':submodules:dslv:library'
|
@ -5,7 +5,6 @@ import android.content.res.Configuration;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.preferences.PlaybackPreferences;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
|
||||
@ -32,8 +31,6 @@ public class PodcastApp extends Application {
|
||||
UserPreferences.createInstance(this);
|
||||
PlaybackPreferences.createInstance(this);
|
||||
EventDistributor.getInstance();
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
manager.loadDBData(getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,15 +1,15 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/** Displays the 'about' screen */
|
||||
public class AboutActivity extends SherlockActivity {
|
||||
public class AboutActivity extends ActionBarActivity {
|
||||
|
||||
private WebView webview;
|
||||
|
||||
|
@ -2,6 +2,9 @@ package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
@ -15,10 +18,6 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
@ -31,7 +30,7 @@ import de.danoeh.antennapod.util.StorageUtils;
|
||||
import de.danoeh.antennapod.util.URLChecker;
|
||||
|
||||
/** Activity for adding a Feed */
|
||||
public class AddFeedActivity extends SherlockActivity {
|
||||
public class AddFeedActivity extends ActionBarActivity {
|
||||
private static final String TAG = "AddFeedActivity";
|
||||
|
||||
private DownloadRequester requester;
|
||||
@ -161,7 +160,7 @@ public class AddFeedActivity extends SherlockActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailure(int reason) {
|
||||
public void onConnectionFailure(DownloadError reason) {
|
||||
handleDownloadError(reason);
|
||||
}
|
||||
});
|
||||
@ -177,11 +176,11 @@ public class AddFeedActivity extends SherlockActivity {
|
||||
progDialog.setMessage(getString(R.string.loading_label));
|
||||
}
|
||||
|
||||
private void handleDownloadError(int reason) {
|
||||
private void handleDownloadError(DownloadError reason) {
|
||||
final AlertDialog errorDialog = new AlertDialog.Builder(this).create();
|
||||
errorDialog.setTitle(R.string.error_label);
|
||||
errorDialog.setMessage(getString(R.string.error_msg_prefix) + " "
|
||||
+ DownloadError.getErrorString(this, reason));
|
||||
+ reason.getErrorString(this));
|
||||
errorDialog.setButton(getString(android.R.string.ok),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
@ -200,6 +199,8 @@ public class AddFeedActivity extends SherlockActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -7,27 +7,31 @@ import android.content.res.TypedArray;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListFragment;
|
||||
import com.actionbarsherlock.view.Window;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.ChapterListAdapter;
|
||||
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.fragment.CoverFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.service.PlaybackService;
|
||||
import de.danoeh.antennapod.util.playback.ExternalMedia;
|
||||
import de.danoeh.antennapod.util.playback.Playable;
|
||||
@ -48,7 +52,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
|
||||
private CoverFragment coverFragment;
|
||||
private ItemDescriptionFragment descriptionFragment;
|
||||
private SherlockListFragment chapterFragment;
|
||||
private ListFragment chapterFragment;
|
||||
|
||||
private Fragment currentlyShownFragment;
|
||||
private int currentlyShownPosition = -1;
|
||||
@ -57,6 +61,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
|
||||
private TextView txtvTitle;
|
||||
private TextView txtvFeed;
|
||||
private Button butPlaybackSpeed;
|
||||
private ImageButton butNavLeft;
|
||||
private ImageButton butNavRight;
|
||||
|
||||
@ -219,7 +224,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
if (savedPosition != -1) {
|
||||
switchToFragment(savedPosition);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -248,8 +253,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
/**
|
||||
* Changes the currently displayed fragment.
|
||||
*
|
||||
* @param Must
|
||||
* be POS_COVER, POS_DESCR, or POS_CHAPTERS
|
||||
* @param pos Must be POS_COVER, POS_DESCR, or POS_CHAPTERS
|
||||
* */
|
||||
private void switchToFragment(int pos) {
|
||||
if (AppConfig.DEBUG)
|
||||
@ -280,7 +284,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
break;
|
||||
case POS_CHAPTERS:
|
||||
if (chapterFragment == null) {
|
||||
chapterFragment = new SherlockListFragment() {
|
||||
chapterFragment = new ListFragment() {
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v,
|
||||
@ -365,6 +369,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
txtvFeed = (TextView) findViewById(R.id.txtvFeed);
|
||||
butNavLeft = (ImageButton) findViewById(R.id.butNavLeft);
|
||||
butNavRight = (ImageButton) findViewById(R.id.butNavRight);
|
||||
butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed);
|
||||
|
||||
butNavLeft.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@ -392,6 +397,65 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
butPlaybackSpeed.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (controller != null && controller.canSetPlaybackSpeed()) {
|
||||
String[] availableSpeeds = UserPreferences
|
||||
.getPlaybackSpeedArray();
|
||||
String currentSpeed = UserPreferences.getPlaybackSpeed();
|
||||
|
||||
// Provide initial value in case the speed list has changed
|
||||
// out from under us
|
||||
// and our current speed isn't in the new list
|
||||
String newSpeed;
|
||||
if (availableSpeeds.length > 0) {
|
||||
newSpeed = availableSpeeds[0];
|
||||
} else {
|
||||
newSpeed = "1.0";
|
||||
}
|
||||
|
||||
for (int i = 0; i < availableSpeeds.length; i++) {
|
||||
if (availableSpeeds[i].equals(currentSpeed)) {
|
||||
if (i == availableSpeeds.length - 1) {
|
||||
newSpeed = availableSpeeds[0];
|
||||
} else {
|
||||
newSpeed = availableSpeeds[i + 1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
UserPreferences.setPlaybackSpeed(newSpeed);
|
||||
controller.setPlaybackSpeed(Float.parseFloat(newSpeed));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
butPlaybackSpeed.setOnLongClickListener(new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
VariableSpeedDialog.showDialog(AudioplayerActivity.this);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPlaybackSpeedChange() {
|
||||
super.onPlaybackSpeedChange();
|
||||
updateButPlaybackSpeed();
|
||||
}
|
||||
|
||||
private void updateButPlaybackSpeed() {
|
||||
if (controller == null
|
||||
|| (controller.getCurrentPlaybackSpeedMultiplier() == -1)) {
|
||||
butPlaybackSpeed.setVisibility(View.GONE);
|
||||
} else {
|
||||
butPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||
butPlaybackSpeed.setText(UserPreferences.getPlaybackSpeed());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -423,7 +487,7 @@ public class AudioplayerActivity extends MediaplayerActivity {
|
||||
((AudioplayerContentFragment) currentlyShownFragment)
|
||||
.onDataSetChanged(media);
|
||||
}
|
||||
|
||||
updateButPlaybackSpeed();
|
||||
}
|
||||
|
||||
public void notifyMediaPositionChanged() {
|
||||
|
@ -12,7 +12,11 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.FileObserver;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.AdapterView;
|
||||
@ -24,11 +28,6 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
@ -37,7 +36,7 @@ import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
* Let's the user choose a directory on the storage device. The selected folder
|
||||
* will be sent back to the starting activity as an activity result.
|
||||
*/
|
||||
public class DirectoryChooserActivity extends SherlockActivity {
|
||||
public class DirectoryChooserActivity extends ActionBarActivity {
|
||||
private static final String TAG = "DirectoryChooserActivity";
|
||||
|
||||
private static final String CREATE_DIRECTORY_NAME = "AntennaPod";
|
||||
@ -348,7 +347,9 @@ public class DirectoryChooserActivity extends SherlockActivity {
|
||||
* CREATE_DIRECTORY_NAME.
|
||||
*/
|
||||
private int createFolder() {
|
||||
if (selectedDir != null && selectedDir.canWrite()) {
|
||||
if (selectedDir == null) {
|
||||
return R.string.create_folder_error;
|
||||
} else if (selectedDir.canWrite()) {
|
||||
File newDir = new File(selectedDir, CREATE_DIRECTORY_NAME);
|
||||
if (!newDir.exists()) {
|
||||
boolean result = newDir.mkdir();
|
||||
@ -360,10 +361,8 @@ public class DirectoryChooserActivity extends SherlockActivity {
|
||||
} else {
|
||||
return R.string.create_folder_error_already_exists;
|
||||
}
|
||||
} else if (selectedDir.canWrite() == false) {
|
||||
return R.string.create_folder_error_no_write_access;
|
||||
} else {
|
||||
return R.string.create_folder_error;
|
||||
return R.string.create_folder_error_no_write_access;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,21 +11,23 @@ import android.content.res.TypedArray;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.view.ActionMode;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemLongClickListener;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListActivity;
|
||||
import com.actionbarsherlock.view.ActionMode;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import android.widget.ListView;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.DownloadlistAdapter;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.service.download.DownloadRequest;
|
||||
import de.danoeh.antennapod.service.download.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
|
||||
@ -33,221 +35,228 @@ import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
* Shows all running downloads in a list. The list objects are DownloadStatus
|
||||
* objects created by a DownloadObserver.
|
||||
*/
|
||||
public class DownloadActivity extends SherlockListActivity implements
|
||||
ActionMode.Callback {
|
||||
public class DownloadActivity extends ActionBarActivity implements
|
||||
ActionMode.Callback {
|
||||
|
||||
private static final String TAG = "DownloadActivity";
|
||||
private static final int MENU_SHOW_LOG = 0;
|
||||
private static final int MENU_CANCEL_ALL_DOWNLOADS = 1;
|
||||
private DownloadlistAdapter dla;
|
||||
private DownloadRequester requester;
|
||||
private static final String TAG = "DownloadActivity";
|
||||
private static final int MENU_SHOW_LOG = 0;
|
||||
private static final int MENU_CANCEL_ALL_DOWNLOADS = 1;
|
||||
private DownloadlistAdapter dla;
|
||||
private DownloadRequester requester;
|
||||
|
||||
private ActionMode mActionMode;
|
||||
private DownloadStatus selectedDownload;
|
||||
private ActionMode mActionMode;
|
||||
private DownloadRequest selectedDownload;
|
||||
|
||||
private DownloadService downloadService = null;
|
||||
boolean mIsBound;
|
||||
private DownloadService downloadService = null;
|
||||
boolean mIsBound;
|
||||
|
||||
private AsyncTask<Void, Void, Void> contentRefresher;
|
||||
private AsyncTask<Void, Void, Void> contentRefresher;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating Activity");
|
||||
requester = DownloadRequester.getInstance();
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
private ListView listview;
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
unbindService(mConnection);
|
||||
unregisterReceiver(contentChanged);
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.listview_activity);
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
registerReceiver(contentChanged, new IntentFilter(
|
||||
DownloadService.ACTION_DOWNLOADS_CONTENT_CHANGED));
|
||||
bindService(new Intent(this, DownloadService.class), mConnection, 0);
|
||||
startContentRefresher();
|
||||
if (dla != null) {
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
listview = (ListView) findViewById(R.id.listview);
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Stopping Activity");
|
||||
stopContentRefresher();
|
||||
}
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating Activity");
|
||||
requester = DownloadRequester.getInstance();
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
public void onServiceDisconnected(ComponentName className) {
|
||||
downloadService = null;
|
||||
mIsBound = false;
|
||||
Log.i(TAG, "Closed connection with DownloadService.");
|
||||
}
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
unbindService(mConnection);
|
||||
unregisterReceiver(contentChanged);
|
||||
}
|
||||
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
downloadService = ((DownloadService.LocalBinder) service)
|
||||
.getService();
|
||||
mIsBound = true;
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Connection to service established");
|
||||
dla = new DownloadlistAdapter(DownloadActivity.this, 0,
|
||||
downloadService.getDownloads());
|
||||
setListAdapter(dla);
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
registerReceiver(contentChanged, new IntentFilter(
|
||||
DownloadService.ACTION_DOWNLOADS_CONTENT_CHANGED));
|
||||
bindService(new Intent(this, DownloadService.class), mConnection, 0);
|
||||
startContentRefresher();
|
||||
if (dla != null) {
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void startContentRefresher() {
|
||||
if (contentRefresher != null) {
|
||||
contentRefresher.cancel(true);
|
||||
}
|
||||
contentRefresher = new AsyncTask<Void, Void, Void>() {
|
||||
private final int WAITING_INTERVALL = 1000;
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Stopping Activity");
|
||||
stopContentRefresher();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(Void... values) {
|
||||
super.onProgressUpdate(values);
|
||||
if (dla != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Refreshing content automatically");
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
public void onServiceDisconnected(ComponentName className) {
|
||||
downloadService = null;
|
||||
mIsBound = false;
|
||||
Log.i(TAG, "Closed connection with DownloadService.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
while (!isCancelled()) {
|
||||
try {
|
||||
Thread.sleep(WAITING_INTERVALL);
|
||||
publishProgress();
|
||||
} catch (InterruptedException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
contentRefresher.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
contentRefresher.execute();
|
||||
}
|
||||
}
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
downloadService = ((DownloadService.LocalBinder) service)
|
||||
.getService();
|
||||
mIsBound = true;
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Connection to service established");
|
||||
dla = new DownloadlistAdapter(DownloadActivity.this, 0,
|
||||
downloadService.getDownloads());
|
||||
listview.setAdapter(dla);
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
|
||||
private void stopContentRefresher() {
|
||||
if (contentRefresher != null) {
|
||||
contentRefresher.cancel(true);
|
||||
}
|
||||
}
|
||||
@SuppressLint("NewApi")
|
||||
private void startContentRefresher() {
|
||||
if (contentRefresher != null) {
|
||||
contentRefresher.cancel(true);
|
||||
}
|
||||
contentRefresher = new AsyncTask<Void, Void, Void>() {
|
||||
private static final int WAITING_INTERVAL = 1000;
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
getListView().setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
@Override
|
||||
protected void onProgressUpdate(Void... values) {
|
||||
super.onProgressUpdate(values);
|
||||
if (dla != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Refreshing content automatically");
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> arg0, View view,
|
||||
int position, long id) {
|
||||
DownloadStatus selection = dla.getItem(position).getStatus();
|
||||
if (selection != null && mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
dla.setSelectedItemIndex(position);
|
||||
selectedDownload = selection;
|
||||
mActionMode = startActionMode(DownloadActivity.this);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
while (!isCancelled()) {
|
||||
try {
|
||||
Thread.sleep(WAITING_INTERVAL);
|
||||
publishProgress();
|
||||
} catch (InterruptedException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
contentRefresher.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
contentRefresher.execute();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
private void stopContentRefresher() {
|
||||
if (contentRefresher != null) {
|
||||
contentRefresher.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, MENU_SHOW_LOG, Menu.NONE,
|
||||
R.string.show_download_log).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
menu.add(Menu.NONE, MENU_CANCEL_ALL_DOWNLOADS, Menu.NONE,
|
||||
R.string.cancel_all_downloads_label).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
listview.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case MENU_SHOW_LOG:
|
||||
startActivity(new Intent(this, DownloadLogActivity.class));
|
||||
break;
|
||||
case MENU_CANCEL_ALL_DOWNLOADS:
|
||||
requester.cancelAllDownloads(this);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> arg0, View view,
|
||||
int position, long id) {
|
||||
DownloadRequest selection = dla.getItem(position)
|
||||
.getDownloadRequest();
|
||||
if (selection != null && mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
dla.setSelectedItemIndex(position);
|
||||
selectedDownload = selection;
|
||||
mActionMode = startSupportActionMode(DownloadActivity.this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
if (!selectedDownload.isDone()) {
|
||||
TypedArray drawables = obtainStyledAttributes(new int[] { R.attr.navigation_cancel });
|
||||
menu.add(Menu.NONE, R.id.cancel_download_item, Menu.NONE,
|
||||
R.string.cancel_download_label).setIcon(
|
||||
drawables.getDrawable(0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, MENU_SHOW_LOG, Menu.NONE,
|
||||
R.string.show_download_log),
|
||||
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, MENU_CANCEL_ALL_DOWNLOADS, Menu.NONE,
|
||||
R.string.cancel_all_downloads_label),
|
||||
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
boolean handled = false;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.cancel_download_item:
|
||||
requester.cancelDownload(this, selectedDownload.getFeedFile());
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
mActionMode.finish();
|
||||
return handled;
|
||||
}
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case MENU_SHOW_LOG:
|
||||
startActivity(new Intent(this, DownloadLogActivity.class));
|
||||
break;
|
||||
case MENU_CANCEL_ALL_DOWNLOADS:
|
||||
requester.cancelAllDownloads(this);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
mActionMode = null;
|
||||
selectedDownload = null;
|
||||
dla.setSelectedItemIndex(DownloadlistAdapter.SELECTION_NONE);
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
if (selectedDownload != null) {
|
||||
TypedArray drawables = obtainStyledAttributes(new int[]{R.attr.navigation_cancel});
|
||||
menu.add(Menu.NONE, R.id.cancel_download_item, Menu.NONE,
|
||||
R.string.cancel_download_label).setIcon(
|
||||
drawables.getDrawable(0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private BroadcastReceiver contentChanged = new BroadcastReceiver() {
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (dla != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Refreshing content");
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
boolean handled = false;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.cancel_download_item:
|
||||
requester.cancelDownload(this, selectedDownload.getSource());
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
mActionMode.finish();
|
||||
return handled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
mActionMode = null;
|
||||
selectedDownload = null;
|
||||
dla.setSelectedItemIndex(DownloadlistAdapter.SELECTION_NONE);
|
||||
}
|
||||
|
||||
private BroadcastReceiver contentChanged = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (dla != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Refreshing content");
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,35 +1,47 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ListView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.DownloadLogAdapter;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Displays completed and failed downloads in a list. The data comes from the
|
||||
* FeedManager.
|
||||
* Displays completed and failed downloads in a list.
|
||||
*/
|
||||
public class DownloadLogActivity extends SherlockListActivity {
|
||||
public class DownloadLogActivity extends ActionBarActivity {
|
||||
private static final String TAG = "DownloadLogActivity";
|
||||
|
||||
DownloadLogAdapter dla;
|
||||
FeedManager manager;
|
||||
private List<DownloadStatus> downloadLog;
|
||||
private DownloadLogAdapter dla;
|
||||
|
||||
private ListView listview;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
manager = FeedManager.getInstance();
|
||||
setContentView(R.layout.listview_activity);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
dla = new DownloadLogAdapter(this);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setListAdapter(dla);
|
||||
|
||||
listview = (ListView) findViewById(R.id.listview);
|
||||
|
||||
dla = new DownloadLogAdapter(this, itemAccess);
|
||||
listview.setAdapter(dla);
|
||||
loadData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,12 +74,48 @@ public class DownloadLogActivity extends SherlockListActivity {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
AsyncTask<Void, Void, List<DownloadStatus>> loadTask = new AsyncTask<Void, Void, List<DownloadStatus>>() {
|
||||
@Override
|
||||
protected List<DownloadStatus> doInBackground(Void... voids) {
|
||||
return DBReader.getDownloadLog(DownloadLogActivity.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<DownloadStatus> downloadStatuses) {
|
||||
super.onPostExecute(downloadStatuses);
|
||||
if (downloadStatuses != null) {
|
||||
downloadLog = downloadStatuses;
|
||||
if (dla != null) {
|
||||
dla.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Could not load download log");
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute();
|
||||
}
|
||||
|
||||
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) {
|
||||
dla.notifyDataSetChanged();
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,113 +1,136 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.util.LangUtils;
|
||||
import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler;
|
||||
|
||||
/** Displays information about a feed. */
|
||||
public class FeedInfoActivity extends SherlockActivity {
|
||||
private static final String TAG = "FeedInfoActivity";
|
||||
/**
|
||||
* Displays information about a feed.
|
||||
*/
|
||||
public class FeedInfoActivity extends ActionBarActivity {
|
||||
private static final String TAG = "FeedInfoActivity";
|
||||
|
||||
public static final String EXTRA_FEED_ID = "de.danoeh.antennapod.extra.feedId";
|
||||
public static final String EXTRA_FEED_ID = "de.danoeh.antennapod.extra.feedId";
|
||||
|
||||
private Feed feed;
|
||||
private Feed feed;
|
||||
|
||||
private ImageView imgvCover;
|
||||
private TextView txtvTitle;
|
||||
private TextView txtvDescription;
|
||||
private TextView txtvLanguage;
|
||||
private TextView txtvAuthor;
|
||||
private ImageView imgvCover;
|
||||
private TextView txtvTitle;
|
||||
private TextView txtvDescription;
|
||||
private TextView txtvLanguage;
|
||||
private TextView txtvAuthor;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.feedinfo);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
long feedId = getIntent().getLongExtra(EXTRA_FEED_ID, -1);
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
feed = manager.getFeed(feedId);
|
||||
if (feed != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Language is " + feed.getLanguage());
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Author is " + feed.getAuthor());
|
||||
imgvCover = (ImageView) findViewById(R.id.imgvCover);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
|
||||
txtvDescription = (TextView) findViewById(R.id.txtvDescription);
|
||||
txtvLanguage = (TextView) findViewById(R.id.txtvLanguage);
|
||||
txtvAuthor = (TextView) findViewById(R.id.txtvAuthor);
|
||||
imgvCover.post(new Runnable() {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.feedinfo);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
long feedId = getIntent().getLongExtra(EXTRA_FEED_ID, -1);
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ImageLoader.getInstance().loadThumbnailBitmap(
|
||||
feed.getImage(), imgvCover);
|
||||
}
|
||||
});
|
||||
AsyncTask<Long, Void, Feed> loadTask = new AsyncTask<Long, Void, Feed>() {
|
||||
|
||||
txtvTitle.setText(feed.getTitle());
|
||||
txtvDescription.setText(feed.getDescription());
|
||||
if (feed.getAuthor() != null) {
|
||||
txtvAuthor.setText(feed.getAuthor());
|
||||
}
|
||||
if (feed.getLanguage() != null) {
|
||||
txtvLanguage.setText(LangUtils.getLanguageString(feed
|
||||
.getLanguage()));
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
}
|
||||
@Override
|
||||
protected Feed doInBackground(Long... params) {
|
||||
return DBReader.getFeed(FeedInfoActivity.this, params[0]);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(Feed result) {
|
||||
super.onPostExecute(result);
|
||||
if (result != null) {
|
||||
feed = result;
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Language is " + feed.getLanguage());
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Author is " + feed.getAuthor());
|
||||
imgvCover = (ImageView) findViewById(R.id.imgvCover);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
|
||||
txtvDescription = (TextView) findViewById(R.id.txtvDescription);
|
||||
txtvLanguage = (TextView) findViewById(R.id.txtvLanguage);
|
||||
txtvAuthor = (TextView) findViewById(R.id.txtvAuthor);
|
||||
imgvCover.post(new Runnable() {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.feedinfo, menu);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
ImageLoader.getInstance().loadThumbnailBitmap(
|
||||
feed.getImage(), imgvCover);
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
menu.findItem(R.id.support_item).setVisible(
|
||||
feed.getPaymentLink() != null);
|
||||
menu.findItem(R.id.share_link_item).setVisible(feed.getLink() != null);
|
||||
txtvTitle.setText(feed.getTitle());
|
||||
txtvDescription.setText(feed.getDescription());
|
||||
if (feed.getAuthor() != null) {
|
||||
txtvAuthor.setText(feed.getAuthor());
|
||||
}
|
||||
if (feed.getLanguage() != null) {
|
||||
txtvLanguage.setText(LangUtils
|
||||
.getLanguageString(feed.getLanguage()));
|
||||
}
|
||||
supportInvalidateOptionsMenu();
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute(feedId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
try {
|
||||
return FeedMenuHandler.onOptionsItemClicked(this, item, feed);
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this, e.getMessage());
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (feed != null) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.feedinfo, menu);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
if (feed != null) {
|
||||
menu.findItem(R.id.support_item).setVisible(
|
||||
feed.getPaymentLink() != null);
|
||||
menu.findItem(R.id.share_link_item).setVisible(feed.getLink() != null);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
try {
|
||||
return FeedMenuHandler.onOptionsItemClicked(this, item, feed);
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this,
|
||||
e.getMessage());
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,151 +1,215 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.SearchManager;
|
||||
import android.app.SearchableInfo;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.media.AudioManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.actionbarsherlock.view.Window;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.FeedRemover;
|
||||
import de.danoeh.antennapod.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
|
||||
import de.danoeh.antennapod.fragment.FeedlistFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemlistFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler;
|
||||
|
||||
/** Displays a List of FeedItems */
|
||||
public class FeedItemlistActivity extends SherlockFragmentActivity {
|
||||
private static final String TAG = "FeedItemlistActivity";
|
||||
/**
|
||||
* Displays a List of FeedItems
|
||||
*/
|
||||
public class FeedItemlistActivity extends ActionBarActivity {
|
||||
private static final String TAG = "FeedItemlistActivity";
|
||||
|
||||
private FeedManager manager;
|
||||
/**
|
||||
* The feed which the activity displays
|
||||
*/
|
||||
private Feed feed;
|
||||
private ItemlistFragment filf;
|
||||
private ExternalPlayerFragment externalPlayerFragment;
|
||||
|
||||
/** The feed which the activity displays */
|
||||
private Feed feed;
|
||||
private ItemlistFragment filf;
|
||||
private ExternalPlayerFragment externalPlayerFragment;
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.feeditemlist_activity);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.feeditemlist_activity);
|
||||
long feedId = getIntent().getLongExtra(
|
||||
FeedlistFragment.EXTRA_SELECTED_FEED, -1);
|
||||
if (feedId == -1) {
|
||||
Log.e(TAG, "Received invalid feed selection.");
|
||||
} else {
|
||||
loadData(feedId);
|
||||
}
|
||||
|
||||
manager = FeedManager.getInstance();
|
||||
long feedId = getIntent().getLongExtra(
|
||||
FeedlistFragment.EXTRA_SELECTED_FEED, -1);
|
||||
if (feedId == -1)
|
||||
Log.e(TAG, "Received invalid feed selection.");
|
||||
}
|
||||
|
||||
feed = manager.getFeed(feedId);
|
||||
setTitle(feed.getTitle());
|
||||
private void loadData(long id) {
|
||||
AsyncTask<Long, Void, Feed> loadTask = new AsyncTask<Long, Void, Feed>() {
|
||||
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fT = fragmentManager.beginTransaction();
|
||||
@Override
|
||||
protected Feed doInBackground(Long... longs) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Loading feed data in background");
|
||||
return DBReader.getFeed(FeedItemlistActivity.this, longs[0]);
|
||||
}
|
||||
|
||||
filf = ItemlistFragment.newInstance(feed.getId());
|
||||
fT.replace(R.id.feeditemlistFragment, filf);
|
||||
@Override
|
||||
protected void onPostExecute(Feed result) {
|
||||
super.onPostExecute(result);
|
||||
if (result != null) {
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Finished loading feed data");
|
||||
feed = result;
|
||||
setTitle(feed.getTitle());
|
||||
|
||||
externalPlayerFragment = new ExternalPlayerFragment();
|
||||
fT.replace(R.id.playerFragment, externalPlayerFragment);
|
||||
fT.commit();
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fT = fragmentManager.beginTransaction();
|
||||
|
||||
}
|
||||
filf = ItemlistFragment.newInstance(feed.getId());
|
||||
fT.replace(R.id.feeditemlistFragment, filf);
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
}
|
||||
externalPlayerFragment = new ExternalPlayerFragment();
|
||||
fT.replace(R.id.playerFragment, externalPlayerFragment);
|
||||
fT.commit();
|
||||
supportInvalidateOptionsMenu();
|
||||
} else {
|
||||
Log.e(TAG, "Error: Feed was null");
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
TypedArray drawables = obtainStyledAttributes(new int[] { R.attr.action_search });
|
||||
menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(drawables.getDrawable(0))
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
return FeedMenuHandler
|
||||
.onCreateOptionsMenu(new MenuInflater(this), menu);
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
return FeedMenuHandler.onPrepareOptionsMenu(menu, feed);
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (feed != null) {
|
||||
TypedArray drawables = obtainStyledAttributes(new int[]{R.attr.action_search});
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(drawables.getDrawable(0)),
|
||||
MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
MenuItemCompat.setActionView(menu.findItem(R.id.search_item), new SearchView(this));
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
try {
|
||||
if (FeedMenuHandler.onOptionsItemClicked(this, item, feed)) {
|
||||
filf.getListAdapter().notifyDataSetChanged();
|
||||
} else {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.remove_item:
|
||||
final FeedRemover remover = new FeedRemover(
|
||||
FeedItemlistActivity.this, feed) {
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
ConfirmationDialog conDialog = new ConfirmationDialog(this,
|
||||
R.string.remove_feed_label,
|
||||
R.string.feed_delete_confirmation_msg) {
|
||||
SearchManager searchManager =
|
||||
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search_item));
|
||||
|
||||
@Override
|
||||
public void onConfirmButtonPressed(
|
||||
DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
remover.executeAsync();
|
||||
}
|
||||
};
|
||||
conDialog.createNewDialog().show();
|
||||
break;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
break;
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this,
|
||||
e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSearchRequested() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong(SearchActivity.EXTRA_FEED_ID, feed.getId());
|
||||
startSearch(null, false, bundle, false);
|
||||
return true;
|
||||
}
|
||||
searchView.setIconifiedByDefault(true);
|
||||
|
||||
searchView.setSearchableInfo(
|
||||
searchManager.getSearchableInfo(getComponentName()));
|
||||
return FeedMenuHandler
|
||||
.onCreateOptionsMenu(new MenuInflater(this), menu);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
return FeedMenuHandler.onPrepareOptionsMenu(menu, feed);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
try {
|
||||
if (FeedMenuHandler.onOptionsItemClicked(this, item, feed)) {
|
||||
filf.getListAdapter().notifyDataSetChanged();
|
||||
} else {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.remove_item:
|
||||
final FeedRemover remover = new FeedRemover(
|
||||
FeedItemlistActivity.this, feed) {
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
ConfirmationDialog conDialog = new ConfirmationDialog(this,
|
||||
R.string.remove_feed_label,
|
||||
R.string.feed_delete_confirmation_msg) {
|
||||
|
||||
@Override
|
||||
public void onConfirmButtonPressed(
|
||||
DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
remover.executeAsync();
|
||||
}
|
||||
};
|
||||
conDialog.createNewDialog().show();
|
||||
break;
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this,
|
||||
e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSearchRequested() {
|
||||
if (feed != null) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong(SearchActivity.EXTRA_FEED_ID, feed.getId());
|
||||
startSearch(null, false, bundle, false);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent) {
|
||||
if (intent.getAction() != null &&
|
||||
intent.getAction().equals(Intent.ACTION_SEARCH)) {
|
||||
addSearchInformation(intent);
|
||||
}
|
||||
super.startActivity(intent);
|
||||
}
|
||||
|
||||
private void addSearchInformation(Intent startIntent) {
|
||||
startIntent.putExtra(SearchActivity.EXTRA_FEED_ID, feed.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import org.shredzone.flattr4j.exception.FlattrException;
|
||||
|
||||
import android.content.Intent;
|
||||
@ -12,10 +15,6 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
@ -23,7 +22,7 @@ import de.danoeh.antennapod.util.flattr.FlattrUtils;
|
||||
|
||||
/** Guides the user through the authentication process */
|
||||
|
||||
public class FlattrAuthActivity extends SherlockActivity {
|
||||
public class FlattrAuthActivity extends ActionBarActivity {
|
||||
private static final String TAG = "FlattrAuthActivity";
|
||||
|
||||
private TextView txtvExplanation;
|
||||
|
@ -1,55 +1,60 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
import android.media.AudioManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.actionbarsherlock.view.Window;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.fragment.FeedlistFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemDescriptionFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemlistFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.util.QueueAccess;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
/** Displays a single FeedItem and provides various actions */
|
||||
public class ItemviewActivity extends SherlockFragmentActivity {
|
||||
public class ItemviewActivity extends ActionBarActivity {
|
||||
private static final String TAG = "ItemviewActivity";
|
||||
|
||||
private FeedManager manager;
|
||||
private FeedItem item;
|
||||
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED | EventDistributor.DOWNLOAD_QUEUED;
|
||||
|
||||
// Widgets
|
||||
private TextView txtvTitle;
|
||||
private TextView txtvPublished;
|
||||
private FeedItem item;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
manager = FeedManager.getInstance();
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
extractFeeditem();
|
||||
populateUI();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
long itemId = getIntent().getLongExtra(
|
||||
ItemlistFragment.EXTRA_SELECTED_FEEDITEM, -1);
|
||||
if (itemId == -1) {
|
||||
Log.e(TAG, "Received invalid selection of either feeditem or feed.");
|
||||
} else {
|
||||
loadData(itemId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,32 +67,43 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Stopping Activity");
|
||||
}
|
||||
|
||||
/** Extracts FeedItem object the activity is supposed to display */
|
||||
private void extractFeeditem() {
|
||||
long itemId = getIntent().getLongExtra(
|
||||
ItemlistFragment.EXTRA_SELECTED_FEEDITEM, -1);
|
||||
long feedId = getIntent().getLongExtra(
|
||||
FeedlistFragment.EXTRA_SELECTED_FEED, -1);
|
||||
if (itemId == -1 || feedId == -1) {
|
||||
Log.e(TAG, "Received invalid selection of either feeditem or feed.");
|
||||
}
|
||||
Feed feed = manager.getFeed(feedId);
|
||||
item = manager.getFeedItem(itemId, feed);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Title of item is " + item.getTitle());
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Title of feed is " + item.getFeed().getTitle());
|
||||
}
|
||||
private void loadData(long itemId) {
|
||||
AsyncTask<Long, Void, FeedItem> loadTask = new AsyncTask<Long, Void, FeedItem>() {
|
||||
|
||||
@Override
|
||||
protected FeedItem doInBackground(Long... longs) {
|
||||
return DBReader.getFeedItem(ItemviewActivity.this, longs[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(FeedItem feedItem) {
|
||||
super.onPostExecute(feedItem);
|
||||
if (feedItem != null && feedItem.getFeed() != null) {
|
||||
item = feedItem;
|
||||
populateUI();
|
||||
supportInvalidateOptionsMenu();
|
||||
} else {
|
||||
if (feedItem == null) {
|
||||
Log.e(TAG, "Error: FeedItem was null");
|
||||
} else if (feedItem.getFeed() == null) {
|
||||
Log.e(TAG, "Error: Feed was null");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute(itemId);
|
||||
}
|
||||
|
||||
private void populateUI() {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.feeditemview);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvItemname);
|
||||
txtvPublished = (TextView) findViewById(R.id.txtvPublished);
|
||||
TextView txtvTitle = (TextView) findViewById(R.id.txtvItemname);
|
||||
TextView txtvPublished = (TextView) findViewById(R.id.txtvPublished);
|
||||
setTitle(item.getFeed().getTitle());
|
||||
|
||||
txtvPublished.setText(DateUtils.formatSameDayTime(item.getPubDate()
|
||||
@ -106,9 +122,13 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getSupportMenuInflater();
|
||||
inflater.inflate(R.menu.feeditem, menu);
|
||||
return true;
|
||||
if (item != null) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.feeditem, menu);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -134,13 +154,28 @@ public class ItemviewActivity extends SherlockFragmentActivity {
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(final Menu menu) {
|
||||
return FeedItemMenuHandler.onPrepareMenu(
|
||||
new FeedItemMenuHandler.MenuInterface() {
|
||||
new FeedItemMenuHandler.MenuInterface() {
|
||||
|
||||
@Override
|
||||
public void setItemVisibility(int id, boolean visible) {
|
||||
menu.findItem(id).setVisible(visible);
|
||||
}
|
||||
}, item, true);
|
||||
@Override
|
||||
public void setItemVisibility(int id, boolean visible) {
|
||||
menu.findItem(id).setVisible(visible);
|
||||
}
|
||||
}, item, true, QueueAccess.NotInQueueAccess());
|
||||
}
|
||||
|
||||
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
|
||||
|
||||
@Override
|
||||
public void update(EventDistributor eventDistributor, Integer arg) {
|
||||
if ((EVENTS & arg) != 0) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Received contentUpdate Intent.");
|
||||
if (item != null) {
|
||||
loadData(item.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,44 +2,47 @@ package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.SearchManager;
|
||||
import android.app.SearchableInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.ActionBar.Tab;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.actionbarsherlock.view.Window;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.fragment.EpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
|
||||
import de.danoeh.antennapod.fragment.FeedlistFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.service.PlaybackService;
|
||||
import de.danoeh.antennapod.service.download.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DBTasks;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
|
||||
/** The activity that is shown when the user launches the app. */
|
||||
public class MainActivity extends SherlockFragmentActivity {
|
||||
public class MainActivity extends ActionBarActivity {
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED
|
||||
| EventDistributor.DOWNLOAD_QUEUED;
|
||||
|
||||
private FeedManager manager;
|
||||
private ViewPager viewpager;
|
||||
private TabsAdapter pagerAdapter;
|
||||
private ExternalPlayerFragment externalPlayerFragment;
|
||||
@ -51,20 +54,20 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
manager = FeedManager.getInstance();
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.main);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
|
||||
viewpager = (ViewPager) findViewById(R.id.viewpager);
|
||||
pagerAdapter = new TabsAdapter(this, viewpager);
|
||||
|
||||
viewpager.setAdapter(pagerAdapter);
|
||||
|
||||
Tab feedsTab = getSupportActionBar().newTab();
|
||||
ActionBar.Tab feedsTab = getSupportActionBar().newTab();
|
||||
feedsTab.setText(R.string.podcasts_label);
|
||||
Tab episodesTab = getSupportActionBar().newTab();
|
||||
ActionBar.Tab episodesTab = getSupportActionBar().newTab();
|
||||
episodesTab.setText(R.string.episodes_label);
|
||||
|
||||
pagerAdapter.addTab(feedsTab, FeedlistFragment.class, null);
|
||||
@ -80,7 +83,7 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
if (!appLaunched && getIntent().getAction() != null
|
||||
&& getIntent().getAction().equals(Intent.ACTION_MAIN)) {
|
||||
appLaunched = true;
|
||||
if (manager.getUnreadItemsSize(true) > 0) {
|
||||
if (DBReader.getNumberOfUnreadItems(this) > 0) {
|
||||
// select 'episodes' tab
|
||||
getSupportActionBar().setSelectedNavigationItem(1);
|
||||
}
|
||||
@ -142,7 +145,7 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
startActivity(new Intent(this, AddFeedActivity.class));
|
||||
return true;
|
||||
case R.id.all_feed_refresh:
|
||||
manager.refreshAllFeeds(this);
|
||||
DBTasks.refreshAllFeeds(this, null);
|
||||
return true;
|
||||
case R.id.show_downloads:
|
||||
startActivity(new Intent(this, DownloadActivity.class));
|
||||
@ -153,9 +156,6 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
case R.id.show_player:
|
||||
startActivity(PlaybackService.getPlayerActivityIntent(this));
|
||||
return true;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
return true;
|
||||
case R.id.show_playback_history:
|
||||
startActivity(new Intent(this, PlaybackHistoryActivity.class));
|
||||
return true;
|
||||
@ -173,9 +173,6 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
} else {
|
||||
refreshAll.setVisible(true);
|
||||
}
|
||||
|
||||
boolean hasFeeds = manager.getFeedsSize() > 0;
|
||||
menu.findItem(R.id.all_feed_refresh).setVisible(hasFeeds);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -183,7 +180,23 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.main, menu);
|
||||
return true;
|
||||
|
||||
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
|
||||
@ -248,7 +261,7 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabSelected(Tab tab, FragmentTransaction ft) {
|
||||
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) {
|
||||
@ -258,12 +271,12 @@ public class MainActivity extends SherlockFragmentActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
|
||||
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(Tab tab, FragmentTransaction ft) {
|
||||
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,24 +4,23 @@ import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
|
||||
import de.danoeh.antennapod.dialog.TimeDialog;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.service.PlaybackService;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
@ -35,12 +34,10 @@ import de.danoeh.antennapod.util.playback.PlaybackController;
|
||||
* Provides general features which are both needed for playing audio and video
|
||||
* files.
|
||||
*/
|
||||
public abstract class MediaplayerActivity extends SherlockFragmentActivity
|
||||
public abstract class MediaplayerActivity extends ActionBarActivity
|
||||
implements OnSeekBarChangeListener {
|
||||
private static final String TAG = "MediaplayerActivity";
|
||||
|
||||
protected FeedManager manager;
|
||||
|
||||
protected PlaybackController controller;
|
||||
|
||||
protected TextView txtvPosition;
|
||||
@ -132,10 +129,19 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
|
||||
public void onPlaybackEnd() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackSpeedChange() {
|
||||
MediaplayerActivity.this.onPlaybackSpeedChange();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
protected void onPlaybackSpeedChange() {
|
||||
|
||||
}
|
||||
|
||||
protected void onServiceQueried() {
|
||||
supportInvalidateOptionsMenu();
|
||||
}
|
||||
@ -147,9 +153,9 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating Activity");
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
orientation = getResources().getConfiguration().orientation;
|
||||
manager = FeedManager.getInstance();
|
||||
orientation = getResources().getConfiguration().orientation;
|
||||
getWindow().setFormat(PixelFormat.TRANSPARENT);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
@ -5,13 +5,11 @@ import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.viewpagerindicator.TabPageIndicator;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
@ -21,14 +19,13 @@ import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
* activity uses MiroGuideChannelListFragments for these lists. If the user
|
||||
* selects a channel, the MiroGuideChannelViewActivity is started.
|
||||
*/
|
||||
public class MiroGuideCategoryActivity extends SherlockFragmentActivity {
|
||||
public class MiroGuideCategoryActivity extends ActionBarActivity {
|
||||
private static final String TAG = "MiroGuideCategoryActivity";
|
||||
|
||||
public static String EXTRA_CATEGORY = "category";
|
||||
public static final String EXTRA_CATEGORY = "category";
|
||||
|
||||
private ViewPager viewpager;
|
||||
private CategoryPagerAdapter pagerAdapter;
|
||||
private TabPageIndicator tabs;
|
||||
|
||||
private String category;
|
||||
|
||||
@ -40,14 +37,12 @@ public class MiroGuideCategoryActivity extends SherlockFragmentActivity {
|
||||
setContentView(R.layout.miroguide_category);
|
||||
|
||||
viewpager = (ViewPager) findViewById(R.id.viewpager);
|
||||
tabs = (TabPageIndicator) findViewById(R.id.tabs);
|
||||
|
||||
category = getIntent().getStringExtra(EXTRA_CATEGORY);
|
||||
if (category != null) {
|
||||
getSupportActionBar().setTitle(category);
|
||||
pagerAdapter = new CategoryPagerAdapter(getSupportFragmentManager());
|
||||
viewpager.setAdapter(pagerAdapter);
|
||||
tabs.setViewPager(viewpager);
|
||||
} else {
|
||||
Log.e(TAG, "Activity was started with invalid arguments");
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
@ -15,21 +20,16 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.MiroGuideItemlistAdapter;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.miroguide.conn.MiroGuideException;
|
||||
import de.danoeh.antennapod.miroguide.conn.MiroGuideService;
|
||||
import de.danoeh.antennapod.miroguide.model.MiroGuideChannel;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
|
||||
@ -37,147 +37,164 @@ import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
* Displays information about one channel and lets the user add this channel to
|
||||
* his library.
|
||||
*/
|
||||
public class MiroGuideChannelViewActivity extends SherlockActivity {
|
||||
public class MiroGuideChannelViewActivity extends ActionBarActivity {
|
||||
private static final String TAG = "MiroGuideChannelViewActivity";
|
||||
|
||||
public static final String EXTRA_CHANNEL_ID = "id";
|
||||
public static final String EXTRA_CHANNEL_URL = "url";
|
||||
public static final String EXTRA_CHANNEL_ID = "id";
|
||||
public static final String EXTRA_CHANNEL_URL = "url";
|
||||
|
||||
private RelativeLayout layoutContent;
|
||||
private ProgressBar progLoading;
|
||||
private TextView txtvTitle;
|
||||
private TextView txtVDescription;
|
||||
private ListView listEntries;
|
||||
private RelativeLayout layoutContent;
|
||||
private ProgressBar progLoading;
|
||||
private TextView txtvTitle;
|
||||
private TextView txtVDescription;
|
||||
private ListView listEntries;
|
||||
|
||||
private long channelId;
|
||||
private String channelUrl;
|
||||
private MiroGuideChannel channel;
|
||||
private long channelId;
|
||||
private String channelUrl;
|
||||
private MiroGuideChannel channel;
|
||||
private volatile List<Feed> feeds;
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
channelLoader.cancel(true);
|
||||
}
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
channelLoader.cancel(true);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miroguide_channelview);
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miroguide_channelview);
|
||||
|
||||
layoutContent = (RelativeLayout) findViewById(R.id.layout_content);
|
||||
progLoading = (ProgressBar) findViewById(R.id.progLoading);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
|
||||
txtVDescription = (TextView) findViewById(R.id.txtvDescription);
|
||||
listEntries = (ListView) findViewById(R.id.itemlist);
|
||||
layoutContent = (RelativeLayout) findViewById(R.id.layout_content);
|
||||
progLoading = (ProgressBar) findViewById(R.id.progLoading);
|
||||
txtvTitle = (TextView) findViewById(R.id.txtvTitle);
|
||||
txtVDescription = (TextView) findViewById(R.id.txtvDescription);
|
||||
listEntries = (ListView) findViewById(R.id.itemlist);
|
||||
|
||||
channelId = getIntent().getLongExtra(EXTRA_CHANNEL_ID, -1);
|
||||
channelUrl = getIntent().getStringExtra(EXTRA_CHANNEL_URL);
|
||||
channelId = getIntent().getLongExtra(EXTRA_CHANNEL_ID, -1);
|
||||
channelUrl = getIntent().getStringExtra(EXTRA_CHANNEL_URL);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
channelLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
channelLoader.execute();
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
channelLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
channelLoader.execute();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** Is used to load channel information asynchronously. */
|
||||
private AsyncTask<Void, Void, Void> channelLoader = new AsyncTask<Void, Void, Void>() {
|
||||
private static final String TAG = "ChannelLoader";
|
||||
private Exception exception;
|
||||
/**
|
||||
* Is used to load channel information asynchronously.
|
||||
*/
|
||||
private AsyncTask<Void, Void, Void> channelLoader = new AsyncTask<Void, Void, Void>() {
|
||||
private static final String TAG = "ChannelLoader";
|
||||
private Exception exception;
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Starting background task");
|
||||
MiroGuideService service = new MiroGuideService();
|
||||
try {
|
||||
channel = service.getChannel(channelId);
|
||||
} catch (MiroGuideException e) {
|
||||
e.printStackTrace();
|
||||
exception = e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Starting background task");
|
||||
feeds = DBReader.getFeedList(MiroGuideChannelViewActivity.this);
|
||||
MiroGuideService service = new MiroGuideService();
|
||||
try {
|
||||
channel = service.getChannel(channelId);
|
||||
} catch (MiroGuideException e) {
|
||||
e.printStackTrace();
|
||||
exception = e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Loading finished");
|
||||
if (exception == null) {
|
||||
txtvTitle.setText(channel.getName());
|
||||
txtVDescription.setText(channel.getDescription());
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Loading finished");
|
||||
if (exception == null) {
|
||||
txtvTitle.setText(channel.getName());
|
||||
txtVDescription.setText(channel.getDescription());
|
||||
|
||||
MiroGuideItemlistAdapter listAdapter = new MiroGuideItemlistAdapter(
|
||||
MiroGuideChannelViewActivity.this, 0,
|
||||
channel.getItems());
|
||||
listEntries.setAdapter(listAdapter);
|
||||
progLoading.setVisibility(View.GONE);
|
||||
layoutContent.setVisibility(View.VISIBLE);
|
||||
supportInvalidateOptionsMenu();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
MiroGuideItemlistAdapter listAdapter = new MiroGuideItemlistAdapter(
|
||||
MiroGuideChannelViewActivity.this, 0,
|
||||
channel.getItems());
|
||||
listEntries.setAdapter(listAdapter);
|
||||
progLoading.setVisibility(View.GONE);
|
||||
layoutContent.setVisibility(View.VISIBLE);
|
||||
supportInvalidateOptionsMenu();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.channelview, menu);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.channelview, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
boolean channelLoaded = channel != null;
|
||||
boolean beingDownloaded = channelLoaded
|
||||
&& DownloadRequester.getInstance().isDownloadingFile(
|
||||
channel.getDownloadUrl());
|
||||
boolean notAdded = channelLoaded
|
||||
&& !((FeedManager.getInstance().feedExists(
|
||||
channel.getDownloadUrl()) || beingDownloaded));
|
||||
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
||||
menu.findItem(R.id.visit_website_item).setVisible(
|
||||
channelLoaded && channel.getWebsiteUrl() != null);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
boolean channelLoaded = channel != null;
|
||||
boolean beingDownloaded = channelLoaded
|
||||
&& DownloadRequester.getInstance().isDownloadingFile(
|
||||
channel.getDownloadUrl());
|
||||
boolean notAdded = channelLoaded
|
||||
&& !((feedExists(
|
||||
channel.getDownloadUrl()) || beingDownloaded));
|
||||
menu.findItem(R.id.add_feed).setVisible(notAdded);
|
||||
menu.findItem(R.id.visit_website_item).setVisible(
|
||||
channelLoaded && channel.getWebsiteUrl() != null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.visit_website_item:
|
||||
Uri uri = Uri.parse(channel.getWebsiteUrl());
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
return true;
|
||||
case R.id.add_feed:
|
||||
try {
|
||||
DownloadRequester.getInstance().downloadFeed(
|
||||
this,
|
||||
new Feed(channel.getDownloadUrl(), new Date(), channel
|
||||
.getName()));
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this,
|
||||
e.getMessage());
|
||||
}
|
||||
Toast toast = Toast.makeText(this, R.string.miro_feed_added,
|
||||
Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
supportInvalidateOptionsMenu();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.visit_website_item:
|
||||
Uri uri = Uri.parse(channel.getWebsiteUrl());
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
return true;
|
||||
case R.id.add_feed:
|
||||
try {
|
||||
DownloadRequester.getInstance().downloadFeed(
|
||||
this,
|
||||
new Feed(channel.getDownloadUrl(), new Date(), channel
|
||||
.getName()));
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(this,
|
||||
e.getMessage());
|
||||
}
|
||||
Toast toast = Toast.makeText(this, R.string.miro_feed_added,
|
||||
Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
supportInvalidateOptionsMenu();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean feedExists(String downloadUrl) {
|
||||
if (feeds == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Feed feed : feeds) {
|
||||
if (feed.getDownload_url().equals(downloadUrl)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,24 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.SearchManager;
|
||||
import android.app.SearchableInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.miroguide.conn.MiroGuideException;
|
||||
@ -24,132 +29,140 @@ import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
* Shows a list of available categories and offers a search button. If the user
|
||||
* selects a category, the MiroGuideCategoryActivity is started.
|
||||
*/
|
||||
public class MiroGuideMainActivity extends SherlockListActivity {
|
||||
private static final String TAG = "MiroGuideMainActivity";
|
||||
public class MiroGuideMainActivity extends ActionBarActivity implements AdapterView.OnItemClickListener {
|
||||
private static final String TAG = "MiroGuideMainActivity";
|
||||
|
||||
private static String[] categories;
|
||||
private ArrayAdapter<String> listAdapter;
|
||||
private static String[] categories;
|
||||
private ArrayAdapter<String> listAdapter;
|
||||
|
||||
private TextView txtvStatus;
|
||||
private TextView txtvStatus;
|
||||
private ListView listView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miroguide_categorylist);
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miroguide_categorylist);
|
||||
|
||||
txtvStatus = (TextView) findViewById(android.R.id.empty);
|
||||
}
|
||||
txtvStatus = (TextView) findViewById(android.R.id.empty);
|
||||
listView = (ListView) findViewById(android.R.id.list);
|
||||
listView.setOnItemClickListener(this);
|
||||
listView.setEmptyView(txtvStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (categories != null) {
|
||||
createAdapter();
|
||||
} else {
|
||||
loadCategories();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (categories != null) {
|
||||
createAdapter();
|
||||
} else {
|
||||
loadCategories();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
String selection = listAdapter.getItem(position);
|
||||
Intent launchIntent = new Intent(this, MiroGuideCategoryActivity.class);
|
||||
launchIntent.putExtra(MiroGuideCategoryActivity.EXTRA_CATEGORY,
|
||||
selection);
|
||||
startActivity(launchIntent);
|
||||
}
|
||||
private void createAdapter() {
|
||||
if (categories != null) {
|
||||
listAdapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_list_item_1, categories);
|
||||
txtvStatus.setText(R.string.no_items_label);
|
||||
listView.setAdapter(listAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
private void createAdapter() {
|
||||
if (categories != null) {
|
||||
listAdapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_list_item_1, categories);
|
||||
txtvStatus.setText(R.string.no_items_label);
|
||||
setListAdapter(listAdapter);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Launches an AsyncTask to load the available categories in the background.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private void loadCategories() {
|
||||
AsyncTask<Void, Void, Void> listLoader = new AsyncTask<Void, Void, Void>() {
|
||||
|
||||
/**
|
||||
* Launches an AsyncTask to load the available categories in the background.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
private void loadCategories() {
|
||||
AsyncTask<Void, Void, Void> listLoader = new AsyncTask<Void, Void, Void>() {
|
||||
private String[] c;
|
||||
private MiroGuideException exception;
|
||||
|
||||
private String[] c;
|
||||
private MiroGuideException exception;
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (exception == null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Successfully loaded categories");
|
||||
categories = c;
|
||||
createAdapter();
|
||||
} else {
|
||||
Log.e(TAG, "Error happened while trying to load categories");
|
||||
txtvStatus.setText(exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
if (exception == null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Successfully loaded categories");
|
||||
categories = c;
|
||||
createAdapter();
|
||||
} else {
|
||||
Log.e(TAG, "Error happened while trying to load categories");
|
||||
txtvStatus.setText(exception.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
txtvStatus.setText(R.string.loading_categories_label);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
txtvStatus.setText(R.string.loading_categories_label);
|
||||
}
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
MiroGuideService service = new MiroGuideService();
|
||||
try {
|
||||
c = service.getCategories();
|
||||
} catch (MiroGuideException e) {
|
||||
e.printStackTrace();
|
||||
exception = e;
|
||||
} finally {
|
||||
service.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
MiroGuideService service = new MiroGuideService();
|
||||
try {
|
||||
c = service.getCategories();
|
||||
} catch (MiroGuideException e) {
|
||||
e.printStackTrace();
|
||||
exception = e;
|
||||
} finally {
|
||||
service.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
listLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
listLoader.execute();
|
||||
}
|
||||
}
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
listLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
listLoader.execute();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(
|
||||
obtainStyledAttributes(
|
||||
new int[]{R.attr.action_search})
|
||||
.getDrawable(0)),
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
MenuItemCompat.setActionView(menu.findItem(R.id.search_item), new SearchView(this));
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(
|
||||
obtainStyledAttributes(
|
||||
new int[] { R.attr.action_search })
|
||||
.getDrawable(0))
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
SearchManager searchManager =
|
||||
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search_item));
|
||||
searchView.setIconifiedByDefault(true);
|
||||
searchView.setSearchableInfo(
|
||||
searchManager.getSearchableInfo(getComponentName()));
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
|
||||
String selection = listAdapter.getItem(position);
|
||||
Intent launchIntent = new Intent(this, MiroGuideCategoryActivity.class);
|
||||
launchIntent.putExtra(MiroGuideCategoryActivity.EXTRA_CATEGORY,
|
||||
selection);
|
||||
startActivity(launchIntent);
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import android.app.SearchManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment;
|
||||
@ -19,72 +19,72 @@ import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
* Displays results when a search for miroguide channels has been performed. It
|
||||
* uses a MiroGuideChannelListFragment to display the results.
|
||||
*/
|
||||
public class MiroGuideSearchActivity extends SherlockFragmentActivity {
|
||||
private static final String TAG = "MiroGuideSearchActivity";
|
||||
public class MiroGuideSearchActivity extends ActionBarActivity {
|
||||
private static final String TAG = "MiroGuideSearchActivity";
|
||||
|
||||
private MiroGuideChannellistFragment listFragment;
|
||||
private MiroGuideChannellistFragment listFragment;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle arg0) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(arg0);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miroguidesearch);
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle arg0) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(arg0);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miroguidesearch);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Intent intent = getIntent();
|
||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||
getSupportActionBar()
|
||||
.setSubtitle(
|
||||
getString(R.string.search_term_label) + "\""
|
||||
+ query + "\"");
|
||||
handleSearchRequest(query);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Intent intent = getIntent();
|
||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||
getSupportActionBar()
|
||||
.setSubtitle(
|
||||
getString(R.string.search_term_label) + "\""
|
||||
+ query + "\"");
|
||||
handleSearchRequest(query);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSearchRequest(String query) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Performing search");
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
listFragment = MiroGuideChannellistFragment.newInstance("name", query,
|
||||
"name");
|
||||
ft.replace(R.id.channellistFragment, listFragment);
|
||||
ft.commit();
|
||||
}
|
||||
private void handleSearchRequest(String query) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Performing search");
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
listFragment = MiroGuideChannellistFragment.newInstance("name", query,
|
||||
"name");
|
||||
ft.replace(R.id.channellistFragment, listFragment);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
setIntent(intent);
|
||||
}
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(
|
||||
obtainStyledAttributes(
|
||||
new int[] { R.attr.action_search })
|
||||
.getDrawable(0))
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(
|
||||
obtainStyledAttributes(
|
||||
new int[]{R.attr.action_search})
|
||||
.getDrawable(0)),
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.Date;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
@ -17,13 +18,12 @@ import android.view.Gravity;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.service.download.DownloadRequest;
|
||||
import de.danoeh.antennapod.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.service.download.Downloader;
|
||||
import de.danoeh.antennapod.service.download.DownloaderCallback;
|
||||
import de.danoeh.antennapod.service.download.HttpDownloader;
|
||||
@ -42,10 +42,10 @@ import de.danoeh.antennapod.util.URLChecker;
|
||||
* If the feed cannot be downloaded or parsed, an error dialog will be displayed
|
||||
* and the activity will finish as soon as the error dialog is closed.
|
||||
*/
|
||||
public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
public abstract class OnlineFeedViewActivity extends ActionBarActivity {
|
||||
private static final String TAG = "OnlineFeedViewActivity";
|
||||
private static final String ARG_FEEDURL = "arg.feedurl";
|
||||
|
||||
|
||||
public static final int RESULT_ERROR = 2;
|
||||
|
||||
private Feed feed;
|
||||
@ -70,7 +70,7 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (downloader != null && downloader.getStatus().isDone() == false) {
|
||||
if (downloader != null && !downloader.isFinished()) {
|
||||
downloader.cancel();
|
||||
}
|
||||
}
|
||||
@ -82,15 +82,14 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
DownloadStatus status = downloader.getStatus();
|
||||
DownloadStatus status = downloader.getResult();
|
||||
if (status != null) {
|
||||
if (!status.isCancelled()) {
|
||||
if (status.isSuccessful()) {
|
||||
parseFeed();
|
||||
} else {
|
||||
String errorMsg = DownloadError.getErrorString(
|
||||
OnlineFeedViewActivity.this,
|
||||
status.getReason());
|
||||
String errorMsg = status.getReason().getErrorString(
|
||||
OnlineFeedViewActivity.this);
|
||||
if (errorMsg != null
|
||||
&& status.getReasonDetailed() != null) {
|
||||
errorMsg += " ("
|
||||
@ -119,10 +118,13 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
FileNameGenerator.generateFileName(feed.getDownload_url()))
|
||||
.toString();
|
||||
feed.setFile_url(fileUrl);
|
||||
DownloadStatus status = new DownloadStatus(feed, "OnlineFeed");
|
||||
DownloadRequest request = new DownloadRequest(feed.getFile_url(),
|
||||
feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED);
|
||||
/* TODO update
|
||||
HttpDownloader httpDownloader = new HttpDownloader(downloaderCallback,
|
||||
status);
|
||||
request);
|
||||
httpDownloader.start();
|
||||
*/
|
||||
}
|
||||
|
||||
/** Displays a progress indicator. */
|
||||
@ -155,7 +157,7 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String reasonDetailed = new String();
|
||||
String reasonDetailed = "";
|
||||
boolean successful = false;
|
||||
FeedHandler handler = new FeedHandler();
|
||||
try {
|
||||
@ -187,9 +189,9 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
final String errorMsg = DownloadError.getErrorString(
|
||||
OnlineFeedViewActivity.this,
|
||||
DownloadError.ERROR_PARSER_EXCEPTION)
|
||||
final String errorMsg =
|
||||
DownloadError.ERROR_PARSER_EXCEPTION.getErrorString(
|
||||
OnlineFeedViewActivity.this)
|
||||
+ " (" + reasonDetailed + ")";
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@ -217,13 +219,14 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity {
|
||||
} else {
|
||||
builder.setMessage(R.string.error_msg_prefix);
|
||||
}
|
||||
builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
|
@ -5,17 +5,17 @@ import java.util.List;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.opml.OpmlElement;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
@ -24,110 +24,111 @@ import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
* Displays the feeds that the OPML-Importer has read and lets the user choose
|
||||
* which feeds he wants to import.
|
||||
*/
|
||||
public class OpmlFeedChooserActivity extends SherlockActivity {
|
||||
private static final String TAG = "OpmlFeedChooserActivity";
|
||||
public class OpmlFeedChooserActivity extends ActionBarActivity {
|
||||
private static final String TAG = "OpmlFeedChooserActivity";
|
||||
|
||||
public static final String EXTRA_SELECTED_ITEMS = "de.danoeh.antennapod.selectedItems";
|
||||
public static final String EXTRA_SELECTED_ITEMS = "de.danoeh.antennapod.selectedItems";
|
||||
|
||||
private Button butConfirm;
|
||||
private Button butCancel;
|
||||
private ListView feedlist;
|
||||
private ArrayAdapter<String> listAdapter;
|
||||
private Button butConfirm;
|
||||
private Button butCancel;
|
||||
private ListView feedlist;
|
||||
private ArrayAdapter<String> listAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.opml_selection);
|
||||
butConfirm = (Button) findViewById(R.id.butConfirm);
|
||||
butCancel = (Button) findViewById(R.id.butCancel);
|
||||
feedlist = (ListView) findViewById(R.id.feedlist);
|
||||
setContentView(R.layout.opml_selection);
|
||||
butConfirm = (Button) findViewById(R.id.butConfirm);
|
||||
butCancel = (Button) findViewById(R.id.butCancel);
|
||||
feedlist = (ListView) findViewById(R.id.feedlist);
|
||||
|
||||
feedlist.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
listAdapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_list_item_multiple_choice,
|
||||
getTitleList());
|
||||
feedlist.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
listAdapter = new ArrayAdapter<String>(this,
|
||||
android.R.layout.simple_list_item_multiple_choice,
|
||||
getTitleList());
|
||||
|
||||
feedlist.setAdapter(listAdapter);
|
||||
feedlist.setAdapter(listAdapter);
|
||||
|
||||
butCancel.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
butCancel.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
butConfirm.setOnClickListener(new OnClickListener() {
|
||||
butConfirm.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent();
|
||||
SparseBooleanArray checked = feedlist.getCheckedItemPositions();
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent();
|
||||
SparseBooleanArray checked = feedlist.getCheckedItemPositions();
|
||||
|
||||
int checkedCount = 0;
|
||||
// Get number of checked items
|
||||
for (int i = 0; i < checked.size(); i++) {
|
||||
if (checked.valueAt(i)) {
|
||||
checkedCount++;
|
||||
}
|
||||
}
|
||||
int[] selection = new int[checkedCount];
|
||||
for (int i = 0, collected = 0; collected < checkedCount; i++) {
|
||||
if (checked.valueAt(i)) {
|
||||
selection[collected] = checked.keyAt(i);
|
||||
collected++;
|
||||
}
|
||||
}
|
||||
intent.putExtra(EXTRA_SELECTED_ITEMS, selection);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
int checkedCount = 0;
|
||||
// Get number of checked items
|
||||
for (int i = 0; i < checked.size(); i++) {
|
||||
if (checked.valueAt(i)) {
|
||||
checkedCount++;
|
||||
}
|
||||
}
|
||||
int[] selection = new int[checkedCount];
|
||||
for (int i = 0, collected = 0; collected < checkedCount; i++) {
|
||||
if (checked.valueAt(i)) {
|
||||
selection[collected] = checked.keyAt(i);
|
||||
collected++;
|
||||
}
|
||||
}
|
||||
intent.putExtra(EXTRA_SELECTED_ITEMS, selection);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getTitleList() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if (OpmlImportHolder.getReadElements() != null) {
|
||||
for (OpmlElement element : OpmlImportHolder.getReadElements()) {
|
||||
result.add(element.getText());
|
||||
}
|
||||
private List<String> getTitleList() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if (OpmlImportHolder.getReadElements() != null) {
|
||||
for (OpmlElement element : OpmlImportHolder.getReadElements()) {
|
||||
result.add(element.getText());
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, R.id.select_all_item, Menu.NONE,
|
||||
R.string.select_all_label).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(Menu.NONE, R.id.deselect_all_item, Menu.NONE,
|
||||
R.string.deselect_all_label).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.select_all_item, Menu.NONE,
|
||||
R.string.select_all_label),
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.select_all_item:
|
||||
selectAllItems(true);
|
||||
return true;
|
||||
case R.id.deselect_all_item:
|
||||
selectAllItems(false);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.deselect_all_item, Menu.NONE,
|
||||
R.string.deselect_all_label),
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void selectAllItems(boolean b) {
|
||||
for (int i = 0; i < feedlist.getCount(); i++) {
|
||||
feedlist.setItemChecked(i, b);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.select_all_item:
|
||||
selectAllItems(true);
|
||||
return true;
|
||||
case R.id.deselect_all_item:
|
||||
selectAllItems(false);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void selectAllItems(boolean b) {
|
||||
for (int i = 0; i < feedlist.getCount(); i++) {
|
||||
feedlist.setItemChecked(i, b);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,10 +4,9 @@ import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.asynctask.OpmlFeedQueuer;
|
||||
import de.danoeh.antennapod.asynctask.OpmlImportWorker;
|
||||
@ -16,7 +15,7 @@ import de.danoeh.antennapod.opml.OpmlElement;
|
||||
/**
|
||||
* Base activity for Opml Import - e.g. with code what to do afterwards
|
||||
* */
|
||||
public class OpmlImportBaseActivity extends SherlockActivity {
|
||||
public class OpmlImportBaseActivity extends ActionBarActivity {
|
||||
|
||||
private static final String TAG = "OpmlImportBaseActivity";
|
||||
private OpmlImportWorker importWorker;
|
||||
|
@ -7,6 +7,7 @@ import java.net.URL;
|
||||
import android.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.util.LangUtils;
|
||||
|
||||
/** Lets the user start the OPML-import process. */
|
||||
public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity {
|
||||
@ -20,7 +21,8 @@ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity {
|
||||
|
||||
try {
|
||||
URL mOpmlURL = new URL(getIntent().getData().toString());
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(mOpmlURL.openStream()));
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(mOpmlURL.openStream(),
|
||||
LangUtils.UTF_8));
|
||||
startImport(in);
|
||||
} catch (Exception e) {
|
||||
new AlertDialog.Builder(this).setMessage("Cannot open XML - Reason: " + e.getMessage()).show();
|
||||
|
@ -1,26 +1,28 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.util.LangUtils;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
|
||||
/**
|
||||
@ -126,8 +128,10 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
|
||||
}
|
||||
|
||||
private void startImport(File file) {
|
||||
Reader mReader = null;
|
||||
try {
|
||||
Reader mReader = new FileReader(file);
|
||||
mReader = new InputStreamReader(new FileInputStream(file),
|
||||
LangUtils.UTF_8);
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Parsing " + file.toString());
|
||||
startImport(mReader);
|
||||
} catch (FileNotFoundException e) {
|
||||
|
@ -1,10 +1,13 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.*;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -12,28 +15,32 @@ import android.widget.BaseAdapter;
|
||||
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.R;
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DBTasks;
|
||||
import de.danoeh.antennapod.storage.DBWriter;
|
||||
import de.danoeh.antennapod.util.UndoBarController;
|
||||
|
||||
public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
import java.util.List;
|
||||
|
||||
public class OrganizeQueueActivity extends ActionBarActivity implements
|
||||
UndoBarController.UndoListener {
|
||||
private static final String TAG = "OrganizeQueueActivity";
|
||||
|
||||
private static final int MENU_ID_ACCEPT = 2;
|
||||
|
||||
private List<FeedItem> queue;
|
||||
|
||||
private OrganizeAdapter adapter;
|
||||
private UndoBarController undoBarController;
|
||||
|
||||
private DragSortListView listView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
@ -41,17 +48,42 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
setContentView(R.layout.organize_queue);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
DragSortListView listView = (DragSortListView) getListView();
|
||||
listView = (DragSortListView) findViewById(android.R.id.list);
|
||||
listView.setDropListener(dropListener);
|
||||
listView.setRemoveListener(removeListener);
|
||||
listView.setEmptyView(findViewById(android.R.id.empty));
|
||||
|
||||
adapter = new OrganizeAdapter(this);
|
||||
setListAdapter(adapter);
|
||||
|
||||
loadData();
|
||||
undoBarController = new UndoBarController(findViewById(R.id.undobar),
|
||||
this);
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
AsyncTask<Void, Void, List<FeedItem>> loadTask = new AsyncTask<Void, Void, List<FeedItem>>() {
|
||||
|
||||
@Override
|
||||
protected List<FeedItem> doInBackground(Void... voids) {
|
||||
return DBReader.getQueue(OrganizeQueueActivity.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<FeedItem> feedItems) {
|
||||
super.onPostExecute(feedItems);
|
||||
if (feedItems != null) {
|
||||
queue = feedItems;
|
||||
if (adapter == null) {
|
||||
adapter = new OrganizeAdapter(OrganizeQueueActivity.this);
|
||||
listView.setAdapter(adapter);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
} else {
|
||||
Log.e(TAG, "Queue was null");
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
@ -61,8 +93,7 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
FeedManager.getInstance().autodownloadUndownloadedItems(
|
||||
getApplicationContext());
|
||||
DBTasks.autodownloadUndownloadedItems(getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,9 +107,7 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
@Override
|
||||
public void update(EventDistributor eventDistributor, Integer arg) {
|
||||
if (((EventDistributor.QUEUE_UPDATE | EventDistributor.FEED_LIST_UPDATE) & arg) != 0) {
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -87,9 +116,10 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
|
||||
@Override
|
||||
public void drop(int from, int to) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
manager.moveQueueItem(OrganizeQueueActivity.this, from, to, false);
|
||||
adapter.notifyDataSetChanged();
|
||||
final FeedItem item = queue.remove(from);
|
||||
queue.add(to, item);
|
||||
adapter.notifyDataSetChanged();
|
||||
DBWriter.moveQueueItem(OrganizeQueueActivity.this, from, to, true);
|
||||
}
|
||||
};
|
||||
|
||||
@ -97,9 +127,8 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
|
||||
@Override
|
||||
public void remove(int which) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
FeedItem item = (FeedItem) getListAdapter().getItem(which);
|
||||
manager.removeQueueItem(OrganizeQueueActivity.this, item, false);
|
||||
FeedItem item = (FeedItem) listView.getAdapter().getItem(which);
|
||||
DBWriter.removeQueueItem(OrganizeQueueActivity.this, item.getId(), true);
|
||||
undoBarController.showUndoBar(false,
|
||||
getString(R.string.removed_from_queue), new UndoToken(item,
|
||||
which));
|
||||
@ -127,22 +156,20 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
public void onUndo(Parcelable token) {
|
||||
// Perform the undo
|
||||
UndoToken undoToken = (UndoToken) token;
|
||||
FeedItem feedItem = undoToken.getFeedItem();
|
||||
int position = undoToken.getPosition();
|
||||
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
manager.addQueueItemAt(OrganizeQueueActivity.this, feedItem, position,
|
||||
false);
|
||||
if (token != null) {
|
||||
long itemId = undoToken.getFeedItemId();
|
||||
int position = undoToken.getPosition();
|
||||
DBWriter.addQueueItemAt(OrganizeQueueActivity.this, itemId, position, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class OrganizeAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private FeedManager manager = FeedManager.getInstance();
|
||||
private OrganizeQueueActivity organizeQueueActivity;
|
||||
|
||||
public OrganizeAdapter(Context context) {
|
||||
public OrganizeAdapter(OrganizeQueueActivity organizeQueueActivity) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.organizeQueueActivity = organizeQueueActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,7 +179,7 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
LayoutInflater inflater = (LayoutInflater) organizeQueueActivity
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = inflater.inflate(
|
||||
R.layout.organize_queue_listitem, null);
|
||||
@ -189,13 +216,20 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
int queueSize = manager.getQueueSize(true);
|
||||
return queueSize;
|
||||
if (organizeQueueActivity.queue != null) {
|
||||
return organizeQueueActivity.queue.size();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedItem getItem(int position) {
|
||||
return manager.getQueueItemAtIndex(position, true);
|
||||
if (organizeQueueActivity.queue != null) {
|
||||
return organizeQueueActivity.queue.get(position);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -211,7 +245,6 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
private int position;
|
||||
|
||||
public UndoToken(FeedItem item, int position) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
this.itemId = item.getId();
|
||||
this.feedId = item.getFeed().getId();
|
||||
this.position = position;
|
||||
@ -243,9 +276,8 @@ public class OrganizeQueueActivity extends SherlockListActivity implements
|
||||
out.writeInt(position);
|
||||
}
|
||||
|
||||
public FeedItem getFeedItem() {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
return manager.getFeedItem(itemId, feedId);
|
||||
public long getFeedItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
|
@ -3,25 +3,25 @@ package de.danoeh.antennapod.activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.storage.DBWriter;
|
||||
|
||||
public class PlaybackHistoryActivity extends SherlockFragmentActivity {
|
||||
public class PlaybackHistoryActivity extends ActionBarActivity {
|
||||
private static final String TAG = "PlaybackHistoryActivity";
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, R.id.clear_history_item, Menu.NONE,
|
||||
R.string.clear_history_label).setShowAsAction(
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.clear_history_item, Menu.NONE,
|
||||
R.string.clear_history_label),
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
@ -36,7 +36,7 @@ public class PlaybackHistoryActivity extends SherlockFragmentActivity {
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.clear_history_item:
|
||||
FeedManager.getInstance().clearPlaybackHistory(this);
|
||||
DBWriter.clearPlaybackHistory(this);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
@ -19,369 +19,368 @@ import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceScreen;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
|
||||
import de.danoeh.antennapod.asynctask.OpmlExportWorker;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.util.flattr.FlattrUtils;
|
||||
|
||||
/** The main preference activity */
|
||||
public class PreferenceActivity extends SherlockPreferenceActivity {
|
||||
private static final String TAG = "PreferenceActivity";
|
||||
/**
|
||||
* The main preference activity
|
||||
*/
|
||||
public class PreferenceActivity extends android.preference.PreferenceActivity {
|
||||
private static final String TAG = "PreferenceActivity";
|
||||
|
||||
private static final String PREF_FLATTR_THIS_APP = "prefFlattrThisApp";
|
||||
private static final String PREF_FLATTR_AUTH = "pref_flattr_authenticate";
|
||||
private static final String PREF_FLATTR_REVOKE = "prefRevokeAccess";
|
||||
private static final String PREF_OPML_EXPORT = "prefOpmlExport";
|
||||
private static final String PREF_ABOUT = "prefAbout";
|
||||
private static final String PREF_CHOOSE_DATA_DIR = "prefChooseDataDir";
|
||||
private static final String AUTO_DL_PREF_SCREEN = "prefAutoDownloadSettings";
|
||||
private static final String PREF_FLATTR_THIS_APP = "prefFlattrThisApp";
|
||||
private static final String PREF_FLATTR_AUTH = "pref_flattr_authenticate";
|
||||
private static final String PREF_FLATTR_REVOKE = "prefRevokeAccess";
|
||||
private static final String PREF_OPML_EXPORT = "prefOpmlExport";
|
||||
private static final String PREF_ABOUT = "prefAbout";
|
||||
private static final String PREF_CHOOSE_DATA_DIR = "prefChooseDataDir";
|
||||
private static final String AUTO_DL_PREF_SCREEN = "prefAutoDownloadSettings";
|
||||
private static final String PREF_PLAYBACK_SPEED_LAUNCHER = "prefPlaybackSpeedLauncher";
|
||||
|
||||
private CheckBoxPreference[] selectedNetworks;
|
||||
|
||||
private CheckBoxPreference[] selectedNetworks;
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
findPreference(PREF_FLATTR_THIS_APP).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
new FlattrClickWorker(PreferenceActivity.this,
|
||||
FlattrUtils.APP_URL).executeAsync();
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
new FlattrClickWorker(PreferenceActivity.this,
|
||||
FlattrUtils.APP_URL).executeAsync();
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
findPreference(PREF_FLATTR_REVOKE).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
findPreference(PREF_FLATTR_REVOKE).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
FlattrUtils.revokeAccessToken(PreferenceActivity.this);
|
||||
checkItemVisibility();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
FlattrUtils.revokeAccessToken(PreferenceActivity.this);
|
||||
checkItemVisibility();
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
findPreference(PREF_ABOUT).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
findPreference(PREF_ABOUT).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
PreferenceActivity.this.startActivity(new Intent(
|
||||
PreferenceActivity.this, AboutActivity.class));
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
PreferenceActivity.this.startActivity(new Intent(
|
||||
PreferenceActivity.this, AboutActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
findPreference(PREF_OPML_EXPORT).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
findPreference(PREF_OPML_EXPORT).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (FeedManager.getInstance().getFeedsSize() > 0) {
|
||||
new OpmlExportWorker(PreferenceActivity.this)
|
||||
.executeAsync();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
new OpmlExportWorker(PreferenceActivity.this)
|
||||
.executeAsync();
|
||||
|
||||
findPreference(PREF_CHOOSE_DATA_DIR).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startActivityForResult(
|
||||
new Intent(PreferenceActivity.this,
|
||||
DirectoryChooserActivity.class),
|
||||
DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_THEME)
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
findPreference(PREF_CHOOSE_DATA_DIR).setOnPreferenceClickListener(
|
||||
new OnPreferenceClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(
|
||||
Preference preference, Object newValue) {
|
||||
Intent i = getIntent();
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
| Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
finish();
|
||||
startActivity(i);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER)
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startActivityForResult(
|
||||
new Intent(PreferenceActivity.this,
|
||||
DirectoryChooserActivity.class),
|
||||
DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_THEME)
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(
|
||||
Preference preference, Object newValue) {
|
||||
if (newValue instanceof Boolean) {
|
||||
setSelectedNetworksEnabled((Boolean) newValue);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE)
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(
|
||||
Preference preference, Object newValue) {
|
||||
Intent i = getIntent();
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
| Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
finish();
|
||||
startActivity(i);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER)
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(
|
||||
Preference preference, Object newValue) {
|
||||
if (newValue instanceof String) {
|
||||
setEpisodeCacheSizeText(Integer
|
||||
.valueOf((String) newValue));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_ENABLE_AUTODL)
|
||||
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(
|
||||
Preference preference, Object newValue) {
|
||||
if (newValue instanceof Boolean) {
|
||||
setSelectedNetworksEnabled((Boolean) newValue);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE)
|
||||
.setOnPreferenceChangeListener(
|
||||
new OnPreferenceChangeListener() {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
checkItemVisibility();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
buildUpdateIntervalPreference();
|
||||
buildAutodownloadSelectedNetworsPreference();
|
||||
setSelectedNetworksEnabled(UserPreferences
|
||||
.isEnableAutodownloadWifiFilter());
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
||||
checkItemVisibility();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
findPreference(PREF_PLAYBACK_SPEED_LAUNCHER)
|
||||
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
VariableSpeedDialog.showDialog(PreferenceActivity.this);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
buildUpdateIntervalPreference();
|
||||
buildAutodownloadSelectedNetworsPreference();
|
||||
setSelectedNetworksEnabled(UserPreferences
|
||||
.isEnableAutodownloadWifiFilter());
|
||||
|
||||
private void buildUpdateIntervalPreference() {
|
||||
ListPreference pref = (ListPreference) findPreference(UserPreferences.PREF_UPDATE_INTERVAL);
|
||||
String[] values = getResources().getStringArray(
|
||||
R.array.update_intervall_values);
|
||||
String[] entries = new String[values.length];
|
||||
for (int x = 0; x < values.length; x++) {
|
||||
Integer v = Integer.parseInt(values[x]);
|
||||
switch (v) {
|
||||
case 0:
|
||||
entries[x] = getString(R.string.pref_update_interval_hours_manual);
|
||||
break;
|
||||
case 1:
|
||||
entries[x] = v
|
||||
+ " "
|
||||
+ getString(R.string.pref_update_interval_hours_singular);
|
||||
break;
|
||||
default:
|
||||
entries[x] = v + " "
|
||||
+ getString(R.string.pref_update_interval_hours_plural);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
pref.setEntries(entries);
|
||||
private void buildUpdateIntervalPreference() {
|
||||
ListPreference pref = (ListPreference) findPreference(UserPreferences.PREF_UPDATE_INTERVAL);
|
||||
String[] values = getResources().getStringArray(
|
||||
R.array.update_intervall_values);
|
||||
String[] entries = new String[values.length];
|
||||
for (int x = 0; x < values.length; x++) {
|
||||
Integer v = Integer.parseInt(values[x]);
|
||||
switch (v) {
|
||||
case 0:
|
||||
entries[x] = getString(R.string.pref_update_interval_hours_manual);
|
||||
break;
|
||||
case 1:
|
||||
entries[x] = v
|
||||
+ " "
|
||||
+ getString(R.string.pref_update_interval_hours_singular);
|
||||
break;
|
||||
default:
|
||||
entries[x] = v + " "
|
||||
+ getString(R.string.pref_update_interval_hours_plural);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
pref.setEntries(entries);
|
||||
|
||||
private void setSelectedNetworksEnabled(boolean b) {
|
||||
if (selectedNetworks != null) {
|
||||
for (Preference p : selectedNetworks) {
|
||||
p.setEnabled(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
checkItemVisibility();
|
||||
setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize());
|
||||
setDataFolderText();
|
||||
}
|
||||
private void setSelectedNetworksEnabled(boolean b) {
|
||||
if (selectedNetworks != null) {
|
||||
for (Preference p : selectedNetworks) {
|
||||
p.setEnabled(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void checkItemVisibility() {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
checkItemVisibility();
|
||||
setEpisodeCacheSizeText(UserPreferences.getEpisodeCacheSize());
|
||||
setDataFolderText();
|
||||
}
|
||||
|
||||
boolean hasFlattrToken = FlattrUtils.hasToken();
|
||||
@SuppressWarnings("deprecation")
|
||||
private void checkItemVisibility() {
|
||||
|
||||
findPreference(PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken);
|
||||
findPreference(PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken);
|
||||
boolean hasFlattrToken = FlattrUtils.hasToken();
|
||||
|
||||
findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER)
|
||||
.setEnabled(UserPreferences.isEnableAutodownload());
|
||||
setSelectedNetworksEnabled(UserPreferences.isEnableAutodownload()
|
||||
&& UserPreferences.isEnableAutodownloadWifiFilter());
|
||||
findPreference(PREF_FLATTR_AUTH).setEnabled(!hasFlattrToken);
|
||||
findPreference(PREF_FLATTR_REVOKE).setEnabled(hasFlattrToken);
|
||||
|
||||
}
|
||||
findPreference(UserPreferences.PREF_ENABLE_AUTODL_WIFI_FILTER)
|
||||
.setEnabled(UserPreferences.isEnableAutodownload());
|
||||
setSelectedNetworksEnabled(UserPreferences.isEnableAutodownload()
|
||||
&& UserPreferences.isEnableAutodownloadWifiFilter());
|
||||
|
||||
private void setEpisodeCacheSizeText(int cacheSize) {
|
||||
String s;
|
||||
if (cacheSize == getResources().getInteger(
|
||||
R.integer.episode_cache_size_unlimited)) {
|
||||
s = getString(R.string.pref_episode_cache_unlimited);
|
||||
} else {
|
||||
s = Integer.toString(cacheSize)
|
||||
+ getString(R.string.episodes_suffix);
|
||||
}
|
||||
findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setSummary(s);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDataFolderText() {
|
||||
File f = UserPreferences.getDataFolder(this, null);
|
||||
if (f != null) {
|
||||
findPreference(PREF_CHOOSE_DATA_DIR)
|
||||
.setSummary(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
private void setEpisodeCacheSizeText(int cacheSize) {
|
||||
String s;
|
||||
if (cacheSize == getResources().getInteger(
|
||||
R.integer.episode_cache_size_unlimited)) {
|
||||
s = getString(R.string.pref_episode_cache_unlimited);
|
||||
} else {
|
||||
s = Integer.toString(cacheSize)
|
||||
+ getString(R.string.episodes_suffix);
|
||||
}
|
||||
findPreference(UserPreferences.PREF_EPISODE_CACHE_SIZE).setSummary(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
return true;
|
||||
}
|
||||
private void setDataFolderText() {
|
||||
File f = UserPreferences.getDataFolder(this, null);
|
||||
if (f != null) {
|
||||
findPreference(PREF_CHOOSE_DATA_DIR)
|
||||
.setSummary(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
|
||||
theme.applyStyle(UserPreferences.getTheme(), true);
|
||||
}
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
|
||||
String dir = data
|
||||
.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Setting data folder");
|
||||
UserPreferences.setDataFolder(dir);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
|
||||
theme.applyStyle(UserPreferences.getTheme(), true);
|
||||
}
|
||||
|
||||
private void buildAutodownloadSelectedNetworsPreference() {
|
||||
if (selectedNetworks != null) {
|
||||
clearAutodownloadSelectedNetworsPreference();
|
||||
}
|
||||
// get configured networks
|
||||
WifiManager wifiservice = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
||||
List<WifiConfiguration> networks = wifiservice.getConfiguredNetworks();
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == DirectoryChooserActivity.RESULT_CODE_DIR_SELECTED) {
|
||||
String dir = data
|
||||
.getStringExtra(DirectoryChooserActivity.RESULT_SELECTED_DIR);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Setting data folder");
|
||||
UserPreferences.setDataFolder(dir);
|
||||
}
|
||||
}
|
||||
|
||||
if (networks != null) {
|
||||
selectedNetworks = new CheckBoxPreference[networks.size()];
|
||||
List<String> prefValues = Arrays.asList(UserPreferences
|
||||
.getAutodownloadSelectedNetworks());
|
||||
PreferenceScreen prefScreen = (PreferenceScreen) findPreference(AUTO_DL_PREF_SCREEN);
|
||||
OnPreferenceClickListener clickListener = new OnPreferenceClickListener() {
|
||||
private void buildAutodownloadSelectedNetworsPreference() {
|
||||
if (selectedNetworks != null) {
|
||||
clearAutodownloadSelectedNetworsPreference();
|
||||
}
|
||||
// get configured networks
|
||||
WifiManager wifiservice = (WifiManager) getSystemService(Context.WIFI_SERVICE);
|
||||
List<WifiConfiguration> networks = wifiservice.getConfiguredNetworks();
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (preference instanceof CheckBoxPreference) {
|
||||
String key = preference.getKey();
|
||||
ArrayList<String> prefValuesList = new ArrayList<String>(
|
||||
Arrays.asList(UserPreferences
|
||||
.getAutodownloadSelectedNetworks()));
|
||||
boolean newValue = ((CheckBoxPreference) preference)
|
||||
.isChecked();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Selected network " + key
|
||||
+ ". New state: " + newValue);
|
||||
if (networks != null) {
|
||||
selectedNetworks = new CheckBoxPreference[networks.size()];
|
||||
List<String> prefValues = Arrays.asList(UserPreferences
|
||||
.getAutodownloadSelectedNetworks());
|
||||
PreferenceScreen prefScreen = (PreferenceScreen) findPreference(AUTO_DL_PREF_SCREEN);
|
||||
OnPreferenceClickListener clickListener = new OnPreferenceClickListener() {
|
||||
|
||||
int index = prefValuesList.indexOf(key);
|
||||
if (index >= 0 && newValue == false) {
|
||||
// remove network
|
||||
prefValuesList.remove(index);
|
||||
} else if (index < 0 && newValue == true) {
|
||||
prefValuesList.add(key);
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
if (preference instanceof CheckBoxPreference) {
|
||||
String key = preference.getKey();
|
||||
ArrayList<String> prefValuesList = new ArrayList<String>(
|
||||
Arrays.asList(UserPreferences
|
||||
.getAutodownloadSelectedNetworks()));
|
||||
boolean newValue = ((CheckBoxPreference) preference)
|
||||
.isChecked();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Selected network " + key
|
||||
+ ". New state: " + newValue);
|
||||
|
||||
UserPreferences.setAutodownloadSelectedNetworks(
|
||||
PreferenceActivity.this, prefValuesList
|
||||
.toArray(new String[prefValuesList
|
||||
.size()]));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
// create preference for each known network. attach listener and set
|
||||
// value
|
||||
for (int i = 0; i < networks.size(); i++) {
|
||||
WifiConfiguration config = networks.get(i);
|
||||
int index = prefValuesList.indexOf(key);
|
||||
if (index >= 0 && newValue == false) {
|
||||
// remove network
|
||||
prefValuesList.remove(index);
|
||||
} else if (index < 0 && newValue == true) {
|
||||
prefValuesList.add(key);
|
||||
}
|
||||
|
||||
CheckBoxPreference pref = new CheckBoxPreference(this);
|
||||
String key = Integer.toString(config.networkId);
|
||||
pref.setTitle(config.SSID);
|
||||
pref.setKey(key);
|
||||
pref.setOnPreferenceClickListener(clickListener);
|
||||
pref.setPersistent(false);
|
||||
pref.setChecked(prefValues.contains(key));
|
||||
selectedNetworks[i] = pref;
|
||||
prefScreen.addPreference(pref);
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Couldn't get list of configure Wi-Fi networks");
|
||||
}
|
||||
}
|
||||
UserPreferences.setAutodownloadSelectedNetworks(
|
||||
PreferenceActivity.this, prefValuesList
|
||||
.toArray(new String[prefValuesList
|
||||
.size()]));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
// create preference for each known network. attach listener and set
|
||||
// value
|
||||
for (int i = 0; i < networks.size(); i++) {
|
||||
WifiConfiguration config = networks.get(i);
|
||||
|
||||
private void clearAutodownloadSelectedNetworsPreference() {
|
||||
if (selectedNetworks != null) {
|
||||
PreferenceScreen prefScreen = (PreferenceScreen) findPreference(AUTO_DL_PREF_SCREEN);
|
||||
CheckBoxPreference pref = new CheckBoxPreference(this);
|
||||
String key = Integer.toString(config.networkId);
|
||||
pref.setTitle(config.SSID);
|
||||
pref.setKey(key);
|
||||
pref.setOnPreferenceClickListener(clickListener);
|
||||
pref.setPersistent(false);
|
||||
pref.setChecked(prefValues.contains(key));
|
||||
selectedNetworks[i] = pref;
|
||||
prefScreen.addPreference(pref);
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Couldn't get list of configure Wi-Fi networks");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < selectedNetworks.length; i++) {
|
||||
if (selectedNetworks[i] != null) {
|
||||
prefScreen.removePreference(selectedNetworks[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void clearAutodownloadSelectedNetworsPreference() {
|
||||
if (selectedNetworks != null) {
|
||||
PreferenceScreen prefScreen = (PreferenceScreen) findPreference(AUTO_DL_PREF_SCREEN);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||
Preference preference) {
|
||||
super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
if (preference != null)
|
||||
if (preference instanceof PreferenceScreen)
|
||||
if (((PreferenceScreen) preference).getDialog() != null)
|
||||
((PreferenceScreen) preference)
|
||||
.getDialog()
|
||||
.getWindow()
|
||||
.getDecorView()
|
||||
.setBackgroundDrawable(
|
||||
this.getWindow().getDecorView()
|
||||
.getBackground().getConstantState()
|
||||
.newDrawable());
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < selectedNetworks.length; i++) {
|
||||
if (selectedNetworks[i] != null) {
|
||||
prefScreen.removePreference(selectedNetworks[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||
Preference preference) {
|
||||
super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
if (preference != null)
|
||||
if (preference instanceof PreferenceScreen)
|
||||
if (((PreferenceScreen) preference).getDialog() != null)
|
||||
((PreferenceScreen) preference)
|
||||
.getDialog()
|
||||
.getWindow()
|
||||
.getDecorView()
|
||||
.setBackgroundDrawable(
|
||||
this.getWindow().getDecorView()
|
||||
.getBackground().getConstantState()
|
||||
.newDrawable());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,185 +1,198 @@
|
||||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.SearchManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.SearchlistAdapter;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.feed.FeedSearcher;
|
||||
import de.danoeh.antennapod.storage.FeedSearcher;
|
||||
import de.danoeh.antennapod.feed.SearchResult;
|
||||
import de.danoeh.antennapod.fragment.FeedlistFragment;
|
||||
import de.danoeh.antennapod.fragment.ItemlistFragment;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
|
||||
/** Displays the results when the user searches for FeedItems or Feeds. */
|
||||
public class SearchActivity extends SherlockListActivity {
|
||||
private static final String TAG = "SearchActivity";
|
||||
/**
|
||||
* Displays the results when the user searches for FeedItems or Feeds.
|
||||
*/
|
||||
public class SearchActivity extends ActionBarActivity implements AdapterView.OnItemClickListener {
|
||||
private static final String TAG = "SearchActivity";
|
||||
|
||||
public static final String EXTRA_FEED_ID = "de.danoeh.antennapod.searchactivity.extra.feedId";
|
||||
public static final String EXTRA_FEED_ID = "de.danoeh.antennapod.searchactivity.extra.feedId";
|
||||
|
||||
private SearchlistAdapter searchAdapter;
|
||||
private ArrayList<SearchResult> content;
|
||||
private SearchlistAdapter searchAdapter;
|
||||
|
||||
/** Feed that is being searched or null if the search is global. */
|
||||
private Feed selectedFeed;
|
||||
/**
|
||||
* ID of the feed that is being searched or null if the search is global.
|
||||
*/
|
||||
private long feedID;
|
||||
|
||||
private TextView txtvStatus;
|
||||
private ListView listView;
|
||||
private TextView txtvStatus;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.searchlist);
|
||||
txtvStatus = (TextView) findViewById(android.R.id.empty);
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(UserPreferences.getTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
setIntent(intent);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.searchlist);
|
||||
listView = (ListView) findViewById(android.R.id.list);
|
||||
txtvStatus = (TextView) findViewById(android.R.id.empty);
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Intent intent = getIntent();
|
||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
Bundle extra = intent.getBundleExtra(SearchManager.APP_DATA);
|
||||
if (extra != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Found bundle extra");
|
||||
long feedId = extra.getLong(EXTRA_FEED_ID);
|
||||
selectedFeed = FeedManager.getInstance().getFeed(feedId);
|
||||
}
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Starting search");
|
||||
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||
getSupportActionBar()
|
||||
.setSubtitle(
|
||||
getString(R.string.search_term_label) + "\""
|
||||
+ query + "\"");
|
||||
handleSearchRequest(query);
|
||||
}
|
||||
}
|
||||
listView.setOnItemClickListener(this);
|
||||
searchAdapter = new SearchlistAdapter(this, 0, new ArrayList<SearchResult>());
|
||||
listView.setAdapter(searchAdapter);
|
||||
listView.setEmptyView(txtvStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(
|
||||
obtainStyledAttributes(
|
||||
new int[] { R.attr.action_search })
|
||||
.getDrawable(0))
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Intent intent = getIntent();
|
||||
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
|
||||
if (intent.hasExtra(SearchActivity.EXTRA_FEED_ID)) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Found bundle extra");
|
||||
feedID = intent.getLongExtra(SearchActivity.EXTRA_FEED_ID, 0);
|
||||
}
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Starting search");
|
||||
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||
getSupportActionBar()
|
||||
.setSubtitle(
|
||||
getString(R.string.search_term_label) + "\""
|
||||
+ query + "\"");
|
||||
handleSearchRequest(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSearchRequested() {
|
||||
Bundle extra = null;
|
||||
if (selectedFeed != null) {
|
||||
extra = new Bundle();
|
||||
extra.putLong(EXTRA_FEED_ID, selectedFeed.getId());
|
||||
}
|
||||
startSearch(null, false, extra, false);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label)
|
||||
.setIcon(
|
||||
obtainStyledAttributes(
|
||||
new int[]{R.attr.action_search})
|
||||
.getDrawable(0)),
|
||||
(MenuItem.SHOW_AS_ACTION_IF_ROOM));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
SearchResult selection = searchAdapter.getItem(position);
|
||||
if (selection.getComponent().getClass() == Feed.class) {
|
||||
Feed feed = (Feed) selection.getComponent();
|
||||
Intent launchIntent = new Intent(this, FeedItemlistActivity.class);
|
||||
launchIntent.putExtra(FeedlistFragment.EXTRA_SELECTED_FEED,
|
||||
feed.getId());
|
||||
startActivity(launchIntent);
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
case R.id.search_item:
|
||||
onSearchRequested();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (selection.getComponent().getClass() == FeedItem.class) {
|
||||
FeedItem item = (FeedItem) selection.getComponent();
|
||||
Intent launchIntent = new Intent(this, ItemviewActivity.class);
|
||||
launchIntent.putExtra(FeedlistFragment.EXTRA_SELECTED_FEED, item
|
||||
.getFeed().getId());
|
||||
launchIntent.putExtra(ItemlistFragment.EXTRA_SELECTED_FEEDITEM,
|
||||
item.getId());
|
||||
startActivity(launchIntent);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onSearchRequested() {
|
||||
Bundle extra = null;
|
||||
if (feedID != 0) {
|
||||
extra = new Bundle();
|
||||
extra.putLong(EXTRA_FEED_ID, feedID);
|
||||
}
|
||||
startSearch(null, false, extra, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint({ "NewApi", "NewApi" })
|
||||
private void handleSearchRequest(final String query) {
|
||||
if (searchAdapter != null) {
|
||||
searchAdapter.clear();
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
}
|
||||
txtvStatus.setText(R.string.search_status_searching);
|
||||
@SuppressLint({"NewApi", "NewApi"})
|
||||
private void handleSearchRequest(final String query) {
|
||||
if (searchAdapter != null) {
|
||||
searchAdapter.clear();
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
}
|
||||
txtvStatus.setText(R.string.search_status_searching);
|
||||
|
||||
Thread thread = new Thread() {
|
||||
Thread thread = new Thread() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d(TAG, "Starting background work");
|
||||
final ArrayList<SearchResult> result = FeedSearcher
|
||||
.performSearch(SearchActivity.this, query, selectedFeed);
|
||||
if (SearchActivity.this != null) {
|
||||
SearchActivity.this.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d(TAG, "Starting background work");
|
||||
final Activity activity = SearchActivity.this;
|
||||
final List<SearchResult> result = FeedSearcher
|
||||
.performSearch(activity, query, feedID);
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Background work finished");
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Found " + result.size()
|
||||
+ " results");
|
||||
content = result;
|
||||
@Override
|
||||
public void run() {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Background work finished");
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Found " + result.size()
|
||||
+ " results");
|
||||
|
||||
searchAdapter = new SearchlistAdapter(
|
||||
SearchActivity.this, 0, content);
|
||||
getListView().setAdapter(searchAdapter);
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
if (content.isEmpty()) {
|
||||
txtvStatus
|
||||
.setText(R.string.search_status_no_results);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
searchAdapter.clear();
|
||||
for (SearchResult s : result) {
|
||||
searchAdapter.add(s);
|
||||
}
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
txtvStatus
|
||||
.setText(R.string.search_status_no_results);
|
||||
if (!searchAdapter.isEmpty()) {
|
||||
txtvStatus.setVisibility(View.GONE);
|
||||
} else {
|
||||
txtvStatus.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
|
||||
SearchResult selection = searchAdapter.getItem(position);
|
||||
if (selection.getComponent().getClass() == Feed.class) {
|
||||
Feed feed = (Feed) selection.getComponent();
|
||||
Intent launchIntent = new Intent(this, FeedItemlistActivity.class);
|
||||
launchIntent.putExtra(FeedlistFragment.EXTRA_SELECTED_FEED,
|
||||
feed.getId());
|
||||
startActivity(launchIntent);
|
||||
|
||||
} else if (selection.getComponent().getClass() == FeedItem.class) {
|
||||
FeedItem item = (FeedItem) selection.getComponent();
|
||||
Intent launchIntent = new Intent(this, ItemviewActivity.class);
|
||||
launchIntent.putExtra(FeedlistFragment.EXTRA_SELECTED_FEED, item
|
||||
.getFeed().getId());
|
||||
launchIntent.putExtra(ItemlistFragment.EXTRA_SELECTED_FEEDITEM,
|
||||
item.getId());
|
||||
startActivity(launchIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,17 +5,16 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
|
||||
/** Is show if there is now external storage available. */
|
||||
public class StorageErrorActivity extends SherlockActivity {
|
||||
public class StorageErrorActivity extends ActionBarActivity {
|
||||
private static final String TAG = "StorageErrorActivity";
|
||||
|
||||
@Override
|
||||
|
@ -5,18 +5,13 @@ import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.*;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import com.actionbarsherlock.view.Window;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.MediaType;
|
||||
|
@ -144,53 +144,6 @@ public class ChapterListAdapter extends ArrayAdapter<Chapter> {
|
||||
TextView link;
|
||||
}
|
||||
|
||||
private LinkMovementMethod linkMovementMethod = new LinkMovementMethod() {
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(TextView widget, Spannable buffer,
|
||||
MotionEvent event) {
|
||||
Object text = widget.getText();
|
||||
if (text instanceof Spanned) {
|
||||
int action = event.getAction();
|
||||
|
||||
if (action == MotionEvent.ACTION_UP
|
||||
|| action == MotionEvent.ACTION_DOWN) {
|
||||
int x = (int) event.getX();
|
||||
int y = (int) event.getY();
|
||||
|
||||
x -= widget.getTotalPaddingLeft();
|
||||
y -= widget.getTotalPaddingTop();
|
||||
|
||||
x += widget.getScrollX();
|
||||
y += widget.getScrollY();
|
||||
|
||||
Layout layout = widget.getLayout();
|
||||
int line = layout.getLineForVertical(y);
|
||||
int off = layout.getOffsetForHorizontal(line, x);
|
||||
|
||||
ClickableSpan[] link = buffer.getSpans(off, off,
|
||||
ClickableSpan.class);
|
||||
|
||||
if (link.length != 0) {
|
||||
if (action == MotionEvent.ACTION_UP) {
|
||||
link[0].onClick(widget);
|
||||
} else if (action == MotionEvent.ACTION_DOWN) {
|
||||
Selection.setSelection(buffer,
|
||||
buffer.getSpanStart(link[0]),
|
||||
buffer.getSpanEnd(link[0]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// ignore invalid chapters
|
||||
|
@ -8,21 +8,22 @@ import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedImage;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.util.DownloadError;
|
||||
|
||||
/** Displays a list of DownloadStatus entries. */
|
||||
public class DownloadLogAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private FeedManager manager = FeedManager.getInstance();
|
||||
|
||||
public DownloadLogAdapter(Context context) {
|
||||
private ItemAccess itemAccess;
|
||||
|
||||
public DownloadLogAdapter(Context context, ItemAccess itemAccess) {
|
||||
super();
|
||||
this.itemAccess = itemAccess;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@ -70,8 +71,7 @@ public class DownloadLogAdapter extends BaseAdapter {
|
||||
holder.successful.setTextColor(convertView.getResources().getColor(
|
||||
R.color.download_failed_red));
|
||||
holder.successful.setText(R.string.download_failed);
|
||||
String reasonText = DownloadError.getErrorString(context,
|
||||
status.getReason());
|
||||
String reasonText = status.getReason().getErrorString(context);
|
||||
if (status.getReasonDetailed() != null) {
|
||||
reasonText += ": " + status.getReasonDetailed();
|
||||
}
|
||||
@ -92,12 +92,12 @@ public class DownloadLogAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return manager.getDownloadLogSize();
|
||||
return itemAccess.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DownloadStatus getItem(int position) {
|
||||
return manager.getDownloadStatusFromLogAtIndex(position);
|
||||
return itemAccess.getItem(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,4 +105,9 @@ public class DownloadLogAdapter extends BaseAdapter {
|
||||
return position;
|
||||
}
|
||||
|
||||
public static interface ItemAccess {
|
||||
public int getCount();
|
||||
public DownloadStatus getItem(int position);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,11 +10,12 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedFile;
|
||||
import de.danoeh.antennapod.feed.FeedImage;
|
||||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.service.download.DownloadRequest;
|
||||
import de.danoeh.antennapod.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.service.download.Downloader;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
import de.danoeh.antennapod.util.ThemeUtils;
|
||||
@ -33,8 +34,7 @@ public class DownloadlistAdapter extends ArrayAdapter<Downloader> {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
Holder holder;
|
||||
DownloadStatus status = getItem(position).getStatus();
|
||||
FeedFile feedFile = status.getFeedFile();
|
||||
DownloadRequest request = getItem(position).getDownloadRequest();
|
||||
// Inflate layout
|
||||
if (convertView == null) {
|
||||
holder = new Holder();
|
||||
@ -62,31 +62,16 @@ public class DownloadlistAdapter extends ArrayAdapter<Downloader> {
|
||||
} else {
|
||||
convertView.setBackgroundResource(0);
|
||||
}
|
||||
|
||||
String titleText = null;
|
||||
if (feedFile.getClass() == FeedMedia.class) {
|
||||
titleText = ((FeedMedia) feedFile).getItem().getTitle();
|
||||
} else if (feedFile.getClass() == Feed.class) {
|
||||
titleText = ((Feed) feedFile).getTitle();
|
||||
} else if (feedFile.getClass() == FeedImage.class) {
|
||||
FeedImage image = (FeedImage) feedFile;
|
||||
if (image.getFeed() != null) {
|
||||
titleText = convertView.getResources().getString(
|
||||
R.string.image_of_prefix)
|
||||
+ image.getFeed().getTitle();
|
||||
} else {
|
||||
titleText = ((FeedImage) feedFile).getTitle();
|
||||
}
|
||||
|
||||
holder.title.setText(request.getTitle());
|
||||
if (request.getStatusMsg() != 0) {
|
||||
holder.message.setText(request.getStatusMsg());
|
||||
}
|
||||
holder.title.setText(titleText);
|
||||
if (status.getStatusMsg() != 0) {
|
||||
holder.message.setText(status.getStatusMsg());
|
||||
}
|
||||
String strDownloaded = Converter.byteToString(status.getSoFar());
|
||||
if (status.getSize() != DownloadStatus.SIZE_UNKNOWN) {
|
||||
strDownloaded += " / " + Converter.byteToString(status.getSize());
|
||||
holder.percent.setText(status.getProgressPercent() + "%");
|
||||
holder.progbar.setProgress(status.getProgressPercent());
|
||||
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);
|
||||
|
@ -14,7 +14,6 @@ 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.feed.FeedManager;
|
||||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
@ -30,17 +29,18 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
|
||||
public static final int GROUP_POS_UNREAD = 1;
|
||||
|
||||
private Context context;
|
||||
private FeedManager manager = FeedManager.getInstance();
|
||||
private ItemAccess itemAccess;
|
||||
|
||||
private ActionButtonCallback feedItemActionCallback;
|
||||
private OnGroupActionClicked groupActionCallback;
|
||||
|
||||
public ExternalEpisodesListAdapter(Context context,
|
||||
ActionButtonCallback callback,
|
||||
OnGroupActionClicked groupActionCallback) {
|
||||
OnGroupActionClicked groupActionCallback,
|
||||
ItemAccess itemAccess) {
|
||||
super();
|
||||
this.context = context;
|
||||
|
||||
this.itemAccess = itemAccess;
|
||||
this.feedItemActionCallback = callback;
|
||||
this.groupActionCallback = groupActionCallback;
|
||||
}
|
||||
@ -53,10 +53,10 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
|
||||
@Override
|
||||
public FeedItem getChild(int groupPosition, int childPosition) {
|
||||
if (groupPosition == GROUP_POS_QUEUE) {
|
||||
return manager.getQueueItemAtIndex(childPosition, true);
|
||||
return itemAccess.getQueueItemAt(childPosition);
|
||||
} else if (groupPosition == GROUP_POS_UNREAD) {
|
||||
return manager.getUnreadItemAtIndex(childPosition, true);
|
||||
}
|
||||
return itemAccess.getUnreadItemAt(childPosition);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -200,9 +200,9 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
if (groupPosition == GROUP_POS_QUEUE) {
|
||||
return manager.getQueueSize(true);
|
||||
return itemAccess.getQueueSize();
|
||||
} else if (groupPosition == GROUP_POS_UNREAD) {
|
||||
return manager.getUnreadItemsSize(true);
|
||||
return itemAccess.getUnreadItemsSize();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
// Hide 'unread items' group if empty
|
||||
if (manager.getUnreadItemsSize(true) > 0) {
|
||||
if (itemAccess.getUnreadItemsSize() > 0) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
@ -264,8 +264,8 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return manager.getUnreadItemsSize(true) == 0
|
||||
&& manager.getQueueSize(true) == 0;
|
||||
return itemAccess.getUnreadItemsSize() == 0
|
||||
&& itemAccess.getQueueSize() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -287,4 +287,11 @@ public class ExternalEpisodesListAdapter extends BaseExpandableListAdapter {
|
||||
public void onClick(long groupId);
|
||||
}
|
||||
|
||||
public static interface ItemAccess {
|
||||
public int getQueueSize();
|
||||
public int getUnreadItemsSize();
|
||||
public FeedItem getQueueItemAt(int position);
|
||||
public FeedItem getUnreadItemAt(int position);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,23 +11,31 @@ import android.widget.TextView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.storage.FeedItemStatistics;
|
||||
import de.danoeh.antennapod.util.ThemeUtils;
|
||||
|
||||
public class FeedlistAdapter extends BaseAdapter {
|
||||
private static final String TAG = "FeedlistAdapter";
|
||||
|
||||
private Context context;
|
||||
private FeedManager manager = FeedManager.getInstance();
|
||||
protected ItemAccess itemAccess;
|
||||
|
||||
private int selectedItemIndex;
|
||||
private ImageLoader imageLoader;
|
||||
public static final int SELECTION_NONE = -1;
|
||||
|
||||
public FeedlistAdapter(Context context) {
|
||||
public FeedlistAdapter(Context context, ItemAccess itemAccess) {
|
||||
super();
|
||||
if (context == null) {
|
||||
throw new IllegalArgumentException("context must not be null");
|
||||
}
|
||||
if (itemAccess == null) {
|
||||
throw new IllegalArgumentException("itemAccess must not be null");
|
||||
}
|
||||
|
||||
this.context = context;
|
||||
this.itemAccess = itemAccess;
|
||||
selectedItemIndex = SELECTION_NONE;
|
||||
imageLoader = ImageLoader.getInstance();
|
||||
}
|
||||
@ -36,6 +44,7 @@ public class FeedlistAdapter extends BaseAdapter {
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
final Holder holder;
|
||||
final Feed feed = getItem(position);
|
||||
final FeedItemStatistics feedItemStatistics = itemAccess.getFeedItemStatistics(position);
|
||||
|
||||
// Inflate Layout
|
||||
if (convertView == null) {
|
||||
@ -75,42 +84,40 @@ public class FeedlistAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
holder.title.setText(feed.getTitle());
|
||||
int numOfItems = feed.getNumOfItems(true);
|
||||
if (DownloadRequester.getInstance().isDownloadingFile(feed)) {
|
||||
holder.lastUpdate.setText(R.string.refreshing_label);
|
||||
} else {
|
||||
if (numOfItems > 0) {
|
||||
holder.lastUpdate.setText(convertView.getResources().getString(
|
||||
R.string.most_recent_prefix)
|
||||
+ DateUtils.getRelativeTimeSpanString(
|
||||
feed.getItemAtIndex(true, 0).getPubDate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
} else {
|
||||
holder.lastUpdate.setText("");
|
||||
}
|
||||
}
|
||||
holder.numberOfEpisodes.setText(numOfItems
|
||||
+ convertView.getResources()
|
||||
.getString(R.string.episodes_suffix));
|
||||
|
||||
int newItems = feed.getNumOfNewItems();
|
||||
int inProgressItems = feed.getNumOfStartedItems();
|
||||
if (feedItemStatistics != null) {
|
||||
if (DownloadRequester.getInstance().isDownloadingFile(feed)) {
|
||||
holder.lastUpdate.setText(R.string.refreshing_label);
|
||||
} else {
|
||||
if (feedItemStatistics.getNumberOfItems() > 0) {
|
||||
holder.lastUpdate.setText(convertView.getResources().getString(
|
||||
R.string.most_recent_prefix)
|
||||
+ DateUtils.getRelativeTimeSpanString(
|
||||
feedItemStatistics.getLastUpdate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
} else {
|
||||
holder.lastUpdate.setText("");
|
||||
}
|
||||
}
|
||||
holder.numberOfEpisodes.setText(feedItemStatistics.getNumberOfItems()
|
||||
+ convertView.getResources()
|
||||
.getString(R.string.episodes_suffix));
|
||||
|
||||
if (newItems > 0) {
|
||||
holder.newEpisodes.setText(Integer.toString(newItems));
|
||||
holder.newEpisodesLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.newEpisodesLabel.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (inProgressItems > 0) {
|
||||
holder.inProgressEpisodes
|
||||
.setText(Integer.toString(inProgressItems));
|
||||
holder.inProgressEpisodesLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.inProgressEpisodesLabel.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (feedItemStatistics.getNumberOfNewItems() > 0) {
|
||||
holder.newEpisodes.setText(Integer.toString(feedItemStatistics.getNumberOfNewItems()));
|
||||
holder.newEpisodesLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.newEpisodesLabel.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (feedItemStatistics.getNumberOfInProgressItems() > 0) {
|
||||
holder.inProgressEpisodes
|
||||
.setText(Integer.toString(feedItemStatistics.getNumberOfInProgressItems()));
|
||||
holder.inProgressEpisodesLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.inProgressEpisodesLabel.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
final String imageUrl = (feed.getImage() != null) ? feed.getImage()
|
||||
.getFile_url() : null;
|
||||
holder.image.setTag(imageUrl);
|
||||
@ -145,12 +152,12 @@ public class FeedlistAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return manager.getFeedsSize();
|
||||
return itemAccess.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Feed getItem(int position) {
|
||||
return manager.getFeedAtIndex(position);
|
||||
return itemAccess.getItem(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -158,4 +165,11 @@ public class FeedlistAdapter extends BaseAdapter {
|
||||
return position;
|
||||
}
|
||||
|
||||
public interface ItemAccess {
|
||||
int getCount();
|
||||
|
||||
Feed getItem(int position);
|
||||
|
||||
FeedItemStatistics getFeedItemStatistics(int position);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,14 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
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;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/** List adapter for items of feeds that the user has already subscribed to. */
|
||||
public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter {
|
||||
|
||||
@ -31,7 +32,7 @@ public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter {
|
||||
public static final int SELECTION_NONE = -1;
|
||||
|
||||
public InternalFeedItemlistAdapter(Context context,
|
||||
DefaultFeedItemlistAdapter.ItemAccess itemAccess,
|
||||
ItemAccess itemAccess,
|
||||
ActionButtonCallback callback, boolean showFeedtitle) {
|
||||
super(context, itemAccess);
|
||||
this.callback = callback;
|
||||
@ -155,7 +156,7 @@ public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter {
|
||||
}
|
||||
|
||||
holder.lenSize.setVisibility(View.VISIBLE);
|
||||
if (FeedManager.getInstance().isInQueue(item)) {
|
||||
if (((ItemAccess) itemAccess).isInQueue(item)) {
|
||||
holder.inPlaylist.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.inPlaylist.setVisibility(View.GONE);
|
||||
@ -224,4 +225,8 @@ public class InternalFeedItemlistAdapter extends DefaultFeedItemlistAdapter {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public static interface ItemAccess extends DefaultFeedItemlistAdapter.ItemAccess {
|
||||
public boolean isInQueue(FeedItem item);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class BitmapDecodeWorkerTask extends Thread {
|
||||
*/
|
||||
protected boolean tagsMatching(ImageView target) {
|
||||
return target.getTag() == null
|
||||
|| target.getTag() == imageResource.getImageLoaderCacheKey();
|
||||
|| target.getTag().equals(imageResource.getImageLoaderCacheKey());
|
||||
}
|
||||
|
||||
protected void onPostExecute() {
|
||||
|
@ -1,198 +0,0 @@
|
||||
package de.danoeh.antennapod.asynctask;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import de.danoeh.antennapod.feed.FeedFile;
|
||||
|
||||
/** Contains status attributes for one download */
|
||||
public class DownloadStatus {
|
||||
/**
|
||||
* Downloaders should use this constant for the size attribute if necessary
|
||||
* so that the listadapters etc. can react properly.
|
||||
*/
|
||||
public static final int SIZE_UNKNOWN = -1;
|
||||
|
||||
public Date getCompletionDate() {
|
||||
return completionDate;
|
||||
}
|
||||
|
||||
// ----------------------------------- ATTRIBUTES STORED IN DB
|
||||
/** Unique id for storing the object in database. */
|
||||
protected long id;
|
||||
/**
|
||||
* A human-readable string which is shown to the user so that he can
|
||||
* identify the download. Should be the title of the item/feed/media or the
|
||||
* URL if the download has no other title.
|
||||
*/
|
||||
protected String title;
|
||||
protected int reason;
|
||||
/**
|
||||
* A message which can be presented to the user to give more information.
|
||||
* Should be null if Download was successful.
|
||||
*/
|
||||
protected String reasonDetailed;
|
||||
protected boolean successful;
|
||||
protected Date completionDate;
|
||||
protected FeedFile feedfile;
|
||||
/**
|
||||
* Is used to determine the type of the feedfile even if the feedfile does
|
||||
* not exist anymore. The value should be FEEDFILETYPE_FEED,
|
||||
* FEEDFILETYPE_FEEDIMAGE or FEEDFILETYPE_FEEDMEDIA
|
||||
*/
|
||||
protected int feedfileType;
|
||||
|
||||
// ------------------------------------ NOT STORED IN DB
|
||||
protected int progressPercent;
|
||||
protected long soFar;
|
||||
protected long size;
|
||||
protected int statusMsg;
|
||||
protected boolean done;
|
||||
protected boolean cancelled;
|
||||
|
||||
public DownloadStatus(FeedFile feedfile, String title) {
|
||||
this.feedfile = feedfile;
|
||||
if (feedfile != null) {
|
||||
feedfileType = feedfile.getTypeAsInt();
|
||||
}
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/** Constructor for restoring Download status entries from DB. */
|
||||
public DownloadStatus(long id, String title, FeedFile feedfile,
|
||||
int feedfileType, boolean successful, int reason,
|
||||
Date completionDate, String reasonDetailed) {
|
||||
progressPercent = 100;
|
||||
soFar = 0;
|
||||
size = 0;
|
||||
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.done = true;
|
||||
this.feedfile = feedfile;
|
||||
this.reason = reason;
|
||||
this.successful = successful;
|
||||
this.completionDate = completionDate;
|
||||
this.reasonDetailed = reasonDetailed;
|
||||
this.feedfileType = feedfileType;
|
||||
}
|
||||
|
||||
/** Constructor for creating new completed downloads. */
|
||||
public DownloadStatus(FeedFile feedfile, String title, int reason,
|
||||
boolean successful, String reasonDetailed) {
|
||||
this(0, title, feedfile, feedfile.getTypeAsInt(), successful, reason,
|
||||
new Date(), reasonDetailed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DownloadStatus [id=" + id + ", title=" + title + ", reason="
|
||||
+ reason + ", reasonDetailed=" + reasonDetailed
|
||||
+ ", successful=" + successful + ", completionDate="
|
||||
+ completionDate + ", feedfile=" + feedfile + ", feedfileType="
|
||||
+ feedfileType + ", progressPercent=" + progressPercent
|
||||
+ ", soFar=" + soFar + ", size=" + size + ", statusMsg="
|
||||
+ statusMsg + ", done=" + done + ", cancelled=" + cancelled
|
||||
+ "]";
|
||||
}
|
||||
|
||||
public FeedFile getFeedFile() {
|
||||
return feedfile;
|
||||
}
|
||||
|
||||
public int getProgressPercent() {
|
||||
return progressPercent;
|
||||
}
|
||||
|
||||
public long getSoFar() {
|
||||
return soFar;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public int getStatusMsg() {
|
||||
return statusMsg;
|
||||
}
|
||||
|
||||
public int getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public boolean isSuccessful() {
|
||||
return successful;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return done;
|
||||
}
|
||||
|
||||
public void setProgressPercent(int progressPercent) {
|
||||
this.progressPercent = progressPercent;
|
||||
}
|
||||
|
||||
public void setSoFar(long soFar) {
|
||||
this.soFar = soFar;
|
||||
}
|
||||
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setStatusMsg(int statusMsg) {
|
||||
this.statusMsg = statusMsg;
|
||||
}
|
||||
|
||||
public void setReason(int reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public void setSuccessful(boolean successful) {
|
||||
this.successful = successful;
|
||||
}
|
||||
|
||||
public void setDone(boolean done) {
|
||||
this.done = done;
|
||||
}
|
||||
|
||||
public void setCompletionDate(Date completionDate) {
|
||||
this.completionDate = completionDate;
|
||||
}
|
||||
|
||||
public String getReasonDetailed() {
|
||||
return reasonDetailed;
|
||||
}
|
||||
|
||||
public void setReasonDetailed(String reasonDetailed) {
|
||||
this.reasonDetailed = reasonDetailed;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getFeedfileType() {
|
||||
return feedfileType;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,9 @@ import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.os.AsyncTask;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.storage.DBWriter;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/** Removes a feed in the background. */
|
||||
public class FeedRemover extends AsyncTask<Void, Void, Void> {
|
||||
@ -23,9 +25,14 @@ public class FeedRemover extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
manager.deleteFeed(context, feed);
|
||||
return null;
|
||||
try {
|
||||
DBWriter.deleteFeed(context, feed.getId()).get();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,7 @@ public class ImageLoader {
|
||||
});
|
||||
}
|
||||
|
||||
public static ImageLoader getInstance() {
|
||||
public static synchronized ImageLoader getInstance() {
|
||||
if (singleton == null) {
|
||||
singleton = new ImageLoader();
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package de.danoeh.antennapod.asynctask;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Arrays;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@ -14,9 +15,10 @@ import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.opml.OpmlWriter;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.util.LangUtils;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
|
||||
/** Writes an OPML file into the export directory in the background. */
|
||||
public class OpmlExportWorker extends AsyncTask<Void, Void, Void> {
|
||||
@ -49,14 +51,21 @@ public class OpmlExportWorker extends AsyncTask<Void, Void, Void> {
|
||||
output.delete();
|
||||
}
|
||||
}
|
||||
OutputStreamWriter writer = null;
|
||||
try {
|
||||
FileWriter writer = new FileWriter(output);
|
||||
opmlWriter.writeDocument(Arrays.asList(FeedManager.getInstance().getFeedsArray()),
|
||||
writer);
|
||||
writer.close();
|
||||
writer = new OutputStreamWriter(new FileOutputStream(output), LangUtils.UTF_8);
|
||||
opmlWriter.writeDocument(DBReader.getFeedList(context), writer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
exception = e;
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException ioe) {
|
||||
exception = ioe;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.danoeh.antennapod.asynctask;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@ -22,7 +23,7 @@ public class OpmlFeedQueuer extends AsyncTask<Void, Void, Void> {
|
||||
public OpmlFeedQueuer(Context context, int[] selection) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.selection = selection;
|
||||
this.selection = Arrays.copyOf(selection, selection.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,6 +64,13 @@ public class OpmlImportWorker extends
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<OpmlElement> result) {
|
||||
if (mReader != null) {
|
||||
try {
|
||||
mReader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
progDialog.dismiss();
|
||||
if (exception != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
|
100
src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java
Normal file
100
src/de/danoeh/antennapod/dialog/VariableSpeedDialog.java
Normal file
@ -0,0 +1,100 @@
|
||||
package de.danoeh.antennapod.dialog;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
|
||||
public class VariableSpeedDialog {
|
||||
private VariableSpeedDialog() {
|
||||
}
|
||||
|
||||
public static void showDialog(final Context context) {
|
||||
if (com.aocate.media.MediaPlayer.isPrestoLibraryInstalled(context)) {
|
||||
showSpeedSelectorDialog(context);
|
||||
} else {
|
||||
showGetPluginDialog(context);
|
||||
}
|
||||
}
|
||||
|
||||
private static void showGetPluginDialog(final Context context) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.no_playback_plugin_title);
|
||||
builder.setMessage(R.string.no_playback_plugin_msg);
|
||||
builder.setNegativeButton(R.string.close_label, null);
|
||||
builder.setPositiveButton(R.string.download_plugin_label,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
try {
|
||||
Intent playStoreIntent = new Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
Uri.parse("market://details?id=com.falconware.prestissimo"));
|
||||
context.startActivity(playStoreIntent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// this is usually thrown on an emulator if the Android market is not installed
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
|
||||
private static void showSpeedSelectorDialog(final Context context) {
|
||||
final String[] speedValues = context.getResources().getStringArray(
|
||||
R.array.playback_speed_values);
|
||||
// According to Java spec these get initialized to false on creation
|
||||
final boolean[] speedChecked = new boolean[speedValues.length];
|
||||
|
||||
// Build the "isChecked" array so that multiChoice dialog is
|
||||
// populated correctly
|
||||
List<String> selectedSpeedList = Arrays.asList(UserPreferences
|
||||
.getPlaybackSpeedArray());
|
||||
for (int i = 0; i < speedValues.length; i++) {
|
||||
speedChecked[i] = selectedSpeedList.contains(speedValues[i]);
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.set_playback_speed_label);
|
||||
builder.setMultiChoiceItems(R.array.playback_speed_values,
|
||||
speedChecked, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which,
|
||||
boolean isChecked) {
|
||||
speedChecked[which] = isChecked;
|
||||
}
|
||||
|
||||
});
|
||||
builder.setNegativeButton(android.R.string.cancel, null);
|
||||
builder.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
int choiceCount = 0;
|
||||
for (int i = 0; i < speedChecked.length; i++) {
|
||||
if (speedChecked[i]) {
|
||||
choiceCount++;
|
||||
}
|
||||
}
|
||||
String[] newSpeedValues = new String[choiceCount];
|
||||
int newSpeedIndex = 0;
|
||||
for (int i = 0; i < speedChecked.length; i++) {
|
||||
if (speedChecked[i]) {
|
||||
newSpeedValues[newSpeedIndex++] = speedValues[i];
|
||||
}
|
||||
}
|
||||
|
||||
UserPreferences.setPlaybackSpeedArray(newSpeedValues);
|
||||
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ public class EventDistributor extends Observable {
|
||||
events = new ConcurrentLinkedQueue<Integer>();
|
||||
}
|
||||
|
||||
public static EventDistributor getInstance() {
|
||||
public static synchronized EventDistributor getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new EventDistributor();
|
||||
}
|
||||
@ -92,7 +92,7 @@ public class EventDistributor extends Observable {
|
||||
super.addObserver(observer);
|
||||
if (!(observer instanceof EventListener)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Observer must be instance of FeedManager.EventListener");
|
||||
"Observer must be instance of EventListener");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,339 +10,360 @@ import de.danoeh.antennapod.util.EpisodeFilter;
|
||||
|
||||
/**
|
||||
* Data Object for a whole feed
|
||||
*
|
||||
*
|
||||
* @author daniel
|
||||
*
|
||||
*/
|
||||
public class Feed extends FeedFile {
|
||||
public static final int FEEDFILETYPE_FEED = 0;
|
||||
public static final String TYPE_RSS2 = "rss";
|
||||
public static final String TYPE_RSS091 = "rss";
|
||||
public static final String TYPE_ATOM1 = "atom";
|
||||
public static final int FEEDFILETYPE_FEED = 0;
|
||||
public static final String TYPE_RSS2 = "rss";
|
||||
public static final String TYPE_RSS091 = "rss";
|
||||
public static final String TYPE_ATOM1 = "atom";
|
||||
|
||||
private String title;
|
||||
/** Contains 'id'-element in Atom feed. */
|
||||
private String feedIdentifier;
|
||||
/** Link to the website. */
|
||||
private String link;
|
||||
private String description;
|
||||
private String language;
|
||||
/** Name of the author */
|
||||
private String author;
|
||||
private FeedImage image;
|
||||
private List<FeedItem> items;
|
||||
/** Date of last refresh. */
|
||||
private Date lastUpdate;
|
||||
private String paymentLink;
|
||||
/** Feed type, for example RSS 2 or Atom */
|
||||
private String type;
|
||||
private String title;
|
||||
/**
|
||||
* Contains 'id'-element in Atom feed.
|
||||
*/
|
||||
private String feedIdentifier;
|
||||
/**
|
||||
* Link to the website.
|
||||
*/
|
||||
private String link;
|
||||
private String description;
|
||||
private String language;
|
||||
/**
|
||||
* Name of the author
|
||||
*/
|
||||
private String author;
|
||||
private FeedImage image;
|
||||
private List<FeedItem> items;
|
||||
/**
|
||||
* Date of last refresh.
|
||||
*/
|
||||
private Date lastUpdate;
|
||||
private String paymentLink;
|
||||
/**
|
||||
* Feed type, for example RSS 2 or Atom
|
||||
*/
|
||||
private String type;
|
||||
|
||||
public Feed(Date lastUpdate) {
|
||||
super();
|
||||
items = Collections.synchronizedList(new ArrayList<FeedItem>());
|
||||
this.lastUpdate = lastUpdate;
|
||||
}
|
||||
/**
|
||||
* This constructor is used for restoring a feed from the database.
|
||||
*/
|
||||
public Feed(long id, Date lastUpdate, String title, String link, String description, String paymentLink,
|
||||
String author, String language, String type, String feedIdentifier, FeedImage image, String fileUrl,
|
||||
String downloadUrl, boolean downloaded) {
|
||||
super(fileUrl, downloadUrl, downloaded);
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
if (lastUpdate != null) {
|
||||
this.lastUpdate = (Date) lastUpdate.clone();
|
||||
} else {
|
||||
this.lastUpdate = null;
|
||||
}
|
||||
this.link = link;
|
||||
this.description = description;
|
||||
this.paymentLink = paymentLink;
|
||||
this.author = author;
|
||||
this.language = language;
|
||||
this.type = type;
|
||||
this.feedIdentifier = feedIdentifier;
|
||||
this.image = image;
|
||||
|
||||
/**
|
||||
* This constructor is used for requesting a feed download. It should NOT be
|
||||
* used if the title of the feed is already known.
|
||||
* */
|
||||
public Feed(String url, Date lastUpdate) {
|
||||
this(lastUpdate);
|
||||
this.download_url = url;
|
||||
}
|
||||
items = new ArrayList<FeedItem>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is used for requesting a feed download. It should be
|
||||
* used if the title of the feed is already known.
|
||||
* */
|
||||
public Feed(String url, Date lastUpdate, String title) {
|
||||
this(url, lastUpdate);
|
||||
this.title = title;
|
||||
}
|
||||
/**
|
||||
* This constructor can be used when parsing feed data. Only the 'lastUpdate' and 'items' field are initialized.
|
||||
*/
|
||||
public Feed() {
|
||||
super();
|
||||
items = new ArrayList<FeedItem>();
|
||||
lastUpdate = new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of FeedItems where 'read' is false. If the 'display
|
||||
* only episodes' - preference is set to true, this method will only count
|
||||
* items with episodes.
|
||||
* */
|
||||
public int getNumOfNewItems() {
|
||||
int count = 0;
|
||||
for (FeedItem item : items) {
|
||||
if (item.getState() == FeedItem.State.NEW) {
|
||||
if (!UserPreferences.isDisplayOnlyEpisodes()
|
||||
|| item.getMedia() != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
/**
|
||||
* This constructor is used for requesting a feed download (it must not be used for anything else!). It should NOT be
|
||||
* used if the title of the feed is already known.
|
||||
*/
|
||||
public Feed(String url, Date lastUpdate) {
|
||||
super(null, url, false);
|
||||
this.lastUpdate = (lastUpdate != null) ? (Date) lastUpdate.clone() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of FeedItems where the media started to play but
|
||||
* wasn't finished yet.
|
||||
* */
|
||||
public int getNumOfStartedItems() {
|
||||
int count = 0;
|
||||
/**
|
||||
* This constructor is used for requesting a feed download (it must not be used for anything else!). It should be
|
||||
* used if the title of the feed is already known.
|
||||
*/
|
||||
public Feed(String url, Date lastUpdate, String title) {
|
||||
this(url, lastUpdate);
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
for (FeedItem item : items) {
|
||||
FeedItem.State state = item.getState();
|
||||
if (state == FeedItem.State.IN_PROGRESS
|
||||
|| state == FeedItem.State.PLAYING) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
/**
|
||||
* Returns the number of FeedItems where 'read' is false. If the 'display
|
||||
* only episodes' - preference is set to true, this method will only count
|
||||
* items with episodes.
|
||||
*/
|
||||
public int getNumOfNewItems() {
|
||||
int count = 0;
|
||||
for (FeedItem item : items) {
|
||||
if (item.getState() == FeedItem.State.NEW) {
|
||||
if (!UserPreferences.isDisplayOnlyEpisodes()
|
||||
|| item.getMedia() != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if at least one item in the itemlist is unread.
|
||||
*
|
||||
* @param enableEpisodeFilter
|
||||
* true if this method should only count items with episodes if
|
||||
* the 'display only episodes' - preference is set to true by the
|
||||
* user.
|
||||
*/
|
||||
public boolean hasNewItems(boolean enableEpisodeFilter) {
|
||||
for (FeedItem item : items) {
|
||||
if (item.getState() == FeedItem.State.NEW) {
|
||||
if (!(enableEpisodeFilter && UserPreferences
|
||||
.isDisplayOnlyEpisodes()) || item.getMedia() != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns the number of FeedItems where the media started to play but
|
||||
* wasn't finished yet.
|
||||
*/
|
||||
public int getNumOfStartedItems() {
|
||||
int count = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of FeedItems.
|
||||
*
|
||||
* @param enableEpisodeFilter
|
||||
* true if this method should only count items with episodes if
|
||||
* the 'display only episodes' - preference is set to true by the
|
||||
* user.
|
||||
* */
|
||||
public int getNumOfItems(boolean enableEpisodeFilter) {
|
||||
if (enableEpisodeFilter && UserPreferences.isDisplayOnlyEpisodes()) {
|
||||
return EpisodeFilter.countItemsWithEpisodes(items);
|
||||
} else {
|
||||
return items.size();
|
||||
}
|
||||
}
|
||||
for (FeedItem item : items) {
|
||||
FeedItem.State state = item.getState();
|
||||
if (state == FeedItem.State.IN_PROGRESS
|
||||
|| state == FeedItem.State.PLAYING) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item at the specified index.
|
||||
*
|
||||
* @param enableEpisodeFilter
|
||||
* true if this method should ignore items without episdodes if
|
||||
* the episodes filter has been enabled by the user.
|
||||
*/
|
||||
public FeedItem getItemAtIndex(boolean enableEpisodeFilter, int position) {
|
||||
if (enableEpisodeFilter && UserPreferences.isDisplayOnlyEpisodes()) {
|
||||
return EpisodeFilter.accessEpisodeByIndex(items, position);
|
||||
} else {
|
||||
return items.get(position);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns true if at least one item in the itemlist is unread.
|
||||
*
|
||||
* @param enableEpisodeFilter true if this method should only count items with episodes if
|
||||
* the 'display only episodes' - preference is set to true by the
|
||||
* user.
|
||||
*/
|
||||
public boolean hasNewItems(boolean enableEpisodeFilter) {
|
||||
for (FeedItem item : items) {
|
||||
if (item.getState() == FeedItem.State.NEW) {
|
||||
if (!(enableEpisodeFilter && UserPreferences
|
||||
.isDisplayOnlyEpisodes()) || item.getMedia() != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value that uniquely identifies this Feed. If the
|
||||
* feedIdentifier attribute is not null, it will be returned. Else it will
|
||||
* try to return the title. If the title is not given, it will use the link
|
||||
* of the feed.
|
||||
* */
|
||||
public String getIdentifyingValue() {
|
||||
if (feedIdentifier != null && !feedIdentifier.isEmpty()) {
|
||||
return feedIdentifier;
|
||||
} else if (title != null && !title.isEmpty()) {
|
||||
return title;
|
||||
} else {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the number of FeedItems.
|
||||
*
|
||||
* @param enableEpisodeFilter true if this method should only count items with episodes if
|
||||
* the 'display only episodes' - preference is set to true by the
|
||||
* user.
|
||||
*/
|
||||
public int getNumOfItems(boolean enableEpisodeFilter) {
|
||||
if (enableEpisodeFilter && UserPreferences.isDisplayOnlyEpisodes()) {
|
||||
return EpisodeFilter.countItemsWithEpisodes(items);
|
||||
} else {
|
||||
return items.size();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHumanReadableIdentifier() {
|
||||
if (title != null) {
|
||||
return title;
|
||||
} else {
|
||||
return download_url;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the item at the specified index.
|
||||
*
|
||||
* @param enableEpisodeFilter true if this method should ignore items without episdodes if
|
||||
* the episodes filter has been enabled by the user.
|
||||
*/
|
||||
public FeedItem getItemAtIndex(boolean enableEpisodeFilter, int position) {
|
||||
if (enableEpisodeFilter && UserPreferences.isDisplayOnlyEpisodes()) {
|
||||
return EpisodeFilter.accessEpisodeByIndex(items, position);
|
||||
} else {
|
||||
return items.get(position);
|
||||
}
|
||||
}
|
||||
|
||||
/** Calls cacheDescriptions on all items. */
|
||||
protected void cacheDescriptionsOfItems() {
|
||||
if (items != null) {
|
||||
for (FeedItem item : items) {
|
||||
item.cacheDescriptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the value that uniquely identifies this Feed. If the
|
||||
* feedIdentifier attribute is not null, it will be returned. Else it will
|
||||
* try to return the title. If the title is not given, it will use the link
|
||||
* of the feed.
|
||||
*/
|
||||
public String getIdentifyingValue() {
|
||||
if (feedIdentifier != null && !feedIdentifier.isEmpty()) {
|
||||
return feedIdentifier;
|
||||
} else if (title != null && !title.isEmpty()) {
|
||||
return title;
|
||||
} else {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFromOther(Feed other) {
|
||||
super.updateFromOther(other);
|
||||
if (other.title != null) {
|
||||
title = other.title;
|
||||
}
|
||||
if (other.feedIdentifier != null) {
|
||||
feedIdentifier = other.feedIdentifier;
|
||||
}
|
||||
if (other.link != null) {
|
||||
link = other.link;
|
||||
}
|
||||
if (other.description != null) {
|
||||
description = other.description;
|
||||
}
|
||||
if (other.language != null) {
|
||||
language = other.language;
|
||||
}
|
||||
if (other.author != null) {
|
||||
author = other.author;
|
||||
}
|
||||
if (other.paymentLink != null) {
|
||||
paymentLink = other.paymentLink;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getHumanReadableIdentifier() {
|
||||
if (title != null) {
|
||||
return title;
|
||||
} else {
|
||||
return download_url;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean compareWithOther(Feed other) {
|
||||
if (super.compareWithOther(other)) {
|
||||
return true;
|
||||
}
|
||||
if (!title.equals(other.title)) {
|
||||
return true;
|
||||
}
|
||||
if (other.feedIdentifier != null) {
|
||||
if (feedIdentifier == null
|
||||
|| !feedIdentifier.equals(other.feedIdentifier)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.link != null) {
|
||||
if (link == null || !link.equals(other.link)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.description != null) {
|
||||
if (description == null || !description.equals(other.description)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.language != null) {
|
||||
if (language == null || !language.equals(other.language)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.author != null) {
|
||||
if (author == null || !author.equals(other.author)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.paymentLink != null) {
|
||||
if (paymentLink == null || !paymentLink.equals(other.paymentLink)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void updateFromOther(Feed other) {
|
||||
super.updateFromOther(other);
|
||||
if (other.title != null) {
|
||||
title = other.title;
|
||||
}
|
||||
if (other.feedIdentifier != null) {
|
||||
feedIdentifier = other.feedIdentifier;
|
||||
}
|
||||
if (other.link != null) {
|
||||
link = other.link;
|
||||
}
|
||||
if (other.description != null) {
|
||||
description = other.description;
|
||||
}
|
||||
if (other.language != null) {
|
||||
language = other.language;
|
||||
}
|
||||
if (other.author != null) {
|
||||
author = other.author;
|
||||
}
|
||||
if (other.paymentLink != null) {
|
||||
paymentLink = other.paymentLink;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeAsInt() {
|
||||
return FEEDFILETYPE_FEED;
|
||||
}
|
||||
public boolean compareWithOther(Feed other) {
|
||||
if (super.compareWithOther(other)) {
|
||||
return true;
|
||||
}
|
||||
if (!title.equals(other.title)) {
|
||||
return true;
|
||||
}
|
||||
if (other.feedIdentifier != null) {
|
||||
if (feedIdentifier == null
|
||||
|| !feedIdentifier.equals(other.feedIdentifier)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.link != null) {
|
||||
if (link == null || !link.equals(other.link)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.description != null) {
|
||||
if (description == null || !description.equals(other.description)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.language != null) {
|
||||
if (language == null || !language.equals(other.language)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.author != null) {
|
||||
if (author == null || !author.equals(other.author)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.paymentLink != null) {
|
||||
if (paymentLink == null || !paymentLink.equals(other.paymentLink)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
@Override
|
||||
public int getTypeAsInt() {
|
||||
return FEEDFILETYPE_FEED;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public FeedImage getImage() {
|
||||
return image;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setImage(FeedImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
public FeedImage getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
List<FeedItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
public void setImage(FeedImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setItems(ArrayList<FeedItem> items) {
|
||||
this.items = Collections.synchronizedList(items);
|
||||
}
|
||||
public List<FeedItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
/** Returns an array that contains all the feeditems of this feed. */
|
||||
public FeedItem[] getItemsArray() {
|
||||
return items.toArray(new FeedItem[items.size()]);
|
||||
}
|
||||
public void setItems(List<FeedItem> list) {
|
||||
this.items = list;
|
||||
}
|
||||
|
||||
public Date getLastUpdate() {
|
||||
return lastUpdate;
|
||||
}
|
||||
public Date getLastUpdate() {
|
||||
return (lastUpdate != null) ? (Date) lastUpdate.clone() : null;
|
||||
}
|
||||
|
||||
public void setLastUpdate(Date lastUpdate) {
|
||||
this.lastUpdate = lastUpdate;
|
||||
}
|
||||
public void setLastUpdate(Date lastUpdate) {
|
||||
this.lastUpdate = (lastUpdate != null) ? (Date) lastUpdate.clone() : null;
|
||||
}
|
||||
|
||||
public String getFeedIdentifier() {
|
||||
return feedIdentifier;
|
||||
}
|
||||
public String getFeedIdentifier() {
|
||||
return feedIdentifier;
|
||||
}
|
||||
|
||||
public void setFeedIdentifier(String feedIdentifier) {
|
||||
this.feedIdentifier = feedIdentifier;
|
||||
}
|
||||
public void setFeedIdentifier(String feedIdentifier) {
|
||||
this.feedIdentifier = feedIdentifier;
|
||||
}
|
||||
|
||||
public String getPaymentLink() {
|
||||
return paymentLink;
|
||||
}
|
||||
public String getPaymentLink() {
|
||||
return paymentLink;
|
||||
}
|
||||
|
||||
public void setPaymentLink(String paymentLink) {
|
||||
this.paymentLink = paymentLink;
|
||||
}
|
||||
public void setPaymentLink(String paymentLink) {
|
||||
this.paymentLink = paymentLink;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.apache.commons.io.IOUtils;
|
||||
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
|
||||
;
|
||||
|
||||
|
||||
public class FeedImage extends FeedFile implements
|
||||
ImageLoader.ImageWorkerTaskResource {
|
||||
|
@ -4,279 +4,305 @@ import java.io.InputStream;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.util.ShownotesProvider;
|
||||
|
||||
/**
|
||||
* Data Object for a XML message
|
||||
*
|
||||
*
|
||||
* @author daniel
|
||||
*
|
||||
*/
|
||||
public class FeedItem extends FeedComponent implements
|
||||
ImageLoader.ImageWorkerTaskResource {
|
||||
ImageLoader.ImageWorkerTaskResource, ShownotesProvider {
|
||||
|
||||
/** The id/guid that can be found in the rss/atom feed. Might not be set. */
|
||||
private String itemIdentifier;
|
||||
private String title;
|
||||
/**
|
||||
* The description of a feeditem. This field should only be set by the
|
||||
* parser.
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* The content of the content-encoded tag of a feeditem. This field should
|
||||
* only be set by the parser.
|
||||
*/
|
||||
private String contentEncoded;
|
||||
/**
|
||||
* The id/guid that can be found in the rss/atom feed. Might not be set.
|
||||
*/
|
||||
private String itemIdentifier;
|
||||
private String title;
|
||||
/**
|
||||
* The description of a feeditem.
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* The content of the content-encoded tag of a feeditem.
|
||||
*/
|
||||
private String contentEncoded;
|
||||
|
||||
private SoftReference<String> cachedDescription;
|
||||
private SoftReference<String> cachedContentEncoded;
|
||||
private String link;
|
||||
private Date pubDate;
|
||||
private FeedMedia media;
|
||||
|
||||
private String link;
|
||||
private Date pubDate;
|
||||
private FeedMedia media;
|
||||
private Feed feed;
|
||||
private boolean read;
|
||||
private String paymentLink;
|
||||
private List<Chapter> chapters;
|
||||
private Feed feed;
|
||||
private long feedId;
|
||||
|
||||
public FeedItem() {
|
||||
this.read = true;
|
||||
}
|
||||
private boolean read;
|
||||
private String paymentLink;
|
||||
private List<Chapter> chapters;
|
||||
|
||||
public void updateFromOther(FeedItem other) {
|
||||
super.updateFromOther(other);
|
||||
if (other.title != null) {
|
||||
title = other.title;
|
||||
}
|
||||
if (other.getDescription() != null) {
|
||||
description = other.getDescription();
|
||||
}
|
||||
if (other.getContentEncoded() != null) {
|
||||
contentEncoded = other.contentEncoded;
|
||||
}
|
||||
if (other.link != null) {
|
||||
link = other.link;
|
||||
}
|
||||
if (other.pubDate != null && other.pubDate != pubDate) {
|
||||
pubDate = other.pubDate;
|
||||
}
|
||||
if (other.media != null) {
|
||||
if (media == null) {
|
||||
media = other.media;
|
||||
} else if (media.compareWithOther(other)) {
|
||||
media.updateFromOther(other);
|
||||
}
|
||||
}
|
||||
if (other.paymentLink != null) {
|
||||
paymentLink = other.paymentLink;
|
||||
}
|
||||
if (other.chapters != null) {
|
||||
if (chapters == null) {
|
||||
chapters = other.chapters;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FeedItem() {
|
||||
this.read = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the 'description' and 'contentEncoded' field of feeditem to their
|
||||
* SoftReference fields.
|
||||
*/
|
||||
protected void cacheDescriptions() {
|
||||
if (description != null) {
|
||||
cachedDescription = new SoftReference<String>(description);
|
||||
}
|
||||
if (contentEncoded != null) {
|
||||
cachedContentEncoded = new SoftReference<String>(contentEncoded);
|
||||
}
|
||||
description = null;
|
||||
contentEncoded = null;
|
||||
}
|
||||
/**
|
||||
* This constructor should be used for creating test objects.
|
||||
* */
|
||||
public FeedItem(long id, String title, String itemIdentifier, String link, Date pubDate, boolean read, Feed feed) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.itemIdentifier = itemIdentifier;
|
||||
this.link = link;
|
||||
this.pubDate = (pubDate != null) ? (Date) pubDate.clone() : null;
|
||||
this.read = read;
|
||||
this.feed = feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value that uniquely identifies this FeedItem. If the
|
||||
* itemIdentifier attribute is not null, it will be returned. Else it will
|
||||
* try to return the title. If the title is not given, it will use the link
|
||||
* of the entry.
|
||||
* */
|
||||
public String getIdentifyingValue() {
|
||||
if (itemIdentifier != null) {
|
||||
return itemIdentifier;
|
||||
} else if (title != null) {
|
||||
return title;
|
||||
} else {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
public void updateFromOther(FeedItem other) {
|
||||
super.updateFromOther(other);
|
||||
if (other.title != null) {
|
||||
title = other.title;
|
||||
}
|
||||
if (other.getDescription() != null) {
|
||||
description = other.getDescription();
|
||||
}
|
||||
if (other.getContentEncoded() != null) {
|
||||
contentEncoded = other.contentEncoded;
|
||||
}
|
||||
if (other.link != null) {
|
||||
link = other.link;
|
||||
}
|
||||
if (other.pubDate != null && other.pubDate != pubDate) {
|
||||
pubDate = other.pubDate;
|
||||
}
|
||||
if (other.media != null) {
|
||||
if (media == null) {
|
||||
media = other.media;
|
||||
} else if (media.compareWithOther(other)) {
|
||||
media.updateFromOther(other);
|
||||
}
|
||||
}
|
||||
if (other.paymentLink != null) {
|
||||
paymentLink = other.paymentLink;
|
||||
}
|
||||
if (other.chapters != null) {
|
||||
if (chapters == null) {
|
||||
chapters = other.chapters;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
/**
|
||||
* Returns the value that uniquely identifies this FeedItem. If the
|
||||
* itemIdentifier attribute is not null, it will be returned. Else it will
|
||||
* try to return the title. If the title is not given, it will use the link
|
||||
* of the entry.
|
||||
*/
|
||||
public String getIdentifyingValue() {
|
||||
if (itemIdentifier != null) {
|
||||
return itemIdentifier;
|
||||
} else if (title != null) {
|
||||
return title;
|
||||
} else {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
if (description == null && cachedDescription != null) {
|
||||
return cachedDescription.get();
|
||||
}
|
||||
return description;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public Date getPubDate() {
|
||||
return pubDate;
|
||||
}
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public void setPubDate(Date pubDate) {
|
||||
this.pubDate = pubDate;
|
||||
}
|
||||
public Date getPubDate() {
|
||||
if (pubDate != null) {
|
||||
return (Date) pubDate.clone();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public FeedMedia getMedia() {
|
||||
return media;
|
||||
}
|
||||
public void setPubDate(Date pubDate) {
|
||||
if (pubDate != null) {
|
||||
this.pubDate = (Date) pubDate.clone();
|
||||
} else {
|
||||
this.pubDate = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMedia(FeedMedia media) {
|
||||
this.media = media;
|
||||
}
|
||||
public FeedMedia getMedia() {
|
||||
return media;
|
||||
}
|
||||
|
||||
public Feed getFeed() {
|
||||
return feed;
|
||||
}
|
||||
/**
|
||||
* Sets the media object of this FeedItem. If the given
|
||||
* FeedMedia object is not null, it's 'item'-attribute value
|
||||
* will also be set to this item.
|
||||
* */
|
||||
public void setMedia(FeedMedia media) {
|
||||
this.media = media;
|
||||
if (media != null && media.getItem() != this) {
|
||||
media.setItem(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFeed(Feed feed) {
|
||||
this.feed = feed;
|
||||
}
|
||||
public Feed getFeed() {
|
||||
return feed;
|
||||
}
|
||||
|
||||
public boolean isRead() {
|
||||
return read || isInProgress();
|
||||
}
|
||||
public void setFeed(Feed feed) {
|
||||
this.feed = feed;
|
||||
}
|
||||
|
||||
public void setRead(boolean read) {
|
||||
this.read = read;
|
||||
}
|
||||
public boolean isRead() {
|
||||
return read || isInProgress();
|
||||
}
|
||||
|
||||
private boolean isInProgress() {
|
||||
return (media != null && media.isInProgress());
|
||||
}
|
||||
public void setRead(boolean read) {
|
||||
this.read = read;
|
||||
}
|
||||
|
||||
public String getContentEncoded() {
|
||||
if (contentEncoded == null && cachedContentEncoded != null) {
|
||||
return cachedContentEncoded.get();
|
||||
private boolean isInProgress() {
|
||||
return (media != null && media.isInProgress());
|
||||
}
|
||||
|
||||
}
|
||||
return contentEncoded;
|
||||
}
|
||||
public String getContentEncoded() {
|
||||
return contentEncoded;
|
||||
}
|
||||
|
||||
public void setContentEncoded(String contentEncoded) {
|
||||
this.contentEncoded = contentEncoded;
|
||||
}
|
||||
public void setContentEncoded(String contentEncoded) {
|
||||
this.contentEncoded = contentEncoded;
|
||||
}
|
||||
|
||||
public String getPaymentLink() {
|
||||
return paymentLink;
|
||||
}
|
||||
public String getPaymentLink() {
|
||||
return paymentLink;
|
||||
}
|
||||
|
||||
public void setPaymentLink(String paymentLink) {
|
||||
this.paymentLink = paymentLink;
|
||||
}
|
||||
public void setPaymentLink(String paymentLink) {
|
||||
this.paymentLink = paymentLink;
|
||||
}
|
||||
|
||||
public List<Chapter> getChapters() {
|
||||
return chapters;
|
||||
}
|
||||
public List<Chapter> getChapters() {
|
||||
return chapters;
|
||||
}
|
||||
|
||||
public void setChapters(List<Chapter> chapters) {
|
||||
this.chapters = chapters;
|
||||
}
|
||||
public void setChapters(List<Chapter> chapters) {
|
||||
this.chapters = chapters;
|
||||
}
|
||||
|
||||
public String getItemIdentifier() {
|
||||
return itemIdentifier;
|
||||
}
|
||||
public String getItemIdentifier() {
|
||||
return itemIdentifier;
|
||||
}
|
||||
|
||||
public void setItemIdentifier(String itemIdentifier) {
|
||||
this.itemIdentifier = itemIdentifier;
|
||||
}
|
||||
public void setItemIdentifier(String itemIdentifier) {
|
||||
this.itemIdentifier = itemIdentifier;
|
||||
}
|
||||
|
||||
public boolean hasMedia() {
|
||||
return media != null;
|
||||
}
|
||||
public boolean hasMedia() {
|
||||
return media != null;
|
||||
}
|
||||
|
||||
private boolean isPlaying() {
|
||||
if (media != null) {
|
||||
return media.isPlaying();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean isPlaying() {
|
||||
if (media != null) {
|
||||
return media.isPlaying();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setCachedDescription(String d) {
|
||||
cachedDescription = new SoftReference<String>(d);
|
||||
}
|
||||
@Override
|
||||
public Callable<String> loadShownotes() {
|
||||
return new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
|
||||
public void setCachedContentEncoded(String c) {
|
||||
cachedContentEncoded = new SoftReference<String>(c);
|
||||
}
|
||||
if (contentEncoded == null || description == null) {
|
||||
DBReader.loadExtraInformationOfFeedItem(PodcastApp.getInstance(), FeedItem.this);
|
||||
|
||||
public enum State {
|
||||
NEW, IN_PROGRESS, READ, PLAYING
|
||||
}
|
||||
}
|
||||
return (contentEncoded != null) ? contentEncoded : description;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
if (hasMedia()) {
|
||||
if (isPlaying()) {
|
||||
return State.PLAYING;
|
||||
}
|
||||
if (isInProgress()) {
|
||||
return State.IN_PROGRESS;
|
||||
}
|
||||
}
|
||||
return (isRead() ? State.READ : State.NEW);
|
||||
}
|
||||
public enum State {
|
||||
NEW, IN_PROGRESS, READ, PLAYING
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream openImageInputStream() {
|
||||
InputStream out = null;
|
||||
if (hasMedia()) {
|
||||
out = media.openImageInputStream();
|
||||
}
|
||||
if (out == null && feed.getImage() != null) {
|
||||
out = feed.getImage().openImageInputStream();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
public State getState() {
|
||||
if (hasMedia()) {
|
||||
if (isPlaying()) {
|
||||
return State.PLAYING;
|
||||
}
|
||||
if (isInProgress()) {
|
||||
return State.IN_PROGRESS;
|
||||
}
|
||||
}
|
||||
return (isRead() ? State.READ : State.NEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream reopenImageInputStream(InputStream input) {
|
||||
InputStream out = null;
|
||||
if (hasMedia()) {
|
||||
out = media.reopenImageInputStream(input);
|
||||
}
|
||||
if (out == null && feed.getImage() != null) {
|
||||
out = feed.getImage().reopenImageInputStream(input);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@Override
|
||||
public InputStream openImageInputStream() {
|
||||
InputStream out = null;
|
||||
if (hasMedia()) {
|
||||
out = media.openImageInputStream();
|
||||
}
|
||||
if (out == null && feed.getImage() != null) {
|
||||
out = feed.getImage().openImageInputStream();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream reopenImageInputStream(InputStream input) {
|
||||
InputStream out = null;
|
||||
if (hasMedia()) {
|
||||
out = media.reopenImageInputStream(input);
|
||||
}
|
||||
if (out == null && feed.getImage() != null) {
|
||||
out = feed.getImage().reopenImageInputStream(input);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageLoaderCacheKey() {
|
||||
String out = null;
|
||||
if (hasMedia()) {
|
||||
out = media.getImageLoaderCacheKey();
|
||||
}
|
||||
if (out == null && feed.getImage() != null) {
|
||||
out = feed.getImage().getImageLoaderCacheKey();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public long getFeedId() {
|
||||
return feedId;
|
||||
}
|
||||
|
||||
public void setFeedId(long feedId) {
|
||||
this.feedId = feedId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageLoaderCacheKey() {
|
||||
String out = null;
|
||||
if (hasMedia()) {
|
||||
out = media.getImageLoaderCacheKey();
|
||||
}
|
||||
if (out == null && feed.getImage() != null) {
|
||||
out = feed.getImage().getImageLoaderCacheKey();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@ import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
@ -11,358 +12,393 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.preferences.PlaybackPreferences;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DBWriter;
|
||||
import de.danoeh.antennapod.util.ChapterUtils;
|
||||
import de.danoeh.antennapod.util.playback.Playable;
|
||||
|
||||
public class FeedMedia extends FeedFile implements Playable {
|
||||
|
||||
public static final int FEEDFILETYPE_FEEDMEDIA = 2;
|
||||
public static final int PLAYABLE_TYPE_FEEDMEDIA = 1;
|
||||
public static final int FEEDFILETYPE_FEEDMEDIA = 2;
|
||||
public static final int PLAYABLE_TYPE_FEEDMEDIA = 1;
|
||||
|
||||
public static final String PREF_MEDIA_ID = "FeedMedia.PrefMediaId";
|
||||
public static final String PREF_FEED_ID = "FeedMedia.PrefFeedId";
|
||||
public static final String PREF_MEDIA_ID = "FeedMedia.PrefMediaId";
|
||||
public static final String PREF_FEED_ID = "FeedMedia.PrefFeedId";
|
||||
|
||||
private int duration;
|
||||
private int position; // Current position in file
|
||||
private long size; // File size in Byte
|
||||
private String mime_type;
|
||||
private FeedItem item;
|
||||
private Date playbackCompletionDate;
|
||||
private int duration;
|
||||
private int position; // Current position in file
|
||||
private long size; // File size in Byte
|
||||
private String mime_type;
|
||||
private volatile FeedItem item;
|
||||
private Date playbackCompletionDate;
|
||||
|
||||
public FeedMedia(FeedItem i, String download_url, long size,
|
||||
String mime_type) {
|
||||
super(null, download_url, false);
|
||||
this.item = i;
|
||||
this.size = size;
|
||||
this.mime_type = mime_type;
|
||||
}
|
||||
/* Used for loading item when restoring from parcel. */
|
||||
private long itemID;
|
||||
|
||||
public FeedMedia(long id, FeedItem item, int duration, int position,
|
||||
long size, String mime_type, String file_url, String download_url,
|
||||
boolean downloaded, Date playbackCompletionDate) {
|
||||
super(file_url, download_url, downloaded);
|
||||
this.id = id;
|
||||
this.item = item;
|
||||
this.duration = duration;
|
||||
this.position = position;
|
||||
this.size = size;
|
||||
this.mime_type = mime_type;
|
||||
this.playbackCompletionDate = playbackCompletionDate;
|
||||
}
|
||||
public FeedMedia(FeedItem i, String download_url, long size,
|
||||
String mime_type) {
|
||||
super(null, download_url, false);
|
||||
this.item = i;
|
||||
this.size = size;
|
||||
this.mime_type = mime_type;
|
||||
}
|
||||
|
||||
public FeedMedia(long id, FeedItem item) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.item = item;
|
||||
}
|
||||
public FeedMedia(long id, FeedItem item, int duration, int position,
|
||||
long size, String mime_type, String file_url, String download_url,
|
||||
boolean downloaded, Date playbackCompletionDate) {
|
||||
super(file_url, download_url, downloaded);
|
||||
this.id = id;
|
||||
this.item = item;
|
||||
this.duration = duration;
|
||||
this.position = position;
|
||||
this.size = size;
|
||||
this.mime_type = mime_type;
|
||||
this.playbackCompletionDate = playbackCompletionDate == null
|
||||
? null : (Date) playbackCompletionDate.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHumanReadableIdentifier() {
|
||||
if (item != null && item.getTitle() != null) {
|
||||
return item.getTitle();
|
||||
} else {
|
||||
return download_url;
|
||||
}
|
||||
}
|
||||
public FeedMedia(long id, FeedItem item) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/** Uses mimetype to determine the type of media. */
|
||||
public MediaType getMediaType() {
|
||||
if (mime_type == null || mime_type.isEmpty()) {
|
||||
return MediaType.UNKNOWN;
|
||||
} else {
|
||||
if (mime_type.startsWith("audio")) {
|
||||
return MediaType.AUDIO;
|
||||
} else if (mime_type.startsWith("video")) {
|
||||
return MediaType.VIDEO;
|
||||
} else if (mime_type.equals("application/ogg")) {
|
||||
return MediaType.AUDIO;
|
||||
}
|
||||
}
|
||||
return MediaType.UNKNOWN;
|
||||
}
|
||||
@Override
|
||||
public String getHumanReadableIdentifier() {
|
||||
if (item != null && item.getTitle() != null) {
|
||||
return item.getTitle();
|
||||
} else {
|
||||
return download_url;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFromOther(FeedMedia other) {
|
||||
super.updateFromOther(other);
|
||||
if (other.size > 0) {
|
||||
size = other.size;
|
||||
}
|
||||
if (other.mime_type != null) {
|
||||
mime_type = other.mime_type;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Uses mimetype to determine the type of media.
|
||||
*/
|
||||
public MediaType getMediaType() {
|
||||
if (mime_type == null || mime_type.isEmpty()) {
|
||||
return MediaType.UNKNOWN;
|
||||
} else {
|
||||
if (mime_type.startsWith("audio")) {
|
||||
return MediaType.AUDIO;
|
||||
} else if (mime_type.startsWith("video")) {
|
||||
return MediaType.VIDEO;
|
||||
} else if (mime_type.equals("application/ogg")) {
|
||||
return MediaType.AUDIO;
|
||||
}
|
||||
}
|
||||
return MediaType.UNKNOWN;
|
||||
}
|
||||
|
||||
public boolean compareWithOther(FeedMedia other) {
|
||||
if (super.compareWithOther(other)) {
|
||||
return true;
|
||||
}
|
||||
if (other.mime_type != null) {
|
||||
if (mime_type == null || !mime_type.equals(other.mime_type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.size > 0 && other.size != size) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void updateFromOther(FeedMedia other) {
|
||||
super.updateFromOther(other);
|
||||
if (other.size > 0) {
|
||||
size = other.size;
|
||||
}
|
||||
if (other.mime_type != null) {
|
||||
mime_type = other.mime_type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads playback preferences to determine whether this FeedMedia object is
|
||||
* currently being played.
|
||||
*/
|
||||
public boolean isPlaying() {
|
||||
return PlaybackPreferences.getCurrentlyPlayingMedia() == FeedMedia.PLAYABLE_TYPE_FEEDMEDIA
|
||||
&& PlaybackPreferences.getCurrentlyPlayingFeedMediaId() == id;
|
||||
}
|
||||
public boolean compareWithOther(FeedMedia other) {
|
||||
if (super.compareWithOther(other)) {
|
||||
return true;
|
||||
}
|
||||
if (other.mime_type != null) {
|
||||
if (mime_type == null || !mime_type.equals(other.mime_type)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (other.size > 0 && other.size != size) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTypeAsInt() {
|
||||
return FEEDFILETYPE_FEEDMEDIA;
|
||||
}
|
||||
/**
|
||||
* Reads playback preferences to determine whether this FeedMedia object is
|
||||
* currently being played.
|
||||
*/
|
||||
public boolean isPlaying() {
|
||||
return PlaybackPreferences.getCurrentlyPlayingMedia() == FeedMedia.PLAYABLE_TYPE_FEEDMEDIA
|
||||
&& PlaybackPreferences.getCurrentlyPlayingFeedMediaId() == id;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
@Override
|
||||
public int getTypeAsInt() {
|
||||
return FEEDFILETYPE_FEEDMEDIA;
|
||||
}
|
||||
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getMime_type() {
|
||||
return mime_type;
|
||||
}
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setMime_type(String mime_type) {
|
||||
this.mime_type = mime_type;
|
||||
}
|
||||
public String getMime_type() {
|
||||
return mime_type;
|
||||
}
|
||||
|
||||
public FeedItem getItem() {
|
||||
return item;
|
||||
}
|
||||
public void setMime_type(String mime_type) {
|
||||
this.mime_type = mime_type;
|
||||
}
|
||||
|
||||
public void setItem(FeedItem item) {
|
||||
this.item = item;
|
||||
}
|
||||
public FeedItem getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public Date getPlaybackCompletionDate() {
|
||||
return playbackCompletionDate;
|
||||
}
|
||||
/**
|
||||
* Sets the item object of this FeedMedia. If the given
|
||||
* FeedItem object is not null, it's 'media'-attribute value
|
||||
* will also be set to this media object.
|
||||
* */
|
||||
public void setItem(FeedItem item) {
|
||||
this.item = item;
|
||||
if (item != null && item.getMedia() != this) {
|
||||
item.setMedia(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlaybackCompletionDate(Date playbackCompletionDate) {
|
||||
this.playbackCompletionDate = playbackCompletionDate;
|
||||
}
|
||||
public Date getPlaybackCompletionDate() {
|
||||
return playbackCompletionDate == null
|
||||
? null : (Date) playbackCompletionDate.clone(); }
|
||||
|
||||
public boolean isInProgress() {
|
||||
return (this.position > 0);
|
||||
}
|
||||
public void setPlaybackCompletionDate(Date playbackCompletionDate) {
|
||||
this.playbackCompletionDate = playbackCompletionDate == null
|
||||
? null : (Date) playbackCompletionDate.clone();
|
||||
}
|
||||
|
||||
public FeedImage getImage() {
|
||||
if (item != null && item.getFeed() != null) {
|
||||
return item.getFeed().getImage();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public boolean isInProgress() {
|
||||
return (this.position > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
public FeedImage getImage() {
|
||||
if (item != null && item.getFeed() != null) {
|
||||
return item.getFeed().getImage();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(item.getFeed().getId());
|
||||
dest.writeLong(item.getId());
|
||||
}
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPreferences(Editor prefEditor) {
|
||||
prefEditor.putLong(PREF_FEED_ID, item.getFeed().getId());
|
||||
prefEditor.putLong(PREF_MEDIA_ID, id);
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(id);
|
||||
dest.writeLong(item.getId());
|
||||
|
||||
@Override
|
||||
public void loadMetadata() throws PlayableException {
|
||||
}
|
||||
dest.writeInt(duration);
|
||||
dest.writeInt(position);
|
||||
dest.writeLong(size);
|
||||
dest.writeString(mime_type);
|
||||
dest.writeString(file_url);
|
||||
dest.writeString(download_url);
|
||||
dest.writeByte((byte) ((downloaded) ? 1 : 0));
|
||||
dest.writeLong((playbackCompletionDate != null) ? playbackCompletionDate.getTime() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadChapterMarks() {
|
||||
if (getChapters() == null && !localFileAvailable()) {
|
||||
ChapterUtils.loadChaptersFromStreamUrl(this);
|
||||
if (getChapters() != null) {
|
||||
FeedManager.getInstance().setFeedItem(PodcastApp.getInstance(),
|
||||
item);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writeToPreferences(Editor prefEditor) {
|
||||
prefEditor.putLong(PREF_FEED_ID, item.getFeed().getId());
|
||||
prefEditor.putLong(PREF_MEDIA_ID, id);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void loadMetadata() throws PlayableException {
|
||||
if (item == null && itemID != 0) {
|
||||
item = DBReader.getFeedItem(PodcastApp.getInstance(), itemID);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEpisodeTitle() {
|
||||
if (getItem().getTitle() != null) {
|
||||
return getItem().getTitle();
|
||||
} else {
|
||||
return getItem().getIdentifyingValue();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void loadChapterMarks() {
|
||||
if (getChapters() == null && !localFileAvailable()) {
|
||||
ChapterUtils.loadChaptersFromStreamUrl(this);
|
||||
if (getChapters() != null && item != null) {
|
||||
DBWriter.setFeedItem(PodcastApp.getInstance(),
|
||||
item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Chapter> getChapters() {
|
||||
return getItem().getChapters();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebsiteLink() {
|
||||
return getItem().getLink();
|
||||
}
|
||||
@Override
|
||||
public String getEpisodeTitle() {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
if (getItem().getTitle() != null) {
|
||||
return getItem().getTitle();
|
||||
} else {
|
||||
return getItem().getIdentifyingValue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeedTitle() {
|
||||
return getItem().getFeed().getTitle();
|
||||
}
|
||||
@Override
|
||||
public List<Chapter> getChapters() {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
return getItem().getChapters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getIdentifier() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public String getWebsiteLink() {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
return getItem().getLink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalMediaUrl() {
|
||||
return file_url;
|
||||
}
|
||||
@Override
|
||||
public String getFeedTitle() {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
return getItem().getFeed().getTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreamUrl() {
|
||||
return download_url;
|
||||
}
|
||||
@Override
|
||||
public Object getIdentifier() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean localFileAvailable() {
|
||||
return isDownloaded() && file_url != null;
|
||||
}
|
||||
@Override
|
||||
public String getLocalMediaUrl() {
|
||||
return file_url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean streamAvailable() {
|
||||
return download_url != null;
|
||||
}
|
||||
@Override
|
||||
public String getStreamUrl() {
|
||||
return download_url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveCurrentPosition(SharedPreferences pref, int newPosition) {
|
||||
position = newPosition;
|
||||
FeedManager.getInstance().setFeedMedia(PodcastApp.getInstance(), this);
|
||||
}
|
||||
@Override
|
||||
public String getPaymentLink() {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
return getItem().getPaymentLink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStart() {
|
||||
}
|
||||
@Override
|
||||
public boolean localFileAvailable() {
|
||||
return isDownloaded() && file_url != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackCompleted() {
|
||||
@Override
|
||||
public boolean streamAvailable() {
|
||||
return download_url != null;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void saveCurrentPosition(SharedPreferences pref, int newPosition) {
|
||||
position = newPosition;
|
||||
DBWriter.setFeedMediaPlaybackInformation(PodcastApp.getInstance(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayableType() {
|
||||
return PLAYABLE_TYPE_FEEDMEDIA;
|
||||
}
|
||||
@Override
|
||||
public void onPlaybackStart() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChapters(List<Chapter> chapters) {
|
||||
getItem().setChapters(chapters);
|
||||
}
|
||||
@Override
|
||||
public void onPlaybackCompleted() {
|
||||
|
||||
@Override
|
||||
public String getPaymentLink() {
|
||||
return getItem().getPaymentLink();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadShownotes(final ShownoteLoaderCallback callback) {
|
||||
String contentEncoded = item.getContentEncoded();
|
||||
if (item.getDescription() == null || contentEncoded == null) {
|
||||
FeedManager.getInstance().loadExtraInformationOfItem(
|
||||
PodcastApp.getInstance(), item,
|
||||
new FeedManager.TaskCallback<String[]>() {
|
||||
@Override
|
||||
public void onCompletion(String[] result) {
|
||||
if (result[1] != null) {
|
||||
callback.onShownotesLoaded(result[1]);
|
||||
} else {
|
||||
callback.onShownotesLoaded(result[0]);
|
||||
@Override
|
||||
public int getPlayableType() {
|
||||
return PLAYABLE_TYPE_FEEDMEDIA;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setChapters(List<Chapter> chapters) {
|
||||
getItem().setChapters(chapters);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback.onShownotesLoaded(contentEncoded);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Callable<String> loadShownotes() {
|
||||
return new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
if (item == null) {
|
||||
item = DBReader.getFeedItem(PodcastApp.getInstance(), itemID);
|
||||
}
|
||||
if (item.getContentEncoded() == null || item.getDescription() == null) {
|
||||
DBReader.loadExtraInformationOfFeedItem(PodcastApp.getInstance(), item);
|
||||
|
||||
public static final Parcelable.Creator<FeedMedia> CREATOR = new Parcelable.Creator<FeedMedia>() {
|
||||
public FeedMedia createFromParcel(Parcel in) {
|
||||
long feedId = in.readLong();
|
||||
long itemId = in.readLong();
|
||||
FeedItem item = FeedManager.getInstance().getFeedItem(itemId,
|
||||
feedId);
|
||||
if (item != null) {
|
||||
return item.getMedia();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (item.getContentEncoded() != null) ? item.getContentEncoded() : item.getDescription();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public FeedMedia[] newArray(int size) {
|
||||
return new FeedMedia[size];
|
||||
}
|
||||
};
|
||||
public static final Parcelable.Creator<FeedMedia> CREATOR = new Parcelable.Creator<FeedMedia>() {
|
||||
public FeedMedia createFromParcel(Parcel in) {
|
||||
final long id = in.readLong();
|
||||
final long itemID = in.readLong();
|
||||
FeedMedia result = new FeedMedia(id, null, in.readInt(), in.readInt(), in.readLong(), in.readString(), in.readString(),
|
||||
in.readString(), in.readByte() != 0, new Date(in.readLong()));
|
||||
result.itemID = itemID;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream openImageInputStream() {
|
||||
InputStream out = new Playable.DefaultPlayableImageLoader(this)
|
||||
.openImageInputStream();
|
||||
if (out == null) {
|
||||
if (item.getFeed().getImage() != null) {
|
||||
return item.getFeed().getImage().openImageInputStream();
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
public FeedMedia[] newArray(int size) {
|
||||
return new FeedMedia[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String getImageLoaderCacheKey() {
|
||||
String out = new Playable.DefaultPlayableImageLoader(this)
|
||||
.getImageLoaderCacheKey();
|
||||
if (out == null) {
|
||||
if (item.getFeed().getImage() != null) {
|
||||
return item.getFeed().getImage().getImageLoaderCacheKey();
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@Override
|
||||
public InputStream openImageInputStream() {
|
||||
InputStream out = new Playable.DefaultPlayableImageLoader(this)
|
||||
.openImageInputStream();
|
||||
if (out == null) {
|
||||
if (item.getFeed().getImage() != null) {
|
||||
return item.getFeed().getImage().openImageInputStream();
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream reopenImageInputStream(InputStream input) {
|
||||
if (input instanceof FileInputStream) {
|
||||
return item.getFeed().getImage().reopenImageInputStream(input);
|
||||
} else {
|
||||
return new Playable.DefaultPlayableImageLoader(this)
|
||||
.reopenImageInputStream(input);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getImageLoaderCacheKey() {
|
||||
String out = new Playable.DefaultPlayableImageLoader(this)
|
||||
.getImageLoaderCacheKey();
|
||||
if (out == null) {
|
||||
if (item.getFeed().getImage() != null) {
|
||||
return item.getFeed().getImage().getImageLoaderCacheKey();
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream reopenImageInputStream(InputStream input) {
|
||||
if (input instanceof FileInputStream) {
|
||||
return item.getFeed().getImage().reopenImageInputStream(input);
|
||||
} else {
|
||||
return new Playable.DefaultPlayableImageLoader(this)
|
||||
.reopenImageInputStream(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,253 +0,0 @@
|
||||
package de.danoeh.antennapod.feed;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.storage.PodDBAdapter;
|
||||
import de.danoeh.antennapod.util.comparator.SearchResultValueComparator;
|
||||
|
||||
/** Performs search on Feeds and FeedItems */
|
||||
public class FeedSearcher {
|
||||
private static final String TAG = "FeedSearcher";
|
||||
|
||||
// Search result values
|
||||
private static final int VALUE_FEED_TITLE = 3;
|
||||
private static final int VALUE_ITEM_TITLE = 2;
|
||||
private static final int VALUE_ITEM_CHAPTER = 1;
|
||||
private static final int VALUE_ITEM_DESCRIPTION = 0;
|
||||
private static final int VALUE_WORD_MATCH = 4;
|
||||
|
||||
/** Performs a search in all feeds or one specific feed. */
|
||||
public static ArrayList<SearchResult> performSearch(final Context context,
|
||||
final String query, final Feed selectedFeed) {
|
||||
final String lcQuery = query.toLowerCase();
|
||||
final ArrayList<SearchResult> result = new ArrayList<SearchResult>();
|
||||
if (selectedFeed == null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Performing global search");
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Searching Feed titles");
|
||||
searchFeedtitles(lcQuery, result);
|
||||
} else if (AppConfig.DEBUG) {
|
||||
Log.d(TAG, "Performing search on specific feed");
|
||||
}
|
||||
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Searching Feeditem titles");
|
||||
searchFeedItemTitles(lcQuery, result, selectedFeed);
|
||||
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Searching item-chaptertitles");
|
||||
searchFeedItemChapters(lcQuery, result, selectedFeed);
|
||||
|
||||
final FeedManager manager = FeedManager.getInstance();
|
||||
Looper.prepare();
|
||||
manager.searchFeedItemDescription(context, selectedFeed, lcQuery,
|
||||
new FeedManager.QueryTaskCallback() {
|
||||
|
||||
@Override
|
||||
public void handleResult(Cursor cResult) {
|
||||
searchFeedItemContentEncodedCursor(lcQuery, result,
|
||||
selectedFeed, cResult);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompletion() {
|
||||
manager.searchFeedItemContentEncoded(context,
|
||||
selectedFeed, lcQuery,
|
||||
new FeedManager.QueryTaskCallback() {
|
||||
|
||||
@Override
|
||||
public void handleResult(Cursor cResult) {
|
||||
searchFeedItemDescriptionCursor(
|
||||
lcQuery, result, selectedFeed,
|
||||
cResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompletion() {
|
||||
Looper.myLooper().quit();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Looper.loop();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Sorting results");
|
||||
Collections.sort(result, new SearchResultValueComparator());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void searchFeedtitles(String query,
|
||||
ArrayList<SearchResult> destination) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
for (Feed feed : manager.getFeeds()) {
|
||||
SearchResult result = createSearchResult(feed, query, feed
|
||||
.getTitle().toLowerCase(), VALUE_FEED_TITLE);
|
||||
if (result != null) {
|
||||
destination.add(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void searchFeedItemTitles(String query,
|
||||
ArrayList<SearchResult> destination, Feed selectedFeed) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
if (selectedFeed == null) {
|
||||
for (Feed feed : manager.getFeeds()) {
|
||||
searchFeedItemTitlesSingleFeed(query, destination, feed);
|
||||
}
|
||||
} else {
|
||||
searchFeedItemTitlesSingleFeed(query, destination, selectedFeed);
|
||||
}
|
||||
}
|
||||
|
||||
private static void searchFeedItemTitlesSingleFeed(String query,
|
||||
ArrayList<SearchResult> destination, Feed feed) {
|
||||
for (FeedItem item : feed.getItems()) {
|
||||
SearchResult result = createSearchResult(item, query, item
|
||||
.getTitle().toLowerCase(), VALUE_ITEM_TITLE);
|
||||
if (result != null) {
|
||||
result.setSubtitle(PodcastApp.getInstance().getString(
|
||||
R.string.found_in_title_label));
|
||||
destination.add(result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void searchFeedItemChapters(String query,
|
||||
ArrayList<SearchResult> destination, Feed selectedFeed) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
if (selectedFeed == null) {
|
||||
for (Feed feed : manager.getFeeds()) {
|
||||
searchFeedItemChaptersSingleFeed(query, destination, feed);
|
||||
}
|
||||
} else {
|
||||
searchFeedItemChaptersSingleFeed(query, destination, selectedFeed);
|
||||
}
|
||||
}
|
||||
|
||||
private static void searchFeedItemChaptersSingleFeed(String query,
|
||||
ArrayList<SearchResult> destination, Feed feed) {
|
||||
for (FeedItem item : feed.getItems()) {
|
||||
if (item.getChapters() != null) {
|
||||
for (Chapter sc : item.getChapters()) {
|
||||
SearchResult result = createSearchResult(item, query, sc
|
||||
.getTitle().toLowerCase(), VALUE_ITEM_CHAPTER);
|
||||
if (result != null) {
|
||||
result.setSubtitle(PodcastApp.getInstance().getString(
|
||||
R.string.found_in_chapters_label));
|
||||
destination.add(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void searchFeedItemDescriptionCursor(String query,
|
||||
ArrayList<SearchResult> destination, Feed feed, Cursor cursor) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
final long itemId = cursor
|
||||
.getLong(PodDBAdapter.IDX_FI_EXTRA_ID);
|
||||
String content = cursor
|
||||
.getString(PodDBAdapter.IDX_FI_EXTRA_DESCRIPTION);
|
||||
if (content != null) {
|
||||
content = content.toLowerCase();
|
||||
final long feedId = cursor
|
||||
.getLong(PodDBAdapter.IDX_FI_EXTRA_FEED);
|
||||
FeedItem item = null;
|
||||
if (feed == null) {
|
||||
item = manager.getFeedItem(itemId, feedId);
|
||||
} else {
|
||||
item = manager.getFeedItem(itemId, feed);
|
||||
}
|
||||
if (item != null) {
|
||||
SearchResult searchResult = createSearchResult(item,
|
||||
query, content, VALUE_ITEM_DESCRIPTION);
|
||||
if (searchResult != null) {
|
||||
searchResult.setSubtitle(PodcastApp.getInstance()
|
||||
.getString(
|
||||
R.string.found_in_shownotes_label));
|
||||
destination.add(searchResult);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
}
|
||||
|
||||
private static void searchFeedItemContentEncodedCursor(String query,
|
||||
ArrayList<SearchResult> destination, Feed feed, Cursor cursor) {
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
final long itemId = cursor
|
||||
.getLong(PodDBAdapter.IDX_FI_EXTRA_ID);
|
||||
String content = cursor
|
||||
.getString(PodDBAdapter.IDX_FI_EXTRA_CONTENT_ENCODED);
|
||||
if (content != null) {
|
||||
content = content.toLowerCase();
|
||||
|
||||
final long feedId = cursor
|
||||
.getLong(PodDBAdapter.IDX_FI_EXTRA_FEED);
|
||||
FeedItem item = null;
|
||||
if (feed == null) {
|
||||
item = manager.getFeedItem(itemId, feedId);
|
||||
} else {
|
||||
item = manager.getFeedItem(itemId, feed);
|
||||
}
|
||||
if (item != null) {
|
||||
SearchResult searchResult = createSearchResult(item,
|
||||
query, content, VALUE_ITEM_DESCRIPTION);
|
||||
if (searchResult != null) {
|
||||
searchResult.setSubtitle(PodcastApp.getInstance()
|
||||
.getString(
|
||||
R.string.found_in_shownotes_label));
|
||||
destination.add(searchResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
}
|
||||
|
||||
private static SearchResult createSearchResult(FeedComponent component,
|
||||
String query, String text, int baseValue) {
|
||||
int bonus = 0;
|
||||
boolean found = false;
|
||||
// try word search
|
||||
Pattern word = Pattern.compile("\b" + query + "\b");
|
||||
Matcher matcher = word.matcher(text);
|
||||
found = matcher.find();
|
||||
if (found) {
|
||||
bonus = VALUE_WORD_MATCH;
|
||||
} else {
|
||||
// search for other occurence
|
||||
found = text.contains(query);
|
||||
}
|
||||
|
||||
if (found) {
|
||||
return new SearchResult(component, baseValue + bonus);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -7,10 +7,11 @@ public class SearchResult {
|
||||
/** Higher value means more importance */
|
||||
private int value;
|
||||
|
||||
public SearchResult(FeedComponent component, int value) {
|
||||
public SearchResult(FeedComponent component, int value, String subtitle) {
|
||||
super();
|
||||
this.component = component;
|
||||
this.value = value;
|
||||
this.subtitle = subtitle;
|
||||
}
|
||||
|
||||
public FeedComponent getComponent() {
|
||||
|
@ -1,14 +1,13 @@
|
||||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment;
|
||||
@ -16,7 +15,7 @@ import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
import de.danoeh.antennapod.util.playback.Playable;
|
||||
|
||||
/** Displays the cover and the title of a FeedItem. */
|
||||
public class CoverFragment extends SherlockFragment implements
|
||||
public class CoverFragment extends Fragment implements
|
||||
AudioplayerContentFragment {
|
||||
private static final String TAG = "CoverFragment";
|
||||
private static final String ARG_PLAYABLE = "arg.playable";
|
||||
|
@ -1,20 +1,16 @@
|
||||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.*;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.OnChildClickListener;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.ItemviewActivity;
|
||||
@ -24,11 +20,16 @@ import de.danoeh.antennapod.adapter.ExternalEpisodesListAdapter;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DBTasks;
|
||||
import de.danoeh.antennapod.storage.DBWriter;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.util.QueueAccess;
|
||||
import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler;
|
||||
|
||||
public class EpisodesFragment extends SherlockFragment {
|
||||
import java.util.List;
|
||||
|
||||
public class EpisodesFragment extends Fragment {
|
||||
private static final String TAG = "EpisodesFragment";
|
||||
|
||||
private static final int EVENTS = EventDistributor.QUEUE_UPDATE
|
||||
@ -40,6 +41,9 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
private ExpandableListView listView;
|
||||
private ExternalEpisodesListAdapter adapter;
|
||||
|
||||
private List<FeedItem> queue;
|
||||
private List<FeedItem> unreadItems;
|
||||
|
||||
protected FeedItem selectedItem = null;
|
||||
protected long selectedGroupId = -1;
|
||||
protected boolean contextMenuClosed = true;
|
||||
@ -92,7 +96,7 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
adapter = new ExternalEpisodesListAdapter(getActivity(),
|
||||
adapterCallback, groupActionCallback);
|
||||
adapterCallback, groupActionCallback, itemAccess);
|
||||
listView.setAdapter(adapter);
|
||||
listView.expandGroup(ExternalEpisodesListAdapter.GROUP_POS_QUEUE);
|
||||
listView.expandGroup(ExternalEpisodesListAdapter.GROUP_POS_UNREAD);
|
||||
@ -117,9 +121,73 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
loadData();
|
||||
registerForContextMenu(listView);
|
||||
|
||||
}
|
||||
|
||||
ExternalEpisodesListAdapter.ItemAccess itemAccess = new ExternalEpisodesListAdapter.ItemAccess() {
|
||||
|
||||
@Override
|
||||
public int getQueueSize() {
|
||||
return (queue != null) ? queue.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUnreadItemsSize() {
|
||||
return (unreadItems != null) ? unreadItems.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedItem getQueueItemAt(int position) {
|
||||
return (queue != null) ? queue.get(position) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedItem getUnreadItemAt(int position) {
|
||||
return (unreadItems != null) ? unreadItems.get(position) : null;
|
||||
}
|
||||
};
|
||||
|
||||
private void loadData() {
|
||||
AsyncTask<Void, Void, Void> loadTask = new AsyncTask<Void, Void, Void>() {
|
||||
private volatile List<FeedItem> queueRef;
|
||||
private volatile List<FeedItem> unreadItemsRef;
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Starting to load list data");
|
||||
Context context = EpisodesFragment.this.getActivity();
|
||||
if (context != null) {
|
||||
queueRef = DBReader.getQueue(context);
|
||||
unreadItemsRef = DBReader.getUnreadItemsList(context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
if (queueRef != null && unreadItemsRef != null) {
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Done loading list data");
|
||||
queue = queueRef;
|
||||
unreadItems = unreadItemsRef;
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
if (queueRef == null) {
|
||||
Log.e(TAG, "Could not load queue");
|
||||
}
|
||||
if (unreadItemsRef == null) {
|
||||
Log.e(TAG, "Could not load unread items");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute();
|
||||
}
|
||||
|
||||
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
|
||||
|
||||
@Override
|
||||
@ -127,7 +195,7 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
if ((EVENTS & arg) != 0) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Received contentUpdate Intent.");
|
||||
adapter.notifyDataSetChanged();
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -146,13 +214,13 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
|
||||
menu.setHeaderTitle(selectedItem.getTitle());
|
||||
FeedItemMenuHandler.onPrepareMenu(
|
||||
new FeedItemMenuHandler.MenuInterface() {
|
||||
new FeedItemMenuHandler.MenuInterface() {
|
||||
|
||||
@Override
|
||||
public void setItemVisibility(int id, boolean visible) {
|
||||
menu.findItem(id).setVisible(visible);
|
||||
}
|
||||
}, selectedItem, false);
|
||||
@Override
|
||||
public void setItemVisibility(int id, boolean visible) {
|
||||
menu.findItem(id).setVisible(visible);
|
||||
}
|
||||
}, selectedItem, false, QueueAccess.ItemListAccess(queue));
|
||||
|
||||
} else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) {
|
||||
menu.add(Menu.NONE, R.id.organize_queue_item, Menu.NONE,
|
||||
@ -172,11 +240,10 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
@Override
|
||||
public boolean onContextItemSelected(android.view.MenuItem item) {
|
||||
boolean handled = false;
|
||||
FeedManager manager = FeedManager.getInstance();
|
||||
if (selectedItem != null) {
|
||||
try {
|
||||
handled = FeedItemMenuHandler.onMenuItemClicked(
|
||||
getSherlockActivity(), item.getItemId(), selectedItem);
|
||||
getActivity(), item.getItemId(), selectedItem);
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(
|
||||
@ -191,10 +258,10 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
OrganizeQueueActivity.class));
|
||||
break;
|
||||
case R.id.clear_queue_item:
|
||||
manager.clearQueue(getActivity());
|
||||
DBWriter.clearQueue(getActivity());
|
||||
break;
|
||||
case R.id.download_all_item:
|
||||
manager.downloadAllItemsInQueue(getActivity());
|
||||
DBTasks.downloadAllItemsInQueue(getActivity());
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
@ -203,10 +270,10 @@ public class EpisodesFragment extends SherlockFragment {
|
||||
handled = true;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.mark_all_read_item:
|
||||
manager.markAllItemsRead(getActivity());
|
||||
DBWriter.markAllItemsRead(getActivity());
|
||||
break;
|
||||
case R.id.enqueue_all_item:
|
||||
manager.enqueueAllNewItems(getActivity());
|
||||
DBTasks.enqueueAllNewItems(getActivity());
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -10,8 +11,6 @@ import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.asynctask.ImageLoader;
|
||||
@ -24,7 +23,7 @@ import de.danoeh.antennapod.util.playback.PlaybackController;
|
||||
* Fragment which is supposed to be displayed outside of the MediaplayerActivity
|
||||
* if the PlaybackService is running
|
||||
*/
|
||||
public class ExternalPlayerFragment extends SherlockFragment {
|
||||
public class ExternalPlayerFragment extends Fragment {
|
||||
private static final String TAG = "ExternalPlayerFragment";
|
||||
|
||||
private ViewGroup fragmentLayout;
|
||||
@ -139,7 +138,10 @@ public class ExternalPlayerFragment extends SherlockFragment {
|
||||
|
||||
@Override
|
||||
public void loadMediaInfo() {
|
||||
ExternalPlayerFragment.this.loadMediaInfo();
|
||||
ExternalPlayerFragment fragment = ExternalPlayerFragment.this;
|
||||
if (fragment != null) {
|
||||
fragment.loadMediaInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -174,6 +176,12 @@ public class ExternalPlayerFragment extends SherlockFragment {
|
||||
.newOnPlayButtonClickListener());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackSpeedChange() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,18 @@
|
||||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.view.ActionMode;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
import com.actionbarsherlock.view.ActionMode;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.FeedItemlistActivity;
|
||||
@ -28,201 +22,280 @@ import de.danoeh.antennapod.dialog.ConfirmationDialog;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.storage.FeedItemStatistics;
|
||||
import de.danoeh.antennapod.util.menuhandler.FeedMenuHandler;
|
||||
|
||||
public class FeedlistFragment extends SherlockFragment implements
|
||||
ActionMode.Callback, AdapterView.OnItemClickListener,
|
||||
AdapterView.OnItemLongClickListener {
|
||||
private static final String TAG = "FeedlistFragment";
|
||||
import java.util.List;
|
||||
|
||||
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED
|
||||
| EventDistributor.DOWNLOAD_QUEUED
|
||||
| EventDistributor.FEED_LIST_UPDATE
|
||||
| EventDistributor.UNREAD_ITEMS_UPDATE;
|
||||
|
||||
public static final String EXTRA_SELECTED_FEED = "extra.de.danoeh.antennapod.activity.selected_feed";
|
||||
public class FeedlistFragment extends Fragment implements
|
||||
ActionMode.Callback, AdapterView.OnItemClickListener,
|
||||
AdapterView.OnItemLongClickListener {
|
||||
private static final String TAG = "FeedlistFragment";
|
||||
|
||||
private FeedManager manager;
|
||||
private FeedlistAdapter fla;
|
||||
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED
|
||||
| EventDistributor.DOWNLOAD_QUEUED
|
||||
| EventDistributor.FEED_LIST_UPDATE
|
||||
| EventDistributor.UNREAD_ITEMS_UPDATE;
|
||||
|
||||
private Feed selectedFeed;
|
||||
private ActionMode mActionMode;
|
||||
public static final String EXTRA_SELECTED_FEED = "extra.de.danoeh.antennapod.activity.selected_feed";
|
||||
|
||||
private GridView gridView;
|
||||
private ListView listView;
|
||||
private TextView txtvEmpty;
|
||||
private FeedlistAdapter fla;
|
||||
private List<Feed> feeds;
|
||||
private List<FeedItemStatistics> feedItemStatistics;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
}
|
||||
private Feed selectedFeed;
|
||||
private ActionMode mActionMode;
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
}
|
||||
private GridView gridView;
|
||||
private ListView listView;
|
||||
private TextView emptyView;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating");
|
||||
manager = FeedManager.getInstance();
|
||||
fla = new FeedlistAdapter(getActivity());
|
||||
private FeedlistAdapter.ItemAccess itemAccess = new FeedlistAdapter.ItemAccess() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public Feed getItem(int position) {
|
||||
if (feeds != null) {
|
||||
return feeds.get(position);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View result = inflater.inflate(R.layout.feedlist, container, false);
|
||||
listView = (ListView) result.findViewById(android.R.id.list);
|
||||
gridView = (GridView) result.findViewById(R.id.grid);
|
||||
txtvEmpty = (TextView) result.findViewById(android.R.id.empty);
|
||||
@Override
|
||||
public FeedItemStatistics getFeedItemStatistics(int position) {
|
||||
if (feedItemStatistics != null && position < feedItemStatistics.size()) {
|
||||
return feedItemStatistics.get(position);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@Override
|
||||
public int getCount() {
|
||||
if (feeds != null) {
|
||||
return feeds.size();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating");
|
||||
fla = new FeedlistAdapter(getActivity(), itemAccess);
|
||||
loadFeeds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (listView != null) {
|
||||
listView.setOnItemClickListener(this);
|
||||
listView.setOnItemLongClickListener(this);
|
||||
listView.setAdapter(fla);
|
||||
listView.setEmptyView(txtvEmpty);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Using ListView");
|
||||
} else {
|
||||
gridView.setOnItemClickListener(this);
|
||||
gridView.setOnItemLongClickListener(this);
|
||||
gridView.setAdapter(fla);
|
||||
gridView.setEmptyView(txtvEmpty);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Using GridView");
|
||||
}
|
||||
}
|
||||
private void loadFeeds() {
|
||||
AsyncTask<Void, Void, List[]> loadTask = new AsyncTask<Void, Void, List[]>() {
|
||||
@Override
|
||||
protected List[] doInBackground(Void... params) {
|
||||
Context context = getActivity();
|
||||
if (context != null) {
|
||||
return new List[]{DBReader.getFeedList(context),
|
||||
DBReader.getFeedStatisticsList(context)};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Resuming");
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
fla.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(List[] result) {
|
||||
super.onPostExecute(result);
|
||||
if (result != null) {
|
||||
feeds = result[0];
|
||||
feedItemStatistics = result[1];
|
||||
setEmptyViewIfListIsEmpty();
|
||||
if (fla != null) {
|
||||
fla.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Failed to load feeds");
|
||||
}
|
||||
}
|
||||
};
|
||||
loadTask.execute();
|
||||
}
|
||||
|
||||
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
|
||||
|
||||
@Override
|
||||
public void update(EventDistributor eventDistributor, Integer arg) {
|
||||
if ((EVENTS & arg) != 0) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Received contentUpdate Intent.");
|
||||
fla.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View result = inflater.inflate(R.layout.feedlist, container, false);
|
||||
listView = (ListView) result.findViewById(android.R.id.list);
|
||||
gridView = (GridView) result.findViewById(R.id.grid);
|
||||
emptyView = (TextView) result.findViewById(android.R.id.empty);
|
||||
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
FeedMenuHandler.onCreateOptionsMenu(mode.getMenuInflater(), menu);
|
||||
mode.setTitle(selectedFeed.getTitle());
|
||||
return true;
|
||||
}
|
||||
return result;
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return FeedMenuHandler.onPrepareOptionsMenu(menu, selectedFeed);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
try {
|
||||
if (FeedMenuHandler.onOptionsItemClicked(getSherlockActivity(),
|
||||
item, selectedFeed)) {
|
||||
fla.notifyDataSetChanged();
|
||||
} else {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.remove_item:
|
||||
final FeedRemover remover = new FeedRemover(
|
||||
getSherlockActivity(), selectedFeed) {
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
fla.notifyDataSetChanged();
|
||||
}
|
||||
};
|
||||
ConfirmationDialog conDialog = new ConfirmationDialog(
|
||||
getActivity(), R.string.remove_feed_label,
|
||||
R.string.feed_delete_confirmation_msg) {
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (listView != null) {
|
||||
listView.setOnItemClickListener(this);
|
||||
listView.setOnItemLongClickListener(this);
|
||||
listView.setAdapter(fla);
|
||||
listView.setEmptyView(emptyView);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Using ListView");
|
||||
} else {
|
||||
gridView.setOnItemClickListener(this);
|
||||
gridView.setOnItemLongClickListener(this);
|
||||
gridView.setAdapter(fla);
|
||||
gridView.setEmptyView(emptyView);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Using GridView");
|
||||
}
|
||||
setEmptyViewIfListIsEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmButtonPressed(
|
||||
DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
remover.executeAsync();
|
||||
}
|
||||
};
|
||||
conDialog.createNewDialog().show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(
|
||||
getActivity(), e.getMessage());
|
||||
}
|
||||
mode.finish();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Resuming");
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
mActionMode = null;
|
||||
selectedFeed = null;
|
||||
fla.setSelectedItemIndex(FeedlistAdapter.SELECTION_NONE);
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
|
||||
long id) {
|
||||
Feed selection = fla.getItem(position);
|
||||
Intent showFeed = new Intent(getActivity(), FeedItemlistActivity.class);
|
||||
showFeed.putExtra(EXTRA_SELECTED_FEED, selection.getId());
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
}
|
||||
|
||||
getActivity().startActivity(showFeed);
|
||||
}
|
||||
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
Feed selection = fla.getItem(position);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Selected Feed with title " + selection.getTitle());
|
||||
if (selection != null) {
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
fla.setSelectedItemIndex(position);
|
||||
selectedFeed = selection;
|
||||
mActionMode = getSherlockActivity().startActionMode(
|
||||
FeedlistFragment.this);
|
||||
@Override
|
||||
public void update(EventDistributor eventDistributor, Integer arg) {
|
||||
if ((EVENTS & arg) != 0) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Received contentUpdate Intent.");
|
||||
loadFeeds();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
FeedMenuHandler.onCreateOptionsMenu(mode.getMenuInflater(), menu);
|
||||
mode.setTitle(selectedFeed.getTitle());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return FeedMenuHandler.onPrepareOptionsMenu(menu, selectedFeed);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
try {
|
||||
if (FeedMenuHandler.onOptionsItemClicked(getActivity(),
|
||||
item, selectedFeed)) {
|
||||
loadFeeds();
|
||||
} else {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.remove_item:
|
||||
final FeedRemover remover = new FeedRemover(
|
||||
getActivity(), selectedFeed) {
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
loadFeeds();
|
||||
}
|
||||
};
|
||||
ConfirmationDialog conDialog = new ConfirmationDialog(
|
||||
getActivity(), R.string.remove_feed_label,
|
||||
R.string.feed_delete_confirmation_msg) {
|
||||
|
||||
@Override
|
||||
public void onConfirmButtonPressed(
|
||||
DialogInterface dialog) {
|
||||
dialog.dismiss();
|
||||
remover.executeAsync();
|
||||
}
|
||||
};
|
||||
conDialog.createNewDialog().show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(
|
||||
getActivity(), e.getMessage());
|
||||
}
|
||||
mode.finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean actionModeDestroyWorkaround = false; // TODO remove this workaround
|
||||
private boolean skipWorkAround = Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||
|
||||
@Override
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
if (skipWorkAround || actionModeDestroyWorkaround) {
|
||||
mActionMode = null;
|
||||
selectedFeed = null;
|
||||
fla.setSelectedItemIndex(FeedlistAdapter.SELECTION_NONE);
|
||||
actionModeDestroyWorkaround = false;
|
||||
} else {
|
||||
actionModeDestroyWorkaround = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
|
||||
long id) {
|
||||
Feed selection = fla.getItem(position);
|
||||
Intent showFeed = new Intent(getActivity(), FeedItemlistActivity.class);
|
||||
showFeed.putExtra(EXTRA_SELECTED_FEED, selection.getId());
|
||||
|
||||
getActivity().startActivity(showFeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
Feed selection = fla.getItem(position);
|
||||
if (selection != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Selected Feed with title " + selection.getTitle());
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
fla.setSelectedItemIndex(position);
|
||||
selectedFeed = selection;
|
||||
mActionMode = ((ActionBarActivity) getActivity()).startSupportActionMode(FeedlistFragment.this);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private AbsListView getMainView() {
|
||||
return (listView != null) ? listView : gridView;
|
||||
}
|
||||
|
||||
private void setEmptyViewIfListIsEmpty() {
|
||||
if (getMainView() != null && emptyView != null && feeds != null) {
|
||||
if (feeds.isEmpty()) {
|
||||
emptyView.setText(R.string.no_feeds_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.content.*;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.util.ShownotesProvider;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
@ -27,442 +29,429 @@ import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.PodcastApp;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.util.ShareUtils;
|
||||
import de.danoeh.antennapod.util.playback.Playable;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/** Displays the description of a Playable object in a Webview. */
|
||||
public class ItemDescriptionFragment extends SherlockFragment {
|
||||
public class ItemDescriptionFragment extends Fragment {
|
||||
|
||||
private static final String TAG = "ItemDescriptionFragment";
|
||||
private static final String TAG = "ItemDescriptionFragment";
|
||||
|
||||
private static final String PREF = "ItemDescriptionFragmentPrefs";
|
||||
private static final String PREF_SCROLL_Y = "prefScrollY";
|
||||
private static final String PREF_PLAYABLE_ID = "prefPlayableId";
|
||||
private static final String PREF = "ItemDescriptionFragmentPrefs";
|
||||
private static final String PREF_SCROLL_Y = "prefScrollY";
|
||||
private static final String PREF_PLAYABLE_ID = "prefPlayableId";
|
||||
|
||||
private static final String ARG_PLAYABLE = "arg.playable";
|
||||
private static final String ARG_PLAYABLE = "arg.playable";
|
||||
private static final String ARG_FEEDITEM_ID = "arg.feeditem";
|
||||
|
||||
private static final String ARG_FEED_ID = "arg.feedId";
|
||||
private static final String ARG_FEED_ITEM_ID = "arg.feeditemId";
|
||||
private static final String ARG_SAVE_STATE = "arg.saveState";
|
||||
private static final String ARG_SAVE_STATE = "arg.saveState";
|
||||
|
||||
private WebView webvDescription;
|
||||
private Playable media;
|
||||
private WebView webvDescription;
|
||||
|
||||
private FeedItem item;
|
||||
private ShownotesProvider shownotesProvider;
|
||||
private Playable media;
|
||||
|
||||
private AsyncTask<Void, Void, Void> webViewLoader;
|
||||
|
||||
private String shownotes;
|
||||
private AsyncTask<Void, Void, Void> webViewLoader;
|
||||
|
||||
/** URL that was selected via long-press. */
|
||||
private String selectedURL;
|
||||
/**
|
||||
* URL that was selected via long-press.
|
||||
*/
|
||||
private String selectedURL;
|
||||
|
||||
/**
|
||||
* True if Fragment should save its state (e.g. scrolling position) in a
|
||||
* shared preference.
|
||||
*/
|
||||
private boolean saveState;
|
||||
/**
|
||||
* True if Fragment should save its state (e.g. scrolling position) in a
|
||||
* shared preference.
|
||||
*/
|
||||
private boolean saveState;
|
||||
|
||||
public static ItemDescriptionFragment newInstance(Playable media,
|
||||
boolean saveState) {
|
||||
ItemDescriptionFragment f = new ItemDescriptionFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(ARG_PLAYABLE, media);
|
||||
args.putBoolean(ARG_SAVE_STATE, saveState);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
public static ItemDescriptionFragment newInstance(Playable media,
|
||||
boolean saveState) {
|
||||
ItemDescriptionFragment f = new ItemDescriptionFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(ARG_PLAYABLE, media);
|
||||
args.putBoolean(ARG_SAVE_STATE, saveState);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
|
||||
public static ItemDescriptionFragment newInstance(FeedItem item,
|
||||
boolean saveState) {
|
||||
ItemDescriptionFragment f = new ItemDescriptionFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putLong(ARG_FEED_ID, item.getFeed().getId());
|
||||
args.putLong(ARG_FEED_ITEM_ID, item.getId());
|
||||
args.putBoolean(ARG_SAVE_STATE, saveState);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
public static ItemDescriptionFragment newInstance(FeedItem item, boolean saveState) {
|
||||
ItemDescriptionFragment f = new ItemDescriptionFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putLong(ARG_FEEDITEM_ID, item.getId());
|
||||
args.putBoolean(ARG_SAVE_STATE, saveState);
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating view");
|
||||
webvDescription = new WebView(getActivity());
|
||||
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(getResources().getColor(
|
||||
R.color.black));
|
||||
}
|
||||
webvDescription.getSettings().setUseWideViewPort(false);
|
||||
webvDescription.getSettings().setLayoutAlgorithm(
|
||||
LayoutAlgorithm.NARROW_COLUMNS);
|
||||
webvDescription.getSettings().setLoadWithOverviewMode(true);
|
||||
webvDescription.setOnLongClickListener(webViewLongClickListener);
|
||||
webvDescription.setWebViewClient(new WebViewClient() {
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating view");
|
||||
webvDescription = new WebView(getActivity());
|
||||
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(getResources().getColor(
|
||||
R.color.black));
|
||||
}
|
||||
webvDescription.getSettings().setUseWideViewPort(false);
|
||||
webvDescription.getSettings().setLayoutAlgorithm(
|
||||
LayoutAlgorithm.NARROW_COLUMNS);
|
||||
webvDescription.getSettings().setLoadWithOverviewMode(true);
|
||||
webvDescription.setOnLongClickListener(webViewLongClickListener);
|
||||
webvDescription.setWebViewClient(new WebViewClient() {
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Page finished");
|
||||
// Restoring the scroll position might not always work
|
||||
view.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Page finished");
|
||||
// Restoring the scroll position might not always work
|
||||
view.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
restoreFromPreference();
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
restoreFromPreference();
|
||||
}
|
||||
|
||||
}, 50);
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
|
||||
});
|
||||
registerForContextMenu(webvDescription);
|
||||
return webvDescription;
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
registerForContextMenu(webvDescription);
|
||||
return webvDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Fragment attached");
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Fragment detached");
|
||||
if (webViewLoader != null) {
|
||||
webViewLoader.cancel(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Fragment attached");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Fragment destroyed");
|
||||
if (webViewLoader != null) {
|
||||
webViewLoader.cancel(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Fragment detached");
|
||||
if (webViewLoader != null) {
|
||||
webViewLoader.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating fragment");
|
||||
Bundle args = getArguments();
|
||||
saveState = args.getBoolean(ARG_SAVE_STATE, false);
|
||||
if (args.containsKey(ARG_PLAYABLE)) {
|
||||
media = args.getParcelable(ARG_PLAYABLE);
|
||||
} else if (args.containsKey(ARG_FEED_ID)
|
||||
&& args.containsKey(ARG_FEED_ITEM_ID)) {
|
||||
long feedId = args.getLong(ARG_FEED_ID);
|
||||
long itemId = args.getLong(ARG_FEED_ITEM_ID);
|
||||
FeedItem f = FeedManager.getInstance().getFeedItem(itemId, feedId);
|
||||
if (f != null) {
|
||||
item = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Fragment destroyed");
|
||||
if (webViewLoader != null) {
|
||||
webViewLoader.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (media != null) {
|
||||
media.loadShownotes(new Playable.ShownoteLoaderCallback() {
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Creating fragment");
|
||||
Bundle args = getArguments();
|
||||
saveState = args.getBoolean(ARG_SAVE_STATE, false);
|
||||
|
||||
@Override
|
||||
public void onShownotesLoaded(String shownotes) {
|
||||
ItemDescriptionFragment.this.shownotes = shownotes;
|
||||
if (ItemDescriptionFragment.this.shownotes != null) {
|
||||
startLoader();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (item != null) {
|
||||
if (item.getDescription() == null
|
||||
|| item.getContentEncoded() == null) {
|
||||
FeedManager.getInstance().loadExtraInformationOfItem(
|
||||
PodcastApp.getInstance(), item,
|
||||
new FeedManager.TaskCallback<String[]>() {
|
||||
@Override
|
||||
public void onCompletion(String[] result) {
|
||||
if (result[1] != null) {
|
||||
shownotes = result[1];
|
||||
} else {
|
||||
shownotes = result[0];
|
||||
}
|
||||
if (shownotes != null) {
|
||||
startLoader();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
shownotes = item.getContentEncoded();
|
||||
startLoader();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Error in onViewCreated: Item and media were null");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
Bundle args = getArguments();
|
||||
if (args.containsKey(ARG_PLAYABLE)) {
|
||||
media = args.getParcelable(ARG_PLAYABLE);
|
||||
shownotesProvider = media;
|
||||
startLoader();
|
||||
} else if (args.containsKey(ARG_FEEDITEM_ID)) {
|
||||
AsyncTask<Void, Void, FeedItem> itemLoadTask = new AsyncTask<Void, Void, FeedItem>() {
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
@Override
|
||||
protected FeedItem doInBackground(Void... voids) {
|
||||
return DBReader.getFeedItem(getActivity(), getArguments().getLong(ARG_FEEDITEM_ID));
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void startLoader() {
|
||||
webViewLoader = createLoader();
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
webViewLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
webViewLoader.execute();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(FeedItem feedItem) {
|
||||
super.onPostExecute(feedItem);
|
||||
shownotesProvider = feedItem;
|
||||
startLoader();
|
||||
}
|
||||
};
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
itemLoadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
itemLoadTask.execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the CSS style of the Webview.
|
||||
*
|
||||
* @param textColor
|
||||
* the default color to use for the text in the webview. This
|
||||
* 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 int pageMargin = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
|
||||
.getDisplayMetrics());
|
||||
return String.format(WEBVIEW_STYLE, textColor, "100%", pageMargin,
|
||||
pageMargin, pageMargin, pageMargin, data);
|
||||
}
|
||||
|
||||
private View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
WebView.HitTestResult r = webvDescription.getHitTestResult();
|
||||
if (r != null
|
||||
&& r.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Link of webview was long-pressed. Extra: "
|
||||
+ r.getExtra());
|
||||
selectedURL = r.getExtra();
|
||||
webvDescription.showContextMenu();
|
||||
return true;
|
||||
}
|
||||
selectedURL = null;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
boolean handled = selectedURL != null;
|
||||
if (selectedURL != null) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.open_in_browser_item:
|
||||
Uri uri = Uri.parse(selectedURL);
|
||||
getActivity()
|
||||
.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
break;
|
||||
case R.id.share_url_item:
|
||||
ShareUtils.shareLink(getActivity(), selectedURL);
|
||||
break;
|
||||
case R.id.copy_url_item:
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
ClipData clipData = ClipData.newPlainText(selectedURL,
|
||||
selectedURL);
|
||||
android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity()
|
||||
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(clipData);
|
||||
} else {
|
||||
android.text.ClipboardManager cm = (android.text.ClipboardManager) getActivity()
|
||||
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(selectedURL);
|
||||
}
|
||||
Toast t = Toast.makeText(getActivity(),
|
||||
R.string.copied_url_msg, Toast.LENGTH_SHORT);
|
||||
t.show();
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
break;
|
||||
@SuppressLint("NewApi")
|
||||
private void startLoader() {
|
||||
webViewLoader = createLoader();
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
|
||||
webViewLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} else {
|
||||
webViewLoader.execute();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
selectedURL = null;
|
||||
}
|
||||
return handled;
|
||||
/**
|
||||
* Return the CSS style of the Webview.
|
||||
*
|
||||
* @param textColor the default color to use for the text in the webview. This
|
||||
* 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 int pageMargin = (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
|
||||
.getDisplayMetrics());
|
||||
return String.format(WEBVIEW_STYLE, textColor, "100%", pageMargin,
|
||||
pageMargin, pageMargin, pageMargin, data);
|
||||
}
|
||||
|
||||
}
|
||||
private View.OnLongClickListener webViewLongClickListener = new View.OnLongClickListener() {
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenuInfo menuInfo) {
|
||||
if (selectedURL != null) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
menu.add(Menu.NONE, R.id.open_in_browser_item, Menu.NONE,
|
||||
R.string.open_in_browser_label);
|
||||
menu.add(Menu.NONE, R.id.copy_url_item, Menu.NONE,
|
||||
R.string.copy_url_label);
|
||||
menu.add(Menu.NONE, R.id.share_url_item, Menu.NONE,
|
||||
R.string.share_url_label);
|
||||
menu.setHeaderTitle(selectedURL);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
WebView.HitTestResult r = webvDescription.getHitTestResult();
|
||||
if (r != null
|
||||
&& r.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Link of webview was long-pressed. Extra: "
|
||||
+ r.getExtra());
|
||||
selectedURL = r.getExtra();
|
||||
webvDescription.showContextMenu();
|
||||
return true;
|
||||
}
|
||||
selectedURL = null;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
private AsyncTask<Void, Void, Void> createLoader() {
|
||||
return new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
super.onCancelled();
|
||||
if (getSherlockActivity() != null) {
|
||||
getSherlockActivity()
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
webViewLoader = null;
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
boolean handled = selectedURL != null;
|
||||
if (selectedURL != null) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.open_in_browser_item:
|
||||
Uri uri = Uri.parse(selectedURL);
|
||||
getActivity()
|
||||
.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
break;
|
||||
case R.id.share_url_item:
|
||||
ShareUtils.shareLink(getActivity(), selectedURL);
|
||||
break;
|
||||
case R.id.copy_url_item:
|
||||
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||
ClipData clipData = ClipData.newPlainText(selectedURL,
|
||||
selectedURL);
|
||||
android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity()
|
||||
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(clipData);
|
||||
} else {
|
||||
android.text.ClipboardManager cm = (android.text.ClipboardManager) getActivity()
|
||||
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(selectedURL);
|
||||
}
|
||||
Toast t = Toast.makeText(getActivity(),
|
||||
R.string.copied_url_msg, Toast.LENGTH_SHORT);
|
||||
t.show();
|
||||
break;
|
||||
default:
|
||||
handled = false;
|
||||
break;
|
||||
|
||||
String data;
|
||||
}
|
||||
selectedURL = null;
|
||||
}
|
||||
return handled;
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
// /webvDescription.loadData(url, "text/html", "utf-8");
|
||||
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
||||
"utf-8", "about:blank");
|
||||
if (getSherlockActivity() != null) {
|
||||
getSherlockActivity()
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Webview loaded");
|
||||
webViewLoader = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
if (getSherlockActivity() != null) {
|
||||
getSherlockActivity()
|
||||
.setSupportProgressBarIndeterminateVisibility(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||
ContextMenuInfo menuInfo) {
|
||||
if (selectedURL != null) {
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
menu.add(Menu.NONE, R.id.open_in_browser_item, Menu.NONE,
|
||||
R.string.open_in_browser_label);
|
||||
menu.add(Menu.NONE, R.id.copy_url_item, Menu.NONE,
|
||||
R.string.copy_url_label);
|
||||
menu.add(Menu.NONE, R.id.share_url_item, Menu.NONE,
|
||||
R.string.share_url_label);
|
||||
menu.setHeaderTitle(selectedURL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Loading Webview");
|
||||
data = "";
|
||||
data = StringEscapeUtils.unescapeHtml4(shownotes);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
TypedArray res = getActivity()
|
||||
.getTheme()
|
||||
.obtainStyledAttributes(
|
||||
new int[] { android.R.attr.textColorPrimary });
|
||||
int colorResource = res.getColor(0, 0);
|
||||
String colorString = String.format("#%06X",
|
||||
0xFFFFFF & colorResource);
|
||||
Log.i(TAG, "text color: " + colorString);
|
||||
res.recycle();
|
||||
data = applyWebviewStyle(colorString, data);
|
||||
} else {
|
||||
cancel(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private AsyncTask<Void, Void, Void> createLoader() {
|
||||
return new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
super.onCancelled();
|
||||
if (getActivity() != null) {
|
||||
((ActionBarActivity) getActivity())
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
webViewLoader = null;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
String data;
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
savePreference();
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
// /webvDescription.loadData(url, "text/html", "utf-8");
|
||||
webvDescription.loadDataWithBaseURL(null, data, "text/html",
|
||||
"utf-8", "about:blank");
|
||||
if (getActivity() != null) {
|
||||
((ActionBarActivity) getActivity())
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Webview loaded");
|
||||
webViewLoader = null;
|
||||
}
|
||||
|
||||
private void savePreference() {
|
||||
if (saveState) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Saving preferences");
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(PREF,
|
||||
Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
if (media != null && webvDescription != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Saving scroll position: "
|
||||
+ webvDescription.getScrollY());
|
||||
editor.putInt(PREF_SCROLL_Y, webvDescription.getScrollY());
|
||||
editor.putString(PREF_PLAYABLE_ID, media.getIdentifier()
|
||||
.toString());
|
||||
} else {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"savePreferences was called while media or webview was null");
|
||||
editor.putInt(PREF_SCROLL_Y, -1);
|
||||
editor.putString(PREF_PLAYABLE_ID, "");
|
||||
}
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
if (getActivity() != null) {
|
||||
((ActionBarActivity) getActivity())
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean restoreFromPreference() {
|
||||
if (saveState) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Restoring from preferences");
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
SharedPreferences prefs = activity.getSharedPreferences(
|
||||
PREF, Activity.MODE_PRIVATE);
|
||||
String id = prefs.getString(PREF_PLAYABLE_ID, "");
|
||||
int scrollY = prefs.getInt(PREF_SCROLL_Y, -1);
|
||||
if (scrollY != -1 && media != null
|
||||
&& id.equals(media.getIdentifier().toString())
|
||||
&& webvDescription != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Restored scroll Position: " + scrollY);
|
||||
webvDescription.scrollTo(webvDescription.getScrollX(),
|
||||
scrollY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Loading Webview");
|
||||
try {
|
||||
Callable<String> shownotesLoadTask = shownotesProvider.loadShownotes();
|
||||
final String shownotes = shownotesLoadTask.call();
|
||||
|
||||
data = StringEscapeUtils.unescapeHtml4(shownotes);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
TypedArray res = activity
|
||||
.getTheme()
|
||||
.obtainStyledAttributes(
|
||||
new int[]{android.R.attr.textColorPrimary});
|
||||
int colorResource = res.getColor(0, 0);
|
||||
String colorString = String.format("#%06X",
|
||||
0xFFFFFF & colorResource);
|
||||
Log.i(TAG, "text color: " + colorString);
|
||||
res.recycle();
|
||||
data = applyWebviewStyle(colorString, data);
|
||||
} else {
|
||||
cancel(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
savePreference();
|
||||
}
|
||||
|
||||
private void savePreference() {
|
||||
if (saveState) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Saving preferences");
|
||||
SharedPreferences prefs = getActivity().getSharedPreferences(PREF,
|
||||
Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
if (media != null && webvDescription != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"Saving scroll position: "
|
||||
+ webvDescription.getScrollY());
|
||||
editor.putInt(PREF_SCROLL_Y, webvDescription.getScrollY());
|
||||
editor.putString(PREF_PLAYABLE_ID, media.getIdentifier()
|
||||
.toString());
|
||||
} else {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG,
|
||||
"savePreferences was called while media or webview was null");
|
||||
editor.putInt(PREF_SCROLL_Y, -1);
|
||||
editor.putString(PREF_PLAYABLE_ID, "");
|
||||
}
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean restoreFromPreference() {
|
||||
if (saveState) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Restoring from preferences");
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
SharedPreferences prefs = activity.getSharedPreferences(
|
||||
PREF, Activity.MODE_PRIVATE);
|
||||
String id = prefs.getString(PREF_PLAYABLE_ID, "");
|
||||
int scrollY = prefs.getInt(PREF_SCROLL_Y, -1);
|
||||
if (scrollY != -1 && media != null
|
||||
&& id.equals(media.getIdentifier().toString())
|
||||
&& webvDescription != null) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Restored scroll Position: " + scrollY);
|
||||
webvDescription.scrollTo(webvDescription.getScrollX(),
|
||||
scrollY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package de.danoeh.antennapod.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
@ -12,27 +16,30 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockListFragment;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.ItemviewActivity;
|
||||
import de.danoeh.antennapod.adapter.ActionButtonCallback;
|
||||
import de.danoeh.antennapod.adapter.DefaultFeedItemlistAdapter;
|
||||
import de.danoeh.antennapod.adapter.InternalFeedItemlistAdapter;
|
||||
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.feed.Feed;
|
||||
import de.danoeh.antennapod.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.service.download.DownloadService;
|
||||
import de.danoeh.antennapod.storage.DBReader;
|
||||
import de.danoeh.antennapod.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.QueueAccess;
|
||||
import de.danoeh.antennapod.util.menuhandler.FeedItemMenuHandler;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/** Displays a list of FeedItems. */
|
||||
@SuppressLint("ValidFragment")
|
||||
public class ItemlistFragment extends SherlockListFragment {
|
||||
public class ItemlistFragment extends ListFragment {
|
||||
private static final String TAG = "ItemlistFragment";
|
||||
|
||||
private static final int EVENTS = EventDistributor.DOWNLOAD_HANDLED
|
||||
@ -43,12 +50,9 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
public static final String EXTRA_SELECTED_FEEDITEM = "extra.de.danoeh.antennapod.activity.selected_feeditem";
|
||||
public static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id";
|
||||
protected InternalFeedItemlistAdapter fila;
|
||||
protected FeedManager manager = FeedManager.getInstance();
|
||||
protected DownloadRequester requester = DownloadRequester.getInstance();
|
||||
|
||||
private DefaultFeedItemlistAdapter.ItemAccess itemAccess;
|
||||
|
||||
private Feed feed;
|
||||
protected List<Long> queue;
|
||||
|
||||
protected FeedItem selectedItem = null;
|
||||
protected boolean contextMenuClosed = true;
|
||||
@ -56,10 +60,10 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
/** Argument for FeeditemlistAdapter */
|
||||
protected boolean showFeedtitle;
|
||||
|
||||
public ItemlistFragment(DefaultFeedItemlistAdapter.ItemAccess itemAccess,
|
||||
boolean showFeedtitle) {
|
||||
private AsyncTask<Long, Void, Feed> currentLoadTask;
|
||||
|
||||
public ItemlistFragment(boolean showFeedtitle) {
|
||||
super();
|
||||
this.itemAccess = itemAccess;
|
||||
this.showFeedtitle = showFeedtitle;
|
||||
}
|
||||
|
||||
@ -83,50 +87,116 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
return i;
|
||||
}
|
||||
|
||||
private InternalFeedItemlistAdapter.ItemAccess itemAccessRef;
|
||||
protected InternalFeedItemlistAdapter.ItemAccess itemAccess() {
|
||||
if (itemAccessRef == null) {
|
||||
itemAccessRef = new InternalFeedItemlistAdapter.ItemAccess() {
|
||||
|
||||
@Override
|
||||
public FeedItem getItem(int position) {
|
||||
return (feed != null) ? feed.getItemAtIndex(true, position) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return (feed != null) ? feed.getNumOfItems(true) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInQueue(FeedItem item) {
|
||||
return (queue != null) && queue.contains(item.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
return itemAccessRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.feeditemlist, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (itemAccess == null) {
|
||||
long feedId = getArguments().getLong(ARGUMENT_FEED_ID);
|
||||
final Feed feed = FeedManager.getInstance().getFeed(feedId);
|
||||
this.feed = feed;
|
||||
itemAccess = new DefaultFeedItemlistAdapter.ItemAccess() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
loadData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedItem getItem(int position) {
|
||||
return feed.getItemAtIndex(true, position);
|
||||
}
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if (currentLoadTask != null) {
|
||||
currentLoadTask.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return feed.getNumOfItems(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
protected void loadData() {
|
||||
final long feedId;
|
||||
if (feed == null) {
|
||||
feedId = getArguments().getLong(ARGUMENT_FEED_ID);
|
||||
} else {
|
||||
feedId = feed.getId();
|
||||
}
|
||||
AsyncTask<Long, Void, Feed> loadTask = new AsyncTask<Long, Void, Feed>(){
|
||||
private volatile List<Long> queueRef;
|
||||
|
||||
@Override
|
||||
protected Feed doInBackground(Long... longs) {
|
||||
Context context = ItemlistFragment.this.getActivity();
|
||||
if (context != null) {
|
||||
Feed result = DBReader.getFeed(context, longs[0]);
|
||||
if (result != null) {
|
||||
result.setItems(DBReader.getFeedItemList(context, result));
|
||||
queueRef = DBReader.getQueueIDList(context);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Feed result) {
|
||||
super.onPostExecute(result);
|
||||
if (result != null && result.getItems() != null) {
|
||||
feed = result;
|
||||
if (queueRef != null) {
|
||||
queue = queueRef;
|
||||
} else {
|
||||
Log.e(TAG, "Could not load queue");
|
||||
}
|
||||
setEmptyViewIfListIsEmpty();
|
||||
if (fila != null) {
|
||||
fila.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
if (result == null) {
|
||||
Log.e(TAG, "Could not load feed with id " + feedId);
|
||||
} else if (result.getItems() == null) {
|
||||
Log.e(TAG, "Could not load feed items");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
currentLoadTask = loadTask;
|
||||
loadTask.execute(feedId);
|
||||
}
|
||||
|
||||
private void setEmptyViewIfListIsEmpty() {
|
||||
if (getListView() != null && feed != null && feed.getItems() != null) {
|
||||
if (feed.getItems().isEmpty()) {
|
||||
((TextView) getActivity().findViewById(android.R.id.empty)).setText(R.string.no_items_label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected InternalFeedItemlistAdapter createListAdapter() {
|
||||
return new InternalFeedItemlistAdapter(getActivity(), itemAccess,
|
||||
return new InternalFeedItemlistAdapter(getActivity(), itemAccess(),
|
||||
adapterCallback, showFeedtitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@ -138,7 +208,6 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
}
|
||||
});
|
||||
updateProgressBarVisibility();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -162,7 +231,9 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
if ((EventDistributor.DOWNLOAD_QUEUED & arg) != 0) {
|
||||
updateProgressBarVisibility();
|
||||
} else {
|
||||
fila.notifyDataSetChanged();
|
||||
if (feed != null) {
|
||||
loadData();
|
||||
}
|
||||
updateProgressBarVisibility();
|
||||
}
|
||||
}
|
||||
@ -173,13 +244,13 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
if (feed != null) {
|
||||
if (DownloadService.isRunning
|
||||
&& DownloadRequester.getInstance().isDownloadingFile(feed)) {
|
||||
getSherlockActivity()
|
||||
((ActionBarActivity) getActivity())
|
||||
.setSupportProgressBarIndeterminateVisibility(true);
|
||||
} else {
|
||||
getSherlockActivity()
|
||||
((ActionBarActivity) getActivity())
|
||||
.setSupportProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
getSherlockActivity().supportInvalidateOptionsMenu();
|
||||
getActivity().supportInvalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,13 +289,13 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
|
||||
menu.setHeaderTitle(selectedItem.getTitle());
|
||||
FeedItemMenuHandler.onPrepareMenu(
|
||||
new FeedItemMenuHandler.MenuInterface() {
|
||||
new FeedItemMenuHandler.MenuInterface() {
|
||||
|
||||
@Override
|
||||
public void setItemVisibility(int id, boolean visible) {
|
||||
menu.findItem(id).setVisible(visible);
|
||||
}
|
||||
}, selectedItem, false);
|
||||
@Override
|
||||
public void setItemVisibility(int id, boolean visible) {
|
||||
menu.findItem(id).setVisible(visible);
|
||||
}
|
||||
}, selectedItem, false, QueueAccess.IDListAccess(queue));
|
||||
|
||||
}
|
||||
}
|
||||
@ -237,7 +308,7 @@ public class ItemlistFragment extends SherlockListFragment {
|
||||
|
||||
try {
|
||||
handled = FeedItemMenuHandler.onMenuItemClicked(
|
||||
getSherlockActivity(), item.getItemId(), selectedItem);
|
||||
getActivity(), item.getItemId(), selectedItem);
|
||||
} catch (DownloadRequestException e) {
|
||||
e.printStackTrace();
|
||||
DownloadRequestErrorDialogCreator.newRequestErrorDialog(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user