This file contains hidden or 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
apply plugin: 'java-library' | |
apply plugin: 'kotlin' | |
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |
compileOnly 'com.android.tools.lint:lint-api:26.4.1' | |
compileOnly 'com.android.tools.lint:lint-checks:26.4.1' | |
} |
This file contains hidden or 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
object DirectColorUseIssue { | |
private const val ID = "DirectColorUse" | |
private const val DESCRIPTION = "Color used directly" | |
const val EXPLANATION = | |
'''Avoid direct use of colors in XML files. | |
This will cause issues with different theme (dark-theme?) support''' | |
private val CATEGORY = Category.CORRECTNESS | |
private const val PRIORITY = 6 | |
private val SEVERITY = Severity.WARNING |
This file contains hidden or 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
private const val BACKGROUND = "background" | |
private const val FOREGROUND = "foreground" | |
private const val SRC = "src" | |
private const val TEXT_COLOR = "textColor" | |
private const val TINT = "tint" | |
//Vector Drawables. | |
private const val FILL_COLOR = "fillColor" | |
private const val STROKE_COLOR = "strokeColor" | |
private const val COLOR = "color" |
This file contains hidden or 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 DarkThemeLintRegistry : IssueRegistry() { | |
override val issues: List<Issue> | |
get() = listOf(DirectColorUseIssue.ISSUE) | |
} |
This file contains hidden or 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
object MissingNightColorIssue { | |
private const val ID = "MissingNightColor" | |
private const val DESCRIPTION = "Night Color missing" | |
const val EXPLANATION = | |
'''Night color value for this color resource seems to be missing. | |
If your app supports dark theme, then you should add an equivalent color resource for it in the night values folder.''' | |
private val CATEGORY = Category.CORRECTNESS | |
private const val PRIORITY = 6 | |
private val SEVERITY = Severity.WARNING |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="colorPrimary">#008577</color> | |
<color name="colorPrimaryDark">#00574B</color> | |
<color name="colorAccent">#D81B60</color> | |
</resources> |
This file contains hidden or 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
private const val COLOR = "color" | |
class MissingNightColorDetector : ResourceXmlDetector() { | |
private val nightModeColors = mutableListOf<String>() | |
private val regularColors = mutableMapOf<String, Location>() | |
override fun appliesTo(folderType: ResourceFolderType): Boolean { | |
return folderType == ResourceFolderType.VALUES | |
} |
This file contains hidden or 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 DarkThemeLintRegistry : IssueRegistry() { | |
override val issues: List<Issue> | |
get() = listOf( | |
DirectColorUseIssue.ISSUE, | |
MissingNightColorIssue.ISSUE | |
) | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE module PUBLIC | |
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" | |
"https://checkstyle.org/dtds/configuration_1_3.dtd"> | |
<module name="Checker"> | |
<property name="severity" value="warning" /> | |
<property name="charset" value="UTF-8" /> | |
<module name="FileTabCharacter"> |
This file contains hidden or 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
interface ModuleInitializer { | |
/** Initializes a module given the application Context | |
* | |
* @return A Completable if the module needs the app to wait for its setup to complete before proceeding. | |
* If the module setup doesn't need an asynchronous setup, then it can simply return Completable.complete() | |
*/ | |
fun initialize(context: Context): Completable | |
} |