From d74beb00277dec1763da5e399a3dc9621a9daa7d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 16 Oct 2013 12:42:58 +0400 Subject: [PATCH] move pulltorefresh adapter to common activity, remove some imports and unused pragmas --- src/org/fox/ttrss/ArticleFragment.java | 5 ---- src/org/fox/ttrss/ArticlePager.java | 3 +-- src/org/fox/ttrss/CommonActivity.java | 6 ++--- src/org/fox/ttrss/FeedCategoriesFragment.java | 1 - src/org/fox/ttrss/FeedsActivity.java | 14 +++-------- src/org/fox/ttrss/FeedsFragment.java | 4 ++-- src/org/fox/ttrss/HeadlinesFragment.java | 8 +------ src/org/fox/ttrss/OnlineActivity.java | 23 +++++++------------ .../ttrss/offline/OfflineArticleFragment.java | 3 +-- .../ttrss/offline/OfflineFeedsActivity.java | 7 +++--- .../offline/OfflineHeadlinesActivity.java | 1 - .../offline/OfflineHeadlinesFragment.java | 6 ----- .../fox/ttrss/share/CommonShareActivity.java | 3 +-- .../fox/ttrss/share/SubscribeActivity.java | 3 +-- 14 files changed, 23 insertions(+), 64 deletions(-) diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 9378ea25..855ecd65 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -18,20 +18,16 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Typeface; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.text.Html; -import android.util.Log; import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.GestureDetector; import android.view.LayoutInflater; -import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; @@ -42,7 +38,6 @@ import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebView; import android.webkit.WebView.HitTestResult; import android.widget.TextView; -import android.widget.AdapterView.AdapterContextMenuInfo; public class ArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { private final String TAG = this.getClass().getSimpleName(); diff --git a/src/org/fox/ttrss/ArticlePager.java b/src/org/fox/ttrss/ArticlePager.java index f7e5a13f..e9c3f57a 100644 --- a/src/org/fox/ttrss/ArticlePager.java +++ b/src/org/fox/ttrss/ArticlePager.java @@ -24,7 +24,6 @@ import android.view.ViewGroup; import android.view.WindowManager; import com.google.gson.JsonElement; -import com.viewpagerindicator.TitlePageIndicator; import com.viewpagerindicator.UnderlinePageIndicator; public class ArticlePager extends Fragment { @@ -141,7 +140,7 @@ public class ArticlePager extends Fragment { return view; } - @SuppressWarnings({ "unchecked", "serial" }) + @SuppressWarnings({ "serial" }) protected void refresh(boolean append) { m_activity.setLoadingStatus(R.string.blank, true); diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index dd426966..b417d25a 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -2,22 +2,20 @@ package org.fox.ttrss; import org.fox.ttrss.util.DatabaseHelper; -import com.actionbarsherlock.app.SherlockFragmentActivity; - import android.annotation.SuppressLint; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.graphics.Point; -import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.Display; import android.view.View; import android.widget.TextView; import android.widget.Toast; +import com.actionbarsherlock.app.SherlockFragmentActivity; + public class CommonActivity extends SherlockFragmentActivity { private final String TAG = this.getClass().getSimpleName(); diff --git a/src/org/fox/ttrss/FeedCategoriesFragment.java b/src/org/fox/ttrss/FeedCategoriesFragment.java index 03dc4873..5c0a15ff 100644 --- a/src/org/fox/ttrss/FeedCategoriesFragment.java +++ b/src/org/fox/ttrss/FeedCategoriesFragment.java @@ -254,7 +254,6 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe m_activity.setProgressBarIndeterminateVisibility(showProgress); } */ - @SuppressWarnings("unchecked") public void refresh(boolean background) { CatsRequest req = new CatsRequest(getActivity().getApplicationContext()); diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 0b4ca761..1c875fbb 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -9,12 +9,6 @@ import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.FeedCategory; import org.fox.ttrss.util.AppRater; -import com.actionbarsherlock.view.MenuItem; -import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; -import uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock.PullToRefreshAttacher; - -import android.view.ViewGroup; -import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.content.Intent; @@ -25,9 +19,11 @@ import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; -import android.view.View; import android.widget.LinearLayout; +import com.actionbarsherlock.view.MenuItem; +import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; + public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener { private final String TAG = this.getClass().getSimpleName(); @@ -41,8 +37,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe private SlidingMenu m_slidingMenu; private boolean m_feedIsSelected = false; - protected PullToRefreshAttacher m_pullToRefreshAttacher; - @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { @@ -58,8 +52,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe findViewById(R.id.sw600dp_port_anchor) == null); GlobalState.getInstance().load(savedInstanceState); - - m_pullToRefreshAttacher = PullToRefreshAttacher.get(this); if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) { m_slidingMenu = new SlidingMenu(this); diff --git a/src/org/fox/ttrss/FeedsFragment.java b/src/org/fox/ttrss/FeedsFragment.java index 31c03ed7..97b1f2b2 100644 --- a/src/org/fox/ttrss/FeedsFragment.java +++ b/src/org/fox/ttrss/FeedsFragment.java @@ -319,7 +319,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh } } - @SuppressWarnings({ "unchecked", "serial" }) + @SuppressWarnings({ "serial" }) public void refresh(boolean background) { //FeedCategory cat = m_onlineServices.getActiveCategory(); @@ -364,7 +364,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh getActivity().setProgressBarIndeterminateVisibility(showProgress); } */ - @SuppressWarnings({ "unchecked", "serial" }) + @SuppressWarnings({ "serial" }) public void getFeedIcons() { ApiRequest req = new ApiRequest(getActivity().getApplicationContext()) { diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index f5e62e5b..e9812d36 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -34,11 +34,6 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.view.animation.AnimationSet; -import android.view.animation.LayoutAnimationController; -import android.view.animation.TranslateAnimation; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.AdapterView; @@ -46,7 +41,6 @@ import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.CheckBox; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -361,7 +355,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } } - @SuppressWarnings({ "unchecked", "serial" }) + @SuppressWarnings({ "serial" }) public void refresh(boolean append) { if (m_activity != null && m_feed != null) { m_refreshInProgress = true; diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 033b119d..3b15b572 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -13,14 +13,16 @@ import org.fox.ttrss.types.ArticleList; import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.Label; import org.fox.ttrss.widget.SmallWidgetProvider; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.select.Elements; +import uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock.PullToRefreshAttacher; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Dialog; -import android.appwidget.AppWidgetManager; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; -import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; @@ -38,11 +40,8 @@ import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.Window; -import android.webkit.WebView; -import android.webkit.WebView.HitTestResult; import android.widget.EditText; import android.widget.SearchView; -import android.widget.ShareActionProvider; import android.widget.TextView; import com.actionbarsherlock.view.ActionMode; @@ -54,11 +53,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; - public class OnlineActivity extends CommonActivity { private final String TAG = this.getClass().getSimpleName(); @@ -75,6 +69,8 @@ public class OnlineActivity extends CommonActivity { private String m_lastImageHitTestUrl; + protected PullToRefreshAttacher m_pullToRefreshAttacher; + private BroadcastReceiver m_broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context content, Intent intent) { @@ -153,6 +149,8 @@ public class OnlineActivity extends CommonActivity { super.onCreate(savedInstanceState); + m_pullToRefreshAttacher = PullToRefreshAttacher.get(this); + if (canUseProgress()) { requestWindowFeature(Window.FEATURE_PROGRESS); } @@ -1268,7 +1266,6 @@ public class OnlineActivity extends CommonActivity { req.execute(map); } - @SuppressWarnings({ "unchecked", "serial" }) public void saveArticleMarked(final Article article) { ApiRequest req = new ApiRequest(getApplicationContext()) { protected void onPostExecute(JsonElement result) { @@ -1409,7 +1406,6 @@ public class OnlineActivity extends CommonActivity { return super.onKeyUp(keyCode, event); } - @SuppressWarnings("unchecked") public void catchupFeed(final Feed feed) { Log.d(TAG, "catchupFeed=" + feed); @@ -1433,7 +1429,6 @@ public class OnlineActivity extends CommonActivity { req.execute(map); } - @SuppressWarnings("unchecked") public void toggleArticlesMarked(final ArticleList articles) { ApiRequest req = new ApiRequest(getApplicationContext()); @@ -1451,7 +1446,6 @@ public class OnlineActivity extends CommonActivity { req.execute(map); } - @SuppressWarnings("unchecked") public void toggleArticlesUnread(final ArticleList articles) { ApiRequest req = new ApiRequest(getApplicationContext()); @@ -1470,7 +1464,6 @@ public class OnlineActivity extends CommonActivity { //refresh(); } - @SuppressWarnings("unchecked") public void toggleArticlesPublished(final ArticleList articles) { ApiRequest req = new ApiRequest(getApplicationContext()); diff --git a/src/org/fox/ttrss/offline/OfflineArticleFragment.java b/src/org/fox/ttrss/offline/OfflineArticleFragment.java index c3a175dc..dabf84b0 100644 --- a/src/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/src/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -7,7 +7,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; -import org.fox.ttrss.CommonActivity; import org.fox.ttrss.R; import org.fox.ttrss.util.ImageCacheService; import org.jsoup.Jsoup; @@ -39,8 +38,8 @@ import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebSettings.LayoutAlgorithm; -import android.webkit.WebView.HitTestResult; import android.webkit.WebView; +import android.webkit.WebView.HitTestResult; import android.widget.TextView; public class OfflineArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java index 1ca965b7..a6c8b349 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -3,9 +3,6 @@ package org.fox.ttrss.offline; import org.fox.ttrss.GlobalState; import org.fox.ttrss.R; -import com.actionbarsherlock.view.MenuItem; -import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; - import android.animation.LayoutTransition; import android.annotation.SuppressLint; import android.content.Intent; @@ -17,10 +14,12 @@ import android.provider.BaseColumns; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.util.Log; -import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; +import com.actionbarsherlock.view.MenuItem; +import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; + public class OfflineFeedsActivity extends OfflineActivity implements OfflineHeadlinesEventListener { private final String TAG = this.getClass().getSimpleName(); diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java index 5495d5b6..b40f3983 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesActivity.java @@ -19,7 +19,6 @@ import android.util.Log; import android.view.View; public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener { - @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); protected SharedPreferences m_prefs; diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index eae05b8b..50c861ca 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -34,17 +34,11 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.view.animation.AnimationSet; -import android.view.animation.LayoutAnimationController; -import android.view.animation.TranslateAnimation; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.CheckBox; -import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; diff --git a/src/org/fox/ttrss/share/CommonShareActivity.java b/src/org/fox/ttrss/share/CommonShareActivity.java index 4935e44e..984ad152 100644 --- a/src/org/fox/ttrss/share/CommonShareActivity.java +++ b/src/org/fox/ttrss/share/CommonShareActivity.java @@ -54,7 +54,7 @@ public abstract class CommonShareActivity extends CommonActivity { protected abstract void onLoggingIn(int requestId); - @SuppressWarnings({ "unchecked", "serial" }) + @SuppressWarnings({ "serial" }) public void login(int requestId) { if (m_prefs.getString("ttrss_url", "").trim().length() == 0) { @@ -105,7 +105,6 @@ public abstract class CommonShareActivity extends CommonActivity { m_requestId = requestId; } - @SuppressWarnings("unchecked") protected void onPostExecute(JsonElement result) { if (result != null) { try { diff --git a/src/org/fox/ttrss/share/SubscribeActivity.java b/src/org/fox/ttrss/share/SubscribeActivity.java index bed173a2..b8faf114 100644 --- a/src/org/fox/ttrss/share/SubscribeActivity.java +++ b/src/org/fox/ttrss/share/SubscribeActivity.java @@ -8,10 +8,9 @@ import java.util.HashMap; import java.util.List; import org.fox.ttrss.ApiRequest; -import org.fox.ttrss.ApiRequest.ApiError; +import org.fox.ttrss.R; import org.fox.ttrss.types.FeedCategory; import org.fox.ttrss.types.FeedCategoryList; -import org.fox.ttrss.R; import android.content.Context; import android.os.Bundle;