diff --git a/res/layout-sw600dp/feeds.xml b/res/layout-sw600dp/feeds.xml index 1bc48b2b..3e75a37c 100644 --- a/res/layout-sw600dp/feeds.xml +++ b/res/layout-sw600dp/feeds.xml @@ -25,6 +25,7 @@ android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" + android:baselineAligned="false" android:orientation="horizontal" > , Integer, JsonE } } + @SuppressWarnings("deprecation") private static void disableConnectionReuseIfNecessary() { // HTTP connection reuse which was buggy pre-froyo if (Integer.parseInt(Build.VERSION.SDK) < Build.VERSION_CODES.FROYO) { diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index d001fc8f..54eef0e1 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -39,10 +39,8 @@ import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.TextView; -import android.widget.AdapterView.AdapterContextMenuInfo; public class ArticleFragment extends Fragment { - @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); private SharedPreferences m_prefs; @@ -65,8 +63,8 @@ public class ArticleFragment extends Fragment { @Override public boolean onContextItemSelected(MenuItem item) { - AdapterContextMenuInfo info = (AdapterContextMenuInfo) item - .getMenuInfo(); + /* AdapterContextMenuInfo info = (AdapterContextMenuInfo) item + .getMenuInfo(); */ switch (item.getItemId()) { case R.id.article_link_share: diff --git a/src/org/fox/ttrss/ArticlePager.java b/src/org/fox/ttrss/ArticlePager.java index bae9d1f3..1f25a546 100644 --- a/src/org/fox/ttrss/ArticlePager.java +++ b/src/org/fox/ttrss/ArticlePager.java @@ -2,7 +2,6 @@ package org.fox.ttrss; import java.util.HashMap; -import org.fox.ttrss.ApiRequest.ApiError; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Feed; diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index d9359b24..35e8718c 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -2,6 +2,7 @@ package org.fox.ttrss; import org.fox.ttrss.util.DatabaseHelper; +import android.annotation.SuppressLint; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v4.app.FragmentActivity; @@ -118,6 +119,7 @@ public class CommonActivity extends FragmentActivity { return m_compatMode; } + @SuppressWarnings("deprecation") public boolean isPortrait() { Display display = getWindowManager().getDefaultDisplay(); @@ -127,9 +129,10 @@ public class CommonActivity extends FragmentActivity { return width < height; } + @SuppressLint("NewApi") + @SuppressWarnings("deprecation") public void copyToClipboard(String str) { if (android.os.Build.VERSION.SDK_INT < 11) { - @SuppressWarnings("deprecation") android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText(str); } else { diff --git a/src/org/fox/ttrss/FeedCategoriesFragment.java b/src/org/fox/ttrss/FeedCategoriesFragment.java index 46c476df..92e4f1c7 100644 --- a/src/org/fox/ttrss/FeedCategoriesFragment.java +++ b/src/org/fox/ttrss/FeedCategoriesFragment.java @@ -39,7 +39,6 @@ import com.google.gson.JsonElement; import com.google.gson.reflect.TypeToken; public class FeedCategoriesFragment extends Fragment implements OnItemClickListener, OnSharedPreferenceChangeListener { - @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); private SharedPreferences m_prefs; private FeedCategoryListAdapter m_adapter; diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 9e47b1c7..ef75616e 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -1,6 +1,6 @@ package org.fox.ttrss; -import java.util.HashMap; +import java.util.Date; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; @@ -8,6 +8,7 @@ import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.FeedCategory; import org.fox.ttrss.util.AppRater; +import android.annotation.SuppressLint; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; @@ -15,18 +16,16 @@ import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import android.view.Window; -import android.widget.ShareActionProvider; public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener { private final String TAG = this.getClass().getSimpleName(); protected SharedPreferences m_prefs; + protected long m_lastRefresh = 0; + @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { m_prefs = PreferenceManager @@ -160,7 +159,14 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe HeadlinesFragment hf = new HeadlinesFragment(feed); ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES); - ft.commit(); + ft.commit(); + + Date date = new Date(); + + if (date.getTime() - m_lastRefresh > 10000) { + m_lastRefresh = date.getTime(); + refresh(false); + } } } @@ -282,7 +288,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe onArticleSelected(article, true); } - @SuppressWarnings("unchecked") public void catchupFeed(final Feed feed) { super.catchupFeed(feed); refresh(); diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java index 7b307f84..d1012b48 100644 --- a/src/org/fox/ttrss/FeedsFragment.java +++ b/src/org/fox/ttrss/FeedsFragment.java @@ -575,6 +575,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh } } + @SuppressWarnings("deprecation") private void disableConnectionReuseIfNecessary() { // HTTP connection reuse which was buggy pre-froyo if (Integer.parseInt(Build.VERSION.SDK) < Build.VERSION_CODES.FROYO) { diff --git a/src/org/fox/ttrss/GlobalState.java b/src/org/fox/ttrss/GlobalState.java index 6cd168e4..324364f3 100644 --- a/src/org/fox/ttrss/GlobalState.java +++ b/src/org/fox/ttrss/GlobalState.java @@ -4,9 +4,7 @@ import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Feed; -import android.app.Activity; import android.app.Application; -import android.os.Bundle; public class GlobalState extends Application { private static GlobalState m_singleton; diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 64dce016..5a89434d 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -4,6 +4,7 @@ import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Feed; +import android.annotation.SuppressLint; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; @@ -19,6 +20,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL protected SharedPreferences m_prefs; + @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { m_prefs = PreferenceManager diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 09dba7cc..9a1c720c 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -1,6 +1,5 @@ package org.fox.ttrss; -import java.lang.reflect.Type; import java.net.MalformedURLException; import java.net.URL; import java.text.DateFormat; @@ -8,10 +7,8 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.TimeZone; -import org.fox.ttrss.ApiRequest.ApiError; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Attachment; @@ -54,10 +51,7 @@ import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; -import com.google.gson.Gson; -import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import com.google.gson.reflect.TypeToken; public class HeadlinesFragment extends Fragment implements OnItemClickListener, OnScrollListener { public static enum ArticlesSelection { ALL, NONE, UNREAD }; @@ -83,6 +77,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, private ImageGetter m_dummyGetter = new ImageGetter() { + @SuppressWarnings("deprecation") @Override public Drawable getDrawable(String source) { return new BitmapDrawable(); diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 6d43af48..2810948b 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -12,6 +12,7 @@ import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.Label; +import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Dialog; import android.content.BroadcastReceiver; @@ -74,6 +75,7 @@ public class OnlineActivity extends CommonActivity { }; + @TargetApi(11) private class HeadlinesActionModeCallback implements ActionMode.Callback { @Override @@ -1157,7 +1159,7 @@ public class OnlineActivity extends CommonActivity { } } - protected void refresh() { + protected void refresh(boolean includeHeadlines) { FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS); if (cf != null) { @@ -1170,13 +1172,19 @@ public class OnlineActivity extends CommonActivity { ff.refresh(false); } - HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); + if (includeHeadlines) { + HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - if (hf != null) { - hf.refresh(false); + if (hf != null) { + hf.refresh(false); + } } } + protected void refresh() { + refresh(true); + } + private class LoginRequest extends ApiRequest { public LoginRequest(Context context) { super(context); diff --git a/src/org/fox/ttrss/PreferencesActivity.java b/src/org/fox/ttrss/PreferencesActivity.java index 2278ad0f..0568d813 100644 --- a/src/org/fox/ttrss/PreferencesActivity.java +++ b/src/org/fox/ttrss/PreferencesActivity.java @@ -1,16 +1,14 @@ package org.fox.ttrss; import android.content.SharedPreferences; -import android.content.res.Configuration; import android.os.Bundle; import android.preference.Preference; -import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceActivity; -import android.preference.PreferenceCategory; import android.preference.PreferenceManager; public class PreferencesActivity extends PreferenceActivity { + @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 6cf597d4..93ebe932 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -4,6 +4,7 @@ import org.fox.ttrss.CommonActivity; import org.fox.ttrss.PreferencesActivity; import org.fox.ttrss.R; +import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; @@ -36,6 +37,7 @@ public class OfflineActivity extends CommonActivity { private ActionMode m_headlinesActionMode; private HeadlinesActionModeCallback m_headlinesActionModeCallback; + @SuppressLint("NewApi") private class HeadlinesActionModeCallback implements ActionMode.Callback { @Override @@ -161,11 +163,11 @@ public class OfflineActivity extends CommonActivity { final OfflineHeadlinesFragment ohf = (OfflineHeadlinesFragment) getSupportFragmentManager() .findFragmentByTag(FRAG_HEADLINES); - final OfflineFeedsFragment off = (OfflineFeedsFragment) getSupportFragmentManager() - .findFragmentByTag(FRAG_FEEDS); + /* final OfflineFeedsFragment off = (OfflineFeedsFragment) getSupportFragmentManager() + .findFragmentByTag(FRAG_FEEDS); */ - final OfflineFeedCategoriesFragment ocf = (OfflineFeedCategoriesFragment) getSupportFragmentManager() - .findFragmentByTag(FRAG_CATS); + /* final OfflineFeedCategoriesFragment ocf = (OfflineFeedCategoriesFragment) getSupportFragmentManager() + .findFragmentByTag(FRAG_CATS); */ final OfflineArticlePager oap = (OfflineArticlePager) getSupportFragmentManager() .findFragmentByTag(FRAG_ARTICLE); @@ -403,6 +405,7 @@ public class OfflineActivity extends CommonActivity { return m_unreadOnly; } + @SuppressLint("NewApi") protected void initMenu() { if (m_menu != null) { m_menu.setGroupVisible(R.id.menu_group_headlines, false); diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index e05f7581..3035d629 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -10,6 +10,7 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.SharedPreferences; import android.database.Cursor; @@ -30,11 +31,9 @@ import android.view.ViewGroup; import android.webkit.WebSettings; import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; -import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.TextView; public class OfflineArticleFragment extends Fragment { - @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); private SharedPreferences m_prefs; @@ -55,8 +54,8 @@ public class OfflineArticleFragment extends Fragment { @Override public boolean onContextItemSelected(MenuItem item) { - AdapterContextMenuInfo info = (AdapterContextMenuInfo) item - .getMenuInfo(); + /* AdapterContextMenuInfo info = (AdapterContextMenuInfo) item + .getMenuInfo(); */ switch (item.getItemId()) { case R.id.article_link_share: @@ -89,6 +88,7 @@ public class OfflineArticleFragment extends Fragment { } + @SuppressLint("NewApi") @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { diff --git a/src/org/fox/ttrss/offline/OfflineDownloadService.java b/src/org/fox/ttrss/offline/OfflineDownloadService.java index c7100ee0..eb9a802e 100644 --- a/src/org/fox/ttrss/offline/OfflineDownloadService.java +++ b/src/org/fox/ttrss/offline/OfflineDownloadService.java @@ -87,6 +87,7 @@ public class OfflineDownloadService extends Service { initDatabase(); } + @SuppressWarnings("deprecation") private void updateNotification(String msg) { Notification notification = new Notification(R.drawable.icon, getString(R.string.notify_downloading_title), System.currentTimeMillis()); @@ -158,9 +159,9 @@ public class OfflineDownloadService extends Service { m_readableDb = dh.getReadableDatabase(); } - private synchronized SQLiteDatabase getReadableDb() { + /* private synchronized SQLiteDatabase getReadableDb() { return m_readableDb; - } + } */ private synchronized SQLiteDatabase getWritableDb() { return m_writableDb; diff --git a/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java b/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java index 0d48dc12..d46e5587 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineFeedCategoriesFragment.java @@ -1,8 +1,6 @@ package org.fox.ttrss.offline; import org.fox.ttrss.R; -import org.fox.ttrss.types.Feed; -import org.fox.ttrss.types.FeedCategory; import android.app.Activity; import android.content.Context; diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java index e4207a4f..4122f456 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -1,8 +1,8 @@ package org.fox.ttrss.offline; -import org.fox.ttrss.HeadlinesFragment; import org.fox.ttrss.R; +import android.annotation.SuppressLint; import android.content.Intent; import android.database.sqlite.SQLiteStatement; import android.os.Bundle; @@ -17,6 +17,7 @@ import android.view.View; public class OfflineFeedsActivity extends OfflineActivity implements OfflineHeadlinesEventListener { private final String TAG = this.getClass().getSimpleName(); + @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { m_prefs = PreferenceManager diff --git a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java index d70c247d..87af187c 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsFragment.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsFragment.java @@ -3,7 +3,6 @@ package org.fox.ttrss.offline; import java.io.File; import org.fox.ttrss.R; -import org.fox.ttrss.types.Feed; import android.app.Activity; import android.content.Context; diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java index 932a59e5..d9053f27 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java @@ -1,9 +1,9 @@ package org.fox.ttrss.offline; import org.fox.ttrss.GlobalState; -import org.fox.ttrss.HeadlinesFragment; import org.fox.ttrss.R; +import android.annotation.SuppressLint; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; @@ -16,10 +16,12 @@ import android.support.v4.app.FragmentTransaction; import android.view.View; public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener { + @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); protected SharedPreferences m_prefs; + @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { m_prefs = PreferenceManager @@ -98,12 +100,9 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline stmt.close(); if (open) { - OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); af.setArticleId(articleId); - } else { OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 776df09c..b7817ac6 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -62,6 +62,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis private ImageGetter m_dummyGetter = new ImageGetter() { + @SuppressWarnings("deprecation") @Override public Drawable getDrawable(String source) { return new BitmapDrawable(); diff --git a/src/org/fox/ttrss/offline/OfflineUploadService.java b/src/org/fox/ttrss/offline/OfflineUploadService.java index dd4c829f..bacb1ede 100644 --- a/src/org/fox/ttrss/offline/OfflineUploadService.java +++ b/src/org/fox/ttrss/offline/OfflineUploadService.java @@ -48,6 +48,7 @@ public class OfflineUploadService extends IntentService { m_nmgr.cancel(NOTIFY_UPLOADING); } + @SuppressWarnings("deprecation") private void updateNotification(String msg) { Notification notification = new Notification(R.drawable.icon, getString(R.string.notify_uploading_title), System.currentTimeMillis()); diff --git a/src/org/fox/ttrss/util/HeadlinesRequest.java b/src/org/fox/ttrss/util/HeadlinesRequest.java index 5615ffdf..768abc7c 100644 --- a/src/org/fox/ttrss/util/HeadlinesRequest.java +++ b/src/org/fox/ttrss/util/HeadlinesRequest.java @@ -4,22 +4,19 @@ import java.lang.reflect.Type; import java.util.List; import org.fox.ttrss.ApiRequest; +import org.fox.ttrss.GlobalState; import org.fox.ttrss.OnlineActivity; import org.fox.ttrss.R; -import org.fox.ttrss.GlobalState; -import org.fox.ttrss.ApiRequest.ApiError; import org.fox.ttrss.types.Article; import org.fox.ttrss.types.ArticleList; +import android.content.Context; + import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.reflect.TypeToken; -import android.content.Context; -import android.widget.Adapter; -import android.widget.ArrayAdapter; - public class HeadlinesRequest extends ApiRequest { public static final int HEADLINES_REQUEST_SIZE = 30; public static final int HEADLINES_BUFFER_MAX = 500; diff --git a/src/org/fox/ttrss/util/ImageCacheService.java b/src/org/fox/ttrss/util/ImageCacheService.java index 30bc6022..b699c569 100644 --- a/src/org/fox/ttrss/util/ImageCacheService.java +++ b/src/org/fox/ttrss/util/ImageCacheService.java @@ -25,6 +25,7 @@ import android.os.Environment; public class ImageCacheService extends IntentService { + @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); public static final int NOTIFY_DOWNLOADING = 1; @@ -123,6 +124,7 @@ public class ImageCacheService extends IntentService { } } + @SuppressWarnings("deprecation") private void updateNotification(String msg) { Notification notification = new Notification(R.drawable.icon, getString(R.string.notify_downloading_title), System.currentTimeMillis());