Skip to content

Commit

Permalink
Fix kotlin warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
abelgardep committed Dec 12, 2019
1 parent f70fb18 commit def9982
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ class FileDataStorageManager {

val sharedByLinkFilesFromCurrentAccount: Vector<OCFile>
get() {
val allSharedFiles = Vector<OCFile>();
val result = Vector<OCFile>();
var cursorOnShared: Cursor? = null;
val allSharedFiles = Vector<OCFile>()
val result = Vector<OCFile>()
var cursorOnShared: Cursor? = null
try {
cursorOnShared = contentResolver?.query(
CONTENT_URI,
Expand All @@ -191,33 +191,33 @@ class FileDataStorageManager {
null
)
if (cursorOnShared != null && cursorOnShared.moveToFirst()) {
var file: OCFile?;
var file: OCFile?
do {
file = createFileInstance(cursorOnShared);
allSharedFiles.add(file);
} while (cursorOnShared.moveToNext());
file = createFileInstance(cursorOnShared)
allSharedFiles.add(file)
} while (cursorOnShared.moveToNext())
}
} catch (exception: Exception) {
Log_OC.e(TAG, "Exception retrieving all the shared by link files", exception);
Log_OC.e(TAG, "Exception retrieving all the shared by link files", exception)
} finally {
cursorOnShared?.close()
}

if (allSharedFiles.isNotEmpty()) {
val allSharedDirs = Vector<Long>();
val allSharedDirs = Vector<Long>()
for (file in allSharedFiles) {
if (file.isFolder) {
allSharedDirs.add(file.fileId);
allSharedDirs.add(file.fileId)
}
}
for (file in allSharedFiles) {
if (file.isFolder || (!file.isFolder && !allSharedDirs.contains(file.parentId))) {
result.add(file);
result.add(file)
}
}
}
result.sort();
return result;
result.sort()
return result
}

fun getFileByPath(path: String): OCFile? {
Expand Down Expand Up @@ -914,7 +914,7 @@ class FileDataStorageManager {

val reqUri = Uri.withAppendedPath(CONTENT_URI_DIR, parentId.toString())

val selection: String = "$FILE_PARENT=?"
val selection = "$FILE_PARENT=?"
val selectionArgs: Array<String> = arrayOf(parentId.toString())

val c: Cursor? = try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ class UsersAndGroupsSearchProvider : ContentProvider() {
/**
* Show error genericErrorMessage
*
* @param resource Resource with the failure information.
*/
private fun showErrorMessage(genericErrorMessage: String, throwable: Throwable?) {
val errorMessage = throwable?.parseError(genericErrorMessage, context.resources)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.owncloud.android.domain.sharing.shares.model.OCShare

/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in fragments handling [OCShareEntity]s
* fragment to allow an interaction in fragments handling [OCShare]s
* to be communicated to the parent activity and potentially other fragments
* contained in that activity.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.owncloud.android.R
import info.hannes.logcat.BothLogsFragment
import info.hannes.logcat.LogcatFragment
import info.hannes.timber.fileLoggingTree
import timber.log.Timber

class LogHistoryActivity : ToolbarActivity() {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,9 @@ data class OCShareEntity(
val name: String?,
@ColumnInfo(name = ProviderTableMeta.OCSHARES_URL)
val shareLink: String?
) : Parcelable {
) {
@PrimaryKey(autoGenerate = true) var id: Int = 0

constructor(parcel: Parcel) : this(
parcel.readLong(),
parcel.readLong(),
parcel.readInt(),
parcel.readString(),
parcel.readString(),
parcel.readInt(),
parcel.readLong(),
parcel.readLong(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readByte() != 0.toByte(),
parcel.readLong(),
parcel.readLong(),
parcel.readString(),
parcel.readString(),
parcel.readString()
) {
id = parcel.readInt()
}

companion object {

fun fromCursor(cursor: Cursor): OCShareEntity {
Expand Down Expand Up @@ -137,40 +115,5 @@ data class OCShareEntity(
values.getAsString(ProviderTableMeta.OCSHARES_URL)
)
}

/**
* Parcelable Methods
*/
@JvmField
val CREATOR: Parcelable.Creator<OCShareEntity> = object : Parcelable.Creator<OCShareEntity> {
override fun createFromParcel(source: Parcel): OCShareEntity {
return OCShareEntity(source)
}

override fun newArray(size: Int): Array<OCShareEntity?> {
return arrayOfNulls(size)
}
}
}

override fun describeContents(): Int = this.hashCode()

override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeInt(id)
dest?.writeString(shareWith)
dest?.writeString(path)
dest?.writeString(token)
dest?.writeString(sharedWithDisplayName)
dest?.writeString(sharedWithAdditionalInfo)
dest?.writeString(name)
dest?.writeString(shareLink)
dest?.writeLong(fileSource)
dest?.writeLong(itemSource)
dest?.writeInt(shareType)
dest?.writeInt(permissions)
dest?.writeLong(sharedDate)
dest?.writeLong(expirationDate)
dest?.writeInt(if (isFolder) 1 else 0)
dest?.writeLong(userId)
}
}

0 comments on commit def9982

Please sign in to comment.