Browse Source

Fixed a number of lint warnings

master
Anthony Restaino 9 years ago
parent
commit
d5102b5e54
  1. 3
      app/src/main/java/acr/browser/lightning/dialog/BookmarksDialogBuilder.java
  2. 5
      app/src/main/java/acr/browser/lightning/fragment/BookmarkSettingsFragment.java
  3. 3
      app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java
  4. 1
      app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java
  5. 2
      app/src/main/java/acr/browser/lightning/object/SearchAdapter.java
  6. 3
      app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java
  7. 2
      app/src/main/java/acr/browser/lightning/utils/PermissionsManager.java
  8. 6
      app/src/main/java/acr/browser/lightning/view/LightningView.java

3
app/src/main/java/acr/browser/lightning/dialog/BookmarksDialogBuilder.java

@ -49,7 +49,7 @@ public class BookmarksDialogBuilder {
public void showLongPressedDialogForUrl(final Context context, final String url) { public void showLongPressedDialogForUrl(final Context context, final String url) {
final HistoryItem item; final HistoryItem item;
if (url.startsWith(Constants.FILE) && url.endsWith(Constants.BOOKMARKS_FILENAME)) { if (url.startsWith(Constants.FILE) && url.endsWith(Constants.BOOKMARKS_FILENAME)) {
// TODO this in so many ways is wrong, probably we need to redesign the folder mechanism // TODO hacky, make a better bookmark mechanism in the future
final Uri uri = Uri.parse(url); final Uri uri = Uri.parse(url);
final String filename = uri.getLastPathSegment(); final String filename = uri.getLastPathSegment();
final String folderTitle = filename.substring(0, filename.length() - Constants.BOOKMARKS_FILENAME.length() - 1); final String folderTitle = filename.substring(0, filename.length() - Constants.BOOKMARKS_FILENAME.length() - 1);
@ -125,7 +125,6 @@ public class BookmarksDialogBuilder {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
HistoryItem editedItem = new HistoryItem(); HistoryItem editedItem = new HistoryItem();
String currentFolder = item.getFolder();
editedItem.setTitle(getTitle.getText().toString()); editedItem.setTitle(getTitle.getText().toString());
editedItem.setUrl(getUrl.getText().toString()); editedItem.setUrl(getUrl.getText().toString());
editedItem.setUrl(getUrl.getText().toString()); editedItem.setUrl(getUrl.getText().toString());

5
app/src/main/java/acr/browser/lightning/fragment/BookmarkSettingsFragment.java

@ -33,7 +33,6 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
@Inject BookmarkManager mBookmarkManager; @Inject BookmarkManager mBookmarkManager;
private File[] mFileList; private File[] mFileList;
private String[] mFileNameList; private String[] mFileNameList;
private PermissionsManager mPermissionsManager;
private static final String[] REQUIRED_PERMISSIONS = new String[]{ private static final String[] REQUIRED_PERMISSIONS = new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE Manifest.permission.WRITE_EXTERNAL_STORAGE
@ -51,9 +50,9 @@ public class BookmarkSettingsFragment extends PreferenceFragment implements Pref
initPrefs(); initPrefs();
mPermissionsManager = PermissionsManager.getInstance(); PermissionsManager permissionsManager = PermissionsManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mPermissionsManager.requestPermissionsIfNecessary(getActivity(), REQUIRED_PERMISSIONS); permissionsManager.requestPermissionsIfNecessary(getActivity(), REQUIRED_PERMISSIONS);
} }
} }

3
app/src/main/java/acr/browser/lightning/fragment/BookmarksFragment.java

@ -70,7 +70,7 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
private Bitmap mWebpageBitmap, mFolderBitmap; private Bitmap mWebpageBitmap, mFolderBitmap;
// Bookmarks // Bookmarks
private List<HistoryItem> mBookmarks = new ArrayList<>(); private final List<HistoryItem> mBookmarks = new ArrayList<>();
// Views // Views
private ListView mBookmarksListView; private ListView mBookmarksListView;
@ -222,7 +222,6 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
@Subscribe @Subscribe
public void bookmarkDeleted(final BookmarkEvents.Deleted event) { public void bookmarkDeleted(final BookmarkEvents.Deleted event) {
final HistoryItem item = event.item;
// final int size = mBookmarks.size(); // final int size = mBookmarks.size();
mBookmarks.remove(event.item); mBookmarks.remove(event.item);
// assert mBookmarks.size() < size; // assert mBookmarks.size() < size;

1
app/src/main/java/acr/browser/lightning/fragment/GeneralSettingsFragment.java

@ -228,7 +228,6 @@ public class GeneralSettingsFragment extends PreferenceFragment implements Prefe
} }
private void setProxyChoice(int choice) { private void setProxyChoice(int choice) {
ProxyUtils utils = ProxyUtils.getInstance(mActivity);
switch (choice) { switch (choice) {
case Constants.PROXY_ORBOT: case Constants.PROXY_ORBOT:
choice = ProxyUtils.setProxyChoice(choice, mActivity); choice = ProxyUtils.setProxyChoice(choice, mActivity);

2
app/src/main/java/acr/browser/lightning/object/SearchAdapter.java

@ -402,7 +402,7 @@ public class SearchAdapter extends BaseAdapter implements Filterable {
return connectivity.getActiveNetworkInfo(); return connectivity.getActiveNetworkInfo();
} }
//TODO Write simpler algorithm // The old suggestions algorithm, leaving here just for reference
// private List<HistoryItem> getSuggestions() { // private List<HistoryItem> getSuggestions() {
// List<HistoryItem> filteredList = new ArrayList<>(); // List<HistoryItem> filteredList = new ArrayList<>();
// //

3
app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java

@ -736,8 +736,7 @@ public class ArticleTextExtractor {
} }
private static String extractType(Document doc) { private static String extractType(Document doc) {
String type = SHelper.innerTrim(doc.select("head meta[property=og:type]").attr("content")); return SHelper.innerTrim(doc.select("head meta[property=og:type]").attr("content"));
return type;
} }
private static String extractSitename(Document doc) { private static String extractSitename(Document doc) {

2
app/src/main/java/acr/browser/lightning/utils/PermissionsManager.java

@ -16,7 +16,7 @@ import java.util.Set;
public class PermissionsManager { public class PermissionsManager {
private static PermissionsManager mInstance; private static PermissionsManager mInstance;
private Set<String> mPendingRequests = new HashSet<>(); private final Set<String> mPendingRequests = new HashSet<>();
public static PermissionsManager getInstance() { public static PermissionsManager getInstance() {
if (mInstance == null) { if (mInstance == null) {

6
app/src/main/java/acr/browser/lightning/view/LightningView.java

@ -72,8 +72,8 @@ public class LightningView {
private final Title mTitle; private final Title mTitle;
private WebView mWebView; private WebView mWebView;
private final boolean mIsIncognitoTab; private final boolean mIsIncognitoTab;
private BrowserController mBrowserController; private final BrowserController mBrowserController;
private GestureDetector mGestureDetector; private final GestureDetector mGestureDetector;
private final Activity mActivity; private final Activity mActivity;
private static String mHomepage; private static String mHomepage;
private static String mDefaultUserAgent; private static String mDefaultUserAgent;
@ -81,7 +81,7 @@ public class LightningView {
private final Bitmap mWebpageBitmap; private final Bitmap mWebpageBitmap;
private static PreferenceManager mPreferences; private static PreferenceManager mPreferences;
private final AdBlock mAdBlock; private final AdBlock mAdBlock;
private IntentUtils mIntentUtils; private final IntentUtils mIntentUtils;
private final Paint mPaint = new Paint(); private final Paint mPaint = new Paint();
private boolean isForegroundTab; private boolean isForegroundTab;
private boolean mTextReflow = false; private boolean mTextReflow = false;

Loading…
Cancel
Save