Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style improvements #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
root = true
[*]
insert_final_newline = true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/
/.idea/*
!.idea/codeStyles/
!.idea/vcs.xml
.DS_Store
/build
/captures
236 changes: 236 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ plugins {
id("kotlin-android")
id("kotlin-kapt")
id("io.intrepid.static-analysis")
id("org.jlleitschuh.gradle.ktlint")
// Uncomment the following line after adding fabric.properties file
//id("io.fabric")
// id("io.fabric")

id("jacoco")
}
Expand Down Expand Up @@ -84,7 +85,11 @@ android {
}
}

//https://github.com/mockk/mockk/issues/281
ktlint {
version.set("0.33.0")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version 34.2 is out

}

// https://github.com/mockk/mockk/issues/281
configurations.all {
resolutionStrategy {
force("org.objenesis:objenesis:2.6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class CoroutineIdlingResource(dispatcher: InterceptableDispatcher) : IdlingResou
callback?.onTransitionToIdle()
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.StringBuilder

object TestFileUtils {
fun convertStreamToString(inputStream: InputStream): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ abstract class BaseFragment<out VM : BaseViewModel> : Fragment(), LiveDataObserv
Timber.v("Lifecycle onStart: $this")
super.onStart()
viewEventDisposables += viewModel.eventObservable
.observeOn(AndroidSchedulers.mainThread())
.subscribeBy(onNext = {
onViewEvent(it)
})
.observeOn(AndroidSchedulers.mainThread())
.subscribeBy(onNext = {
onViewEvent(it)
})
}

@CallSuper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,15 @@ abstract class BaseMvvmActivity<VM : BaseViewModel> : BaseActivity() {
* Override this method to do any additional view initialization (ex: setup RecycleView adapter)
*/
protected open fun onViewCreated(savedInstanceState: Bundle?) {

}

override fun onStart() {
super.onStart()
viewEventDisposables += viewModel.eventObservable
.observeOn(AndroidSchedulers.mainThread())
.subscribeBy(onNext = {
onViewEvent(it)
})
.observeOn(AndroidSchedulers.mainThread())
.subscribeBy(onNext = {
onViewEvent(it)
})
}

override fun onStop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import io.intrepid.skotlinton.utils.ViewEvent
import io.intrepid.skotlinton.utils.applySchedulers
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.subjects.PublishSubject
import kotlinx.coroutines.cancel
Expand Down
1 change: 0 additions & 1 deletion app/src/main/kotlin/io/intrepid/skotlinton/rest/RestApi.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.intrepid.skotlinton.rest

import io.intrepid.skotlinton.models.IpModel
import io.reactivex.Single
import retrofit2.http.GET

interface RestApi {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package io.intrepid.skotlinton.utils

import io.reactivex.*
import io.reactivex.Completable
import io.reactivex.Flowable
import io.reactivex.Maybe
import io.reactivex.Observable
import io.reactivex.Scheduler
import io.reactivex.Single

fun <T> Observable<T>.applySchedulers(subscribeOnScheduler: Scheduler, observeOnScheduler: Scheduler): Observable<T> {
return this.subscribeOn(subscribeOnScheduler).observeOn(observeOnScheduler)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package io.intrepid.skotlinton.utils

import io.reactivex.*
import io.reactivex.Completable
import io.reactivex.Flowable
import io.reactivex.Maybe
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.schedulers.TestScheduler
import org.junit.Test

Expand Down
Loading