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 EnableEdgeToEdgeRule(config: Config) : Rule(config) { | |
| override val issue = Issue( | |
| javaClass.simpleName, | |
| Severity.Defect, | |
| EDGE_TO_EDGE_MESSAGE, | |
| Debt.TWENTY_MINS | |
| ) | |
| override fun visitKtFile(file: KtFile) { |
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
| plugins { | |
| kotlin | |
| id("io.gitlab.arturbosch.detekt") | |
| } | |
| dependencies { | |
| compileOnly(libs.kotlin) | |
| compileOnly("io.gitlab.arturbosch.detekt:detekt-api:<version>") | |
| } |
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 JetRuleSetProvider : RuleSetProvider { | |
| override val ruleSetId: String = "JetRuleSet" | |
| override fun instance(config: Config): RuleSet { | |
| return RuleSet( | |
| ruleSetId, | |
| listOf( | |
| EnableEdgeToEdgeRule(config) | |
| ), | |
| ) |
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
| com.jet.detektcustomrules.JetRuleSetProvider |
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
| dependencies { | |
| detektPlugins(project(":detekt-custom-rules")) | |
| } | |
| detekt { | |
| config.setFrom(file("config/detekt/detekt.yml")) | |
| } |
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
| JetRuleSet: | |
| EnableEdgeToEdgeRule: | |
| active: true |
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 EnableEdgeToEdgeRuleTest { | |
| @Test | |
| fun `should report when edgeToEdge is not used`() { | |
| val code = """ | |
| class A : AppCompatActivity() { | |
| fun foo() { | |
| } | |
| } | |
| """ |
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
| fun NotificationCompat.Builder.progressStyleNotification(context: Context) { | |
| val segmentColor = ContextCompat.getColor(context, R.color.jet_brand) | |
| val segments = List(4) { NotificationCompat.ProgressStyle.Segment(25).setColor(segmentColor) } | |
| setStyle( | |
| NotificationCompat | |
| .ProgressStyle() | |
| .setStyledByProgress(true) | |
| .setProgressSegments(segments) | |
| .setProgress(25) | |
| ) |
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
| NotificationCompat | |
| .Builder(...) | |
| .apply { | |
| setOngoing(true) | |
| setRequestPromotedOngoing(true) | |
| setShowWhen(true) | |
| setWhen(... future ETA in long format ...) | |
| } |
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
| internal class LiveUpdateWorker(..) : CoroutineWorker(..) { | |
| override suspend fun doWork(): Result { | |
| // .. | |
| repository.orderStatusFlow.collect { orderStatus -> | |
| setForeground( | |
| ForegroundInfo( | |
| "notificationId", | |
| buildNotification(orderStatus), | |
| ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE, | |
| ) |
OlderNewer