Linting fixes

This commit is contained in:
arkon
2020-04-25 14:24:45 -04:00
parent 4da760d614
commit 3f63b320c4
272 changed files with 4167 additions and 3602 deletions
@@ -52,7 +52,7 @@ fun Context.toast(text: String?, duration: Int = Toast.LENGTH_SHORT) {
*/
fun Context.notificationBuilder(channelId: String, block: (NotificationCompat.Builder.() -> Unit)? = null): NotificationCompat.Builder {
val builder = NotificationCompat.Builder(this, channelId)
.setColor(ContextCompat.getColor(this, R.color.colorPrimary))
.setColor(ContextCompat.getColor(this, R.color.colorPrimary))
if (block != null) {
builder.block()
}
@@ -78,10 +78,10 @@ fun Context.notification(channelId: String, block: (NotificationCompat.Builder.(
*/
fun Context.getFilePicker(currentDir: String): Intent {
return Intent(this, CustomLayoutPickerActivity::class.java)
.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)
.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true)
.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR)
.putExtra(FilePickerActivity.EXTRA_START_PATH, currentDir)
.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)
.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, true)
.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR)
.putExtra(FilePickerActivity.EXTRA_START_PATH, currentDir)
}
/**
@@ -178,7 +178,7 @@ fun Context.isServiceRunning(serviceClass: Class<*>): Boolean {
val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
@Suppress("DEPRECATION")
return manager.getRunningServices(Integer.MAX_VALUE)
.any { className == it.service.className }
.any { className == it.service.className }
}
/**
@@ -188,8 +188,8 @@ fun Context.openInBrowser(url: String) {
try {
val parsedUrl = Uri.parse(url)
val intent = CustomTabsIntent.Builder()
.setToolbarColor(getResourceColor(R.attr.colorPrimary))
.build()
.setToolbarColor(getResourceColor(R.attr.colorPrimary))
.build()
intent.launchUrl(this, parsedUrl)
} catch (e: Exception) {
toast(e.message)
@@ -29,8 +29,9 @@ object ImageUtil {
stream.read(bytes, 0, bytes.size)
}
if (length == -1)
if (length == -1) {
return null
}
if (bytes.compareWith(charByteArrayOf(0xFF, 0xD8, 0xFF))) {
return ImageType.JPG
@@ -60,8 +60,10 @@ abstract class WebViewClientCompat : WebViewClient() {
request: WebResourceRequest,
error: WebResourceError
) {
onReceivedErrorCompat(view, error.errorCode, error.description?.toString(),
request.url.toString(), request.isForMainFrame)
onReceivedErrorCompat(
view, error.errorCode, error.description?.toString(),
request.url.toString(), request.isForMainFrame
)
}
final override fun onReceivedError(
@@ -79,7 +81,11 @@ abstract class WebViewClientCompat : WebViewClient() {
request: WebResourceRequest,
error: WebResourceResponse
) {
onReceivedErrorCompat(view, error.statusCode, error.reasonPhrase, request.url
.toString(), request.isForMainFrame)
onReceivedErrorCompat(
view, error.statusCode, error.reasonPhrase,
request.url
.toString(),
request.isForMainFrame
)
}
}