Merge branch 'master' into feature/page-indicator

This commit is contained in:
Christine Emrich 2015-04-01 15:09:19 +02:00
commit c6d1f7a477
31 changed files with 38 additions and 2507 deletions

1
.gitignore vendored
View file

@ -22,6 +22,7 @@ local.properties
# Eclipse project files
.classpath
.project
.settings
# Android Studio
.idea/

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OwncloudNewsReader</name>
<comment></comment>
<projects>
<project>ActionBarSherlock</project>
<project>Android-PullToRefresh</project>
</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,4 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,2 +0,0 @@
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

View file

@ -1,21 +0,0 @@
<?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="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,189 +0,0 @@
<?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="News-Android-App" 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=":News-Android-App" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<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" />
<output-test url="file://$MODULE_DIR$/build/test-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/res/generated/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$/build/generated/res/generated/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/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" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
<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" />
<excludeFolder url="file://$MODULE_DIR$/build/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/test-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/test-report" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="library" exported="" name="greendao-1.3.7" level="project" />
<orderEntry type="library" exported="" name="gson-2.2.4" level="project" />
<orderEntry type="library" exported="" name="greendao-generator-1.3.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.7.2" level="project" />
<orderEntry type="library" exported="" name="library-3.0.0" level="project" />
<orderEntry type="library" exported="" name="picasso-2.3.1" level="project" />
<orderEntry type="library" exported="" name="eventbus-2.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" name="freemarker-2.3.18" level="project" />
<orderEntry type="library" exported="" name="butterknife-5.1.2" level="project" />
<orderEntry type="module" module-name="library" exported="" />
<orderEntry type="module" module-name="ownCloud-Account-Importer" exported="" />
<orderEntry type="module" module-name="android-HoloCircularProgressBar-library" exported="" />
<orderEntry type="module" module-name="MessageBar" exported="" />
<orderEntry type="module" module-name="ChangeLogLibrary" exported="" />
<orderEntry type="library" exported="" scope="TEST" name="ownCloud-Account-Importer-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-2.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-codec-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="butterknife-5.1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ChangeLogLibrary-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpclient-4.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="freemarker-2.3.18" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="picasso-2.3.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="greendao-generator-1.3.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="MessageBar-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsoup-1.7.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="eventbus-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="greendao-1.3.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="gson-2.2.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpcore-4.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-2.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-logging-1.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-3.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="objenesis-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ownCloud-Account-Importer-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-2.4.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-2.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-codec-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="butterknife-5.1.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ChangeLogLibrary-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpclient-4.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="freemarker-2.3.18" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="picasso-2.3.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="greendao-generator-1.3.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="MessageBar-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="jsoup-1.7.2" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="eventbus-2.2.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="greendao-1.3.7" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="gson-2.2.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="httpcore-4.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-2.4" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="commons-logging-1.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-release" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="library-3.0.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="objenesis-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
</component>
</module>

View file

@ -13,7 +13,6 @@ import org.robolectric.annotation.Config;
import java.util.List;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseHelperOrm;
import de.luhmer.owncloudnewsreader.database.model.DaoSession;

View file

@ -127,11 +127,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
mTextColorLightTheme = mContext.getResources().getColor(R.color.slider_listview_text_color_light_theme);
//int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
//Use 1/8 of the available memory for this memory cache
//int cachSize = maxMemory / 8;
//favIconCache = new BitmapDrawableLruCache(cachSize);
fHelper = new FontHelper(mContext);
unreadCountFeeds = new SparseArray<String>();
@ -462,26 +457,6 @@ public class SubscriptionExpandableListAdapter extends BaseExpandableListAdapter
}
/*
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void SetUnreadCountForFeed(TextView textView, String idDatabase, boolean execludeStarredItems)
{
IGetTextForTextViewAsyncTask iGetter = new UnreadFeedCount(mContext, idDatabase, execludeStarredItems);
FillTextForTextViewHelper.FillTextForTextView(textView, iGetter, !mIsTwoPane);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void SetUnreadCountForFolder(TextView textView, String idDatabase)
{
IGetTextForTextViewAsyncTask iGetter = new UnreadFolderCount(mContext, idDatabase);
FillTextForTextViewHelper.FillTextForTextView(textView, iGetter, !mIsTwoPane);
}
*/
static class GroupHolder
{
@InjectView(R.id.summary) TextView txt_Summary;

View file

@ -1,55 +0,0 @@
/**
* Android ownCloud News
*
* @author David Luhmer
* @copyright 2013 David Luhmer david-dev@live.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.luhmer.owncloudnewsreader.ListView;
import android.content.Context;
import de.luhmer.owncloudnewsreader.async_tasks.IGetTextForTextViewAsyncTask;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
@Deprecated
public class UnreadFeedCount implements IGetTextForTextViewAsyncTask {
Context context;
String idDatabase;
boolean execludeStarredItems;
public UnreadFeedCount(Context context, String idDatabase, boolean execludeStarredItems) {
this.context = context;
this.idDatabase = idDatabase;
this.execludeStarredItems = execludeStarredItems;
}
@Override
public String getText() {
DatabaseConnection dbConn = new DatabaseConnection(context);
int unread = 0;
try
{
unread = dbConn.getCountItemsForSubscription(idDatabase, true, execludeStarredItems);
} finally {
dbConn.closeDatabase();
}
return String.valueOf(unread);
}
}

View file

@ -1,53 +0,0 @@
/**
* Android ownCloud News
*
* @author David Luhmer
* @copyright 2013 David Luhmer david-dev@live.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.luhmer.owncloudnewsreader.ListView;
import android.content.Context;
import de.luhmer.owncloudnewsreader.async_tasks.IGetTextForTextViewAsyncTask;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
@Deprecated
public class UnreadFolderCount implements IGetTextForTextViewAsyncTask {
Context context;
String idDatabase;
public UnreadFolderCount(Context context, String idDatabase) {
this.context = context;
this.idDatabase = idDatabase;
}
@Override
public String getText() {
DatabaseConnection dbConn = new DatabaseConnection(context);
int unread = 0;
try
{
unread = dbConn.getCountFeedsForFolder(idDatabase, true);
} finally {
dbConn.closeDatabase();
}
return String.valueOf(unread);
}
}

View file

@ -21,7 +21,6 @@
package de.luhmer.owncloudnewsreader;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -38,7 +37,6 @@ import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
@ -48,8 +46,8 @@ import android.widget.ProgressBar;
import butterknife.ButterKnife;
import butterknife.InjectView;
import de.greenrobot.dao.query.LazyList;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.model.RssItem;
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;

View file

@ -29,10 +29,8 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -53,8 +51,8 @@ import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.adapter.NewsListArrayAdapter;
import de.luhmer.owncloudnewsreader.cursor.IOnStayUnread;
import de.luhmer.owncloudnewsreader.cursor.NewsListCursorAdapter;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.model.RssItem;
import de.luhmer.owncloudnewsreader.services.PodcastDownloadService;
@ -75,13 +73,6 @@ public class NewsReaderDetailFragment extends ListFragment implements IOnStayUnr
//private boolean DialogShowedToMarkLastItemsAsRead = false;
/*
private NewsListCursorAdapter lvAdapter;
public NewsListCursorAdapter getLvAdapter() {
return lvAdapter;
}*/
Long idFeed;
/**
* @return the idFeed
@ -293,10 +284,6 @@ public class NewsReaderDetailFragment extends ListFragment implements IOnStayUnr
NewsListArrayAdapter nca = (NewsListArrayAdapter) getListAdapter();
if(nca != null)
nca.notifyDataSetChanged();
//NewsListCursorAdapter nca = (NewsListCursorAdapter) getListAdapter();
//if(nca != null)
//((NewsListCursorAdapter) getListAdapter()).notifyDataSetChanged();
}
/**

View file

@ -27,12 +27,10 @@ import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.SlidingPaneLayout;
@ -57,7 +55,6 @@ import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.LoginDialogFragment.LoginSuccessfullListener;
import de.luhmer.owncloudnewsreader.adapter.NewsListArrayAdapter;
import de.luhmer.owncloudnewsreader.authentication.AccountGeneral;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.DatabaseHelperOrm;
import de.luhmer.owncloudnewsreader.database.model.DaoSession;
@ -249,7 +246,7 @@ public class NewsReaderListActivity extends MenuUtilsFragmentActivity implements
/* Test 2 */
for (Folder folder : folderList) {
String query = dbConn.getAllItemsIdsForFolderSQL(folder.getId(), true, DatabaseConnection.SORT_DIRECTION.asc);
String query = dbConn.getAllItemsIdsForFolderSQL(folder.getId(), true, DatabaseConnectionOrm.SORT_DIRECTION.asc);
dbConn.insertIntoRssCurrentViewTable(query);
//Log.d(TAG, "Inserting time needed: " + (System.currentTimeMillis() - start) + " ms");

View file

@ -21,12 +21,9 @@
package de.luhmer.owncloudnewsreader.async_tasks;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.util.Log;
import org.apache.http.util.ByteArrayBuffer;
@ -41,7 +38,6 @@ import java.net.URLConnection;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.model.Feed;
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
@ -70,8 +66,7 @@ public class GetImageThreaded extends Thread
}
catch(Exception ex)
{
Log.d(TAG, ex.getLocalizedMessage() + " - URL: " + WEB_URL_TO_FILE);
//ex.printStackTrace();
Log.d(TAG, "Invalid URL: " + WEB_URL_TO_FILE, ex);
}
this.cont = cont;

View file

@ -21,422 +21,23 @@
package de.luhmer.owncloudnewsreader.cursor;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.support.v4.widget.CursorAdapter;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.format.DateUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.webkit.WebView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
import de.luhmer.owncloudnewsreader.R;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.async_tasks.IGetTextForTextViewAsyncTask;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.FillTextForTextViewHelper;
import de.luhmer.owncloudnewsreader.helper.FontHelper;
import de.luhmer.owncloudnewsreader.helper.PostDelayHandler;
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
import de.luhmer.owncloudnewsreader.reader.IReader;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
@Deprecated
public class NewsListCursorAdapter extends CursorAdapter {
//private static final String TAG = "NewsListCursorAdapter";
DatabaseConnection dbConn;
IReader _Reader;
//SimpleDateFormat simpleDateFormat;
final int LengthBody = 400;
ForegroundColorSpan bodyForegroundColor;
IOnStayUnread onStayUnread;
PostDelayHandler pDelayHandler;
int selectedDesign = 0;
@SuppressLint("SimpleDateFormat")
@SuppressWarnings("deprecation")
public NewsListCursorAdapter(Context context, Cursor c, IOnStayUnread onStayUnread) {
super(context, c);
this.onStayUnread = onStayUnread;
pDelayHandler = new PostDelayHandler(context);
//simpleDateFormat = new SimpleDateFormat("EEE, d. MMM HH:mm:ss");
bodyForegroundColor = new ForegroundColorSpan(context.getResources().getColor(android.R.color.secondary_text_dark));
_Reader = new OwnCloud_Reader();
dbConn = new DatabaseConnection(context);
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
selectedDesign = Integer.valueOf(mPrefs.getString(SettingsActivity.SP_FEED_LIST_LAYOUT, "0"));
}
@Override
public void bindView(final View view, final Context context, Cursor cursor) {
final String idItemDb = cursor.getString(0);
switch (selectedDesign) {
case 0:
setSimpleLayout(view, cursor);
break;
case 1:
setExtendedLayout(view, cursor);
break;
case 2:
setExtendedLayoutWebView(view, cursor);
break;
default:
break;
}
FontHelper fHelper = new FontHelper(context);
fHelper.setFontForAllChildren(view, fHelper.getFont());
CheckBox cbStarred = (CheckBox) view.findViewById(R.id.cb_lv_item_starred);
if(ThemeChooser.isDarkTheme(mContext))
cbStarred.setBackgroundResource(R.drawable.checkbox_background_holo_dark);
/*
//The default is white so we don't need to set it here again..
else
cbStarred.setBackgroundResource(R.drawable.checkbox_background_holo_light);*/
cbStarred.setOnCheckedChangeListener(null);
Boolean isStarred = dbConn.isFeedUnreadStarred(cursor.getString(0), false);//false => starred will be checked
//Log.d("ISSTARRED", "" + isStarred + " - Cursor: " + cursor.getString(0));
cbStarred.setChecked(isStarred);
cbStarred.setClickable(true);
cbStarred.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
dbConn.updateIsStarredOfItem(idItemDb, isChecked);
if(isChecked)
UpdateIsReadCheckBox(buttonView, idItemDb);
pDelayHandler.DelayTimer();
}
});
LinearLayout ll_cb_starred_wrapper = (LinearLayout) view.findViewById(R.id.ll_cb_starred_wrapper);
if(ll_cb_starred_wrapper != null) {
ll_cb_starred_wrapper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CheckBox cbStarred = (CheckBox) view.findViewById(R.id.cb_lv_item_starred);
cbStarred.setChecked(!cbStarred.isChecked());
}
});
}
CheckBox cbRead = (CheckBox) view.findViewById(R.id.cb_lv_item_read);
cbRead.setTag(idItemDb);
cbRead.setOnCheckedChangeListener(null);
Boolean isChecked = dbConn.isFeedUnreadStarred(cursor.getString(0), true);
//Log.d("ISREAD", "" + isChecked + " - Cursor: " + cursor.getString(0));
cbRead.setChecked(isChecked);
if(!isChecked) {
TextView textView = (TextView) view.findViewById(R.id.summary);
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
}
cbRead.setClickable(true);
cbRead.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
ChangeReadStateOfItem((CheckBox) buttonView, view, isChecked, context);
}
});
String colorString = dbConn.getAvgColourOfFeedByDbId(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID)));
View viewColor = view.findViewById(R.id.color_line_feed);
if(colorString != null)
viewColor.setBackgroundColor(Integer.parseInt(colorString));
}
public void ChangeReadStateOfItem(CheckBox checkBox, View parentView, boolean isChecked, Context context) {
dbConn.updateIsReadOfItem(checkBox.getTag().toString(), isChecked);
UpdateListCursor(mContext);
pDelayHandler.DelayTimer();
TextView textView = (TextView) parentView.findViewById(R.id.summary);
if(textView != null && parentView.getTop() >= 0)
{
FontHelper fHelper = new FontHelper(context);
if(isChecked)
fHelper.setFontStyleForSingleView(textView, fHelper.getFont());
//textView.setTextAppearance(mContext, R.style.RobotoFontStyle);
else {
fHelper.setFontStyleForSingleView(textView, fHelper.getFontUnreadStyle());
onStayUnread.stayUnread(checkBox);
}
//textView.setTextAppearance(mContext, R.style.RobotoFontStyleBold);
textView.invalidate();
}
}
public void setSimpleLayout(View view, Cursor cursor)
{
SimpleLayout simpleLayout = new SimpleLayout(view);
simpleLayout.textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
simpleLayout.textViewItemDate.setText(dateString);
simpleLayout.textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
simpleLayout.textViewSummary.setTag(cursor.getString(0));
if(!ThemeChooser.isDarkTheme(mContext)) {
simpleLayout.viewDivider.setBackgroundColor(mContext.getResources().getColor(R.color.divider_row_color_light_theme));
}
}
static class SimpleLayout {
@InjectView(R.id.divider) View viewDivider;
@InjectView(R.id.summary) TextView textViewSummary;
@InjectView(R.id.tv_item_date) TextView textViewItemDate;
@InjectView(R.id.tv_subscription) TextView textViewTitle;
SimpleLayout(View view) {
ButterKnife.inject(this, view);
}
}
public void setExtendedLayout(View view, Cursor cursor)
{
ExtendedLayout extendedLayout = new ExtendedLayout(view);
extendedLayout.textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))).toString());
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
//textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
String dateString = (String) DateUtils.getRelativeTimeSpanString(pubDate);
extendedLayout.textViewItemDate.setText(dateString);
extendedLayout.textViewItemBody.setVisibility(View.INVISIBLE);
String idItemDb = cursor.getString(0);
IGetTextForTextViewAsyncTask iGetter = new DescriptionTextGetter(idItemDb);
FillTextForTextViewHelper.FillTextForTextView(extendedLayout.textViewItemBody, iGetter, true);
extendedLayout.textViewTitle.setText(dbConn.getTitleOfSubscriptionByRowID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
extendedLayout.textViewSummary.setTag(cursor.getString(0));
if(!ThemeChooser.isDarkTheme(mContext)) {
extendedLayout.textViewItemBody.setTextColor(mContext.getResources().getColor(R.color.extended_listview_item_body_text_color_light_theme));
extendedLayout.viewDivider.setBackgroundColor(mContext.getResources().getColor(R.color.divider_row_color_light_theme));
}
}
static class ExtendedLayout {
@InjectView(R.id.divider) View viewDivider;
@InjectView(R.id.summary) TextView textViewSummary;
@InjectView(R.id.tv_item_date) TextView textViewItemDate;
@InjectView(R.id.body) TextView textViewItemBody;
@InjectView(R.id.tv_subscription) TextView textViewTitle;
ExtendedLayout(View view) {
ButterKnife.inject(this, view);
}
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setExtendedLayoutWebView(View view, Cursor cursor)
{
WebView webViewContent = (WebView) view.findViewById(R.id.webView_body);
webViewContent.setClickable(false);
webViewContent.setFocusable(false);
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
// webViewContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//webViewContent.loadDataWithBaseURL("", NewsDetailFragment.getHtmlPage(mContext, dbConn , cursor.getInt(0)), "text/html", "UTF-8", ""); //This line is needed to run the adapter
}
public void CloseDatabaseConnection()
{
if(dbConn != null)
dbConn.closeDatabase();
}
private void UpdateIsReadCheckBox(View view, String idItemDb)
{
LinearLayout lLayout = (LinearLayout) view.getParent();
Boolean isChecked = dbConn.isFeedUnreadStarred(idItemDb, true);
CheckBox cbRead = (CheckBox) lLayout.findViewById(R.id.cb_lv_item_read);
if(cbRead == null) {//In the default layout the star checkbox is nested two times.
lLayout = (LinearLayout) lLayout.getParent();
cbRead = (CheckBox) lLayout.findViewById(R.id.cb_lv_item_read);
}
cbRead.setChecked(isChecked);
}
public class NewsListCursorAdapter
{
public static void ChangeCheckBoxState(CheckBox cb, boolean state, Context context)
{
if(cb != null && cb.isChecked() != state)
cb.setChecked(state);
}
public static void UpdateListCursor(Context context)
{
FragmentActivity sfa = (FragmentActivity) context;
if(sfa instanceof NewsReaderListActivity && ((NewsReaderListActivity) sfa).isSlidingPaneOpen())
((NewsReaderListActivity) sfa).updateAdapter();
}
private String getBodyText(String body)
{
body = body.replaceAll("<img[^>]*>", "");
body = body.replaceAll("<video[^>]*>", "");
SpannableString bodyStringSpannable = new SpannableString(Html.fromHtml(body));
bodyStringSpannable.setSpan(bodyForegroundColor, 0, bodyStringSpannable.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
String bodyString = bodyStringSpannable.toString().trim();
if(bodyString.length() > LengthBody)
bodyString = bodyString.substring(0, LengthBody);
return bodyString;
}
@Override
public View newView(Context cont, Cursor cursor, ViewGroup parent) {
// when the view will be created for first time,
// we need to tell the adapters, how each item will look
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View retView = null;
switch (selectedDesign) {
case 0:
retView = inflater.inflate(R.layout.subscription_detail_list_item_simple, parent, false);
break;
case 1:
retView = inflater.inflate(R.layout.subscription_detail_list_item_extended, parent, false);
break;
case 2:
retView = inflater.inflate(R.layout.subscription_detail_list_item_extended_webview, parent, false);
break;
}
if(retView != null)
retView.setTag(cursor.getString(0));
return retView;
}
class DescriptionTextGetter implements IGetTextForTextViewAsyncTask {
private String idItemDb;
public DescriptionTextGetter(String idItemDb) {
this.idItemDb = idItemDb;
}
@Override
public String getText() {
DatabaseConnection dbConn = new DatabaseConnection(mContext);
Cursor cursor = dbConn.getItemByDbID(idItemDb);
cursor.moveToFirst();
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
String result = getBodyText(body);
cursor.close();
return result;
}
}
/*
class DescriptionTextLoaderTask extends AsyncTask<Void, Void, String> {
private String idItemDb;
private final WeakReference<TextView> textViewWeakReference;
public DescriptionTextLoaderTask(TextView textView, String idItemDb) {
textViewWeakReference = new WeakReference<TextView>(textView);
this.idItemDb = idItemDb;
}
@Override
// Actual download method, run in the task thread
protected String doInBackground(Void... params) {
DatabaseConnection dbConn = new DatabaseConnection(mContext);
Cursor cursor = dbConn.getItemByDbID(idItemDb);
cursor.moveToFirst();
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
String result = getBodyText(body);
cursor.close();
return result;
}
@Override
// Once the image is downloaded, associates it to the imageView
protected void onPostExecute(String text) {
if (isCancelled()) {
text = null;
}
if (textViewWeakReference != null) {
TextView textView = textViewWeakReference.get();
if (textView != null) {
textView.setText(text);
FadeInTextView(textView);
}
}
}
}
*/
public static void FadeInTextView(final TextView textView)
{
Animation fadeOut = new AlphaAnimation(0, 1);

View file

@ -43,13 +43,14 @@ public class DatabaseConnectionOrm {
this.add("audio/ogg");
this.add("audio/opus");
this.add("audio/ogg;codecs=opus");
this.add("audio/x-m4a");
this.add("youtube");
}
};
public static final String[] VIDEO_FORMATS = { "youtube" };
public enum SORT_DIRECTION { asc, desc }
DaoSession daoSession;
@ -330,11 +331,11 @@ public class DatabaseConnectionOrm {
}
public LazyList<RssItem> getCurrentRssItemView(DatabaseConnection.SORT_DIRECTION sortDirection) {
public LazyList<RssItem> getCurrentRssItemView(SORT_DIRECTION sortDirection) {
WhereCondition whereCondition = new WhereCondition.StringCondition(RssItemDao.Properties.Id.columnName + " IN " +
"(SELECT " + CurrentRssItemViewDao.Properties.RssItemId.columnName + " FROM " + CurrentRssItemViewDao.TABLENAME + ")");
if(sortDirection.equals(DatabaseConnection.SORT_DIRECTION.asc))
if(sortDirection.equals(SORT_DIRECTION.asc))
return daoSession.getRssItemDao().queryBuilder().where(whereCondition).orderAsc(RssItemDao.Properties.PubDate).listLazy();
else
return daoSession.getRssItemDao().queryBuilder().where(whereCondition).orderDesc(RssItemDao.Properties.PubDate).listLazy();
@ -367,7 +368,7 @@ public class DatabaseConnectionOrm {
}
public String getAllItemsIdsForFeedSQL(long idFeed, boolean onlyUnread, boolean onlyStarredItems, DatabaseConnection.SORT_DIRECTION sortDirection) {
public String getAllItemsIdsForFeedSQL(long idFeed, boolean onlyUnread, boolean onlyStarredItems, SORT_DIRECTION sortDirection) {
String buildSQL = "SELECT " + RssItemDao.Properties.Id.columnName +
" FROM " + RssItemDao.TABLENAME +
@ -394,17 +395,17 @@ public class DatabaseConnectionOrm {
return (rssItem != null) ? rssItem.getId() : 0;
}
public List<RssItem> getListOfAllItemsForFolder(long ID_FOLDER, boolean onlyUnread, DatabaseConnection.SORT_DIRECTION sortDirection, int limit) {
public List<RssItem> getListOfAllItemsForFolder(long ID_FOLDER, boolean onlyUnread, SORT_DIRECTION sortDirection, int limit) {
String whereStatement = getAllItemsIdsForFolderSQL(ID_FOLDER, onlyUnread, sortDirection);
whereStatement = whereStatement.replace("SELECT " + RssItemDao.Properties.Id.columnName + " FROM " + RssItemDao.TABLENAME, "");
whereStatement += " LIMIT " + limit;
return daoSession.getRssItemDao().queryRaw(whereStatement, null);
}
public String getAllItemsIdsForFolderSQL(long ID_FOLDER, boolean onlyUnread, DatabaseConnection.SORT_DIRECTION sortDirection) {
public String getAllItemsIdsForFolderSQL(long ID_FOLDER, boolean onlyUnread, SORT_DIRECTION sortDirection) {
//If all starred items are requested always return them in desc. order
if(ID_FOLDER == ALL_STARRED_ITEMS.getValue())
sortDirection = DatabaseConnection.SORT_DIRECTION.desc;
sortDirection = SORT_DIRECTION.desc;
String buildSQL = "SELECT " + RssItemDao.Properties.Id.columnName +
" FROM " + RssItemDao.TABLENAME;

View file

@ -1,130 +0,0 @@
/**
* Android ownCloud News
*
* @author David Luhmer
* @copyright 2013 David Luhmer david-dev@live.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.luhmer.owncloudnewsreader.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "OwncloudNewsReader.db";
private static DatabaseHelper instance;
//private Context context;
private boolean shouldResetDatabase = false;
/**
* @return the shouldResetDatabase
*/
public boolean isShouldResetDatabase() {
return shouldResetDatabase;
}
public static synchronized DatabaseHelper getHelper(Context context)
{
if (instance == null)
instance = new DatabaseHelper(context);
return instance;
}
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, 6);
//this.context = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
/* OLD */ //db.execSQL("CREATE TABLE folder (label TEXT NOT NULL,label_path TEXT);");
//db.execSQL("CREATE TABLE subscription(header_text TEXT NOT NULL, subscription_id_subscription INTEGER, FOREIGN KEY (subscription_id_subscription) REFERENCES subscription(rowid));");
/* OLD */ //db.execSQL("CREATE TABLE subscription(header_text TEXT NOT NULL, stream_id TEXT NOT NULL , folder_idfolder INTEGER, FOREIGN KEY (folder_idfolder) REFERENCES folder(rowid));");
/* OLD */ //db.execSQL("CREATE TABLE rss_item (title TEXT NOT NULL, link TEXT, description TEXT, read BOOL, starred BOOL, rssitem_id TEXT NOT NULL, timestamp DATETIME NULL, subscription_id_subscription INTEGER,FOREIGN KEY (subscription_id_subscription) REFERENCES subscription(rowid));");
db.execSQL("CREATE TABLE folder (label TEXT NOT NULL, label_id TEXT);");
db.execSQL("CREATE TABLE subscription(header_text TEXT NOT NULL, "
+ "subscription_id TEXT NOT NULL, "
+ "favicon_url TEXT, "
+ "link TEXT, "
+ "avg_colour TEXT, "
+ "folder_idfolder INTEGER, FOREIGN KEY (folder_idfolder) REFERENCES folder(rowid)"
+ ");");
db.execSQL("CREATE TABLE rss_item (title TEXT NOT NULL, "
+ "link TEXT, "
+ "body TEXT, "
+ "read BOOL, "
+ "starred BOOL, "
+ "rssitem_id INT NOT NULL, "
+ "pubdate DATETIME NULL, "
+ "author TEXT, "
+ "guid TEXT, "
+ "guidHash TEXT, "
+ "read_temp BOOL, "
+ "starred_temp BOOL, "
+ "enclosureLink TEXT, "
+ "enclosureMime TEXT, "
+ "lastModified DATETIME NULL, "
+ "subscription_id_subscription INTEGER, FOREIGN KEY (subscription_id_subscription) REFERENCES subscription(rowid));");
createRssCurrentViewTable(db);
/*
ContentValues cv = new ContentValues();
cv.put(TITLE, "Gravity, Death Star I");
cv.put(VALUE, SensorManager.GRAVITY_DEATH_STAR_I);
db.insert("constants", TITLE, cv);
*/
}
public void createRssCurrentViewTable(SQLiteDatabase db) {
db.beginTransaction();
try {
db.execSQL("DROP TABLE IF EXISTS " + DatabaseConnection.RSS_CURRENT_VIEW_TABLE);
db.execSQL("CREATE TABLE " + DatabaseConnection.RSS_CURRENT_VIEW_TABLE
+ " (" + DatabaseConnection.RSS_CURRENT_VIEW_RSS_ITEM_ID + " INT NOT NULL,"
+ " FOREIGN KEY (" + DatabaseConnection.RSS_CURRENT_VIEW_RSS_ITEM_ID + ") REFERENCES rss_item(rssitem_id))");
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
//db.endTransaction();
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
android.util.Log.w("Constants", "Upgrading database, which will destroy all old data");
//Toast.makeText(, "Updating Database. All Items are deleted. Please trigger a sync.", Toast.LENGTH_LONG).show();
//shouldResetDatabase = true;
resetDatabase(db);
}
public void resetDatabase(SQLiteDatabase db)
{
db.execSQL("DROP TABLE rss_item;");
db.execSQL("DROP TABLE subscription;");
db.execSQL("DROP TABLE folder;");
onCreate(db);
}
}

View file

@ -1,54 +0,0 @@
/**
* Android ownCloud News
*
* @author David Luhmer
* @copyright 2013 David Luhmer david-dev@live.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.luhmer.owncloudnewsreader.helper;
import android.annotation.TargetApi;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.support.v4.util.LruCache;
public class BitmapDrawableLruCache extends LruCache<Long, BitmapDrawable> {
public static int getDefaultLruCacheSize() {
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / 8;
return cacheSize;
}
public BitmapDrawableLruCache() {
this(getDefaultLruCacheSize());
}
public BitmapDrawableLruCache(int sizeInKiloBytes) {
super(sizeInKiloBytes);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
protected int sizeOf(Long key, BitmapDrawable bitmap) {
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR1)
return bitmap.getBitmap().getByteCount() / 1024;
else
return bitmap.getBitmap().getRowBytes() * bitmap.getBitmap().getHeight() / 1024;
}
}

View file

@ -27,15 +27,13 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import de.luhmer.owncloudnewsreader.database.DatabaseHelper;
public class DatabaseUtils {
public static final String DATABASE_NAME = "OwncloudNewsReader.db";
public static boolean CopyDatabaseToSdCard(Context context)
{
//context.getPackageCodePath()//Path to apk file..!
//String path = "/data/data/de.luhmer.owncloudnewsreader/databases/" + DatabaseHelper.DATABASE_NAME;
String path = context.getDatabasePath(DatabaseHelper.DATABASE_NAME).getPath();
String path = context.getDatabasePath(DATABASE_NAME).getPath();
File db = new File(path);
File backupDb = GetPath(context);
@ -55,6 +53,6 @@ public class DatabaseUtils {
}
public static File GetPath(Context context) {
return new File(FileUtils.getPath(context) + "/dbBackup/" + DatabaseHelper.DATABASE_NAME);
return new File(FileUtils.getPath(context) + "/dbBackup/" + DATABASE_NAME);
}
}

View file

@ -89,6 +89,11 @@ public class FavIconHandler {
}
public void PreCacheFavIcon(Feed feed) {
if(feed.getFaviconUrl() == null) {
Log.v(TAG, "No favicon for "+feed.getFeedTitle());
return;
}
GetImageThreaded giAsync = new GetImageThreaded(feed.getFaviconUrl(), favIconDownloadFinished, feed.getId(), FileUtils.getPathFavIcons(context), context);
giAsync.scaleImage = true;
giAsync.dstHeight = 2*32;

View file

@ -21,8 +21,6 @@
package de.luhmer.owncloudnewsreader.reader.GoogleReaderApi;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import org.apache.http.HttpResponse;
@ -46,14 +44,10 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import de.luhmer.owncloudnewsreader.Constants;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.model.FolderSubscribtionItem;
import de.luhmer.owncloudnewsreader.model.RssFile;
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
public class GoogleReaderMethods {
@ -139,47 +133,6 @@ public class GoogleReaderMethods {
return _SUBTITLE_ARRAYLIST;
}
public static String[] getStarredList(String _USERNAME, String _PASSWORD) {
Log.d("mygr","METHOD: getStarredList()");
String returnString = null;
String _TAG_LABEL = null;
try {
_TAG_LABEL = "stream/contents/user/" + AuthenticationManager.getGoogleUserID(_USERNAME, _PASSWORD) + "/state/com.google/starred";
}catch(IOException e){
e.printStackTrace();
}
try{
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(GoogleReaderConstants._API_URL + _TAG_LABEL);
request.addHeader("Authorization", GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME, _PASSWORD));
HttpResponse response = client.execute(request);
returnString = HttpHelper.request(response);
Pattern pattern = Pattern.compile("\"alternate\":\\[\\{\"href\":\"(.*?)\",");
Matcher matcher = pattern.matcher(returnString);
ArrayList<String> resultList = new ArrayList<String>();
while (matcher.find())
resultList.add(matcher.group(1));
String[] ret = new String[resultList.size()];
resultList.toArray(ret);
return ret;
}catch(IOException e){
e.printStackTrace();
return null;
}
}
@SuppressWarnings("unused")
public static ArrayList<RssFile> getFeeds(String _USERNAME, String _PASSWORD, String _TAG_LABEL) {
@ -360,141 +313,4 @@ public class GoogleReaderMethods {
}
public static void MarkItemAsStarred(Boolean isStarred, Cursor cursor, DatabaseConnection dbConn, Context context, OnAsyncTaskCompletedListener asyncTaskCompletedPerformTagStarred)
{
List<NameValuePair> nameValuePairs = getStarredReadNameValuePairs(dbConn, cursor);
if(isStarred)
nameValuePairs.add(new BasicNameValuePair("a", GoogleReaderConstants._STATE_STARRED));
else
nameValuePairs.add(new BasicNameValuePair("r", GoogleReaderConstants._STATE_STARRED));
ExecuteTagsReadStarred(nameValuePairs, context, asyncTaskCompletedPerformTagStarred);
Log.d("CHECKBOX", "STARRED CHANGED: " + isStarred);
dbConn.updateIsStarredOfItem(cursor.getString(0), isStarred);
}
public static void MarkItemAsRead(Boolean isRead, Cursor cursor, DatabaseConnection dbConn, Context context, OnAsyncTaskCompletedListener asyncTaskCompletedPerformTagRead)
{
List<NameValuePair> nameValuePairs = getStarredReadNameValuePairs(dbConn, cursor);
if(isRead)
nameValuePairs.add(new BasicNameValuePair("a", GoogleReaderConstants._STATE_READ));
else
nameValuePairs.add(new BasicNameValuePair("r", GoogleReaderConstants._STATE_READ));
ExecuteTagsReadStarred(nameValuePairs, context, asyncTaskCompletedPerformTagRead);
Log.d("CHECKBOX", "STATUS CHANGED: " + isRead);
dbConn.updateIsReadOfItem(cursor.getString(0), isRead);
}
private static List<NameValuePair> getStarredReadNameValuePairs(DatabaseConnection dbConn, Cursor cursor)
{
String subscription_id = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID));
String rss_item_id = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_RSSITEM_ID));
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("async", "true"));
nameValuePairs.add(new BasicNameValuePair("s", dbConn.getRowIdBySubscriptionID(subscription_id)));
nameValuePairs.add(new BasicNameValuePair("i", rss_item_id));
return nameValuePairs;
}
private static void ExecuteTagsReadStarred(List<NameValuePair> nameValuePairs, Context context, OnAsyncTaskCompletedListener asyncTaskCompleted)
{
//AsyncTask_PerformTagAction apt = new AsyncTask_PerformTagAction(0, context, asyncTaskCompleted);
//TODO this is needed
/*apt.execute(NewsReaderListFragment.username,
NewsReaderListFragment.password,
nameValuePairs);
*/
}
/*
public static String mark_all_feeds_as_read(String _USERNAME, String _PASSWORD, String FEED_ID) {
Log.d("mygr","METHOD: markAllAsRead");
try{
//String url = GoogleReaderConstants._MARK_ALL_AS_READ + "?s=" + FEED_ID + "&T=" + AuthenticationManager.getGoogleToken(_USERNAME, _PASSWORD);
String url = GoogleReaderConstants._MARK_ALL_AS_READ + "?s=" + FEED_ID;
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
request.addHeader("Authorization", GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME, _PASSWORD));
HttpResponse response = client.execute(request);
return HttpHelper.request(response);
}catch(IOException e){
e.printStackTrace();
return null;
}
}
public static String markItemAsStarred(String _USERNAME, String _PASSWORD, String FEED_ID, Boolean markAsStarred) {
Log.d("mygr","METHOD: markItemAsStarred");
try{
String url = GoogleReaderConstants.get_TAG_STARRED(markAsStarred);
url += "&s=" + FEED_ID + "&T=" + AuthenticationManager.getGoogleToken(_USERNAME, _PASSWORD);
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
request.addHeader("Authorization", GoogleReaderConstants._AUTHPARAMS + AuthenticationManager.getGoogleAuthKey(_USERNAME, _PASSWORD));
HttpResponse response = client.execute(request);
return HttpHelper.request(response);
}catch(IOException e){
e.printStackTrace();
return null;
}
}*/
/*
// Get the subscription list of a user
public String[] getSubscriptionList()
{
ArrayList subsList = new ArrayList();
try
{
Document doc = Jsoup.connect(Constants.SUBSCRIPTION_LIST_URL).header("Authorization", Constants.AUTHPARAMS + authkey).get();
Elements links = doc.select("string");
for(Element link : links)
if(link.attr("name").equals("id"))
subsList.add(link.text());
String[] subsArr = new String[subsList.size()];
subsList.toArray(subsArr);
return subsArr;
}
catch(Exception ex)
{
ex.printStackTrace();
return null;
}
}
public boolean addSubscription(String feedurl,String title,boolean recommendation)
{
String source="";
if(recommendation)
source="&source=RECOMMENDATION";
try{
Document doc = Jsoup.connect(Constants.SUBSCRIPTION_EDIT_URL+"?client=PrivateReader-v1"+source)
.header("Authorization", Constants.AUTHPARAMS + authkey)
.data("s","feed/"+feedurl,
"ac","subscribe",
typgetGoogleToken "t",title,
"T",token)
.post();
if(doc.text().equals("OK"))
return true;
else
return false;
}
catch(Exception ex)
{
ex.printStackTrace();
return false;
}
}
*/
}

View file

@ -31,7 +31,6 @@ import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.util.SparseArray;
import android.widget.Toast;
import java.io.File;
@ -51,7 +50,6 @@ import de.luhmer.owncloudnewsreader.async_tasks.GetImageThreaded;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.model.Feed;
import de.luhmer.owncloudnewsreader.database.model.RssItem;
import de.luhmer.owncloudnewsreader.helper.BitmapDrawableLruCache;
import de.luhmer.owncloudnewsreader.helper.FavIconHandler;
import de.luhmer.owncloudnewsreader.helper.FileUtils;
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
@ -196,10 +194,10 @@ public class DownloadImagesService extends IntentService {
private void RemoveOldImages(Context context) {
HashMap<File, Long> files;
long size = ImageHandler.getFolderSize(new File(FileUtils.getPath(context)));
size = (long) (size / 1024d / 1024d);
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
int max_allowed_size = Integer.parseInt(mPrefs.getString(SettingsActivity.SP_MAX_CACHE_SIZE, "1000"));//Default is 1Gb --> 1000mb
max_allowed_size *= 1024 * 1024; // convert to byte
if(size > max_allowed_size)
{
files = new HashMap<>();
@ -211,8 +209,8 @@ public class DownloadImagesService extends IntentService {
for(Object itemObj : sortHashMapByValuesD(files).keySet())
{
File file = (File) itemObj;
file.delete();
size -= file.length();
file.delete();
if(size < max_allowed_size)
break;
}
@ -259,8 +257,7 @@ public class DownloadImagesService extends IntentService {
if(maxCount == count) {
notificationManager.cancel(NOTIFICATION_ID);
if(DownloadImagesService.this != null)
RemoveOldImages(DownloadImagesService.this);
RemoveOldImages(DownloadImagesService.this);
} else {
NotificationDownloadImages.setProgress(maxCount, count+1, false);
NotificationDownloadImages.setContentText("Downloading Images for offline usage - " + (count+1) + "/" + maxCount);

View file

@ -110,6 +110,7 @@ public class PodcastPlaybackService extends Service implements TextToSpeech.OnIn
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
pause();//Send the over signal
podcastNotification.cancel();
}
});

View file

@ -100,6 +100,8 @@ public class PodcastNotification {
//.addAction(android.R.drawable.ic_media_pause, "More", resultPendingIntent)
}
public void cancel()
{
notificationManager.cancel(NOTIFICATION_ID);
}
}

View file

@ -39,7 +39,7 @@ import java.util.List;
import de.luhmer.owncloudnewsreader.Constants;
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.R;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm.SORT_DIRECTION;
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
import de.luhmer.owncloudnewsreader.database.model.RssItem;

View file

@ -5,8 +5,8 @@
<string name="title_activity_sync_interval_selector">Sélecteur d\'intervalle de synchronisation</string>
<string name="title_activity_news_detail">Activité de détail darticle</string>
<string name="title_activity_subscription">Activité dabonnement</string>
<string name="title_newsreader_list">Lecteur d\'actualités</string>
<string name="title_newsreader_detail">Détail du lecteur d\'actualités</string>
<string name="title_newsreader_list">Lecteur de news</string>
<string name="title_newsreader_detail">Détail du lecteur de news</string>
<string name="empty_view_header">Information</string>
<string name="empty_view_content">Aucun article</string>
<string name="toast_GettingMoreItems">Téléchargement d\'articles supplémentaire en cours... Veuillez patienter.</string>

View file

@ -3,6 +3,7 @@
<string name="auto_sync_string">Ауто-синхронизација</string>
<string name="app_name">ОунКлауд читач вести</string>
<string name="title_activity_sync_interval_selector">Избор размака синхронизације</string>
<string name="title_activity_news_detail">Активност о детаљима вести</string>
<string name="title_activity_subscription">Активност претплаћивања</string>
<string name="title_newsreader_list">Читач новости</string>
<string name="title_newsreader_detail">Детаљи читача</string>

View file

@ -17,6 +17,7 @@
<color name="slide_up_panel_header_background_color">#ff343434</color>
<color name="slide_up_panel_slider_background_color">#ffdcdcdc</color>
<color name="options_menu_item_text">@drawable/options_menu_item_color</color>
<color name="material_grey_900">#212121</color>

View file

@ -30,7 +30,7 @@
</style>
<style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColor">#ffc0c0c0</item>
<item name="android:textColor">@color/options_menu_item_text</item>
</style>

View file

@ -1,11 +0,0 @@
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Nov 01 03:37:25 CET 2014
sdk.dir=C\:\\Program Files\\Android\\android-sdk