Fix detekt
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
4da28f0d8b
commit
c48228bcb3
|
@ -56,6 +56,7 @@ complexity:
|
|||
threshold: 10
|
||||
ignoreSingleWhenExpression: false
|
||||
ignoreSimpleWhenEntries: false
|
||||
excludes: ['**/androidTest/**']
|
||||
LabeledExpression:
|
||||
active: false
|
||||
ignoredLabels: ""
|
||||
|
@ -65,6 +66,7 @@ complexity:
|
|||
LongMethod:
|
||||
active: true
|
||||
threshold: 60
|
||||
excludes: ['**/androidTest/**']
|
||||
LongParameterList:
|
||||
active: true
|
||||
threshold: 6
|
||||
|
|
|
@ -77,6 +77,8 @@ private const val POS_END_OF_WEEK = 5
|
|||
|
||||
private const val ONE_SECOND_IN_MILLIS = 1000
|
||||
private const val ONE_MINUTE_IN_SECONDS = 60
|
||||
private const val THIRTY_MINUTES = 30
|
||||
private const val FOUR_HOURS = 4
|
||||
private const val LAST_HOUR_OF_DAY = 23
|
||||
private const val LAST_MINUTE_OF_HOUR = 59
|
||||
private const val LAST_SECOND_OF_MINUTE = 59
|
||||
|
@ -225,7 +227,7 @@ class SetStatusDialogFragment :
|
|||
|
||||
POS_HALF_AN_HOUR -> {
|
||||
// 30 minutes
|
||||
clearAt = System.currentTimeMillis() / ONE_SECOND_IN_MILLIS + 30 * ONE_MINUTE_IN_SECONDS
|
||||
clearAt = System.currentTimeMillis() / ONE_SECOND_IN_MILLIS + THIRTY_MINUTES * ONE_MINUTE_IN_SECONDS
|
||||
}
|
||||
|
||||
POS_AN_HOUR -> {
|
||||
|
@ -238,7 +240,7 @@ class SetStatusDialogFragment :
|
|||
// four hours
|
||||
clearAt =
|
||||
System.currentTimeMillis() / ONE_SECOND_IN_MILLIS
|
||||
+4 * ONE_MINUTE_IN_SECONDS * ONE_MINUTE_IN_SECONDS
|
||||
+FOUR_HOURS * ONE_MINUTE_IN_SECONDS * ONE_MINUTE_IN_SECONDS
|
||||
}
|
||||
|
||||
POS_TODAY -> {
|
||||
|
@ -268,6 +270,7 @@ class SetStatusDialogFragment :
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("ReturnCount")
|
||||
private fun clearAtToUnixTime(clearAt: ClearAt?): Long {
|
||||
if (clearAt != null) {
|
||||
if (clearAt.type.equals("period")) {
|
||||
|
@ -415,16 +418,16 @@ class SetStatusDialogFragment :
|
|||
val clearAt = predefinedStatus.clearAt!!
|
||||
if (clearAt.type.equals("period")) {
|
||||
when (clearAt.time) {
|
||||
"1800" -> clearStatusAfterSpinner.setSelection(1)
|
||||
"3600" -> clearStatusAfterSpinner.setSelection(2)
|
||||
"14400" -> clearStatusAfterSpinner.setSelection(3)
|
||||
else -> clearStatusAfterSpinner.setSelection(0)
|
||||
"1800" -> clearStatusAfterSpinner.setSelection(POS_HALF_AN_HOUR)
|
||||
"3600" -> clearStatusAfterSpinner.setSelection(POS_AN_HOUR)
|
||||
"14400" -> clearStatusAfterSpinner.setSelection(POS_FOUR_HOURS)
|
||||
else -> clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR)
|
||||
}
|
||||
} else if (clearAt.type.equals("end-of")) {
|
||||
when (clearAt.time) {
|
||||
"day" -> clearStatusAfterSpinner.setSelection(4)
|
||||
"week" -> clearStatusAfterSpinner.setSelection(5)
|
||||
else -> clearStatusAfterSpinner.setSelection(0)
|
||||
"day" -> clearStatusAfterSpinner.setSelection(POS_TODAY)
|
||||
"week" -> clearStatusAfterSpinner.setSelection(POS_END_OF_WEEK)
|
||||
else -> clearStatusAfterSpinner.setSelection(POS_DONT_CLEAR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2020 Tobias Kaminsky
|
||||
* Copyright (C) 2020 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.components
|
||||
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.ColorFilter
|
||||
import android.graphics.Paint
|
||||
import android.graphics.PixelFormat
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.core.graphics.drawable.RoundedBitmapDrawable
|
||||
|
||||
class AvatarWithStatus(val roundedBitmapDrawable: RoundedBitmapDrawable) : Drawable() {
|
||||
private val redPaint: Paint = Paint().apply { setARGB(255, 255, 0, 0) }
|
||||
|
||||
private val avatarSize = 100
|
||||
|
||||
override fun draw(canvas: Canvas) {
|
||||
val width = avatarSize
|
||||
val height = avatarSize
|
||||
val radius: Float = Math.min(width, height).toFloat() / 2f
|
||||
|
||||
// Draw a red circle in the center
|
||||
// canvas.drawBitmap(roundedBitmapDrawable.bitmap!!, 0f, 0f, null)
|
||||
canvas.drawCircle((width / 2).toFloat(), (height / 2).toFloat(), radius, redPaint)
|
||||
}
|
||||
|
||||
override fun setAlpha(alpha: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun setColorFilter(colorFilter: ColorFilter?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun getOpacity(): Int = PixelFormat.OPAQUE
|
||||
}
|
|
@ -37,6 +37,7 @@ import java.io.InputStream
|
|||
/**
|
||||
* Fetcher with OwnCloudClient
|
||||
*/
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
class HttpStreamFetcher internal constructor(
|
||||
private val currentAccount: CurrentAccountProvider,
|
||||
private val clientFactory: ClientFactory,
|
||||
|
|
Loading…
Reference in New Issue