Commit c063b63b authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

changed all dates to JSR-310 android backport (LocalDateTime) and updated gradle

parent 11e088e1
......@@ -10,11 +10,13 @@ android {
defaultConfig {
applicationId "ru.terrakok.gitlabclient"
minSdkVersion 19
targetSdkVersion 27
versionName "1.0"
versionCode getBuildNumber()
buildConfigField "String", "VERSION_UID", '"' + getBuildUid() + '"'
buildConfigField "String", "APP_DESCRIPTION", '"Gitfox is an Android client for Gitlab."'
buildConfigField "String", "FEEDBACK_URL", '"https://gitlab.com/terrakok/gitlab-client/issues"'
......@@ -50,12 +52,8 @@ android {
}
}
kapt {
generateStubs true
}
ext {
supportLibraryVersion = "27.0.2"
supportLibraryVersion = "27.1.0"
moxyVersion = "1.4.6"
toothpickVersion = "1.0.6"
retrofitVersion = "2.2.0"
......@@ -63,56 +61,56 @@ ext {
dependencies {
//Support
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support.constraint:constraint-layout:1.0.2"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support.constraint:constraint-layout:1.0.2"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
//Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
//Log
compile "com.jakewharton.timber:timber:4.5.1"
implementation "com.jakewharton.timber:timber:4.5.1"
//MVP Moxy
kapt "com.arello-mobile:moxy-compiler:$moxyVersion"
compile "com.arello-mobile:moxy-app-compat:$moxyVersion"
implementation "com.arello-mobile:moxy-app-compat:$moxyVersion"
//Cicerone Navigation
compile "ru.terrakok.cicerone:cicerone:3.0.0"
implementation "ru.terrakok.cicerone:cicerone:3.0.0"
//DI
compile "com.github.stephanenicolas.toothpick:toothpick-runtime:$toothpickVersion"
implementation "com.github.stephanenicolas.toothpick:toothpick-runtime:$toothpickVersion"
kapt "com.github.stephanenicolas.toothpick:toothpick-compiler:$toothpickVersion"
//Gson
compile "com.google.code.gson:gson:2.8.0"
implementation "com.google.code.gson:gson:2.8.0"
//Retrofit
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
compile "com.squareup.okhttp3:logging-interceptor:3.6.0"
compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.okhttp3:logging-interceptor:3.6.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
//RxJava
compile "io.reactivex.rxjava2:rxandroid:2.0.1"
compile "io.reactivex.rxjava2:rxjava:2.1.0"
compile 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
implementation "io.reactivex.rxjava2:rxjava:2.1.0"
implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
//Adapter simplify
compile "com.hannesdorfmann:adapterdelegates3:3.0.1"
implementation "com.hannesdorfmann:adapterdelegates3:3.0.1"
//Image load and cache
compile "com.github.bumptech.glide:glide:3.8.0"
implementation "com.github.bumptech.glide:glide:3.8.0"
//Markdown to HTML converter
compile 'ru.noties:markwon:1.0.3'
implementation 'ru.noties:markwon:1.0.3'
//Bottom navigation bar
compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
//Custom fonts
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
//Lottie
compile 'com.airbnb.android:lottie:2.1.0'
implementation 'com.airbnb.android:lottie:2.1.0'
//Date
compile 'joda-time:joda-time:2.9.9'
implementation 'com.jakewharton.threetenabp:threetenabp:1.0.5'
//FlexBox Layout
compile 'com.google.android:flexbox:0.3.1'
implementation 'com.google.android:flexbox:0.3.1'
//JUnit
testCompile "junit:junit:4.12"
testImplementation "junit:junit:4.12"
//Mockito
testCompile "org.mockito:mockito-core:2.8.9"
testImplementation "org.mockito:mockito-core:2.8.9"
//Mockito Kotlin
testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0"
implementation 'com.android.support:cardview-v7:27.0.2'
testImplementation "com.nhaarman:mockito-kotlin-kt1.1:1.5.0"
}
configurations.all {
......
......@@ -2,6 +2,7 @@ package ru.terrakok.gitlabclient
import android.app.Application
import android.graphics.Color
import com.jakewharton.threetenabp.AndroidThreeTen
import ru.noties.markwon.SpannableConfiguration
import ru.noties.markwon.spans.SpannableTheme
import ru.terrakok.gitlabclient.model.data.auth.AuthHolder
......@@ -28,6 +29,7 @@ class App : Application() {
initAppScope()
initCalligraphy()
initMarkwon()
initThreetenABP()
}
private fun initLogger() {
......@@ -72,4 +74,8 @@ class App : Application() {
.theme(theme)
.build()
}
private fun initThreetenABP() {
AndroidThreeTen.init(this)
}
}
\ No newline at end of file
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import java.util.*
import org.threeten.bp.LocalDateTime
data class Milestone(
@SerializedName("id") val id: Long,
......@@ -10,7 +10,7 @@ data class Milestone(
@SerializedName("description") val description: String?,
@SerializedName("state") val state: String?,
@SerializedName("due_date") val dueDate: String?,
@SerializedName("created_at") val createdAt: Date?,
@SerializedName("created_at") val createdAt: LocalDateTime?,
@SerializedName("title") val title: String?,
@SerializedName("updated_at") val updatedAt: String?
)
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.event.EventTargetType
import java.util.*
data class Note(
@SerializedName("id") val id: Long,
@SerializedName("body") val body: String,
@SerializedName("author") val author: Author,
@SerializedName("created_at") val createdAt: Date,
@SerializedName("updated_at") val updatedAt: Date?,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("system") val isSystem: Boolean,
@SerializedName("noteable_id") val noteableId: Long,
@SerializedName("noteable_type") val noteableType: EventTargetType?,
......
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import java.util.*
import org.threeten.bp.LocalDateTime
data class Owner (
@SerializedName("id") val id: Long,
@SerializedName("name") val name: String,
@SerializedName("username") val username: String,
@SerializedName("created_at") val createdAt: Date?
@SerializedName("created_at") val createdAt: LocalDateTime?
)
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import java.util.*
import org.threeten.bp.LocalDateTime
data class Project(
@SerializedName("id") val id: Long,
......@@ -24,8 +24,8 @@ data class Project(
@SerializedName("wiki_enabled") val wikiEnabled: Boolean,
@SerializedName("snippets_enabled") val snippetsEnabled: Boolean,
@SerializedName("container_registry_enabled") val containerRegistryEnabled: Boolean,
@SerializedName("created_at") val createdAt: Date?,
@SerializedName("last_activity_at") val lastActivityAt: Date?,
@SerializedName("created_at") val createdAt: LocalDateTime?,
@SerializedName("last_activity_at") val lastActivityAt: LocalDateTime?,
@SerializedName("creator_id") val creatorId: Long,
@SerializedName("namespace") val namespace: Namespace?,
@SerializedName("permissions") val permissions: Permissions?,
......
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import java.util.*
import org.threeten.bp.LocalDateTime
data class User(
@SerializedName("id") val id: Long,
......@@ -11,7 +11,7 @@ data class User(
@SerializedName("state") val state: String?,
@SerializedName("avatar_url") val avatarUrl: String?,
@SerializedName("web_url") val webUrl: String?,
@SerializedName("created_at") val createdAt: Date,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("is_admin") val isAdmin: Boolean,
@SerializedName("bio") val bio: String?,
@SerializedName("location") val location: String?,
......@@ -20,11 +20,11 @@ data class User(
@SerializedName("twitter") val twitter: String?,
@SerializedName("website_url") val websiteUrl: String?,
@SerializedName("organization") val organization: String?,
@SerializedName("last_sign_in_at") val lastSignInAt: Date,
@SerializedName("confirmed_at") val confirmedAt: Date,
@SerializedName("last_sign_in_at") val lastSignInAt: LocalDateTime,
@SerializedName("confirmed_at") val confirmedAt: LocalDateTime,
@SerializedName("color_scheme_id") val colorSchemeId: Long,
@SerializedName("projects_limit") val projectsLimit: Long,
@SerializedName("current_sign_in_at") val currentSignInAt: Date,
@SerializedName("current_sign_in_at") val currentSignInAt: LocalDateTime,
@SerializedName("identities") val identities: List<Identity>?,
@SerializedName("can_create_group") val canCreateGroup: Boolean,
@SerializedName("can_create_project") val canCreateProject: Boolean,
......
package ru.terrakok.gitlabclient.entity.app.target
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Author
import java.util.*
/**
* Created by Konstantin Tskhovrebov (aka @terrakok) on 24.12.17.
......@@ -11,7 +11,7 @@ data class TargetHeader(
val icon: TargetHeaderIcon,
val title: TargetHeaderTitle,
val body: CharSequence?,
val date: Date,
val date: LocalDateTime,
val target: AppTarget,
val targetId: Long,
val internal: TargetInternal?,
......
package ru.terrakok.gitlabclient.entity.event
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Note
import ru.terrakok.gitlabclient.entity.PushData
import java.util.*
/**
......@@ -18,7 +18,7 @@ data class Event(
@SerializedName("target_type") val targetType: EventTargetType?,
@SerializedName("author_id") val authorId: Long,
@SerializedName("target_title") val targetTitle: String?,
@SerializedName("created_at") val createdAt: Date,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("author") val author: Author,
@SerializedName("author_username") val authorUsername: String,
@SerializedName("push_data") val pushData: PushData?,
......
package ru.terrakok.gitlabclient.entity.issue
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Assignee
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Milestone
import java.util.*
data class Issue(
@SerializedName("id") val id: Long,
......@@ -15,12 +15,12 @@ data class Issue(
@SerializedName("milestone") val milestone: Milestone?,
@SerializedName("project_id") val projectId: Long,
@SerializedName("assignees") val assignees: List<Assignee>,
@SerializedName("updated_at") val updatedAt: Date?,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("title") val title: String?,
@SerializedName("created_at") val createdAt: Date,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("labels") val labels: List<String>,
@SerializedName("user_notes_count") val userNotesCount: Int,
@SerializedName("due_date") val dueDate: Date?,
@SerializedName("due_date") val dueDate: LocalDateTime?,
@SerializedName("web_url") val webUrl: String?,
@SerializedName("confidential") val confidential: Boolean,
@SerializedName("upvotes") val upvotes: Int,
......
package ru.terrakok.gitlabclient.entity.mergerequest
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Milestone
import ru.terrakok.gitlabclient.entity.User
import java.util.*
data class MergeRequest(
@SerializedName("id") val id: Long,
@SerializedName("iid") val iid: Long,
@SerializedName("created_at") val createdAt: Date,
@SerializedName("updated_at") val updatedAt: Date?,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("target_branch") val targetBranch: String?,
@SerializedName("source_branch") val sourceBranch: String?,
@SerializedName("project_id") val projectId: Long,
......
package ru.terrakok.gitlabclient.entity.target
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Assignee
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Milestone
import java.util.*
/**
* @author Eugene Shapovalov (CraggyHaggy). Date: 13.09.17
......@@ -15,8 +15,8 @@ abstract class Target {
@SerializedName("project_id") private val _projectId: Long? = null
@SerializedName("title") private val _title: String? = null
@SerializedName("state") private val _state: TargetState? = null
@SerializedName("updated_at") val updatedAt: Date? = null
@SerializedName("created_at") val createdAt: Date? = null
@SerializedName("updated_at") val updatedAt: LocalDateTime? = null
@SerializedName("created_at") val createdAt: LocalDateTime? = null
@SerializedName("labels") private val _labels: List<String>? = null
@SerializedName("milestone") val milestone: Milestone? = null
@SerializedName("assignees") private val _assignees: List<Assignee>? = null
......
package ru.terrakok.gitlabclient.entity.todo
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.target.Target
import ru.terrakok.gitlabclient.entity.target.TargetType
import java.util.*
/**
* @author Eugene Shapovalov (CraggyHaggy). Date: 11.09.17
......@@ -19,5 +19,5 @@ data class Todo(
val targetUrl: String,
val body: String,
val state: TodoState,
val createdAt: Date
val createdAt: LocalDateTime
)
\ No newline at end of file
......@@ -3,8 +3,8 @@ package ru.terrakok.gitlabclient.extension
import android.content.Context
import android.content.res.Resources
import android.support.annotation.DrawableRes
import org.joda.time.DateTimeZone
import org.joda.time.format.DateTimeFormat
import org.threeten.bp.Duration
import org.threeten.bp.LocalDateTime
import retrofit2.HttpException
import ru.terrakok.gitlabclient.R
import ru.terrakok.gitlabclient.entity.app.develop.LicenseType
......@@ -16,7 +16,6 @@ import ru.terrakok.gitlabclient.entity.todo.TodoAction
import ru.terrakok.gitlabclient.model.system.ResourceManager
import timber.log.Timber
import java.io.IOException
import java.util.*
/**
* Created by Konstantin Tskhovrebov (aka @terrakok) on 14.02.18.
......@@ -39,21 +38,15 @@ fun Throwable.userMessage(resourceManager: ResourceManager) = when (this) {
else -> resourceManager.getString(R.string.unknown_error)
}
private val DATE_FORMAT = DateTimeFormat.forPattern("dd.MM.yyyy")
fun Date.humanTime(resources: Resources): String {
val localMillis = DateTimeZone.getDefault().convertUTCToLocal(this.time)
val timeDelta = (System.currentTimeMillis() - localMillis) / 1000L
fun LocalDateTime.humanTime(resources: Resources): String {
val delta = Duration.between(this, LocalDateTime.now()).seconds
val timeStr =
if (timeDelta < 60) {
resources.getString(R.string.time_sec, timeDelta)
} else if (timeDelta < 60 * 60) {
resources.getString(R.string.time_min, timeDelta / 60)
} else if (timeDelta < 60 * 60 * 24) {
resources.getString(R.string.time_hour, timeDelta / (60 * 60))
} else if (timeDelta < 60 * 60 * 24 * 7) {
resources.getString(R.string.time_day, timeDelta / (60 * 60 * 24))
} else {
return DATE_FORMAT.print(localMillis)
when {
delta < 60 -> resources.getString(R.string.time_sec, delta)
delta < 60 * 60 -> resources.getString(R.string.time_min, delta / 60)
delta < 60 * 60 * 24 -> resources.getString(R.string.time_hour, delta / (60 * 60))
delta < 60 * 60 * 24 * 7 -> resources.getString(R.string.time_day, delta / (60 * 60 * 24))
else -> return this.toLocalDate().toString()
}
return resources.getString(R.string.time_ago, timeStr)
......
......@@ -2,6 +2,7 @@ package ru.terrakok.gitlabclient.model.data.server
import io.reactivex.Completable
import io.reactivex.Single
import org.threeten.bp.LocalDateTime
import retrofit2.http.*
import ru.terrakok.gitlabclient.entity.*
import ru.terrakok.gitlabclient.entity.event.Event
......@@ -18,7 +19,6 @@ import ru.terrakok.gitlabclient.entity.target.TargetType
import ru.terrakok.gitlabclient.entity.todo.Todo
import ru.terrakok.gitlabclient.entity.todo.TodoAction
import ru.terrakok.gitlabclient.entity.todo.TodoState
import java.util.*
/**
* @author Konstantin Tskhovrebov (aka terrakok). Date: 28.03.17
......@@ -114,8 +114,8 @@ interface GitlabApi {
@Query("milestone") milestone: String?,
@Query("view") viewType: MergeRequestViewType?,
@Query("labels") labels: String?,
@Query("created_before") createdBefore: Date?,
@Query("created_after") createdAfter: Date?,
@Query("created_before") createdBefore: LocalDateTime?,
@Query("created_after") createdAfter: LocalDateTime?,
@Query("scope") scope: MergeRequestScope?,
@Query("author_id") authorId: Int?,
@Query("assignee_id") assigneeId: Int?,
......@@ -132,8 +132,8 @@ interface GitlabApi {
@Query("milestone") milestone: String?,
@Query("view") viewType: MergeRequestViewType?,
@Query("labels") labels: String?,
@Query("created_before") createdBefore: Date?,
@Query("created_after") createdAfter: Date?,
@Query("created_before") createdBefore: LocalDateTime?,
@Query("created_after") createdAfter: LocalDateTime?,
@Query("scope") scope: MergeRequestScope?,
@Query("author_id") authorId: Int?,
@Query("assignee_id") assigneeId: Int?,
......
package ru.terrakok.gitlabclient.model.data.server.deserializer
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import org.threeten.bp.LocalDateTime
import org.threeten.bp.ZonedDateTime
import java.lang.reflect.Type
import java.util.*
/**
* Created by Konstantin Tskhovrebov (aka @terrakok) on 27.02.18.
*/
class DateDeserializer : JsonDeserializer<LocalDateTime> {
private val offset = TimeZone.getDefault().rawOffset / 1000L
override fun deserialize(
json: JsonElement,
type: Type,
jsonDeserializationContext: JsonDeserializationContext
): LocalDateTime {
return ZonedDateTime.parse(json.asJsonPrimitive.asString).plusSeconds(offset).toLocalDateTime()
}
}
\ No newline at end of file
package ru.terrakok.gitlabclient.entity.todo
package ru.terrakok.gitlabclient.model.data.server.deserializer
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonParseException
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Author
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.target.Target
import ru.terrakok.gitlabclient.entity.target.TargetType
import ru.terrakok.gitlabclient.entity.target.issue.Issue
import ru.terrakok.gitlabclient.entity.target.mergerequest.MergeRequest
import ru.terrakok.gitlabclient.entity.todo.Todo
import ru.terrakok.gitlabclient.entity.todo.TodoAction
import ru.terrakok.gitlabclient.entity.todo.TodoState
import java.lang.reflect.Type
import java.util.*
/**
* @author Eugene Shapovalov (CraggyHaggy). Date: 13.09.17
......@@ -48,7 +51,7 @@ class TodoDeserializer : JsonDeserializer<Todo> {
jsonObject.get("target_url").asString,
jsonObject.get("body").asString,
context.deserialize<TodoState>(jsonObject.get("state"), TodoState::class.java),
context.deserialize<Date>(jsonObject.get("created_at"), Date::class.java)
context.deserialize<LocalDateTime>(jsonObject.get("created_at"), LocalDateTime::class.java)
)
} else {
throw JsonParseException("Configure Gson in GsonProvider.")
......
......@@ -3,6 +3,7 @@ package ru.terrakok.gitlabclient.model.repository.event
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.functions.BiFunction
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.PushDataRefType
import ru.terrakok.gitlabclient.entity.Sort
......@@ -16,7 +17,6 @@ import ru.terrakok.gitlabclient.model.system.SchedulersProvider
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.DefaultPageSize
import java.text.SimpleDateFormat
import java.util.*
import javax.inject.Inject
/**
......@@ -33,8 +33,8 @@ class EventRepository @Inject constructor(
fun getEvents(
action: EventAction? = null,
targetType: EventTarget? = null,
beforeDay: Date? = null,
afterDay: Date? = null,
beforeDay: LocalDateTime? = null,
afterDay: LocalDateTime? = null,
sort: Sort? = null,
page: Int,
pageSize: Int = defaultPageSize
......@@ -122,13 +122,17 @@ class EventRepository @Inject constructor(
EventTargetType.SNIPPET -> TargetData(AppTarget.SNIPPET, "${AppTarget.SNIPPET} ${event.targetIid!!}", event.targetId!!)
EventTargetType.DIFF_NOTE,
EventTargetType.NOTE -> {
when (event.note!!.noteableType) {
EventTargetType.ISSUE -> TargetData(AppTarget.ISSUE, "${AppTarget.ISSUE} #${event.note.noteableIid}", event.note.noteableId)
EventTargetType.MERGE_REQUEST -> TargetData(AppTarget.MERGE_REQUEST, "${AppTarget.MERGE_REQUEST} !${event.note.noteableIid}", event.note.noteableId)
EventTargetType.MILESTONE -> TargetData(AppTarget.MILESTONE, "${AppTarget.MILESTONE} ${event.note.noteableIid}", event.note.noteableId)
EventTargetType.SNIPPET -> TargetData(AppTarget.SNIPPET, "${AppTarget.SNIPPET} ${event.note.noteableIid}", event.note.noteableId)
null -> TargetData(AppTarget.COMMIT, "${AppTarget.COMMIT} ${event.note.id}", event.note.id)
else -> throw IllegalArgumentException("Unsupported noteable target type: ${event.note.noteableType}.")
if (event.note != null) {
when (event.note.noteableType) {
EventTargetType.ISSUE -> TargetData(AppTarget.ISSUE, "${AppTarget.ISSUE} #${event.note.noteableIid}", event.note.noteableId)
EventTargetType.MERGE_REQUEST -> TargetData(AppTarget.MERGE_REQUEST, "${AppTarget.MERGE_REQUEST} !${event.note.noteableIid}", event.note.noteableId)
EventTargetType.MILESTONE -> TargetData(AppTarget.MILESTONE, "${AppTarget.MILESTONE} ${event.note.noteableIid}", event.note.noteableId)
EventTargetType.SNIPPET -> TargetData(AppTarget.SNIPPET, "${AppTarget.SNIPPET} ${event.note.noteableIid}", event.note.noteableId)
null -> TargetData(AppTarget.COMMIT, "${AppTarget.COMMIT} ${event.note.id}", event.note.id)
else -> throw IllegalArgumentException("Unsupported noteable target type: ${event.note.noteableType}.")
}
} else {
throw IllegalArgumentException("Unsupported event type: $event.")
}
}
else -> {
......
......@@ -3,6 +3,7 @@ package ru.terrakok.gitlabclient.model.repository.mergerequest
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.functions.BiFunction
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.OrderBy
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.Sort
......@@ -16,7 +17,6 @@ import ru.terrakok.gitlabclient.model.data.server.GitlabApi
import ru.terrakok.gitlabclient.model.system.SchedulersProvider
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.DefaultPageSize
import java.util.*
import javax.inject.Inject
class MergeRequestRepository @Inject constructor(
......@@ -31,8 +31,8 @@ class MergeRequestRepository @Inject constructor(
milestone: String? = null,
viewType: MergeRequestViewType? = null,
labels: String? = null,
createdBefore: Date? = null,
createdAfter: Date? = null,
createdBefore: LocalDateTime? = null,
createdAfter: LocalDateTime? = null,
scope: MergeRequestScope? = null,
authorId: Int? = null,
assigneeId: Int? = null,
......
......@@ -2,8 +2,10 @@ package ru.terrakok.gitlabclient.toothpick.provider
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.todo.Todo
import ru.terrakok.gitlabclient.entity.todo.TodoDeserializer
import ru.terrakok.gitlabclient.model.data.server.deserializer.DateDeserializer
import ru.terrakok.gitlabclient.model.data.server.deserializer.TodoDeserializer
import javax.inject.Inject
import javax.inject.Provider
......@@ -14,7 +16,7 @@ class GsonProvider @Inject constructor() : Provider<Gson> {
override fun get(): Gson =
GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss")
.registerTypeAdapter(LocalDateTime::class.java, DateDeserializer())
.registerTypeAdapter(Todo::class.java, TodoDeserializer())
.create()
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ class TargetsAdapter(
private fun isProgress() = items.isNotEmpty() && items.last() is ProgressItem
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int, payloads: MutableList<Any?>?) {
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: MutableList<Any?>) {
super.onBindViewHolder(holder, position, payloads)
if (position == items.size - 10) nextListener()
......
......@@ -137,7 +137,7 @@ class ProjectsListFragment : BaseFragment(), ProjectsListView {
private fun isProgress() = items.isNotEmpty() && items.last() is ProgressItem
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int, payloads: MutableList<Any?>?) {
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, payloads: MutableList<Any?>) {
super.onBindViewHolder(holder, position, payloads)
if (position == items.size - 10) presenter.loadNextProjectsPage()
......
......@@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha03'
classpath 'com.android.tools.build:gradle:3.2.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment