Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #626 from squanchy-dev/update-stuff
Browse files Browse the repository at this point in the history
Update stuff
  • Loading branch information
quiro91 committed Jun 8, 2019
2 parents 2c910b7 + 6484172 commit d6b3dd0
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 74 deletions.
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ play {
detekt {
toolVersion detektVersion

input = files("$projectDir/src/")
input = files("$projectDir/src/main", "$projectDir/src/release")
config = files("$rootDir/team-props/static-analysis/detekt-config.yml")
filters = '.*/test/.*,.*/resources/.*,.*/tmp/.*,.*/build/.*,.*/debug/.*'
reports {
xml.enabled = true
html.enabled = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.squanchy.favorites.view

import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down Expand Up @@ -78,6 +79,7 @@ private object DiffCallback : DiffUtil.ItemCallback<FavoritesItem>() {
return oldItem.id == newItem.id
}

@SuppressLint("DiffUtilEquals") // Bug of the Lint rule with sealed classes (https://issuetracker.google.com/issues/132234925, @ 3.4.1)
override fun areContentsTheSame(oldItem: FavoritesItem, newItem: FavoritesItem): Boolean {
return oldItem == newItem
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ class FirstStartWithNoNetworkActivity : AppCompatActivity() {
val scaleY = Property.of(View::class.java, Float::class.java, "scaleY")
val animator = AnimatorSet()
animator.playTogether(
ObjectAnimator.ofFloat(view, scaleX, *values),
ObjectAnimator.ofFloat(view, scaleY, *values)
ObjectAnimator.ofFloat(view, scaleX, *values),
ObjectAnimator.ofFloat(view, scaleY, *values)
)
animator.interpolator = interpolator
return animator
Expand All @@ -132,19 +132,20 @@ class FirstStartWithNoNetworkActivity : AppCompatActivity() {
private fun animate(view: View, animationProducer: (View) -> Animator, endAction: () -> Unit): Animator {
val animator = animationProducer.invoke(view)
animator.addListener(
object : AnimationEndListener {
override fun onAnimationEnd(animation: Animator) = endAction()
}
object : AnimationEndListener {
override fun onAnimationEnd(animation: Animator) = endAction()
}
)
return animator
}

private fun continueToScheduleAfterDelay() {
firstStartProgress.postDelayed(
{
startActivity(continuationIntent) // We don't use the navigator here, we basically want to restart the whole flow
finish()
}, DELAY_AFTER_ANIMATIONS_MILLIS
{
// We don't use the navigator here, we basically want to restart the whole flow
startActivity(continuationIntent)
finish()
}, DELAY_AFTER_ANIMATIONS_MILLIS
)
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/net/squanchy/search/view/SearchAdapter.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.squanchy.search.view

import android.annotation.SuppressLint
import android.app.Activity
import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down Expand Up @@ -133,6 +134,7 @@ private object DiffCallback : DiffUtil.ItemCallback<SearchListElement>() {
}
}

@SuppressLint("DiffUtilEquals") // Bug of the Lint rule with sealed classes (https://issuetracker.google.com/issues/132234925, @ 3.4.1)
override fun areContentsTheSame(oldItem: SearchListElement, newItem: SearchListElement): Boolean {
return oldItem == newItem
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.annotation.ColorInt
import androidx.annotation.IntRange
import com.google.android.material.bottomnavigation.BottomNavigationMenuView
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.shape.MaterialShapeDrawable
import net.squanchy.support.graphics.CircularRevealDrawable
import net.squanchy.support.view.Hotspot

Expand All @@ -21,7 +22,7 @@ class InterceptingBottomNavigationView @JvmOverloads constructor(
) : BottomNavigationView(context, attrs, defStyleAttr) {

private var lastUpEvent: MotionEvent? = null
private var listener: BottomNavigationView.OnNavigationItemSelectedListener? = null
private var listener: OnNavigationItemSelectedListener? = null
var colorProvider: (() -> Int)? = null

var revealDurationMillis: Int
Expand Down Expand Up @@ -89,12 +90,18 @@ class InterceptingBottomNavigationView @JvmOverloads constructor(
}

override fun setBackground(background: Drawable?) {
if (background is ColorDrawable) {
val currentBackground = getBackground()
val newColor = background.color
updateBackgroundColor(currentBackground, newColor)
} else {
throw IllegalArgumentException("Only ColorDrawables are supported")
when (background) {
is ColorDrawable -> {
val currentBackground = getBackground()
val newColor = background.color
updateBackgroundColor(currentBackground, newColor)
}
is MaterialShapeDrawable -> {
val currentBackground = getBackground()
val newColor = background.fillColor?.defaultColor!!
updateBackgroundColor(currentBackground, newColor)
}
else -> throw IllegalArgumentException("Only ColorDrawables and MaterialShapeDrawable are supported")
}
}

Expand All @@ -112,7 +119,7 @@ class InterceptingBottomNavigationView @JvmOverloads constructor(
(background as? CircularRevealDrawable)?.cancelTransitions()
}

override fun setOnNavigationItemSelectedListener(listener: BottomNavigationView.OnNavigationItemSelectedListener?) {
override fun setOnNavigationItemSelectedListener(listener: OnNavigationItemSelectedListener?) {
this.listener = listener
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.os.Parcelable
import android.view.View
import android.view.ViewGroup
import androidx.annotation.IdRes
import androidx.annotation.Px
import androidx.appcompat.widget.ActionMenuView
import androidx.appcompat.widget.Toolbar
import androidx.core.view.children
Expand All @@ -24,7 +23,7 @@ fun Toolbar.calculateMenuItemCenterCoordinates(@IdRes menuItemId: Int): OriginCo
)
}

data class OriginCoordinates(@Px val x: Float, @Px val y: Float) : Parcelable {
data class OriginCoordinates(val x: Float, val y: Float) : Parcelable {

constructor(parcel: Parcel) : this(parcel.readFloat(), parcel.readFloat())

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ buildscript {

plugins {
id 'com.github.ben-manes.versions' version '0.21.0'
id 'io.gitlab.arturbosch.detekt' version '1.0.0-RC14'
id 'org.jlleitschuh.gradle.ktlint' version '7.2.1'
id 'io.gitlab.arturbosch.detekt' version '1.0.0-RC15'
id 'org.jlleitschuh.gradle.ktlint' version '8.0.0'
}

def teamPropsFile(propsFile) {
Expand Down
52 changes: 26 additions & 26 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
ext {
daggerVersion = '2.22.1'
daggerVersion = '2.23.1'
glideVersion = '4.9.0'
workManagerVersion = '1.0.1-rc01'
kotlinVersion = '1.3.21'
workManagerVersion = '1.0.1'
kotlinVersion = '1.3.31'
moshiVersion = '1.8.0'

detektVersion = '1.0.0-RC14'
ktlintVersion = '0.31.0'
detektVersion = '1.0.0-RC15'
ktlintVersion = '0.33.0'

gradlePlugins = [
buildProperties: 'com.novoda:gradle-build-properties-plugin:0.4.1',
fabric : 'io.fabric.tools:gradle:1.28.1',
fabric : 'io.fabric.tools:gradle:1.29.0',
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
]

libraries = [
app : [
algolia : 'com.algolia:algoliasearch-android:3.27.0',
androidxAnnotations : 'androidx.annotation:annotation:1.1.0-beta01',
androidxAppCompat : 'androidx.appcompat:appcompat:1.1.0-alpha04',
androidxConstraintLayout: 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4',
androidxKtx : 'androidx.core:core-ktx:1.1.0-alpha05',
androidxMaterial : 'com.google.android.material:material:1.1.0-alpha05',
androidxAnnotations : 'androidx.annotation:annotation:1.1.0',
androidxAppCompat : 'androidx.appcompat:appcompat:1.1.0-beta01',
androidxConstraintLayout: 'androidx.constraintlayout:constraintlayout:2.0.0-beta1',
androidxKtx : 'androidx.core:core-ktx:1.2.0-alpha01',
androidxMaterial : 'com.google.android.material:material:1.1.0-alpha07',
androidxWorkManager : "android.arch.work:work-runtime-ktx:$workManagerVersion",
androidxWorkManagerRx : "android.arch.work:work-rxjava2:$workManagerVersion",
arrowCore : 'io.arrow-kt:arrow-core:0.8.2',
crashlytics : 'com.crashlytics.sdk.android:crashlytics:2.9.9',
crashlytics : 'com.crashlytics.sdk.android:crashlytics:2.10.1',
dagger : "com.google.dagger:dagger:${daggerVersion}",
daggerCompiler : "com.google.dagger:dagger-compiler:${daggerVersion}",
firebaseAuth : 'com.google.firebase:firebase-auth:16.2.1',
firebaseConfig : 'com.google.firebase:firebase-config:16.5.0',
firebaseCore : 'com.google.firebase:firebase-core:16.0.8',
firebaseFirestore : 'com.google.firebase:firebase-firestore:18.2.0',
firebaseMessaging : 'com.google.firebase:firebase-messaging:17.6.0',
firebaseStorage : 'com.google.firebase:firebase-storage:16.1.0',
firebaseUiStorage : 'com.firebaseui:firebase-ui-storage:4.3.2',
firebaseAuth : 'com.google.firebase:firebase-auth:17.0.0',
firebaseConfig : 'com.google.firebase:firebase-config:17.0.0',
firebaseCore : 'com.google.firebase:firebase-core:16.0.9',
firebaseFirestore : 'com.google.firebase:firebase-firestore:19.0.2',
firebaseMessaging : 'com.google.firebase:firebase-messaging:18.0.0',
firebaseStorage : 'com.google.firebase:firebase-storage:17.0.0',
firebaseUiStorage : 'com.firebaseui:firebase-ui-storage:5.0.0',
flexbox : 'com.google.android:flexbox:1.1.0',
glide : "com.github.bumptech.glide:glide:${glideVersion}",
glideCompiler : "com.github.bumptech.glide:compiler:${glideVersion}",
Expand All @@ -45,24 +45,24 @@ ext {
moshiKotlin : "com.squareup.moshi:moshi-kotlin:${moshiVersion}",
playServicesAuth : 'com.google.android.gms:play-services-auth:16.0.1',
rxAndroid : 'io.reactivex.rxjava2:rxandroid:2.1.1',
rxJava : 'io.reactivex.rxjava2:rxjava:2.2.8',
rxJava : 'io.reactivex.rxjava2:rxjava:2.2.9',
rxKotlin : 'io.reactivex.rxjava2:rxkotlin:2.3.0',
rxLint : 'nl.littlerobots.rxlint:rxlint:1.7.3',
threeTenAbp : 'com.jakewharton.threetenabp:threetenabp:1.2.0',
rxLint : 'nl.littlerobots.rxlint:rxlint:1.7.4',
threeTenAbp : 'com.jakewharton.threetenabp:threetenabp:1.2.1',
timber : 'com.jakewharton.timber:timber:4.7.1',
viewPagerAdapter : 'com.novoda:view-pager-adapter:1.0.0'
],

test: [
truth : 'com.google.truth:truth:0.44',
truth : 'com.google.truth:truth:0.45',
jUnit4 : 'junit:junit:4.12',
mockito : 'org.mockito:mockito-inline:2.26.0',
threeTenBp: 'org.threeten:threetenbp:1.3.8'
mockito : 'org.mockito:mockito-inline:2.28.2',
threeTenBp: 'org.threeten:threetenbp:1.4.0'
]
]

buildScript = [
android : 'com.android.tools.build:gradle:3.3.2',
android : 'com.android.tools.build:gradle:3.4.1',
googleServices: 'com.google.gms:google-services:4.2.0',
playPublisher : 'com.github.triplet.gradle:play-publisher:2.2.0'
]
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
28 changes: 4 additions & 24 deletions team-props/static-analysis/detekt-config.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
autoCorrect: true

test-pattern: # Configure exclusions for test sources
active: true
patterns: # Test file regexes
- '.*/test/.*'
- '.*/androidTest/.*'
- '.*Test.kt'
- '.*Spec.kt'
- '.*Spek.kt'
exclude-rule-sets:
- 'comments'
exclude-rules:
- 'NamingRules'
- 'WildcardImport'
- 'MagicNumber'
- 'MaxLineLength'
- 'LateinitUsage'
- 'StringLiteralDuplication'
- 'SpreadOperator'
- 'TooManyFunctions'
- 'ForEachOnRange'
- 'FunctionMaxLength'
- 'TooGenericExceptionCaught'
- 'InstanceOfCheckForException'

build:
maxIssues: 0
weights:
Expand Down Expand Up @@ -88,3 +64,7 @@ style:
active: true
WildcardImport:
excludeImports: 'kotlinx.android.synthetic.*'

empty-blocks:
EmptyFunctionBlock:
active: false # It's bugged, see https://github.com/arturbosch/detekt/issues/1684

0 comments on commit d6b3dd0

Please sign in to comment.