Skip to content

Commit 204ace4

Browse files
committed
remove Lint errors
1 parent 5de7e9e commit 204ace4

File tree

4 files changed

+33
-148
lines changed

4 files changed

+33
-148
lines changed

owncloudApp/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* ownCloud Android client application
33
*
44
* @author Bartek Przybylski
@@ -57,6 +57,9 @@
5757
import com.owncloud.android.utils.MimetypeIconUtil;
5858
import com.owncloud.android.utils.PreferenceUtils;
5959

60+
import org.jetbrains.annotations.NotNull;
61+
62+
6063
/**
6164
* This Fragment is used to display the details about a file.
6265
*/
@@ -76,7 +79,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
7679

7780
/**
7881
* Public factory method to create new FileDetailFragment instances.
79-
*
82+
* <p>
8083
* When 'fileToDetail' or 'ocAccount' are null, creates a dummy layout (to use when a file wasn't tapped before).
8184
*
8285
* @param fileToDetail An {@link OCFile} to show in the fragment
@@ -94,7 +97,7 @@ public static FileDetailFragment newInstance(OCFile fileToDetail, Account accoun
9497

9598
/**
9699
* Creates an empty details fragment.
97-
*
100+
* <p>
98101
* It's necessary to keep a public constructor without parameters; the system uses it when tries
99102
* to reinstantiate a fragment automatically.
100103
*/
@@ -106,7 +109,7 @@ public FileDetailFragment() {
106109

107110
@Override
108111
public void onActivityCreated(Bundle savedInstanceState) {
109-
super.onCreate(savedInstanceState);
112+
super.onActivityCreated(savedInstanceState);
110113
setHasOptionsMenu(true);
111114
mProgressController = new TransferProgressController((ComponentsGetter) getActivity());
112115
ProgressBar progressBar = mView.findViewById(R.id.fdProgressBar);
@@ -128,8 +131,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
128131
}
129132

130133
@Override
131-
public View onCreateView(LayoutInflater inflater, ViewGroup container,
132-
Bundle savedInstanceState) {
134+
public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
133135

134136
setFile(getArguments().getParcelable(ARG_FILE));
135137
mAccount = getArguments().getParcelable(ARG_ACCOUNT);
@@ -154,7 +156,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
154156
}
155157

156158
@Override
157-
public void onSaveInstanceState(Bundle outState) {
159+
public void onSaveInstanceState(@NotNull Bundle outState) {
158160
super.onSaveInstanceState(outState);
159161
outState.putParcelable(FileActivity.EXTRA_FILE, getFile());
160162
outState.putParcelable(FileActivity.EXTRA_ACCOUNT, mAccount);
@@ -367,9 +369,9 @@ public boolean isEmpty() {
367369
* Updates the view with all relevant details about that file.
368370
*
369371
* @param forcedTransferring Flag signaling if the file should be considered as downloading or uploading,
370-
* although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and
371-
* {@link FileUploaderBinder#isUploading(Account, OCFile)} return false.
372-
* @param refresh If 'true', try to refresh the whole file from the database
372+
* although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and
373+
* {@link FileUploaderBinder#isUploading(Account, OCFile)} return false.
374+
* @param refresh If 'true', try to refresh the whole file from the database
373375
*/
374376
private void updateFileDetails(boolean forcedTransferring, boolean refresh) {
375377
if (readyToShow()) {
@@ -431,6 +433,7 @@ private void setFilename(String filename) {
431433

432434
/**
433435
* Updates the MIME type in view
436+
*
434437
* @param file : An {@link OCFile}
435438
*/
436439
private void setFiletype(OCFile file) {

owncloudApp/src/main/java/com/owncloud/android/ui/preview/ImageViewCustom.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

owncloudApp/src/main/java/third_parties/in/srain/cube/GridViewWithHeaderAndFooter.java

Lines changed: 18 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,23 @@ private static class FixedViewInfo {
5555
* The view to add to the grid
5656
*/
5757
public View view;
58-
public ViewGroup viewContainer;
58+
ViewGroup viewContainer;
5959
/**
6060
* The data backing the view. This is returned from {@link android.widget.ListAdapter#getItem(int)}.
6161
*/
6262
public Object data;
6363
/**
6464
* <code>true</code> if the fixed view should be selectable in the grid
6565
*/
66-
public boolean isSelectable;
66+
boolean isSelectable;
6767
}
6868

69-
private int mNumColumns = AUTO_FIT;
7069
private View mViewForMeasureRowHeight = null;
7170
private int mRowHeight = -1;
72-
private static final String LOG_TAG = "grid-view-with-header-and-footer";
71+
private static final String LOG_TAG = "grid-view-header-footer";
7372

74-
private ArrayList<FixedViewInfo> mHeaderViewInfos = new ArrayList<FixedViewInfo>();
75-
private ArrayList<FixedViewInfo> mFooterViewInfos = new ArrayList<FixedViewInfo>();
73+
private ArrayList<FixedViewInfo> mHeaderViewInfos = new ArrayList<>();
74+
private ArrayList<FixedViewInfo> mFooterViewInfos = new ArrayList<>();
7675

7776
private void initHeaderGridView() {
7877
}
@@ -96,7 +95,7 @@ public GridViewWithHeaderAndFooter(Context context, AttributeSet attrs, int defS
9695
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
9796
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
9897
ListAdapter adapter = getAdapter();
99-
if (adapter != null && adapter instanceof HeaderViewGridAdapter) {
98+
if (adapter instanceof HeaderViewGridAdapter) {
10099
((HeaderViewGridAdapter) adapter).setNumColumns(getNumColumnsCompatible());
101100
invalidateRowHeight();
102101
((HeaderViewGridAdapter) adapter).setRowHeight(getRowHeight());
@@ -108,15 +107,6 @@ public void setClipChildren(boolean clipChildren) {
108107
// Ignore, since the header rows depend on not being clipped
109108
}
110109

111-
/**
112-
* Do not call this method unless you know how it works.
113-
*
114-
* @param clipChildren
115-
*/
116-
public void setClipChildrenSupper(boolean clipChildren) {
117-
super.setClipChildren(false);
118-
}
119-
120110
/**
121111
* Add a fixed view to appear at the top of the grid. If addHeaderView is
122112
* called more than once, the views will appear in the order they were
@@ -263,23 +253,8 @@ private void removeFixedViewInfo(View v, ArrayList<FixedViewInfo> where) {
263253
}
264254
}
265255

266-
@TargetApi(11)
267256
private int getNumColumnsCompatible() {
268-
if (Build.VERSION.SDK_INT >= 11) {
269-
return super.getNumColumns();
270-
} else {
271-
try {
272-
Field numColumns = getClass().getSuperclass().getDeclaredField("mNumColumns");
273-
numColumns.setAccessible(true);
274-
return numColumns.getInt(this);
275-
} catch (Exception e) {
276-
if (mNumColumns != -1) {
277-
return mNumColumns;
278-
}
279-
throw new RuntimeException("Can not determine the mNumColumns for this API platform, please call " +
280-
"setNumColumns to set it.");
281-
}
282-
}
257+
return super.getNumColumns();
283258
}
284259

285260
@TargetApi(16)
@@ -337,24 +312,14 @@ public int getRowHeight() {
337312
return mRowHeight;
338313
}
339314

340-
@TargetApi(11)
341315
public void tryToScrollToBottomSmoothly() {
342316
int lastPos = getAdapter().getCount() - 1;
343-
if (Build.VERSION.SDK_INT >= 11) {
344-
smoothScrollToPositionFromTop(lastPos, 0);
345-
} else {
346-
setSelection(lastPos);
347-
}
317+
smoothScrollToPositionFromTop(lastPos, 0);
348318
}
349319

350-
@TargetApi(11)
351320
public void tryToScrollToBottomSmoothly(int duration) {
352321
int lastPos = getAdapter().getCount() - 1;
353-
if (Build.VERSION.SDK_INT >= 11) {
354-
smoothScrollToPositionFromTop(lastPos, 0, duration);
355-
} else {
356-
setSelection(lastPos);
357-
}
322+
smoothScrollToPositionFromTop(lastPos, 0, duration);
358323
}
359324

360325
@Override
@@ -406,9 +371,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
406371
@Override
407372
public void setNumColumns(int numColumns) {
408373
super.setNumColumns(numColumns);
409-
mNumColumns = numColumns;
410374
ListAdapter adapter = getAdapter();
411-
if (adapter != null && adapter instanceof HeaderViewGridAdapter) {
375+
if (adapter instanceof HeaderViewGridAdapter) {
412376
((HeaderViewGridAdapter) adapter).setNumColumns(numColumns);
413377
}
414378
}
@@ -426,7 +390,7 @@ private static class HeaderViewGridAdapter implements WrapperListAdapter, Filter
426390
private final DataSetObservable mDataSetObservable = new DataSetObservable();
427391
private final ListAdapter mAdapter;
428392
static final ArrayList<FixedViewInfo> EMPTY_INFO_LIST =
429-
new ArrayList<FixedViewInfo>();
393+
new ArrayList<>();
430394

431395
// This ArrayList is assumed to NOT be null.
432396
ArrayList<FixedViewInfo> mHeaderViewInfos;
@@ -458,7 +422,7 @@ public HeaderViewGridAdapter(ArrayList<FixedViewInfo> headerViewInfos, ArrayList
458422
&& areAllListInfosSelectable(mFooterViewInfos);
459423
}
460424

461-
public void setNumColumns(int numColumns) {
425+
void setNumColumns(int numColumns) {
462426
if (numColumns < 1) {
463427
return;
464428
}
@@ -468,15 +432,15 @@ public void setNumColumns(int numColumns) {
468432
}
469433
}
470434

471-
public void setRowHeight(int height) {
435+
void setRowHeight(int height) {
472436
mRowHeight = height;
473437
}
474438

475439
public int getHeadersCount() {
476440
return mHeaderViewInfos.size();
477441
}
478442

479-
public int getFootersCount() {
443+
int getFootersCount() {
480444
return mFooterViewInfos.size();
481445
}
482446

@@ -496,7 +460,7 @@ private boolean areAllListInfosSelectable(ArrayList<FixedViewInfo> infos) {
496460
return true;
497461
}
498462

499-
public boolean removeHeader(View v) {
463+
boolean removeHeader(View v) {
500464
for (int i = 0; i < mHeaderViewInfos.size(); i++) {
501465
FixedViewInfo info = mHeaderViewInfos.get(i);
502466
if (info.view == v) {
@@ -510,7 +474,7 @@ public boolean removeHeader(View v) {
510474
return false;
511475
}
512476

513-
public boolean removeFooter(View v) {
477+
boolean removeFooter(View v) {
514478
for (int i = 0; i < mFooterViewInfos.size(); i++) {
515479
FixedViewInfo info = mFooterViewInfos.get(i);
516480
if (info.view == v) {
@@ -543,8 +507,7 @@ public boolean areAllItemsEnabled() {
543507
}
544508

545509
private int getAdapterAndPlaceHolderCount() {
546-
final int adapterCount = (int) (Math.ceil(1f * mAdapter.getCount() / mNumColumns) * mNumColumns);
547-
return adapterCount;
510+
return (int) (Math.ceil(1f * mAdapter.getCount() / mNumColumns) * mNumColumns);
548511
}
549512

550513
@Override
@@ -657,8 +620,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
657620
adapterCount = getAdapterAndPlaceHolderCount();
658621
if (adjPosition < adapterCount) {
659622
if (adjPosition < mAdapter.getCount()) {
660-
View view = mAdapter.getView(adjPosition, convertView, parent);
661-
return view;
623+
return mAdapter.getView(adjPosition, convertView, parent);
662624
} else {
663625
if (convertView == null) {
664626
convertView = new View(parent.getContext());

owncloudApp/src/main/res/menu/file_actions_menu.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
<item
2424
android:id="@+id/file_action_select_all"
2525
android:title="@string/actionbar_select_all"
26-
android:showAsAction="never" />
26+
app:showAsAction="never" />
2727

2828
<item
2929
android:id="@+id/action_select_inverse"
3030
android:title="@string/actionbar_select_inverse"
3131
android:visible="true"
32-
android:showAsAction="never" />
32+
app:showAsAction="never" />
3333

3434
<item
3535
android:id="@+id/action_share_file"

0 commit comments

Comments
 (0)