Skip to content

Commit

Permalink
Add spotless gradle plugin (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewCarlson authored Jan 18, 2022
1 parent 6ab12ac commit 30b8cfe
Show file tree
Hide file tree
Showing 140 changed files with 410 additions and 326 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/spotless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Spotless

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
spotless:
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11

- name: Cache Build files
uses: actions/cache@v2
if: ${{ !startsWith(matrix.os, 'windows') }}
with:
path: |
~/.konan
~/.gradle
key: ${{ runner.os }}-${{ hashFiles('gradle.properties') }}-v2

- uses: gradle/gradle-build-action@v2
name: Spotless Check
with:
arguments: spotlessCheck
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2022 Amit Goel
* Copyright (C) 2022 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -49,4 +49,3 @@ object FlipperProvider {
return FlipperOkhttpInterceptor(networkFlipperPlugin)
}
}

2 changes: 1 addition & 1 deletion anystream-client-android/src/main/kotlin/App.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down
6 changes: 2 additions & 4 deletions anystream-client-android/src/main/kotlin/AppTheme.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -37,6 +37,4 @@ val AppColors = darkColors(
primaryVariant = Color.Red
)

val AppTypography = Typography(

)
val AppTypography = Typography()
4 changes: 1 addition & 3 deletions anystream-client-android/src/main/kotlin/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -33,8 +33,6 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import anystream.android.router.*
import anystream.android.ui.*
import anystream.client.AnyStreamClient
import anystream.client.SessionManager
import anystream.core.AndroidSessionDataStore
Expand Down
4 changes: 2 additions & 2 deletions anystream-client-android/src/main/kotlin/Routes.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand All @@ -25,4 +25,4 @@ sealed class Routes {
data class Player(
val mediaRefId: String
) : Routes()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -30,4 +30,4 @@ class BackPressHandler(

fun handle(): Boolean =
children.reversed().any { it() }
}
}
5 changes: 2 additions & 3 deletions anystream-client-android/src/main/kotlin/router/BackStack.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand All @@ -21,7 +21,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue


class BackStack<T> internal constructor(
initialElement: T,
private var onElementRemoved: ((Int) -> Unit)
Expand Down Expand Up @@ -70,4 +69,4 @@ class BackStack<T> internal constructor(
}
elements = arrayListOf(element)
}
}
}
3 changes: 1 addition & 2 deletions anystream-client-android/src/main/kotlin/router/Router.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -94,4 +94,3 @@ private fun <T> fetchBackStack(key: String, defaultElement: T, override: T?): Ba
backStackMap[key] = it
}
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -51,7 +51,6 @@ private fun saveInt(key: String, value: Int) {
bundle.putInt(key, value)
}


@Composable
fun BundleScope(
savedInstanceState: Bundle?,
Expand Down Expand Up @@ -88,4 +87,4 @@ fun BundleScope(
CompositionLocalProvider(LocalSavedInstanceState provides downstream) {
children(downstream)
}
}
}
7 changes: 3 additions & 4 deletions anystream-client-android/src/main/kotlin/ui/HomeScreen.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -42,7 +42,6 @@ import anystream.models.*
import anystream.models.api.HomeResponse
import coil.compose.ImagePainter
import coil.compose.rememberImagePainter
import coil.request.ImageRequest

private val CARD_SPACING = 12.dp

Expand Down Expand Up @@ -233,7 +232,7 @@ private fun TvRow(
PosterCard(
title = show.name,
imagePath = show.posterPath,
onClick = { },
onClick = { },
)
}
}
Expand All @@ -248,4 +247,4 @@ private fun RowTitle(text: String) {
style = AppTypography.h3,
modifier = Modifier.padding(vertical = 8.dp),
)
}
}
2 changes: 1 addition & 1 deletion anystream-client-android/src/main/kotlin/ui/LoginScreen.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions anystream-client-android/src/main/kotlin/ui/MoviesScreen.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -104,4 +104,4 @@ private fun MovieGrid(
)
}
}
}
}
4 changes: 2 additions & 2 deletions anystream-client-android/src/main/kotlin/ui/PairingScanner.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -75,4 +75,4 @@ fun PairingScanner(
launched = true
}
}
}
}
7 changes: 3 additions & 4 deletions anystream-client-android/src/main/kotlin/ui/PlayerScreen.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -37,13 +37,12 @@ import anystream.models.MediaReference
import anystream.models.Movie
import anystream.models.PlaybackState
import com.google.android.exoplayer2.ExoPlayer
import com.google.android.exoplayer2.MediaItem as ExoMediaItem
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.ui.PlayerView
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

import com.google.android.exoplayer2.MediaItem as ExoMediaItem

private const val PLAYER_STATE_UPDATE_INTERVAL = 250L
private const val PLAYER_STATE_REMOTE_UPDATE_INTERVAL = 5_000L
Expand Down Expand Up @@ -184,4 +183,4 @@ fun PlayerScreen(
}
}
}
}
}
4 changes: 2 additions & 2 deletions anystream-client-android/src/main/kotlin/ui/PosterCard.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2021 Drew Carlson
* Copyright (C) 2021 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -125,4 +125,4 @@ private fun MovieCardPreview() {
imagePath = "/sHgjdRPYduUCaw3Te2CXaWLpBkm.jpg",
onClick = { }
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2022 Drew Carlson
* Copyright (C) 2022 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -50,4 +50,4 @@ fun AutofillInput(

fun Autofill.onFocusStateChanged(focusState: FocusState, node: AutofillNode) {
if (focusState.isFocused) requestAutofillForNode(node) else cancelAutofillForNode(node)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2022 Drew Carlson
* Copyright (C) 2022 AnyStream Maintainers
*
* 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
Expand All @@ -27,7 +27,6 @@ import androidx.compose.ui.graphics.asImageBitmap
import com.google.zxing.BarcodeFormat
import com.google.zxing.qrcode.QRCodeWriter


@Composable
fun QrImage(
content: String,
Expand Down Expand Up @@ -62,4 +61,4 @@ fun QrImage(
contentDescription = null
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* AnyStream
* Copyright (C) 2022 Drew Carlson
* Copyright (C) 2022 AnyStream Maintainers
*
* 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
Expand Down Expand Up @@ -77,4 +77,4 @@ fun <M, E> createLoopController(
}
}
return Pair(modelState, eventConsumer)
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
/**
* AnyStream
* Copyright (C) 2022 AnyStream Maintainers
*
* 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 <http://www.gnu.org/licenses/>.
*/
package helper

import android.app.Application
import com.facebook.flipper.android.AndroidFlipperClient
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin
import com.facebook.flipper.plugins.inspector.DescriptorMapping
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
import com.facebook.soloader.SoLoader

object FlipperProvider {
fun init(context: Application): Unit

fun getFlipperOkhttpInterceptor(): Interceptor? = null
}
}
Loading

0 comments on commit 30b8cfe

Please sign in to comment.