This file contains 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 ApiClient { | |
fun getUserFromApi(requestCallback: (isSuccess: Boolean, response: UserResponse?,message: String?) -> (Unit)) { | |
RetrofitClient.getApi() | |
.create(ApiHelper::class.java) | |
.getUser() | |
.enqueue(object : Callback<UserResponse> { | |
override fun onFailure(call: Call<UserResponse>, t: Throwable) { | |
requestCallback(false,null,t.localizedMessage) |
This file contains 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
interface ApiHelper { | |
@GET("(default)/documents/user") | |
fun getUser(): Call<UserResponse> | |
} |
This file contains 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 RetrofitClient { | |
companion object { | |
const val baseUrl = "https://firestore.googleapis.com/v1/projects/firestorerestapi/databases/" | |
fun getApi(): Retrofit { | |
return Retrofit.Builder() | |
.baseUrl(baseUrl) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build() | |
} |
This file contains 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
data class Value( | |
@field:SerializedName("stringValue") | |
val stringValue: String? = null | |
) |
This file contains 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
data class Fields( | |
@field:SerializedName("surname") | |
val surname: Value? = null, | |
@field:SerializedName("name") | |
val name: Value? = null | |
) |
This file contains 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
data class DocumentsItem( | |
@field:SerializedName("createTime") | |
val createTime: String? = null, | |
@field:SerializedName("name") | |
val name: String? = null, | |
@field:SerializedName("updateTime") | |
val updateTime: String? = null, |
This file contains 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
data class UserResponse( | |
@field:SerializedName("documents") | |
val documents: List<DocumentsItem?>? = null | |
) |
This file contains 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
implementation 'com.squareup.retrofit2:retrofit:2.5.0' | |
implementation 'com.squareup.retrofit2:converter-gson:2.3.0' |
This file contains 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
private fun processFaceResult(faces: MutableList<FirebaseVisionFace>) { | |
faces.forEach { | |
val bounds = it.boundingBox | |
val rectOverLay = RectOverlay(graphic_overlay, bounds) | |
graphic_overlay.add(rectOverLay) | |
} | |
alertDialog.dismiss() | |
} |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<Button android:layout_width="match_parent" android:layout_height="wrap_content" | |
android:layout_alignParentBottom="true" |