various lint-related stuff

This commit is contained in:
Andrew Dolgov 2012-09-19 13:37:12 +04:00
parent 9fb03a43f1
commit 797dbe2080
25 changed files with 64 additions and 53 deletions

View File

@ -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" >
<FrameLayout

View File

@ -26,6 +26,7 @@
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >
<FrameLayout

View File

@ -286,6 +286,7 @@ public class ApiRequest extends AsyncTask<HashMap<String,String>, 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) {

View File

@ -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:

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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
@ -161,6 +160,13 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES);
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();

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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,12 +1172,18 @@ public class OnlineActivity extends CommonActivity {
ff.refresh(false);
}
if (includeHeadlines) {
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (hf != null) {
hf.refresh(false);
}
}
}
protected void refresh() {
refresh(true);
}
private class LoginRequest extends ApiRequest {
public LoginRequest(Context context) {

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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());

View File

@ -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;

View File

@ -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());