aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorCamil Staps2015-06-10 18:35:37 +0200
committerCamil Staps2015-06-10 18:35:37 +0200
commitbf7bc4ed61a098a037d1eb71623fc370af689976 (patch)
treeefc984106e3c70a71d4579ddd9b898bbba080729 /app
parentCleanup xml (diff)
Moving stuff around
Diffstat (limited to 'app')
-rw-r--r--app/src/androidTest/java/org/rssin/neurons/FeedSorterTest.java3
-rw-r--r--app/src/main/java/org/rssin/android/ArticleActivity.java5
-rw-r--r--app/src/main/java/org/rssin/android/FeedItemAdapter.java37
-rw-r--r--app/src/main/java/org/rssin/android/FeedItemsListFragment.java3
-rw-r--r--app/src/main/java/org/rssin/android/SortedFeedItemContainer.java (renamed from app/src/main/java/org/rssin/rssin/SortedFeedItemContainer.java)42
-rw-r--r--app/src/main/java/org/rssin/neurons/FeedSorter.java38
-rw-r--r--app/src/main/java/org/rssin/rss/FeedSorterProvider.java (renamed from app/src/main/java/org/rssin/android/FeedSorterProvider.java)47
-rw-r--r--app/src/main/java/org/rssin/rss/FeedSorterTrainer.java (renamed from app/src/main/java/org/rssin/android/FeedSorterTrainer.java)38
-rw-r--r--app/src/main/java/org/rssin/rssin/FeedLoaderAndSorter.java45
9 files changed, 129 insertions, 129 deletions
diff --git a/app/src/androidTest/java/org/rssin/neurons/FeedSorterTest.java b/app/src/androidTest/java/org/rssin/neurons/FeedSorterTest.java
index ba76dea..f921fcc 100644
--- a/app/src/androidTest/java/org/rssin/neurons/FeedSorterTest.java
+++ b/app/src/androidTest/java/org/rssin/neurons/FeedSorterTest.java
@@ -24,9 +24,8 @@ import junit.framework.Assert;
import junit.framework.TestCase;
import org.rssin.rss.FeedItem;
-import org.rssin.rssin.SortedFeedItemContainer;
+import org.rssin.android.SortedFeedItemContainer;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
diff --git a/app/src/main/java/org/rssin/android/ArticleActivity.java b/app/src/main/java/org/rssin/android/ArticleActivity.java
index 119d937..82190db 100644
--- a/app/src/main/java/org/rssin/android/ArticleActivity.java
+++ b/app/src/main/java/org/rssin/android/ArticleActivity.java
@@ -28,8 +28,9 @@ import android.widget.TextView;
import android.widget.Toast;
import org.rssin.rss.FeedItem;
+import org.rssin.rss.FeedSorterProvider;
+import org.rssin.rss.FeedSorterTrainer;
import org.rssin.rssin.R;
-import org.rssin.rssin.SortedFeedItemContainer;
import static org.rssin.neurons.Feedback.Dislike;
import static org.rssin.neurons.Feedback.Like;
@@ -68,7 +69,7 @@ public class ArticleActivity extends ActionBarActivity {
date.setText(R.string.article_published_on_unknown);
}
- new Thread(new FeedSorterTrainer(FeedSorterProvider.getInstance(this))).start();
+ new Thread(new FeedSorterTrainer(FeedSorterProvider.getInstance(DefaultStorageProvider.getInstance(this)))).start();
} catch (NullPointerException e) {
Frontend.error(this, R.string.error_load_article, e);
finish();
diff --git a/app/src/main/java/org/rssin/android/FeedItemAdapter.java b/app/src/main/java/org/rssin/android/FeedItemAdapter.java
index 249d5ec..a67b267 100644
--- a/app/src/main/java/org/rssin/android/FeedItemAdapter.java
+++ b/app/src/main/java/org/rssin/android/FeedItemAdapter.java
@@ -1,21 +1,21 @@
-/**
- * RSSin - Clever RSS reader for Android
- * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+/**
+ * RSSin - Clever RSS reader for Android
+ * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
package org.rssin.android;
/**
@@ -31,7 +31,6 @@ import android.widget.TextView;
import org.rssin.neurons.Feedback;
import org.rssin.rssin.R;
-import org.rssin.rssin.SortedFeedItemContainer;
import org.rssin.summaries.BablukiAPI;
import org.rssin.summaries.LengthMode;
import org.rssin.summaries.SummaryAPIInterface;
diff --git a/app/src/main/java/org/rssin/android/FeedItemsListFragment.java b/app/src/main/java/org/rssin/android/FeedItemsListFragment.java
index d41be81..488c5b5 100644
--- a/app/src/main/java/org/rssin/android/FeedItemsListFragment.java
+++ b/app/src/main/java/org/rssin/android/FeedItemsListFragment.java
@@ -31,7 +31,6 @@ import org.rssin.listener.RealtimeListener;
import org.rssin.rssin.Feed;
import org.rssin.rssin.FeedLoaderAndSorter;
import org.rssin.rssin.R;
-import org.rssin.rssin.SortedFeedItemContainer;
import java.util.ArrayList;
import java.util.List;
@@ -83,7 +82,7 @@ public class FeedItemsListFragment extends Fragment {
FeedLoaderAndSorter loaderAndSorter = new FeedLoaderAndSorter(feeds);
loaderAndSorter.getFilteredFeedItems(
- context,
+ DefaultStorageProvider.getInstance(context),
VolleyFetcher.getInstance(context),
new RealtimeListener<List<SortedFeedItemContainer>, Object>() {
@Override
diff --git a/app/src/main/java/org/rssin/rssin/SortedFeedItemContainer.java b/app/src/main/java/org/rssin/android/SortedFeedItemContainer.java
index bc2d373..fd2777c 100644
--- a/app/src/main/java/org/rssin/rssin/SortedFeedItemContainer.java
+++ b/app/src/main/java/org/rssin/android/SortedFeedItemContainer.java
@@ -1,29 +1,29 @@
-/**
- * RSSin - Clever RSS reader for Android
- * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-package org.rssin.rssin;
+/**
+ * RSSin - Clever RSS reader for Android
+ * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+package org.rssin.android;
import android.content.Context;
-import org.rssin.android.FeedSorterProvider;
import org.rssin.neurons.Feedback;
import org.rssin.neurons.TrainingCase;
import org.rssin.rss.FeedItem;
+import org.rssin.rss.FeedSorterProvider;
import java.io.Serializable;
@@ -57,7 +57,7 @@ public class SortedFeedItemContainer implements Comparable<SortedFeedItemContain
{
if(trainingCase == null)
{
- trainingCase = FeedSorterProvider.getInstance(context).getFeedSorter().feedback(getFeeditem(), feedback);
+ trainingCase = FeedSorterProvider.getInstance(DefaultStorageProvider.getInstance(context)).getFeedSorter().feedback(getFeeditem(), feedback);
}else {
trainingCase.setFeedback(feedback);
}
diff --git a/app/src/main/java/org/rssin/neurons/FeedSorter.java b/app/src/main/java/org/rssin/neurons/FeedSorter.java
index 8e1dc55..b195772 100644
--- a/app/src/main/java/org/rssin/neurons/FeedSorter.java
+++ b/app/src/main/java/org/rssin/neurons/FeedSorter.java
@@ -1,27 +1,27 @@
-/**
- * RSSin - Clever RSS reader for Android
- * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+/**
+ * RSSin - Clever RSS reader for Android
+ * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
package org.rssin.neurons;
import android.util.Log;
import org.rssin.rss.FeedItem;
-import org.rssin.rssin.SortedFeedItemContainer;
+import org.rssin.android.SortedFeedItemContainer;
import org.rssin.storage.Storable;
import java.util.ArrayList;
diff --git a/app/src/main/java/org/rssin/android/FeedSorterProvider.java b/app/src/main/java/org/rssin/rss/FeedSorterProvider.java
index 8e08c7e..304e4fc 100644
--- a/app/src/main/java/org/rssin/android/FeedSorterProvider.java
+++ b/app/src/main/java/org/rssin/rss/FeedSorterProvider.java
@@ -1,22 +1,22 @@
-/**
- * RSSin - Clever RSS reader for Android
- * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-package org.rssin.android;
+/**
+ * RSSin - Clever RSS reader for Android
+ * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+package org.rssin.rss;
import android.content.Context;
import android.util.Log;
@@ -28,14 +28,15 @@ import org.rssin.storage.StorageProvider;
* @author Jos.
*/
public class FeedSorterProvider {
+
private static FeedSorterProvider instance;
private FeedSorter sorter = null;
private final String storageKey = "FeedSorter";
private final StorageProvider storageProvider;
- private FeedSorterProvider(Context context)
+ private FeedSorterProvider(StorageProvider storageProvider)
{
- storageProvider = SharedPreferencesStorageProvider.getInstance(context);
+ this.storageProvider = storageProvider;
}
public synchronized static FeedSorterProvider getInstance()
@@ -43,11 +44,11 @@ public class FeedSorterProvider {
return instance;
}
- public synchronized static FeedSorterProvider getInstance(Context context)
+ public synchronized static FeedSorterProvider getInstance(StorageProvider storageProvider)
{
if(instance == null)
{
- instance = new FeedSorterProvider(context);
+ instance = new FeedSorterProvider(storageProvider);
}
return instance;
diff --git a/app/src/main/java/org/rssin/android/FeedSorterTrainer.java b/app/src/main/java/org/rssin/rss/FeedSorterTrainer.java
index d982fb9..097cfe6 100644
--- a/app/src/main/java/org/rssin/android/FeedSorterTrainer.java
+++ b/app/src/main/java/org/rssin/rss/FeedSorterTrainer.java
@@ -1,22 +1,22 @@
-/**
- * RSSin - Clever RSS reader for Android
- * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-package org.rssin.android;
+/**
+ * RSSin - Clever RSS reader for Android
+ * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+package org.rssin.rss;
import android.util.Log;
diff --git a/app/src/main/java/org/rssin/rssin/FeedLoaderAndSorter.java b/app/src/main/java/org/rssin/rssin/FeedLoaderAndSorter.java
index 3581368..e561657 100644
--- a/app/src/main/java/org/rssin/rssin/FeedLoaderAndSorter.java
+++ b/app/src/main/java/org/rssin/rssin/FeedLoaderAndSorter.java
@@ -1,33 +1,34 @@
-/**
- * RSSin - Clever RSS reader for Android
- * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+/**
+ * RSSin - Clever RSS reader for Android
+ * Copyright (C) 2015 Randy Wanga, Jos Craaijo, Joep Bernards, Camil Staps
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
package org.rssin.rssin;
-import android.content.Context;
import android.util.Log;
-import org.rssin.android.FeedSorterProvider;
+import org.rssin.rss.FeedSorterProvider;
+import org.rssin.android.SortedFeedItemContainer;
import org.rssin.http.Fetcher;
import org.rssin.listener.FallibleListener;
import org.rssin.listener.RealtimeListener;
import org.rssin.neurons.FeedSorter;
import org.rssin.rss.FeedItem;
import org.rssin.rss.FeedLoader;
+import org.rssin.storage.StorageProvider;
import java.util.ArrayList;
import java.util.List;
@@ -53,13 +54,13 @@ public class FeedLoaderAndSorter {
* @param listener Listener for when the fetcher finishes
*/
public void getFilteredFeedItems(
- Context context,
+ StorageProvider storageProvider,
Fetcher fetcher,
final RealtimeListener<List<SortedFeedItemContainer>, Object> listener) {
final List<SortedFeedItemContainer> resultingItems = new ArrayList<>();
final Counter counter = new Counter(feeds.size());
Log.v("FLAS", "Counter has size " + feeds.size());
- final FeedSorter sorter = FeedSorterProvider.getInstance(context).getFeedSorter();
+ final FeedSorter sorter = FeedSorterProvider.getInstance(storageProvider).getFeedSorter();
for (Feed feed : feeds) {
Loader loader = new Loader(