Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
9e21f88
added structure
Agamagsm13 Mar 6, 2020
e98a2f9
Changed layout
Agamagsm13 Mar 6, 2020
12a9de0
Added rate graph
Agamagsm13 Mar 6, 2020
67fd047
BCV-34
Agamagsm13 Mar 8, 2020
dd1287b
Removed .build
Agamagsm13 Mar 10, 2020
e583d88
added constants + renamed some vars + restructurised some classes
Agamagsm13 Mar 10, 2020
023cde3
Rewrited some null-safe places
Agamagsm13 Mar 10, 2020
648e55d
layout for login
Agamagsm13 Mar 12, 2020
1151fd2
for build apk with gradle
Agamagsm13 Mar 12, 2020
3e5bfa0
folder for apk
Agamagsm13 Mar 12, 2020
86c1d15
readme to get apk
Agamagsm13 Mar 12, 2020
e781d4a
Added Sdk version in README
Agamagsm13 Mar 12, 2020
ace4794
BCV-36 (control) + new Api for rates
Agamagsm13 Mar 14, 2020
adeb15a
Network security config added
Agamagsm13 Mar 14, 2020
0bde519
Modified rates graph
Agamagsm13 Mar 15, 2020
fe5f8a0
Test for calculation balances for time.
Agamagsm13 Mar 16, 2020
2001e20
Separated graphs logic and added calculation in USD for Pie Chart
Agamagsm13 Mar 16, 2020
cb2c13c
Added column graph without rates multiplying
Agamagsm13 Mar 16, 2020
c17d515
test for column graph
Agamagsm13 Mar 17, 2020
403b106
Added activity for login and some work with column graph
Agamagsm13 Mar 20, 2020
d0021cb
Added register activity
Agamagsm13 Mar 20, 2020
f44abe9
Authorization with login/password only
Agamagsm13 Mar 22, 2020
8631438
Get transactions and trades for authorized client
Agamagsm13 Mar 22, 2020
0165020
BCV-39 registration
Agamagsm13 Mar 22, 2020
d96746d
Register layout changed
Agamagsm13 Mar 22, 2020
1c9e733
Refactor charts
Agamagsm13 Mar 23, 2020
9ad0d73
Started adding income graph
Agamagsm13 Mar 23, 2020
5108341
BCV-40
Agamagsm13 Mar 23, 2020
c70dbb0
Just cleaning something
Agamagsm13 Mar 24, 2020
6bea088
Test for income and corrections for calculation
Agamagsm13 Mar 24, 2020
8b0f8c1
Changed hint color
Agamagsm13 Mar 25, 2020
824d903
BCV-41 without tests
Agamagsm13 Mar 26, 2020
f4d4a40
BCV-42 portfolio list after authorization
Agamagsm13 Mar 27, 2020
19423ee
Just a little refactoring
Agamagsm13 Mar 28, 2020
2d79fac
Another library for charts and new pieChart
Agamagsm13 Mar 28, 2020
26028f4
Test for balance for one currency
Agamagsm13 Mar 29, 2020
703ffbc
Shared Preferences for token
Agamagsm13 Mar 29, 2020
3f480c0
Preparetions for correlation graph and small fixes
Agamagsm13 Mar 29, 2020
56fddd9
BCV-43 Correlation Chart
Agamagsm13 Mar 30, 2020
dc8a88f
Prepare for input/output chart
Agamagsm13 Mar 30, 2020
8f43828
Input/Output prepare
Agamagsm13 Mar 30, 2020
7dacf37
Add portfolio function
Agamagsm13 Apr 1, 2020
748791f
Responce to delete portfolios and preparations for upload
Agamagsm13 Apr 1, 2020
fa54b51
Input/output graph
Agamagsm13 Apr 2, 2020
96a6be1
Income portfolio graph
Agamagsm13 Apr 3, 2020
551598a
Test for input/output graph
Agamagsm13 Apr 3, 2020
2bd42af
Test for income portfolio
Agamagsm13 Apr 3, 2020
88aa448
Some refactoring
Agamagsm13 Apr 5, 2020
9301d72
gradle changes
Agamagsm13 Apr 5, 2020
205c58c
Rename folder
Agamagsm13 Apr 6, 2020
9339760
Rename(2)
Agamagsm13 Apr 6, 2020
fbb0390
Some corrections
Agamagsm13 Apr 6, 2020
0590288
Added "delete portfolio" function and progress bar when log in
Agamagsm13 Apr 6, 2020
a97e1a3
Correlation calcutating
Agamagsm13 Apr 7, 2020
4a8a912
Another pie chart
Agamagsm13 Apr 8, 2020
90ec8d9
Another toolbar and preparations for upload files to server
Agamagsm13 Apr 9, 2020
e0a4fb3
upload trans and trades (response 400)
Agamagsm13 Apr 10, 2020
8beedd0
New login button
Agamagsm13 Apr 10, 2020
51218e0
Working uploading trades and transactions
Agamagsm13 Apr 11, 2020
8da4457
Refactor viewModel
Agamagsm13 Apr 11, 2020
e0421f7
another main screnn and intervals for rates
Agamagsm13 Apr 12, 2020
e3b377b
Column graph using monthly rates
Agamagsm13 Apr 12, 2020
8e92c7a
Transition between activities
Agamagsm13 Apr 12, 2020
7d5f289
Base currency added
Agamagsm13 Apr 16, 2020
d152d50
Another button
Agamagsm13 Apr 17, 2020
3586d62
Preparations for adding one trade or transaction
Agamagsm13 Apr 17, 2020
5c1b4d3
New endpoints and adding one transaction/trade
Agamagsm13 Apr 17, 2020
115e8d0
Correction uploading one trade/transaction
Agamagsm13 Apr 18, 2020
2d6493e
Adding rates in recycler in main screen
Agamagsm13 Apr 18, 2020
3869016
Custom buttons and periods for input/output
Agamagsm13 Apr 19, 2020
8a5a0c3
Own activity for income
Agamagsm13 Apr 19, 2020
b1953f1
Dialog alert with negative balances
Agamagsm13 May 2, 2020
4e113c4
New server address
Agamagsm13 May 18, 2020
a05eb76
Server
Agamagsm13 Jun 1, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.mvvmkotlincoroutineretrofitdemo.interfaces

import com.example.mvvmkotlincoroutineretrofitdemo.model.Rate
import com.example.mvvmkotlincoroutineretrofitdemo.model.Trade
import com.example.mvvmkotlincoroutineretrofitdemo.model.Transaction
import kotlinx.coroutines.Deferred
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {

@GET("/bcv/quotes/bars/{instrument}/{timeFrom}/{timeTo}")
fun getRatesForTime(@Path("instrument") instrument:String, @Path("timeFrom") timeFrom: Long, @Path("timeTo") timeTo: Long): Deferred<Response<MutableList<Rate>>>
@GET("/bcv/quotes/bars/{instrument}")
fun getRate(@Query("instrument") instrument: String): Deferred<Response<MutableList<Rate>>>
@GET("/bcv/transactions")
fun getTrans(): Deferred<Response<MutableList<Transaction>>>
@GET("/bcv/trades")
fun getTrades(): Deferred<Response<MutableList<Trade>>>

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.example.mvvmkotlincoroutineretrofitdemo.manager

import android.view.GestureDetector
import android.view.MotionEvent
import android.view.View
import kotlin.math.abs

open class OnSwipeTouchListener : View.OnTouchListener {

private val gestureDetector = GestureDetector(GestureListener())

fun onTouch(event: MotionEvent): Boolean {
return gestureDetector.onTouchEvent(event)
}

private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {

private val SWIPE_THRESHOLD = 100
private val SWIPE_VELOCITY_THRESHOLD = 100





override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
val result = false
try {
val diffY = e2.y - e1.y
val diffX = e2.x - e1.x
if (abs(diffX) > abs(diffY)) {
if (abs(diffX) > SWIPE_THRESHOLD && abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
onSwipeRight()
} else {
onSwipeLeft()
}
}
} else {
// onTouch(e);
}
} catch (exception: Exception) {
exception.printStackTrace()
}

return result
}
}

override fun onTouch(v: View, event: MotionEvent): Boolean {
return gestureDetector.onTouchEvent(event)
}

open fun onSwipeRight() {}

open fun onSwipeLeft() {}

open fun onSwipeTop() {}

open fun onSwipeBottom() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.example.mvvmkotlincoroutineretrofitdemo.manager

import com.example.mvvmkotlincoroutineretrofitdemo.interfaces.ApiService
import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object RetrofitManager {

val apiRate: ApiService
init {
val client = OkHttpClient.Builder().build()
apiRate = Retrofit.Builder()
.baseUrl("http://3.248.170.197:8888")
Comment thread
phil-dolgolev marked this conversation as resolved.
Outdated
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(CoroutineCallAdapterFactory())
.client(client)
.build()
.create(ApiService::class.java)
}

val apiTransTrades: ApiService
init {
val client = OkHttpClient.Builder().build()
apiTransTrades = Retrofit.Builder()
.baseUrl("http://3.248.170.197:9999")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Энто в настройки бы вынести

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Энто в настройки бы вынести

не очень понял

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Урлы и порты обычно хочется выносить в настройки, ибо вот возьму, тачку перезагружу на AWS - и код протухнет, и надо пересобирать чтоб заработало, и менять именно в RetrofitManager :)

.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(CoroutineCallAdapterFactory())
.client(client)
.build()
.create(ApiService::class.java)
}




}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.example.mvvmkotlincoroutineretrofitdemo.model

import android.system.Int64Ref
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import java.math.BigDecimal

data class Rate(
@SerializedName("exchangeRate")
@Expose
val exchangeRate: BigDecimal,
@SerializedName("timestamp")
@Expose
val date: Long
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.example.mvvmkotlincoroutineretrofitdemo.model

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import java.math.BigDecimal

data class Trade(
@SerializedName("id")
@Expose
val id: Int,
@SerializedName("dateTime")
@Expose
val dateTime: String,
@SerializedName("instrument")
@Expose
val instrument: String,
@SerializedName("tradeType")
@Expose
val tradeType: String,
@SerializedName("tradedQuantity")
@Expose
val tradedQuantity: BigDecimal,
@SerializedName("tradedQuantityCurrency")
@Expose
val tradedQuantityCurrency: String,
@SerializedName("tradedPrice")
@Expose
val tradedPrice: BigDecimal,
@SerializedName("tradedPriceCurrency")
@Expose
val tradedPriceCurrency: String,
@SerializedName("commission")
@Expose
val commission: BigDecimal,
@SerializedName("commissionCurrency")
@Expose
val commissionCurrency: String,
@SerializedName("tradeValueId")
@Expose
val tradeValueId: Int
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.example.mvvmkotlincoroutineretrofitdemo.model

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
import java.math.BigDecimal

data class Transaction(
@SerializedName("id")
@Expose
val id: Int,
@SerializedName("transactionType")
@Expose
val transactionType: String,
@SerializedName("dateTime")
@Expose
val dateTime: String,
@SerializedName("currency")
@Expose
val currency: String,
@SerializedName("amount")
@Expose
val amount: BigDecimal,
@SerializedName("commission")
@Expose
val commission: BigDecimal,
@SerializedName("transactionStatus")
@Expose
val transactionStatus: String,
@SerializedName("transactionValueId")
@Expose
val transactionValueId: Int
)
Loading