mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
reformat code
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
c776bfd0e7
commit
c7d0d0f47d
21 changed files with 100 additions and 45 deletions
|
@ -76,8 +76,8 @@ class DocumentsStorageProviderIT : AbstractOnServerIT() {
|
|||
val file1 = rootDir.createFile(type1, name1)!!
|
||||
|
||||
// check assumptions
|
||||
@Suppress("ForbiddenComment")
|
||||
file1.assertRegularFile(name1, 0L, null/* FIXME: type1 */, rootDir)
|
||||
/* FIXME: mimeType */
|
||||
file1.assertRegularFile(name1, 0L, null, rootDir)
|
||||
file1.assertRecentlyModified()
|
||||
|
||||
// file1 is found in root
|
||||
|
|
|
@ -352,7 +352,8 @@ class FileDetailSharingFragmentIT : AbstractIT() {
|
|||
val secondary = FileDetailFragment.newInstance(file, parentFolder, user)
|
||||
activity.addSecondaryFragment(secondary, FileDisplayActivity.TAG_LIST_OF_FILES)
|
||||
activity.addView(
|
||||
FloatingActionButton(activity).apply { // needed for some reason
|
||||
FloatingActionButton(activity).apply {
|
||||
// needed for some reason
|
||||
visibility = View.GONE
|
||||
id = R.id.fab_main
|
||||
}
|
||||
|
|
|
@ -210,9 +210,7 @@ class DocumentScanViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private
|
||||
|
||||
companion object {
|
||||
private companion object {
|
||||
private const val TAG = "DocumentScanViewModel"
|
||||
}
|
||||
|
||||
|
|
|
@ -81,11 +81,13 @@ class AccountRemovalWork(
|
|||
@Suppress("ReturnCount") // legacy code
|
||||
override fun doWork(): Result {
|
||||
val accountName = inputData.getString(ACCOUNT) ?: ""
|
||||
if (TextUtils.isEmpty(accountName)) { // didn't receive account to delete
|
||||
if (TextUtils.isEmpty(accountName)) {
|
||||
// didn't receive account to delete
|
||||
return Result.failure()
|
||||
}
|
||||
val optionalUser = userAccountManager.getUser(accountName)
|
||||
if (!optionalUser.isPresent) { // trying to delete non-existing user
|
||||
if (!optionalUser.isPresent) {
|
||||
// trying to delete non-existing user
|
||||
return Result.failure()
|
||||
}
|
||||
val remoteWipe = inputData.getBoolean(REMOTE_WIPE, false)
|
||||
|
|
|
@ -52,7 +52,8 @@ class CalendarBackupWork(
|
|||
override fun doWork(): Result {
|
||||
val accountName = inputData.getString(ACCOUNT) ?: ""
|
||||
val optionalUser = accountManager.getUser(accountName)
|
||||
if (!optionalUser.isPresent || TextUtils.isEmpty(accountName)) { // no account provided
|
||||
if (!optionalUser.isPresent || TextUtils.isEmpty(accountName)) {
|
||||
// no account provided
|
||||
Log_OC.d(TAG, "User not present")
|
||||
return Result.failure()
|
||||
}
|
||||
|
|
|
@ -81,7 +81,8 @@ class ContactsBackupWork(
|
|||
@Suppress("ReturnCount") // pre-existing issue
|
||||
override fun doWork(): Result {
|
||||
val accountName = inputData.getString(KEY_ACCOUNT) ?: ""
|
||||
if (TextUtils.isEmpty(accountName)) { // no account provided
|
||||
if (TextUtils.isEmpty(accountName)) {
|
||||
// no account provided
|
||||
return Result.failure()
|
||||
}
|
||||
val optionalUser = accountManager.getUser(accountName)
|
||||
|
@ -175,7 +176,8 @@ class ContactsBackupWork(
|
|||
connection.enqueue(request)
|
||||
}
|
||||
|
||||
private fun expireFiles(daysToExpire: Int, backupFolderString: String, user: User) { // -1 disables expiration
|
||||
private fun expireFiles(daysToExpire: Int, backupFolderString: String, user: User) {
|
||||
// -1 disables expiration
|
||||
if (daysToExpire > -1) {
|
||||
val storageManager = FileDataStorageManager(
|
||||
user,
|
||||
|
|
|
@ -198,7 +198,8 @@ class NotificationWork constructor(
|
|||
disableIntent
|
||||
)
|
||||
)
|
||||
} else { // Actions
|
||||
} else {
|
||||
// Actions
|
||||
for (action in notification.getActions()) {
|
||||
val actionIntent = Intent(context, NotificationReceiver::class.java)
|
||||
actionIntent.putExtra(NUMERIC_NOTIFICATION_ID, notification.getNotificationId())
|
||||
|
|
|
@ -184,7 +184,9 @@ internal class PlayerStateMachine(initialState: State, private val delegate: Del
|
|||
.onExit(Action { delegate.onAudioDuck(false) })
|
||||
|
||||
stateMachine = StateMachine(initialState, config)
|
||||
stateMachine.onUnhandledTrigger { _, _ -> /* ignore unhandled event */ }
|
||||
stateMachine.onUnhandledTrigger { _, _ ->
|
||||
/* ignore unhandled event */
|
||||
}
|
||||
}
|
||||
|
||||
private fun immediateTransition() {
|
||||
|
|
|
@ -28,13 +28,39 @@ import android.os.Bundle
|
|||
* a mix-in.
|
||||
*/
|
||||
interface ActivityMixin {
|
||||
fun onNewIntent(intent: Intent) { /* no-op */ }
|
||||
fun onSaveInstanceState(outState: Bundle) { /* no-op */ }
|
||||
fun onCreate(savedInstanceState: Bundle?) { /* no-op */ }
|
||||
fun onRestart() { /* no-op */ }
|
||||
fun onStart() { /* no-op */ }
|
||||
fun onResume() { /* no-op */ }
|
||||
fun onPause() { /* no-op */ }
|
||||
fun onStop() { /* no-op */ }
|
||||
fun onDestroy() { /* no-op */ }
|
||||
fun onNewIntent(intent: Intent) {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onSaveInstanceState(outState: Bundle) {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onCreate(savedInstanceState: Bundle?) {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onRestart() {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onStart() {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onPause() {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onStop() {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
/* no-op */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,8 +91,12 @@ object ContentResolverHelper {
|
|||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private fun
|
||||
getQueryArgsBundle(selection: String?, sortColumn: String?, sortDirection: String?, limit: Int?): Bundle {
|
||||
private fun getQueryArgsBundle(
|
||||
selection: String?,
|
||||
sortColumn: String?,
|
||||
sortDirection: String?,
|
||||
limit: Int?
|
||||
): Bundle {
|
||||
return Bundle().apply {
|
||||
if (selection != null) {
|
||||
putString(ContentResolver.QUERY_ARG_SQL_SELECTION, selection)
|
||||
|
|
|
@ -332,13 +332,15 @@ public class FileUploader extends Service
|
|||
boolean onWifiOnly = intent.getBooleanExtra(KEY_WHILE_ON_WIFI_ONLY, false);
|
||||
boolean whileChargingOnly = intent.getBooleanExtra(KEY_WHILE_CHARGING_ONLY, false);
|
||||
|
||||
if (retry) { // Retry uploads
|
||||
if (retry) {
|
||||
// Retry uploads
|
||||
if (!intent.hasExtra(KEY_ACCOUNT) || !intent.hasExtra(KEY_RETRY_UPLOAD)) {
|
||||
Log_OC.e(TAG, "Not enough information provided in intent: no KEY_RETRY_UPLOAD_KEY");
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
retryUploads(intent, user, requestedUploads);
|
||||
} else { // Start new uploads
|
||||
} else {
|
||||
// Start new uploads
|
||||
if (!(intent.hasExtra(KEY_LOCAL_FILE) || intent.hasExtra(KEY_FILE))) {
|
||||
Log_OC.e(TAG, "Not enough information provided in intent");
|
||||
return Service.START_NOT_STICKY;
|
||||
|
@ -793,7 +795,8 @@ public class FileUploader extends Service
|
|||
boolean needsToUpdateCredentials = uploadResult.getCode() == ResultCode.UNAUTHORIZED;
|
||||
if (needsToUpdateCredentials) {
|
||||
tickerId = R.string.uploader_upload_failed_credentials_error;
|
||||
} else if (uploadResult.getCode() == ResultCode.SYNC_CONFLICT) { // check file conflict
|
||||
} else if (uploadResult.getCode() == ResultCode.SYNC_CONFLICT) {
|
||||
// check file conflict
|
||||
tickerId = R.string.uploader_upload_failed_sync_conflict_error;
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,8 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
|
|||
saveFolderInDB();
|
||||
}
|
||||
}
|
||||
} else { // Create directory on DB
|
||||
} else {
|
||||
// Create directory on DB
|
||||
OCFile newDir = new OCFile(remotePath);
|
||||
newDir.setMimeType(MimeType.DIRECTORY);
|
||||
long parentId = getStorageManager().getFileByPath(FileStorageUtils.getParentPath(remotePath)).getFileId();
|
||||
|
|
|
@ -260,7 +260,8 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
Handler handler = new Handler(context.getMainLooper());
|
||||
try {
|
||||
return ParcelFileDescriptor.open(file, accessMode, handler, error -> {
|
||||
if (error == null) { // no error
|
||||
if (error == null) {
|
||||
// no error
|
||||
// As we can't upload the file synchronously, let's at least update its metadata here already.
|
||||
ocFile.setFileLength(file.length());
|
||||
ocFile.setModificationTimestamp(System.currentTimeMillis());
|
||||
|
@ -275,7 +276,8 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
LOCAL_BEHAVIOUR_DELETE,
|
||||
NameCollisionPolicy.OVERWRITE,
|
||||
false);
|
||||
} else { // error, no upload needed
|
||||
} else {
|
||||
// error, no upload needed
|
||||
Log_OC.e(TAG, "File was closed with an error: " + ocFile.getFileName(), error);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -823,7 +823,8 @@ public abstract class FileActivity extends DrawerActivity
|
|||
// Was tried without password, but not sure that it's optional.
|
||||
|
||||
// Try with password before giving up; see also ShareFileFragment#OnShareViaLinkListener
|
||||
if (sharingFragment != null && sharingFragment.isAdded()) { // only if added to the view hierarchy
|
||||
if (sharingFragment != null && sharingFragment.isAdded()) {
|
||||
// only if added to the view hierarchy
|
||||
|
||||
sharingFragment.requestPasswordForShareViaLink(true,
|
||||
getCapabilities().getFilesSharingPublicAskForOptionalPassword()
|
||||
|
|
|
@ -320,7 +320,8 @@ open class FolderPickerActivity :
|
|||
|
||||
fun browseToRoot() {
|
||||
val listOfFiles = listOfFilesFragment
|
||||
if (listOfFiles != null) { // should never be null, indeed
|
||||
if (listOfFiles != null) {
|
||||
// should never be null, indeed
|
||||
val root = storageManager.getFileByPath(OCFile.ROOT_PATH)
|
||||
listOfFiles.listDirectory(root, false, false)
|
||||
file = listOfFiles.currentFile
|
||||
|
@ -331,7 +332,8 @@ open class FolderPickerActivity :
|
|||
|
||||
override fun onBackPressed() {
|
||||
val listOfFiles = listOfFilesFragment
|
||||
if (listOfFiles != null) { // should never be null, indeed
|
||||
if (listOfFiles != null) {
|
||||
// should never be null, indeed
|
||||
val levelsUp = listOfFiles.onBrowseUp()
|
||||
if (levelsUp == 0) {
|
||||
finish()
|
||||
|
|
|
@ -497,7 +497,8 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
|||
String remotePath = item.getRemotePath();
|
||||
OCFile ocFile = storageManager.getFileByPath(remotePath);
|
||||
|
||||
if (ocFile == null) { // Remote file doesn't exist, try to refresh folder
|
||||
if (ocFile == null) {
|
||||
// Remote file doesn't exist, try to refresh folder
|
||||
OCFile folder = storageManager.getFileByPath(new File(remotePath).getParent() + "/");
|
||||
if (folder != null && folder.isFolder()) {
|
||||
this.refreshFolder(itemViewHolder, user, folder, (caller, result) -> {
|
||||
|
|
|
@ -328,7 +328,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
|
||||
mFabMain = requireActivity().findViewById(R.id.fab_main);
|
||||
|
||||
if (mFabMain != null) { // is not available in FolderPickerActivity
|
||||
if (mFabMain != null) {
|
||||
// is not available in FolderPickerActivity
|
||||
viewThemeUtils.material.themeFAB(mFabMain);
|
||||
}
|
||||
|
||||
|
@ -387,7 +388,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
registerFabListener();
|
||||
}
|
||||
|
||||
if (!searchFragment) { // do not touch search event if previously searched
|
||||
if (!searchFragment) {
|
||||
// do not touch search event if previously searched
|
||||
if (getArguments() == null) {
|
||||
searchEvent = null;
|
||||
} else {
|
||||
|
@ -478,7 +480,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
public void registerFabListener() {
|
||||
FileActivity activity = (FileActivity) getActivity();
|
||||
|
||||
if (mFabMain != null) { // is not available in FolderPickerActivity
|
||||
if (mFabMain != null) {
|
||||
// is not available in FolderPickerActivity
|
||||
viewThemeUtils.material.themeFAB(mFabMain);
|
||||
mFabMain.setOnClickListener(v -> {
|
||||
final OCFileListBottomSheetDialog dialog =
|
||||
|
@ -1028,7 +1031,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
intent.putExtra(FolderPickerActivity.EXTRA_FILES, file);
|
||||
getActivity().setResult(Activity.RESULT_OK, intent);
|
||||
getActivity().finish();
|
||||
} else if (!mOnlyFoldersClickable) { // Click on a file
|
||||
} else if (!mOnlyFoldersClickable) {
|
||||
// Click on a file
|
||||
if (PreviewImageFragment.canBePreviewed(file)) {
|
||||
// preview image - it handles the download, if needed
|
||||
if (searchFragment) {
|
||||
|
|
|
@ -583,7 +583,8 @@ public final class FileStorageUtils {
|
|||
}
|
||||
|
||||
FileStorageUtils.StandardDirectory standardDirectory = FileStorageUtils.StandardDirectory.fromPath(storageFolder);
|
||||
if (standardDirectory != null) { // Friendly name of standard directory
|
||||
if (standardDirectory != null) {
|
||||
// Friendly name of standard directory
|
||||
storageFolder = " " + resources.getString(standardDirectory.getDisplayName());
|
||||
}
|
||||
|
||||
|
|
|
@ -433,13 +433,15 @@ public class ProcessVEvent {
|
|||
// - Check the calendars max number of alarms
|
||||
if (t.getDateTime() != null) {
|
||||
alarmMs = t.getDateTime().getTime(); // Absolute
|
||||
} else if (t.getDuration() != null && t.getDuration().isNegative()) { //alarm trigger before start of event
|
||||
} else if (t.getDuration() != null && t.getDuration().isNegative()) {
|
||||
//alarm trigger before start of event
|
||||
Related rel = (Related) t.getParameter(Parameter.RELATED);
|
||||
if (rel != null && rel == Related.END) {
|
||||
alarmStartMs = e.getEndDate().getDate().getTime();
|
||||
}
|
||||
alarmMs = alarmStartMs - durationToMs(t.getDuration()); // Relative "-"
|
||||
} else if (t.getDuration() != null && !t.getDuration().isNegative()) { //alarm trigger after start of event
|
||||
} else if (t.getDuration() != null && !t.getDuration().isNegative()) {
|
||||
//alarm trigger after start of event
|
||||
Related rel = (Related) t.getParameter(Parameter.RELATED);
|
||||
if (rel != null && rel == Related.END) {
|
||||
alarmStartMs = e.getEndDate().getDate().getTime();
|
||||
|
|
|
@ -69,7 +69,8 @@ class LogsViewModelTest {
|
|||
|
||||
override val lostEntries: Boolean = false
|
||||
override fun load(onLoaded: OnLogsLoaded) { this.onLoadedCallback = onLoaded; loadRequestCount++ }
|
||||
override fun deleteAll() { /* no implementation neeeded */
|
||||
override fun deleteAll() {
|
||||
/* no implementation needed */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue