This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun ignoreInspection( | |
fileEditor: FileEditor, | |
psiFile: PsiFile, | |
project: Project | |
) { | |
if (isErrorHighlighted(psiFile, project)) { | |
HighlightLevelUtil.forceRootHighlighting( | |
psiFile, | |
FileHighlightingSetting.SKIP_HIGHLIGHTING | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun addAnnotation(ktClass: KtClass, project: Project) { | |
val param = ktClass.getMissingAnnotationParam() | |
param?.let { | |
WriteCommandAction.runWriteCommandAction(project) { | |
param.addAnnotation( | |
annotationFqName = | |
FqName("com.google.gson.annotations.SerializedName"), | |
annotationInnerText = "\"${param.name}\"" | |
) | |
JavaCodeStyleManager.getInstance(project) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun createPanel( | |
psiFile: PsiFile, | |
project: Project, | |
name: String, | |
onAddClick: () -> Unit, | |
onIgnoreClick: () -> Unit | |
): EditorNotificationPanel? { | |
return if (isErrorHighlighted(psiFile, project)) { | |
val panel = EditorNotificationPanel() | |
panel.text("Add SerializedName annotation to $name params?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SerializedNameNotification : | |
EditorNotifications.Provider<EditorNotificationPanel>() { | |
companion object { | |
val KEY = | |
Key.create<EditorNotificationPanel>("Add missing annotation?") | |
} | |
override fun getKey(): Key<EditorNotificationPanel> = KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SerializedNameInspector : AbstractKotlinInspection() { | |
override fun buildVisitor( | |
holder: ProblemsHolder, | |
isOnTheFly: Boolean | |
): KtVisitorVoid { | |
return classVisitor { ktClass -> | |
if (ktClass.isData()) { | |
// check if serialized name annotation is required. | |
val param = ktClass.isSerializedNameAnnotationMissing() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<idea-plugin> | |
<id>com.ruben.codespector</id> | |
<name>Codespector</name> | |
<vendor email="support@yourcompany.com" url="http://www.yourcompany.com">YourCompany</vendor> | |
<description><![CDATA[ | |
Enter short description for your plugin here.<br> | |
<em>most HTML tags may be used</em> | |
]]></description> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameVideoTest() { | |
@get:Rule val composeTestRule = createComposeRule() | |
@Test | |
fun vide_player_and_playlist_show_be_shown() { | |
composeTestRule.setContent { | |
ShowGameVideos( | |
gameVideos = | |
FakeGamesData.getFakeGameVideos() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun VideoItem( | |
index: Int, | |
video: VideoResultEntity, | |
currentPlaying: State<Int>, | |
onVideoChange: (Int) -> Unit | |
) { | |
val currentlyPlaying = remember { | |
mutableStateOf(false) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun VideoPlayList( | |
modifier: Modifier = Modifier, | |
gameVideos: List<VideoResultEntity>, | |
currentPlaying: State<Int>, | |
onVideoChange: (Int) -> Unit | |
) { | |
LazyColumn(modifier = modifier) { | |
itemsIndexed( | |
items = gameVideos, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalAnimationApi | |
@Composable | |
fun VideoPlayer( | |
modifier: Modifier = Modifier, | |
gameVideos: List<VideoResultEntity>, | |
currentPlaying: State<Int>, | |
onVideoChange: (Int) -> Unit | |
) { | |
val videoTitle = remember { |