move pulltorefresh adapter to common activity, remove some imports and

unused pragmas
This commit is contained in:
Andrew Dolgov 2013-10-16 12:42:58 +04:00
parent 29cb4f17d8
commit d74beb0027
14 changed files with 23 additions and 64 deletions

View File

@ -18,20 +18,16 @@ import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.Html; import android.text.Html;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -42,7 +38,6 @@ import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebView.HitTestResult; import android.webkit.WebView.HitTestResult;
import android.widget.TextView; import android.widget.TextView;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class ArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { public class ArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();

View File

@ -24,7 +24,6 @@ import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.viewpagerindicator.TitlePageIndicator;
import com.viewpagerindicator.UnderlinePageIndicator; import com.viewpagerindicator.UnderlinePageIndicator;
public class ArticlePager extends Fragment { public class ArticlePager extends Fragment {
@ -141,7 +140,7 @@ public class ArticlePager extends Fragment {
return view; return view;
} }
@SuppressWarnings({ "unchecked", "serial" }) @SuppressWarnings({ "serial" })
protected void refresh(boolean append) { protected void refresh(boolean append) {
m_activity.setLoadingStatus(R.string.blank, true); m_activity.setLoadingStatus(R.string.blank, true);

View File

@ -2,22 +2,20 @@ package org.fox.ttrss;
import org.fox.ttrss.util.DatabaseHelper; import org.fox.ttrss.util.DatabaseHelper;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.graphics.Point; import android.graphics.Point;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragmentActivity;
public class CommonActivity extends SherlockFragmentActivity { public class CommonActivity extends SherlockFragmentActivity {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();

View File

@ -254,7 +254,6 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
m_activity.setProgressBarIndeterminateVisibility(showProgress); m_activity.setProgressBarIndeterminateVisibility(showProgress);
} */ } */
@SuppressWarnings("unchecked")
public void refresh(boolean background) { public void refresh(boolean background) {
CatsRequest req = new CatsRequest(getActivity().getApplicationContext()); CatsRequest req = new CatsRequest(getActivity().getApplicationContext());

View File

@ -9,12 +9,6 @@ import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.FeedCategory; import org.fox.ttrss.types.FeedCategory;
import org.fox.ttrss.util.AppRater; 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.animation.ObjectAnimator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
@ -25,9 +19,11 @@ import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.actionbarsherlock.view.MenuItem;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener { public class FeedsActivity extends OnlineActivity implements HeadlinesEventListener {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@ -41,8 +37,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
private SlidingMenu m_slidingMenu; private SlidingMenu m_slidingMenu;
private boolean m_feedIsSelected = false; private boolean m_feedIsSelected = false;
protected PullToRefreshAttacher m_pullToRefreshAttacher;
@SuppressLint("NewApi") @SuppressLint("NewApi")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -58,8 +52,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
findViewById(R.id.sw600dp_port_anchor) == null); findViewById(R.id.sw600dp_port_anchor) == null);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);
m_pullToRefreshAttacher = PullToRefreshAttacher.get(this);
if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) { if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this); m_slidingMenu = new SlidingMenu(this);

View File

@ -319,7 +319,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
} }
} }
@SuppressWarnings({ "unchecked", "serial" }) @SuppressWarnings({ "serial" })
public void refresh(boolean background) { public void refresh(boolean background) {
//FeedCategory cat = m_onlineServices.getActiveCategory(); //FeedCategory cat = m_onlineServices.getActiveCategory();
@ -364,7 +364,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
getActivity().setProgressBarIndeterminateVisibility(showProgress); getActivity().setProgressBarIndeterminateVisibility(showProgress);
} */ } */
@SuppressWarnings({ "unchecked", "serial" }) @SuppressWarnings({ "serial" })
public void getFeedIcons() { public void getFeedIcons() {
ApiRequest req = new ApiRequest(getActivity().getApplicationContext()) { ApiRequest req = new ApiRequest(getActivity().getApplicationContext()) {

View File

@ -34,11 +34,6 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; 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;
import android.widget.AbsListView.OnScrollListener; import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView; import android.widget.AdapterView;
@ -46,7 +41,6 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; 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) { public void refresh(boolean append) {
if (m_activity != null && m_feed != null) { if (m_activity != null && m_feed != null) {
m_refreshInProgress = true; m_refreshInProgress = true;

View File

@ -13,14 +13,16 @@ import org.fox.ttrss.types.ArticleList;
import org.fox.ttrss.types.Feed; import org.fox.ttrss.types.Feed;
import org.fox.ttrss.types.Label; import org.fox.ttrss.types.Label;
import org.fox.ttrss.widget.SmallWidgetProvider; 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.annotation.TargetApi;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.appwidget.AppWidgetManager;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
@ -38,11 +40,8 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.widget.EditText; import android.widget.EditText;
import android.widget.SearchView; import android.widget.SearchView;
import android.widget.ShareActionProvider;
import android.widget.TextView; import android.widget.TextView;
import com.actionbarsherlock.view.ActionMode; import com.actionbarsherlock.view.ActionMode;
@ -54,11 +53,6 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken; 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 { public class OnlineActivity extends CommonActivity {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@ -75,6 +69,8 @@ public class OnlineActivity extends CommonActivity {
private String m_lastImageHitTestUrl; private String m_lastImageHitTestUrl;
protected PullToRefreshAttacher m_pullToRefreshAttacher;
private BroadcastReceiver m_broadcastReceiver = new BroadcastReceiver() { private BroadcastReceiver m_broadcastReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context content, Intent intent) { public void onReceive(Context content, Intent intent) {
@ -153,6 +149,8 @@ public class OnlineActivity extends CommonActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
m_pullToRefreshAttacher = PullToRefreshAttacher.get(this);
if (canUseProgress()) { if (canUseProgress()) {
requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_PROGRESS);
} }
@ -1268,7 +1266,6 @@ public class OnlineActivity extends CommonActivity {
req.execute(map); req.execute(map);
} }
@SuppressWarnings({ "unchecked", "serial" })
public void saveArticleMarked(final Article article) { public void saveArticleMarked(final Article article) {
ApiRequest req = new ApiRequest(getApplicationContext()) { ApiRequest req = new ApiRequest(getApplicationContext()) {
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
@ -1409,7 +1406,6 @@ public class OnlineActivity extends CommonActivity {
return super.onKeyUp(keyCode, event); return super.onKeyUp(keyCode, event);
} }
@SuppressWarnings("unchecked")
public void catchupFeed(final Feed feed) { public void catchupFeed(final Feed feed) {
Log.d(TAG, "catchupFeed=" + feed); Log.d(TAG, "catchupFeed=" + feed);
@ -1433,7 +1429,6 @@ public class OnlineActivity extends CommonActivity {
req.execute(map); req.execute(map);
} }
@SuppressWarnings("unchecked")
public void toggleArticlesMarked(final ArticleList articles) { public void toggleArticlesMarked(final ArticleList articles) {
ApiRequest req = new ApiRequest(getApplicationContext()); ApiRequest req = new ApiRequest(getApplicationContext());
@ -1451,7 +1446,6 @@ public class OnlineActivity extends CommonActivity {
req.execute(map); req.execute(map);
} }
@SuppressWarnings("unchecked")
public void toggleArticlesUnread(final ArticleList articles) { public void toggleArticlesUnread(final ArticleList articles) {
ApiRequest req = new ApiRequest(getApplicationContext()); ApiRequest req = new ApiRequest(getApplicationContext());
@ -1470,7 +1464,6 @@ public class OnlineActivity extends CommonActivity {
//refresh(); //refresh();
} }
@SuppressWarnings("unchecked")
public void toggleArticlesPublished(final ArticleList articles) { public void toggleArticlesPublished(final ArticleList articles) {
ApiRequest req = new ApiRequest(getApplicationContext()); ApiRequest req = new ApiRequest(getApplicationContext());

View File

@ -7,7 +7,6 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.fox.ttrss.CommonActivity;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import org.fox.ttrss.util.ImageCacheService; import org.fox.ttrss.util.ImageCacheService;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
@ -39,8 +38,8 @@ import android.view.ViewGroup;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView.HitTestResult;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.widget.TextView; import android.widget.TextView;
public class OfflineArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener { public class OfflineArticleFragment extends Fragment implements GestureDetector.OnDoubleTapListener {

View File

@ -3,9 +3,6 @@ package org.fox.ttrss.offline;
import org.fox.ttrss.GlobalState; import org.fox.ttrss.GlobalState;
import org.fox.ttrss.R; import org.fox.ttrss.R;
import com.actionbarsherlock.view.MenuItem;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import android.animation.LayoutTransition; import android.animation.LayoutTransition;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
@ -17,10 +14,12 @@ import android.provider.BaseColumns;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.actionbarsherlock.view.MenuItem;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
public class OfflineFeedsActivity extends OfflineActivity implements OfflineHeadlinesEventListener { public class OfflineFeedsActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();

View File

@ -19,7 +19,6 @@ import android.util.Log;
import android.view.View; import android.view.View;
public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener { public class OfflineHeadlinesActivity extends OfflineActivity implements OfflineHeadlinesEventListener {
@SuppressWarnings("unused")
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
protected SharedPreferences m_prefs; protected SharedPreferences m_prefs;

View File

@ -34,17 +34,11 @@ import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; 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.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;

View File

@ -54,7 +54,7 @@ public abstract class CommonShareActivity extends CommonActivity {
protected abstract void onLoggingIn(int requestId); protected abstract void onLoggingIn(int requestId);
@SuppressWarnings({ "unchecked", "serial" }) @SuppressWarnings({ "serial" })
public void login(int requestId) { public void login(int requestId) {
if (m_prefs.getString("ttrss_url", "").trim().length() == 0) { if (m_prefs.getString("ttrss_url", "").trim().length() == 0) {
@ -105,7 +105,6 @@ public abstract class CommonShareActivity extends CommonActivity {
m_requestId = requestId; m_requestId = requestId;
} }
@SuppressWarnings("unchecked")
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
if (result != null) { if (result != null) {
try { try {

View File

@ -8,10 +8,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import org.fox.ttrss.ApiRequest; 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.FeedCategory;
import org.fox.ttrss.types.FeedCategoryList; import org.fox.ttrss.types.FeedCategoryList;
import org.fox.ttrss.R;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;