This commit is contained in:
Andrew Dolgov 2014-10-17 00:06:56 +04:00
parent 5775c0d56b
commit 97cc96839d
283 changed files with 5142 additions and 3559 deletions

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/gson-1.7.1.jar"/>
<classpathentry kind="lib" path="libs/jsoup-1.6.1.jar"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="lib" path="libs/dashclock-api-r1.1.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

13
.gitignore vendored
View File

@ -1,3 +1,12 @@
/gen bin/
/bin gen/
.gradle/
build/
local.properties
import-summary.txt
Thumbs.db Thumbs.db
.idea/workspace.xml
.idea/tasks.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/libraries

1
.idea/.name generated Normal file
View File

@ -0,0 +1 @@
Tiny-Tiny-RSS-for-Honeycomb

23
.idea/compiler.xml generated Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

3
.idea/copyright/profiles_settings.xml generated Normal file
View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

5
.idea/encodings.xml generated Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

19
.idea/gradle.xml generated Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/orgfoxttrss" />
<option value="$PROJECT_DIR$/taskerlocaleapi" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

26
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>Android API 19 Platform</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

11
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Tiny-Tiny-RSS-for-Honeycomb.iml" filepath="$PROJECT_DIR$/Tiny-Tiny-RSS-for-Honeycomb.iml" />
<module fileurl="file://$PROJECT_DIR$/orgfoxttrss/orgfoxttrss.iml" filepath="$PROJECT_DIR$/orgfoxttrss/orgfoxttrss.iml" />
<module fileurl="file://$PROJECT_DIR$/taskerlocaleapi/taskerlocaleapi.iml" filepath="$PROJECT_DIR$/taskerlocaleapi/taskerlocaleapi.iml" />
</modules>
</component>
</project>

5
.idea/scopes/scope_settings.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

7
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.fox.ttrss</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding//src/org/fox/ttrss/util/EnlargingImageView.java=UTF-8

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -1,24 +0,0 @@
Tiny Tiny RSS client for Android
================================
http://tt-rss.org/tt-rss-android
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright (c) 2011 Andrew Dolgov (unless explicitly stated otherwise).
## See also
* FAQ: http://tt-rss.org/redmine/projects/tt-rss-android/wiki/#FAQ
* Forum: http://tt-rss.org/forum

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

17
build.gradle Normal file
View File

@ -0,0 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
jcenter()
}
}

View File

@ -1,2 +0,0 @@
# Project target.
target=android-14

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

164
gradlew vendored Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>

32
orgfoxttrss/build.gradle Normal file
View File

@ -0,0 +1,32 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "org.fox.ttrss"
minSdkVersion 8
targetSdkVersion 19
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//compile project(':slidingMenulibrary')
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.code.gson:gson:1.7.1'
compile 'com.android.support:appcompat-v7:18.0.0'
compile files('libs/dashclock-api-r1.1.jar')
compile files('libs/jsoup-1.6.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}

3
orgfoxttrss/lint.xml Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
</lint>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Tiny-Tiny-RSS-for-Honeycomb" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":orgfoxttrss" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" />
<orderEntry type="library" exported="" name="systembartint-1.0.3" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.6.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
<orderEntry type="library" exported="" name="library-1.3" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-18.0.0" level="project" />
<orderEntry type="library" exported="" name="gson-1.7.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.1" level="project" />
<orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" />
</component>
</module>

View File

@ -1,39 +1,39 @@
package android.support.v4.app; package android.support.v4.app;
// http://code.google.com/p/android/issues/detail?id=37484 // http://code.google.com/p/android/issues/detail?id=37484
// Thanks for your amazing code quality, Google. // Thanks for your amazing code quality, Google.
import android.os.Bundle; import android.os.Bundle;
import android.view.ViewGroup; import android.view.ViewGroup;
public class ClassloaderWorkaroundFragmentStatePagerAdapter extends public class ClassloaderWorkaroundFragmentStatePagerAdapter extends
FragmentStatePagerAdapter { FragmentStatePagerAdapter {
public ClassloaderWorkaroundFragmentStatePagerAdapter(FragmentManager fm) { public ClassloaderWorkaroundFragmentStatePagerAdapter(FragmentManager fm) {
super(fm); super(fm);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
@Override @Override
public Fragment getItem(int arg0) { public Fragment getItem(int arg0) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Object instantiateItem(ViewGroup container, int position) { public Object instantiateItem(ViewGroup container, int position) {
Fragment f = (Fragment) super.instantiateItem(container, position); Fragment f = (Fragment) super.instantiateItem(container, position);
Bundle savedFragmentState = f.mSavedFragmentState; Bundle savedFragmentState = f.mSavedFragmentState;
if (savedFragmentState != null) { if (savedFragmentState != null) {
savedFragmentState.setClassLoader(f.getClass().getClassLoader()); savedFragmentState.setClassLoader(f.getClass().getClassLoader());
} }
return f; return f;
} }
@Override @Override
public int getCount() { public int getCount() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return 0;
} }
} }

View File

@ -1,93 +1,93 @@
package org.fox.ttrss.tasker; package org.fox.ttrss.tasker;
import org.fox.ttrss.ApiRequest; import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.CommonActivity; import org.fox.ttrss.CommonActivity;
import org.fox.ttrss.OnlineActivity; import org.fox.ttrss.OnlineActivity;
import org.fox.ttrss.offline.OfflineDownloadService; import org.fox.ttrss.offline.OfflineDownloadService;
import org.fox.ttrss.offline.OfflineUploadService; import org.fox.ttrss.offline.OfflineUploadService;
import org.fox.ttrss.util.SimpleLoginManager; import org.fox.ttrss.util.SimpleLoginManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
public class TaskerReceiver extends BroadcastReceiver { public class TaskerReceiver extends BroadcastReceiver {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d(TAG, "Got action: " + intent.getAction()); Log.d(TAG, "Got action: " + intent.getAction());
final Context fContext = context; final Context fContext = context;
if (com.twofortyfouram.locale.Intent.ACTION_FIRE_SETTING.equals(intent.getAction())) { if (com.twofortyfouram.locale.Intent.ACTION_FIRE_SETTING.equals(intent.getAction())) {
final Bundle settings = intent.getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE); final Bundle settings = intent.getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE);
final int actionId = settings != null ? settings.getInt("actionId", -1) : -1; final int actionId = settings != null ? settings.getInt("actionId", -1) : -1;
Log.d(TAG, "received action id=" + actionId); Log.d(TAG, "received action id=" + actionId);
SimpleLoginManager loginMgr = new SimpleLoginManager() { SimpleLoginManager loginMgr = new SimpleLoginManager() {
@Override @Override
protected void onLoginSuccess(int requestId, String sessionId, int apiLevel) { protected void onLoginSuccess(int requestId, String sessionId, int apiLevel) {
switch (actionId) { switch (actionId) {
case TaskerSettingsActivity.ACTION_DOWNLOAD: case TaskerSettingsActivity.ACTION_DOWNLOAD:
if (true) { if (true) {
Intent intent = new Intent(fContext, Intent intent = new Intent(fContext,
OfflineDownloadService.class); OfflineDownloadService.class);
intent.putExtra("sessionId", sessionId); intent.putExtra("sessionId", sessionId);
intent.putExtra("batchMode", true); intent.putExtra("batchMode", true);
fContext.startService(intent); fContext.startService(intent);
} }
break; break;
case TaskerSettingsActivity.ACTION_UPLOAD: case TaskerSettingsActivity.ACTION_UPLOAD:
if (true) { if (true) {
Intent intent = new Intent(fContext, Intent intent = new Intent(fContext,
OfflineUploadService.class); OfflineUploadService.class);
intent.putExtra("sessionId", sessionId); intent.putExtra("sessionId", sessionId);
intent.putExtra("batchMode", true); intent.putExtra("batchMode", true);
fContext.startService(intent); fContext.startService(intent);
} }
break; break;
default: default:
Log.d(TAG, "unknown action id=" + actionId); Log.d(TAG, "unknown action id=" + actionId);
} }
} }
@Override @Override
protected void onLoginFailed(int requestId, ApiRequest ar) { protected void onLoginFailed(int requestId, ApiRequest ar) {
Toast toast = Toast.makeText(fContext, fContext.getString(ar.getErrorMessage()), Toast.LENGTH_SHORT); Toast toast = Toast.makeText(fContext, fContext.getString(ar.getErrorMessage()), Toast.LENGTH_SHORT);
toast.show(); toast.show();
} }
@Override @Override
protected void onLoggingIn(int requestId) { protected void onLoggingIn(int requestId) {
// //
} }
}; };
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String login = prefs.getString("login", "").trim(); String login = prefs.getString("login", "").trim();
String password = prefs.getString("password", "").trim(); String password = prefs.getString("password", "").trim();
String ttrssUrl = prefs.getString("ttrss_url", "").trim(); String ttrssUrl = prefs.getString("ttrss_url", "").trim();
if (ttrssUrl.equals("")) { if (ttrssUrl.equals("")) {
Toast toast = Toast.makeText(fContext, "Could not download articles: not configured?", Toast.LENGTH_SHORT); Toast toast = Toast.makeText(fContext, "Could not download articles: not configured?", Toast.LENGTH_SHORT);
toast.show(); toast.show();
} else { } else {
loginMgr.logIn(context, 1, login, password); loginMgr.logIn(context, 1, login, password);
} }
} }
} }
} }

View File

@ -1,96 +1,96 @@
package org.fox.ttrss.tasker; package org.fox.ttrss.tasker;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import org.fox.ttrss.offline.OfflineDownloadService; import org.fox.ttrss.offline.OfflineDownloadService;
import org.fox.ttrss.offline.OfflineUploadService; import org.fox.ttrss.offline.OfflineUploadService;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.RadioGroup.OnCheckedChangeListener;
public class TaskerSettingsActivity extends Activity { public class TaskerSettingsActivity extends Activity {
protected static final int ACTION_DOWNLOAD = 0; protected static final int ACTION_DOWNLOAD = 0;
protected static final int ACTION_UPLOAD = 1; protected static final int ACTION_UPLOAD = 1;
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
protected Bundle m_settings = new Bundle(); protected Bundle m_settings = new Bundle();
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Bundle settings = getIntent().getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE); Bundle settings = getIntent().getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE);
int actionId = settings != null ? settings.getInt("actionId", -1) : -1; int actionId = settings != null ? settings.getInt("actionId", -1) : -1;
setContentView(R.layout.tasker_settings); setContentView(R.layout.tasker_settings);
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.taskerActions); RadioGroup radioGroup = (RadioGroup) findViewById(R.id.taskerActions);
switch (actionId) { switch (actionId) {
case TaskerSettingsActivity.ACTION_DOWNLOAD: case TaskerSettingsActivity.ACTION_DOWNLOAD:
radioGroup.check(R.id.actionDownload); radioGroup.check(R.id.actionDownload);
break; break;
case TaskerSettingsActivity.ACTION_UPLOAD: case TaskerSettingsActivity.ACTION_UPLOAD:
radioGroup.check(R.id.actionUpload); radioGroup.check(R.id.actionUpload);
break; break;
default: default:
Log.d(TAG, "unknown action id=" + actionId); Log.d(TAG, "unknown action id=" + actionId);
} }
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(RadioGroup group, int checkedId) { public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) { switch (checkedId) {
case R.id.actionDownload: case R.id.actionDownload:
m_settings.putInt("actionId", ACTION_DOWNLOAD); m_settings.putInt("actionId", ACTION_DOWNLOAD);
break; break;
case R.id.actionUpload: case R.id.actionUpload:
m_settings.putInt("actionId", ACTION_UPLOAD); m_settings.putInt("actionId", ACTION_UPLOAD);
break; break;
} }
} }
}); });
Button button = (Button)findViewById(R.id.close_button); Button button = (Button)findViewById(R.id.close_button);
button.setOnClickListener(new OnClickListener() { button.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
finish(); finish();
} }
}); });
} }
@Override @Override
public void finish() { public void finish() {
final Intent intent = new Intent(); final Intent intent = new Intent();
intent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, m_settings); intent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE, m_settings);
String blurb = "?"; String blurb = "?";
switch (m_settings.getInt("actionId")) { switch (m_settings.getInt("actionId")) {
case TaskerSettingsActivity.ACTION_DOWNLOAD: case TaskerSettingsActivity.ACTION_DOWNLOAD:
blurb = getString(R.string.download_articles_and_go_offline); blurb = getString(R.string.download_articles_and_go_offline);
break; break;
case TaskerSettingsActivity.ACTION_UPLOAD: case TaskerSettingsActivity.ACTION_UPLOAD:
blurb = getString(R.string.synchronize_read_articles_and_go_online); blurb = getString(R.string.synchronize_read_articles_and_go_online);
break; break;
} }
intent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB, blurb); intent.putExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BLURB, blurb);
setResult(RESULT_OK, intent); setResult(RESULT_OK, intent);
super.finish(); super.finish();
} }
} }

View File

@ -1,252 +1,252 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
/* /*
* Copyright (C) 2013 Tomáš Procházka * Copyright (C) 2013 Tomáš Procházka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import java.lang.reflect.Field; import java.lang.reflect.Field;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
/** /**
* Special version of ImageView which allow enlarge width of image if android:adjustViewBounds is true. * Special version of ImageView which allow enlarge width of image if android:adjustViewBounds is true.
* *
* <p>It simulate HTML behaviour &lt;img src="" widh="100" /&gt;</p> * <p>It simulate HTML behaviour &lt;img src="" widh="100" /&gt;</p>
* <p><a href="http://stackoverflow.com/questions/6202000/imageview-one-dimension-to-fit-free-space-and-second-evaluate-to-keep-aspect-rati">Stackoverflow question link</a></p> * <p><a href="http://stackoverflow.com/questions/6202000/imageview-one-dimension-to-fit-free-space-and-second-evaluate-to-keep-aspect-rati">Stackoverflow question link</a></p>
* *
* <p>It also allow set related view which will be used as reference for size measure.</p> * <p>It also allow set related view which will be used as reference for size measure.</p>
* *
* @author Tomáš Procházka &lt;<a href="mailto:tomas.prochazka@inmite.eu">tomas.prochazka@gmail.com</a>&gt; * @author Tomáš Procházka &lt;<a href="mailto:tomas.prochazka@inmite.eu">tomas.prochazka@gmail.com</a>&gt;
* @version $Revision: 0$ ($Date: 6.6.2011 18:16:52$) * @version $Revision: 0$ ($Date: 6.6.2011 18:16:52$)
*/ */
public class EnlargingImageView extends android.widget.ImageView { public class EnlargingImageView extends android.widget.ImageView {
private int mDrawableWidth; private int mDrawableWidth;
private int mDrawableHeight; private int mDrawableHeight;
private boolean mAdjustViewBoundsL; private boolean mAdjustViewBoundsL;
private int mMaxWidthL = Integer.MAX_VALUE; private int mMaxWidthL = Integer.MAX_VALUE;
private int mMaxHeightL = Integer.MAX_VALUE; private int mMaxHeightL = Integer.MAX_VALUE;
private View relatedView; private View relatedView;
public EnlargingImageView(Context context, AttributeSet attrs, int defStyle) { public EnlargingImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
// hack for acces some private field of parent :-( // hack for acces some private field of parent :-(
Field f; Field f;
try { try {
f = android.widget.ImageView.class.getDeclaredField("mAdjustViewBounds"); f = android.widget.ImageView.class.getDeclaredField("mAdjustViewBounds");
f.setAccessible(true); f.setAccessible(true);
setAdjustViewBounds((Boolean) f.get(this)); setAdjustViewBounds((Boolean) f.get(this));
f = android.widget.ImageView.class.getDeclaredField("mMaxWidth"); f = android.widget.ImageView.class.getDeclaredField("mMaxWidth");
f.setAccessible(true); f.setAccessible(true);
setMaxWidth((Integer) f.get(this)); setMaxWidth((Integer) f.get(this));
f = android.widget.ImageView.class.getDeclaredField("mMaxHeight"); f = android.widget.ImageView.class.getDeclaredField("mMaxHeight");
f.setAccessible(true); f.setAccessible(true);
setMaxHeight((Integer) f.get(this)); setMaxHeight((Integer) f.get(this));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public EnlargingImageView(Context context, AttributeSet attrs) { public EnlargingImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, 0);
} }
public EnlargingImageView(Context context) { public EnlargingImageView(Context context) {
super(context); super(context);
} }
public void setAdjustViewBounds(boolean adjustViewBounds) { public void setAdjustViewBounds(boolean adjustViewBounds) {
super.setAdjustViewBounds(adjustViewBounds); super.setAdjustViewBounds(adjustViewBounds);
mAdjustViewBoundsL = adjustViewBounds; mAdjustViewBoundsL = adjustViewBounds;
} }
public void setMaxWidth(int maxWidth) { public void setMaxWidth(int maxWidth) {
super.setMaxWidth(maxWidth); super.setMaxWidth(maxWidth);
mMaxWidthL = maxWidth; mMaxWidthL = maxWidth;
} }
public void setMaxHeight(int maxHeight) { public void setMaxHeight(int maxHeight) {
super.setMaxHeight(maxHeight); super.setMaxHeight(maxHeight);
mMaxHeightL = maxHeight; mMaxHeightL = maxHeight;
} }
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (getDrawable() == null) { if (getDrawable() == null) {
setMeasuredDimension(0, 0); setMeasuredDimension(0, 0);
return; return;
} }
mDrawableWidth = getDrawable().getIntrinsicWidth(); mDrawableWidth = getDrawable().getIntrinsicWidth();
mDrawableHeight = getDrawable().getIntrinsicHeight(); mDrawableHeight = getDrawable().getIntrinsicHeight();
int w = 0; int w = 0;
int h = 0; int h = 0;
// Desired aspect ratio of the view's contents (not including padding) // Desired aspect ratio of the view's contents (not including padding)
float desiredAspect = 0.0f; float desiredAspect = 0.0f;
// We are allowed to change the view's width // We are allowed to change the view's width
boolean resizeWidth = false; boolean resizeWidth = false;
// We are allowed to change the view's height // We are allowed to change the view's height
boolean resizeHeight = false; boolean resizeHeight = false;
if (mDrawableWidth > 0) { if (mDrawableWidth > 0) {
w = mDrawableWidth; w = mDrawableWidth;
h = mDrawableHeight; h = mDrawableHeight;
if (w <= 0) w = 1; if (w <= 0) w = 1;
if (h <= 0) h = 1; if (h <= 0) h = 1;
// We are supposed to adjust view bounds to match the aspect // We are supposed to adjust view bounds to match the aspect
// ratio of our drawable. See if that is possible. // ratio of our drawable. See if that is possible.
if (mAdjustViewBoundsL) { if (mAdjustViewBoundsL) {
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec); int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec); int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
resizeWidth = widthSpecMode != MeasureSpec.EXACTLY; resizeWidth = widthSpecMode != MeasureSpec.EXACTLY;
resizeHeight = heightSpecMode != MeasureSpec.EXACTLY; resizeHeight = heightSpecMode != MeasureSpec.EXACTLY;
desiredAspect = (float) w / (float) h; desiredAspect = (float) w / (float) h;
} }
} }
int pleft = getPaddingLeft(); int pleft = getPaddingLeft();
int pright = getPaddingRight(); int pright = getPaddingRight();
int ptop = getPaddingTop(); int ptop = getPaddingTop();
int pbottom = getPaddingBottom(); int pbottom = getPaddingBottom();
int widthSize; int widthSize;
int heightSize; int heightSize;
if (resizeWidth || resizeHeight) { if (resizeWidth || resizeHeight) {
/* If we get here, it means we want to resize to match the /* If we get here, it means we want to resize to match the
drawables aspect ratio, and we have the freedom to change at drawables aspect ratio, and we have the freedom to change at
least one dimension. least one dimension.
*/ */
// Get the max possible width given our constraints // Get the max possible width given our constraints
widthSize = resolveAdjustedSize(w + pleft + pright, widthSize = resolveAdjustedSize(w + pleft + pright,
mMaxWidthL, widthMeasureSpec); mMaxWidthL, widthMeasureSpec);
// Get the max possible height given our constraints // Get the max possible height given our constraints
heightSize = resolveAdjustedSize(h + ptop + pbottom, heightSize = resolveAdjustedSize(h + ptop + pbottom,
mMaxHeightL, heightMeasureSpec); mMaxHeightL, heightMeasureSpec);
if (desiredAspect != 0.0f) { if (desiredAspect != 0.0f) {
// See what our actual aspect ratio is // See what our actual aspect ratio is
float actualAspect = (float) (widthSize - pleft - pright) / float actualAspect = (float) (widthSize - pleft - pright) /
(heightSize - ptop - pbottom); (heightSize - ptop - pbottom);
if (Math.abs(actualAspect - desiredAspect) > 0.0000001) { if (Math.abs(actualAspect - desiredAspect) > 0.0000001) {
// Try adjusting width to be proportional to height // Try adjusting width to be proportional to height
if (resizeWidth) { if (resizeWidth) {
int newWidth = (int) (desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright; int newWidth = (int) (desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright;
if (/*newWidth <= widthSize &&*/newWidth > 0) { if (/*newWidth <= widthSize &&*/newWidth > 0) {
widthSize = Math.min(newWidth, mMaxWidthL); widthSize = Math.min(newWidth, mMaxWidthL);
heightSize = (int) ((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom; heightSize = (int) ((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom;
} }
} }
// Try adjusting height to be proportional to width // Try adjusting height to be proportional to width
if (resizeHeight) { if (resizeHeight) {
int newHeight = (int) ((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom; int newHeight = (int) ((widthSize - pleft - pright) / desiredAspect) + ptop + pbottom;
if (/*newHeight <= heightSize && */newHeight > 0) { if (/*newHeight <= heightSize && */newHeight > 0) {
heightSize = Math.min(newHeight, mMaxHeightL); heightSize = Math.min(newHeight, mMaxHeightL);
widthSize = (int) (desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright; widthSize = (int) (desiredAspect * (heightSize - ptop - pbottom)) + pleft + pright;
} }
} }
} }
} }
} else { } else {
/* We are either don't want to preserve the drawables aspect ratio, /* We are either don't want to preserve the drawables aspect ratio,
or we are not allowed to change view dimensions. Just measure in or we are not allowed to change view dimensions. Just measure in
the normal way. the normal way.
*/ */
w += pleft + pright; w += pleft + pright;
h += ptop + pbottom; h += ptop + pbottom;
w = Math.max(w, getSuggestedMinimumWidth()); w = Math.max(w, getSuggestedMinimumWidth());
h = Math.max(h, getSuggestedMinimumHeight()); h = Math.max(h, getSuggestedMinimumHeight());
widthSize = resolveSize(w, widthMeasureSpec); widthSize = resolveSize(w, widthMeasureSpec);
heightSize = resolveSize(h, heightMeasureSpec); heightSize = resolveSize(h, heightMeasureSpec);
} }
//Log.d(Constants.LOGTAG, mDrawableWidth + ":" + mDrawableHeight + " to " + widthSize + ":" + heightSize); //Log.d(Constants.LOGTAG, mDrawableWidth + ":" + mDrawableHeight + " to " + widthSize + ":" + heightSize);
setMeasuredDimension(widthSize, heightSize); setMeasuredDimension(widthSize, heightSize);
if (relatedView != null) { if (relatedView != null) {
//Log.i(Constants.LOGTAG, getTag() + " onMeasure:" + widthSize + ", " + heightSize + " update size of related view!"); //Log.i(Constants.LOGTAG, getTag() + " onMeasure:" + widthSize + ", " + heightSize + " update size of related view!");
relatedView.getLayoutParams().width = widthSize; relatedView.getLayoutParams().width = widthSize;
relatedView.getLayoutParams().height = heightSize; relatedView.getLayoutParams().height = heightSize;
} }
} }
@Override @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom); super.onLayout(changed, left, top, right, bottom);
//Log.d(Constants.LOGTAG, getTag() + " onLayout:" + left + ", " + top + ", " + right + ", " + bottom); //Log.d(Constants.LOGTAG, getTag() + " onLayout:" + left + ", " + top + ", " + right + ", " + bottom);
} }
/** /**
* Experimental. This view will be set to the same size as this image. * Experimental. This view will be set to the same size as this image.
*/ */
public void setRelatedView(View view) { public void setRelatedView(View view) {
relatedView = view; relatedView = view;
} }
@Override @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) { protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh); super.onSizeChanged(w, h, oldw, oldh);
//Log.d(Constants.LOGTAG, getTag() + " onSizeChanged:" + w + ", " + h + ", " + oldw + ", " + oldh); //Log.d(Constants.LOGTAG, getTag() + " onSizeChanged:" + w + ", " + h + ", " + oldw + ", " + oldh);
} }
private int resolveAdjustedSize(int desiredSize, int maxSize, int measureSpec) { private int resolveAdjustedSize(int desiredSize, int maxSize, int measureSpec) {
int result = desiredSize; int result = desiredSize;
int specMode = MeasureSpec.getMode(measureSpec); int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec); int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) { switch (specMode) {
case MeasureSpec.UNSPECIFIED: case MeasureSpec.UNSPECIFIED:
/* Parent says we can be as big as we want. Just don't be larger /* Parent says we can be as big as we want. Just don't be larger
than max size imposed on ourselves. than max size imposed on ourselves.
*/ */
result = Math.min(desiredSize, maxSize); result = Math.min(desiredSize, maxSize);
break; break;
case MeasureSpec.AT_MOST: case MeasureSpec.AT_MOST:
// Parent says we can be as big as we want, up to specSize. // Parent says we can be as big as we want, up to specSize.
// Don't be larger than specSize, and don't be larger than // Don't be larger than specSize, and don't be larger than
// the max size imposed on ourselves. // the max size imposed on ourselves.
result = Math.min(Math.min(desiredSize, specSize), maxSize); result = Math.min(Math.min(desiredSize, specSize), maxSize);
break; break;
case MeasureSpec.EXACTLY: case MeasureSpec.EXACTLY:
// No choice. Do what we are told. // No choice. Do what we are told.
result = specSize; result = specSize;
break; break;
} }
return result; return result;
} }
} }

View File

@ -1,224 +1,224 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
// http://www.lukehorvat.com/blog/android-seekbardialogpreference/ // http://www.lukehorvat.com/blog/android-seekbardialogpreference/
import org.fox.ttrss.R; import org.fox.ttrss.R;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.preference.DialogPreference; import android.preference.DialogPreference;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.View; import android.view.View;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView; import android.widget.TextView;
/** /**
* A {@link DialogPreference} that provides a user with the means to select an * A {@link DialogPreference} that provides a user with the means to select an
* integer from a {@link SeekBar}, and persist it. * integer from a {@link SeekBar}, and persist it.
* *
* @author lukehorvat * @author lukehorvat
* *
*/ */
public class FontSizeDialogPreference extends DialogPreference { public class FontSizeDialogPreference extends DialogPreference {
private static final int DEFAULT_MIN_PROGRESS = 9; private static final int DEFAULT_MIN_PROGRESS = 9;
private static final int DEFAULT_MAX_PROGRESS = 24; private static final int DEFAULT_MAX_PROGRESS = 24;
private static final String DEFAULT_PROGRESS = "0"; private static final String DEFAULT_PROGRESS = "0";
private int mMinProgress = DEFAULT_MIN_PROGRESS; private int mMinProgress = DEFAULT_MIN_PROGRESS;
private int mMaxProgress = DEFAULT_MAX_PROGRESS; private int mMaxProgress = DEFAULT_MAX_PROGRESS;
private int mProgress; private int mProgress;
private CharSequence mProgressTextSuffix; private CharSequence mProgressTextSuffix;
private TextView mProgressText; private TextView mProgressText;
private SeekBar mSeekBar; private SeekBar mSeekBar;
public FontSizeDialogPreference(Context context) { public FontSizeDialogPreference(Context context) {
this(context, null); this(context, null);
} }
public FontSizeDialogPreference(Context context, AttributeSet attrs) { public FontSizeDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setProgressTextSuffix(" " + context.getString(R.string.font_size_dialog_suffix)); setProgressTextSuffix(" " + context.getString(R.string.font_size_dialog_suffix));
// set layout // set layout
setDialogLayoutResource(R.layout.select_font_size_dialog); setDialogLayoutResource(R.layout.select_font_size_dialog);
setPositiveButtonText(android.R.string.ok); setPositiveButtonText(android.R.string.ok);
setNegativeButtonText(android.R.string.cancel); setNegativeButtonText(android.R.string.cancel);
setDialogIcon(null); setDialogIcon(null);
} }
@Override @Override
protected void onSetInitialValue(boolean restore, Object defaultValue) { protected void onSetInitialValue(boolean restore, Object defaultValue) {
setProgress(restore ? Integer.valueOf(getPersistedString(DEFAULT_PROGRESS)) setProgress(restore ? Integer.valueOf(getPersistedString(DEFAULT_PROGRESS))
: Integer.valueOf((String)defaultValue)); : Integer.valueOf((String)defaultValue));
} }
@Override @Override
protected Object onGetDefaultValue(TypedArray a, int index) { protected Object onGetDefaultValue(TypedArray a, int index) {
return a.getString(index); return a.getString(index);
} }
@Override @Override
protected void onBindDialogView(View view) { protected void onBindDialogView(View view) {
super.onBindDialogView(view); super.onBindDialogView(view);
mProgressText = (TextView) view.findViewById(R.id.text_progress); mProgressText = (TextView) view.findViewById(R.id.text_progress);
mSeekBar = (SeekBar) view.findViewById(R.id.seek_bar); mSeekBar = (SeekBar) view.findViewById(R.id.seek_bar);
mSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { mSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) {
} }
@Override @Override
public void onStartTrackingTouch(SeekBar seekBar) { public void onStartTrackingTouch(SeekBar seekBar) {
} }
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) { boolean fromUser) {
// update text that displays the current SeekBar progress value // update text that displays the current SeekBar progress value
// note: this does not persist the progress value. that is only // note: this does not persist the progress value. that is only
// ever done in setProgress() // ever done in setProgress()
String progressStr = String.valueOf(progress + mMinProgress); String progressStr = String.valueOf(progress + mMinProgress);
mProgressText.setText(mProgressTextSuffix == null ? progressStr mProgressText.setText(mProgressTextSuffix == null ? progressStr
: progressStr.concat(mProgressTextSuffix.toString())); : progressStr.concat(mProgressTextSuffix.toString()));
mProgressText.setTextSize(TypedValue.COMPLEX_UNIT_SP, progress + mMinProgress); mProgressText.setTextSize(TypedValue.COMPLEX_UNIT_SP, progress + mMinProgress);
} }
}); });
mSeekBar.setMax(mMaxProgress - mMinProgress); mSeekBar.setMax(mMaxProgress - mMinProgress);
mSeekBar.setProgress(mProgress - mMinProgress); mSeekBar.setProgress(mProgress - mMinProgress);
} }
public int getMinProgress() { public int getMinProgress() {
return mMinProgress; return mMinProgress;
} }
public void setMinProgress(int minProgress) { public void setMinProgress(int minProgress) {
mMinProgress = minProgress; mMinProgress = minProgress;
setProgress(Math.max(mProgress, mMinProgress)); setProgress(Math.max(mProgress, mMinProgress));
} }
public int getMaxProgress() { public int getMaxProgress() {
return mMaxProgress; return mMaxProgress;
} }
public void setMaxProgress(int maxProgress) { public void setMaxProgress(int maxProgress) {
mMaxProgress = maxProgress; mMaxProgress = maxProgress;
setProgress(Math.min(mProgress, mMaxProgress)); setProgress(Math.min(mProgress, mMaxProgress));
} }
public int getProgress() { public int getProgress() {
return mProgress; return mProgress;
} }
public void setProgress(int progress) { public void setProgress(int progress) {
progress = Math.max(Math.min(progress, mMaxProgress), mMinProgress); progress = Math.max(Math.min(progress, mMaxProgress), mMinProgress);
if (progress != mProgress) { if (progress != mProgress) {
mProgress = progress; mProgress = progress;
persistString(String.valueOf(progress)); persistString(String.valueOf(progress));
notifyChanged(); notifyChanged();
} }
} }
public CharSequence getProgressTextSuffix() { public CharSequence getProgressTextSuffix() {
return mProgressTextSuffix; return mProgressTextSuffix;
} }
public void setProgressTextSuffix(CharSequence progressTextSuffix) { public void setProgressTextSuffix(CharSequence progressTextSuffix) {
mProgressTextSuffix = progressTextSuffix; mProgressTextSuffix = progressTextSuffix;
} }
@Override @Override
protected void onDialogClosed(boolean positiveResult) { protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult); super.onDialogClosed(positiveResult);
// when the user selects "OK", persist the new value // when the user selects "OK", persist the new value
if (positiveResult) { if (positiveResult) {
int seekBarProgress = mSeekBar.getProgress() + mMinProgress; int seekBarProgress = mSeekBar.getProgress() + mMinProgress;
if (callChangeListener(seekBarProgress)) { if (callChangeListener(seekBarProgress)) {
setProgress(seekBarProgress); setProgress(seekBarProgress);
} }
} }
} }
@Override @Override
protected Parcelable onSaveInstanceState() { protected Parcelable onSaveInstanceState() {
// save the instance state so that it will survive screen orientation // save the instance state so that it will survive screen orientation
// changes and other events that may temporarily destroy it // changes and other events that may temporarily destroy it
final Parcelable superState = super.onSaveInstanceState(); final Parcelable superState = super.onSaveInstanceState();
// set the state's value with the class member that holds current // set the state's value with the class member that holds current
// setting value // setting value
final SavedState myState = new SavedState(superState); final SavedState myState = new SavedState(superState);
myState.minProgress = getMinProgress(); myState.minProgress = getMinProgress();
myState.maxProgress = getMaxProgress(); myState.maxProgress = getMaxProgress();
myState.progress = getProgress(); myState.progress = getProgress();
return myState; return myState;
} }
@Override @Override
protected void onRestoreInstanceState(Parcelable state) { protected void onRestoreInstanceState(Parcelable state) {
// check whether we saved the state in onSaveInstanceState() // check whether we saved the state in onSaveInstanceState()
if (state == null || !state.getClass().equals(SavedState.class)) { if (state == null || !state.getClass().equals(SavedState.class)) {
// didn't save the state, so call superclass // didn't save the state, so call superclass
super.onRestoreInstanceState(state); super.onRestoreInstanceState(state);
return; return;
} }
// restore the state // restore the state
SavedState myState = (SavedState) state; SavedState myState = (SavedState) state;
setMinProgress(myState.minProgress); setMinProgress(myState.minProgress);
setMaxProgress(myState.maxProgress); setMaxProgress(myState.maxProgress);
setProgress(myState.progress); setProgress(myState.progress);
super.onRestoreInstanceState(myState.getSuperState()); super.onRestoreInstanceState(myState.getSuperState());
} }
private static class SavedState extends BaseSavedState { private static class SavedState extends BaseSavedState {
int minProgress; int minProgress;
int maxProgress; int maxProgress;
int progress; int progress;
public SavedState(Parcelable superState) { public SavedState(Parcelable superState) {
super(superState); super(superState);
} }
public SavedState(Parcel source) { public SavedState(Parcel source) {
super(source); super(source);
minProgress = source.readInt(); minProgress = source.readInt();
maxProgress = source.readInt(); maxProgress = source.readInt();
progress = source.readInt(); progress = source.readInt();
} }
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags); super.writeToParcel(dest, flags);
dest.writeInt(minProgress); dest.writeInt(minProgress);
dest.writeInt(maxProgress); dest.writeInt(maxProgress);
dest.writeInt(progress); dest.writeInt(progress);
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {
@Override @Override
public SavedState createFromParcel(Parcel in) { public SavedState createFromParcel(Parcel in) {
return new SavedState(in); return new SavedState(in);
} }
@Override @Override
public SavedState[] newArray(int size) { public SavedState[] newArray(int size) {
return new SavedState[size]; return new SavedState[size];
} }
}; };
} }
} }

View File

@ -1,37 +1,37 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.webkit.WebView; import android.webkit.WebView;
public class LessBrokenWebView extends WebView { public class LessBrokenWebView extends WebView {
public LessBrokenWebView(Context context) { public LessBrokenWebView(Context context) {
super(context); super(context);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public LessBrokenWebView(Context context, AttributeSet attrs) { public LessBrokenWebView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public LessBrokenWebView(Context context, AttributeSet attrs, int defStyle) { public LessBrokenWebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) { if (event.getAction() == MotionEvent.ACTION_DOWN) {
int temp_ScrollY = getScrollY(); int temp_ScrollY = getScrollY();
scrollTo(getScrollX(), getScrollY() + 1); scrollTo(getScrollX(), getScrollY() + 1);
scrollTo(getScrollX(), temp_ScrollY); scrollTo(getScrollX(), temp_ScrollY);
} }
return super.onTouchEvent(event); return super.onTouchEvent(event);
} }
} }

View File

@ -1,34 +1,34 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.ScrollView; import android.widget.ScrollView;
public class NoChildFocusScrollView extends ScrollView { public class NoChildFocusScrollView extends ScrollView {
public NoChildFocusScrollView(Context context) { public NoChildFocusScrollView(Context context) {
super(context); super(context);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public NoChildFocusScrollView(Context context, AttributeSet attrs) { public NoChildFocusScrollView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public NoChildFocusScrollView(Context context, AttributeSet attrs, public NoChildFocusScrollView(Context context, AttributeSet attrs,
int defStyle) { int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
@Override @Override
public void requestChildFocus(View child, View focused) { public void requestChildFocus(View child, View focused) {
if (focused instanceof WebView ) if (focused instanceof WebView )
return; return;
super.requestChildFocus(child, focused); super.requestChildFocus(child, focused);
} }
} }

View File

@ -1,105 +1,105 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
import java.util.HashMap; import java.util.HashMap;
import org.fox.ttrss.ApiRequest; import org.fox.ttrss.ApiRequest;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
public abstract class SimpleLoginManager { public abstract class SimpleLoginManager {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
protected class LoginRequest extends ApiRequest { protected class LoginRequest extends ApiRequest {
private int m_requestId; private int m_requestId;
protected String m_sessionId; protected String m_sessionId;
protected int m_apiLevel; protected int m_apiLevel;
protected Context m_context; protected Context m_context;
public LoginRequest(Context context, int requestId) { public LoginRequest(Context context, int requestId) {
super(context); super(context);
m_context = context; m_context = context;
m_requestId = requestId; m_requestId = requestId;
} }
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
Log.d(TAG, "onPostExecute"); Log.d(TAG, "onPostExecute");
if (result != null) { if (result != null) {
try { try {
JsonObject content = result.getAsJsonObject(); JsonObject content = result.getAsJsonObject();
if (content != null) { if (content != null) {
m_sessionId = content.get("session_id").getAsString(); m_sessionId = content.get("session_id").getAsString();
Log.d(TAG, "[SLM] Authenticated!"); Log.d(TAG, "[SLM] Authenticated!");
ApiRequest req = new ApiRequest(m_context) { ApiRequest req = new ApiRequest(m_context) {
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
m_apiLevel = 0; m_apiLevel = 0;
if (result != null) { if (result != null) {
try { try {
m_apiLevel = result.getAsJsonObject() m_apiLevel = result.getAsJsonObject()
.get("level").getAsInt(); .get("level").getAsInt();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
Log.d(TAG, "[SLM] Received API level: " + m_apiLevel); Log.d(TAG, "[SLM] Received API level: " + m_apiLevel);
onLoginSuccess(m_requestId, m_sessionId, m_apiLevel); onLoginSuccess(m_requestId, m_sessionId, m_apiLevel);
} }
}; };
@SuppressWarnings("serial") @SuppressWarnings("serial")
HashMap<String, String> map = new HashMap<String, String>() { HashMap<String, String> map = new HashMap<String, String>() {
{ {
put("sid", m_sessionId); put("sid", m_sessionId);
put("op", "getApiLevel"); put("op", "getApiLevel");
} }
}; };
req.execute(map); req.execute(map);
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
m_sessionId = null; m_sessionId = null;
onLoginFailed(m_requestId, this); onLoginFailed(m_requestId, this);
} }
} }
public void logIn(Context context, int requestId, final String login, final String password) { public void logIn(Context context, int requestId, final String login, final String password) {
LoginRequest ar = new LoginRequest(context, requestId); LoginRequest ar = new LoginRequest(context, requestId);
HashMap<String, String> map = new HashMap<String, String>() { HashMap<String, String> map = new HashMap<String, String>() {
{ {
put("op", "login"); put("op", "login");
put("user", login.trim()); put("user", login.trim());
put("password", password.trim()); put("password", password.trim());
} }
}; };
onLoggingIn(requestId); onLoggingIn(requestId);
ar.execute(map); ar.execute(map);
} }
protected abstract void onLoggingIn(int requestId); protected abstract void onLoggingIn(int requestId);
protected abstract void onLoginSuccess(int requestId, String sessionId, int apiLevel); protected abstract void onLoginSuccess(int requestId, String sessionId, int apiLevel);
protected abstract void onLoginFailed(int requestId, ApiRequest ar); protected abstract void onLoginFailed(int requestId, ApiRequest ar);
} }

View File

@ -1,29 +1,29 @@
package org.fox.ttrss.util; package org.fox.ttrss.util;
import java.util.Hashtable; import java.util.Hashtable;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.util.Log; import android.util.Log;
public class TypefaceCache { public class TypefaceCache {
private static final String TAG = "TypefaceCache"; private static final String TAG = "TypefaceCache";
private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>(); private static final Hashtable<String, Typeface> cache = new Hashtable<String, Typeface>();
public static Typeface get(Context c, String typefaceName, int style) { public static Typeface get(Context c, String typefaceName, int style) {
synchronized (cache) { synchronized (cache) {
String key = typefaceName + ":" + style; String key = typefaceName + ":" + style;
if (!cache.containsKey(key)) { if (!cache.containsKey(key)) {
try { try {
Typeface t = Typeface.create(typefaceName, style); Typeface t = Typeface.create(typefaceName, style);
cache.put(key, t); cache.put(key, t);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Could not get typeface '" + typefaceName + "' because " + e.getMessage()); Log.e(TAG, "Could not get typeface '" + typefaceName + "' because " + e.getMessage());
return null; return null;
} }
} }
return cache.get(key); return cache.get(key);
} }
} }
} }

View File

@ -1,65 +1,65 @@
package org.fox.ttrss.widget; package org.fox.ttrss.widget;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException; import android.app.PendingIntent.CanceledException;
import android.app.Service; import android.app.Service;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetProvider;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.util.Log;
import android.widget.RemoteViews; import android.widget.RemoteViews;
public class SmallWidgetProvider extends AppWidgetProvider { public class SmallWidgetProvider extends AppWidgetProvider {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
public static final String FORCE_UPDATE_ACTION = "org.fox.ttrss.WIDGET_FORCE_UPDATE"; public static final String FORCE_UPDATE_ACTION = "org.fox.ttrss.WIDGET_FORCE_UPDATE";
@Override @Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
//RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_small); //RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_small);
final int N = appWidgetIds.length; final int N = appWidgetIds.length;
for (int i=0; i < N; i++) { for (int i=0; i < N; i++) {
int appWidgetId = appWidgetIds[i]; int appWidgetId = appWidgetIds[i];
Intent updateIntent = new Intent(context, org.fox.ttrss.widget.WidgetUpdateService.class); Intent updateIntent = new Intent(context, org.fox.ttrss.widget.WidgetUpdateService.class);
PendingIntent updatePendingIntent = PendingIntent.getService(context, 0, updateIntent, 0); PendingIntent updatePendingIntent = PendingIntent.getService(context, 0, updateIntent, 0);
Intent intent = new Intent(context, org.fox.ttrss.OnlineActivity.class); Intent intent = new Intent(context, org.fox.ttrss.OnlineActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_small); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_small);
views.setOnClickPendingIntent(R.id.widget_main, pendingIntent); views.setOnClickPendingIntent(R.id.widget_main, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, views); appWidgetManager.updateAppWidget(appWidgetId, views);
try { try {
updatePendingIntent.send(); updatePendingIntent.send();
} catch (CanceledException e) { } catch (CanceledException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent); super.onReceive(context, intent);
if (FORCE_UPDATE_ACTION.equals(intent.getAction())) { if (FORCE_UPDATE_ACTION.equals(intent.getAction())) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
ComponentName thisAppWidget = new ComponentName(context.getPackageName(), SmallWidgetProvider.class.getName()); ComponentName thisAppWidget = new ComponentName(context.getPackageName(), SmallWidgetProvider.class.getName());
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget);
onUpdate(context, appWidgetManager, appWidgetIds); onUpdate(context, appWidgetManager, appWidgetIds);
} }
} }
} }

View File

@ -1,141 +1,141 @@
package org.fox.ttrss.widget; package org.fox.ttrss.widget;
import java.util.HashMap; import java.util.HashMap;
import org.fox.ttrss.ApiRequest; import org.fox.ttrss.ApiRequest;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import org.fox.ttrss.util.SimpleLoginManager; import org.fox.ttrss.util.SimpleLoginManager;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import android.app.Service; import android.app.Service;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.IBinder; import android.os.IBinder;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.RemoteViews; import android.widget.RemoteViews;
public class WidgetUpdateService extends Service { public class WidgetUpdateService extends Service {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
Log.d(TAG, "onBind"); Log.d(TAG, "onBind");
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
/* @Override /* @Override
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
Log.d(TAG, "onStartCommand"); Log.d(TAG, "onStartCommand");
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
} */ } */
public void update() { public void update() {
} }
@Override @Override
public void onStart(Intent intent, int startId) { public void onStart(Intent intent, int startId) {
final RemoteViews view = new RemoteViews(getPackageName(), R.layout.widget_small); final RemoteViews view = new RemoteViews(getPackageName(), R.layout.widget_small);
final ComponentName thisWidget = new ComponentName(this, SmallWidgetProvider.class); final ComponentName thisWidget = new ComponentName(this, SmallWidgetProvider.class);
final AppWidgetManager manager = AppWidgetManager.getInstance(this); final AppWidgetManager manager = AppWidgetManager.getInstance(this);
try { try {
view.setTextViewText(R.id.counter, String.valueOf("")); view.setTextViewText(R.id.counter, String.valueOf(""));
view.setViewVisibility(R.id.progress, View.VISIBLE); view.setViewVisibility(R.id.progress, View.VISIBLE);
manager.updateAppWidget(thisWidget, view); manager.updateAppWidget(thisWidget, view);
final SharedPreferences m_prefs = PreferenceManager final SharedPreferences m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext()); .getDefaultSharedPreferences(getApplicationContext());
if (m_prefs.getString("ttrss_url", "").trim().length() == 0) { if (m_prefs.getString("ttrss_url", "").trim().length() == 0) {
// Toast: need configure // Toast: need configure
} else { } else {
SimpleLoginManager loginManager = new SimpleLoginManager() { SimpleLoginManager loginManager = new SimpleLoginManager() {
@Override @Override
protected void onLoginSuccess(int requestId, String sessionId, int apiLevel) { protected void onLoginSuccess(int requestId, String sessionId, int apiLevel) {
ApiRequest aru = new ApiRequest(getApplicationContext()) { ApiRequest aru = new ApiRequest(getApplicationContext()) {
@Override @Override
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
if (result != null) { if (result != null) {
try { try {
JsonObject content = result.getAsJsonObject(); JsonObject content = result.getAsJsonObject();
if (content != null) { if (content != null) {
int unread = content.get("unread").getAsInt(); int unread = content.get("unread").getAsInt();
view.setViewVisibility(R.id.progress, View.GONE); view.setViewVisibility(R.id.progress, View.GONE);
view.setTextViewText(R.id.counter, String.valueOf(unread)); view.setTextViewText(R.id.counter, String.valueOf(unread));
manager.updateAppWidget(thisWidget, view); manager.updateAppWidget(thisWidget, view);
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
view.setViewVisibility(R.id.progress, View.GONE); view.setViewVisibility(R.id.progress, View.GONE);
view.setTextViewText(R.id.counter, "?"); view.setTextViewText(R.id.counter, "?");
manager.updateAppWidget(thisWidget, view); manager.updateAppWidget(thisWidget, view);
} }
}; };
final String fSessionId = sessionId; final String fSessionId = sessionId;
HashMap<String, String> umap = new HashMap<String, String>() { HashMap<String, String> umap = new HashMap<String, String>() {
{ {
put("op", "getUnread"); put("op", "getUnread");
put("sid", fSessionId); put("sid", fSessionId);
} }
}; };
aru.execute(umap); aru.execute(umap);
} }
@Override @Override
protected void onLoginFailed(int requestId, ApiRequest ar) { protected void onLoginFailed(int requestId, ApiRequest ar) {
view.setViewVisibility(R.id.progress, View.GONE); view.setViewVisibility(R.id.progress, View.GONE);
view.setTextViewText(R.id.counter, "?"); view.setTextViewText(R.id.counter, "?");
manager.updateAppWidget(thisWidget, view); manager.updateAppWidget(thisWidget, view);
} }
@Override @Override
protected void onLoggingIn(int requestId) { protected void onLoggingIn(int requestId) {
} }
}; };
String login = m_prefs.getString("login", "").trim(); String login = m_prefs.getString("login", "").trim();
String password = m_prefs.getString("password", "").trim(); String password = m_prefs.getString("password", "").trim();
loginManager.logIn(getApplicationContext(), 1, login, password); loginManager.logIn(getApplicationContext(), 1, login, password);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
view.setViewVisibility(R.id.progress, View.GONE); view.setViewVisibility(R.id.progress, View.GONE);
view.setTextViewText(R.id.counter, getString(R.string.app_name)); view.setTextViewText(R.id.counter, getString(R.string.app_name));
manager.updateAppWidget(thisWidget, view); manager.updateAppWidget(thisWidget, view);
} }
} }
} }

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<alpha <alpha
android:fromAlpha="0" android:fromAlpha="0"
android:toAlpha="1" android:toAlpha="1"
android:duration="150" android:duration="150"
/> />
</set> </set>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<alpha <alpha
android:fromAlpha="0" android:fromAlpha="0"
android:toAlpha="1" android:toAlpha="1"
android:duration="250" android:duration="250"
/> />
<translate <translate
android:fromXDelta="100%p" android:fromXDelta="100%p"
android:toXDelta="0" android:toXDelta="0"
android:duration="250" android:duration="250"
/> />
</set> </set>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android" <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="20%" android:delay="20%"
android:animation="@anim/feed_item" android:animation="@anim/feed_item"
/> />

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android" <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="20%" android:delay="20%"
android:animation="@anim/headline_item" android:animation="@anim/headline_item"
/> />

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

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