Skip to content

Commit

Permalink
remove Lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Feb 25, 2019
1 parent 6d6e6e9 commit e98d064
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 170 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author Bartek Przybylski
Expand Down Expand Up @@ -54,6 +54,8 @@
import com.owncloud.android.utils.MimetypeIconUtil;
import com.owncloud.android.utils.PreferenceUtils;

import org.jetbrains.annotations.NotNull;


/**
* This Fragment is used to display the details about a file.
Expand All @@ -75,12 +77,12 @@ public class FileDetailFragment extends FileFragment implements OnClickListener

/**
* Public factory method to create new FileDetailFragment instances.
*
* <p>
* When 'fileToDetail' or 'ocAccount' are null, creates a dummy layout (to use when a file wasn't tapped before).
*
* @param fileToDetail An {@link OCFile} to show in the fragment
* @param account An ownCloud account; needed to start downloads
* @return New fragment with arguments set
* @param fileToDetail An {@link OCFile} to show in the fragment
* @param account An ownCloud account; needed to start downloads
* @return New fragment with arguments set
*/
public static FileDetailFragment newInstance(OCFile fileToDetail, Account account) {
FileDetailFragment frag = new FileDetailFragment();
Expand All @@ -93,7 +95,7 @@ public static FileDetailFragment newInstance(OCFile fileToDetail, Account accoun

/**
* Creates an empty details fragment.
*
* <p>
* It's necessary to keep a public constructor without parameters; the system uses it when tries
* to reinstantiate a fragment automatically.
*/
Expand All @@ -105,7 +107,7 @@ public FileDetailFragment() {

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
mProgressController = new TransferProgressController((ComponentsGetter) getActivity());
ProgressBar progressBar = mView.findViewById(R.id.fdProgressBar);
Expand All @@ -127,8 +129,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

setFile(getArguments().getParcelable(ARG_FILE));
mAccount = getArguments().getParcelable(ARG_ACCOUNT);
Expand All @@ -153,7 +154,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}

@Override
public void onSaveInstanceState(Bundle outState) {
public void onSaveInstanceState(@NotNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable(FileActivity.EXTRA_FILE, getFile());
outState.putParcelable(FileActivity.EXTRA_ACCOUNT, mAccount);
Expand Down Expand Up @@ -233,10 +234,10 @@ public void onPrepareOptionsMenu(Menu menu) {

if (mContainerActivity.getStorageManager() != null) {
FileMenuFilter mf = new FileMenuFilter(
getFile(),
mContainerActivity.getStorageManager().getAccount(),
mContainerActivity,
getActivity()
getFile(),
mContainerActivity.getStorageManager().getAccount(),
mContainerActivity,
getActivity()
);
mf.filter(menu, false, false);
}
Expand All @@ -263,7 +264,7 @@ public void onPrepareOptionsMenu(Menu menu) {
}

item = menu.findItem(R.id.action_switch_view);
if (item != null){
if (item != null) {
item.setVisible(false);
item.setEnabled(false);
}
Expand Down Expand Up @@ -313,7 +314,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}
case R.id.action_cancel_sync: {
((FileDisplayActivity)mContainerActivity).cancelTransference(getFile());
((FileDisplayActivity) mContainerActivity).cancelTransference(getFile());
return true;
}
case R.id.action_download_file:
Expand All @@ -326,17 +327,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
if (!getFile().isDown()) { // Download the file
Log_OC.d(TAG, getFile().getRemotePath() + " : File must be downloaded");
((FileDisplayActivity) mContainerActivity).startDownloadForSending(getFile());
}
else {
} else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());
}
return true;
}
case R.id.action_set_available_offline:{
case R.id.action_set_available_offline: {
mContainerActivity.getFileOperationsHelper().toggleAvailableOffline(getFile(), true);
return true;
}
case R.id.action_unset_available_offline:{
case R.id.action_unset_available_offline: {
mContainerActivity.getFileOperationsHelper().toggleAvailableOffline(getFile(), false);
return true;
}
Expand Down Expand Up @@ -371,9 +371,9 @@ public boolean isEmpty() {
* Updates the view with all relevant details about that file.
*
* @param forcedTransferring Flag signaling if the file should be considered as downloading or uploading,
* although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and
* {@link FileUploaderBinder#isUploading(Account, OCFile)} return false.
* @param refresh If 'true', try to refresh the whole file from the database
* although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and
* {@link FileUploaderBinder#isUploading(Account, OCFile)} return false.
* @param refresh If 'true', try to refresh the whole file from the database
*/
private void updateFileDetails(boolean forcedTransferring, boolean refresh) {
if (readyToShow()) {
Expand All @@ -389,20 +389,20 @@ private void updateFileDetails(boolean forcedTransferring, boolean refresh) {
setFilesize(file.getFileLength());

setTimeModified(file.getModificationTimestamp());

// configure UI for depending upon local state of the file
FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
if (forcedTransferring ||
(downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) ||
(uploaderBinder != null && uploaderBinder.isUploading(mAccount, file))
) {
) {
setButtonsForTransferring();

} else if (file.isDown()) {

setButtonsForDown();

} else {
// TODO load default preview image; when the local file is removed, the preview
// remains there
Expand Down Expand Up @@ -436,13 +436,14 @@ private void setFilename(String filename) {

/**
* Updates the MIME type in view
*
* @param file : An {@link OCFile}
*/
private void setFiletype(OCFile file) {
String mimetype = file.getMimetype();
TextView tv = getView().findViewById(R.id.fdType);
if (tv != null) {
// mimetype MIME type to set
// mimetype MIME type to set
String printableMimetype = DisplayUtils.convertMIMEtoPrettyPrint(mimetype);
tv.setText(printableMimetype);
}
Expand Down Expand Up @@ -480,10 +481,10 @@ private void setFiletype(OCFile file) {
}
}
} else {
// Name of the file, to deduce the icon to use in case the MIME type is not precise enough
String filename = file.getFileName();
// Name of the file, to deduce the icon to use in case the MIME type is not precise enough
String filename = file.getFileName();
iv.setImageResource(MimetypeIconUtil.getFileTypeIconId(mimetype, filename));
}
}
}
}

Expand Down Expand Up @@ -525,8 +526,7 @@ private void setButtonsForTransferring() {
//if (getFile().isDownloading()) {
if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, getFile())) {
progressText.setText(R.string.downloader_download_in_progress_ticker);
}
else {
} else {
if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, getFile())) {
progressText.setText(R.string.uploader_upload_in_progress_ticker);
}
Expand Down

This file was deleted.

Loading

0 comments on commit e98d064

Please sign in to comment.