This file contains hidden or 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
fun getTasks() { | |
FindAllTasksQuery.builder()?.build()?.let { | |
Utils.getApolloClient(this)?.query(it) | |
?.responseFetcher(ApolloResponseFetchers.NETWORK_FIRST) | |
?.enqueue(object : ApolloCall.Callback<FindAllTasksQuery.Data>() { | |
override fun onFailure(e: ApolloException) { | |
e.printStackTrace() | |
Log.e(TAG, "getTasks ----$e ") |
This file contains hidden or 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
//Create a mutation object | |
val input = TaskInput.builder().title(title).version(version).description(description).status("test").build() | |
val mutation = UpdateTaskMutation.builder().id(id).input(input).build() | |
//Create an object of apolloCall | |
val mutationCall = apolloClient.mutate(mutation)?.refetchQueries(apolloQueryWatcher?.operation()?.name()) | |
//Create a callback object of type ApolloCall.Callback | |
val callback = object : ApolloCall.Callback<UpdateTaskMutation.Data>() { | |
This file contains hidden or 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
fun createTask(title: String, description: String, version: Int) { | |
val input = | |
TaskInput.builder().title(title).description(description).version(version).status("test") | |
.build() | |
val mutation = CreateTaskMutation.builder().input(input).build() | |
val mutationCall = Utils.getApolloClient(this)?.mutate( | |
mutation |
This file contains hidden or 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
object Utils { | |
//To run on emulator use http://10.0.2.2:4000/graphql | |
const val BASE_URL = "http://10.0.2.2:4000/graphql" | |
private var apClient: ApolloClient? = null | |
private var httpClient: OkHttpClient? = null | |
@JvmStatic | |
fun getApolloClient(context: Context): ApolloClient? { |
This file contains hidden or 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
mutation createTask($input: TaskInput!){ | |
createTask(input: $input){ | |
id | |
version | |
title | |
description | |
status | |
creationMetadata{ | |
createdDate | |
taskId |
This file contains hidden or 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
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |
... | |
implementation 'com.apollographql.apollo:apollo-android-support:1.2.2' | |
implementation 'com.apollographql.apollo:apollo-runtime:1.2.2' | |
... | |
} |
This file contains hidden or 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
apply plugin: 'com.android.application' | |
apply plugin: 'com.apollographql.android' //Add this | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-kapt' | |
apply plugin: 'kotlin-android-extensions' | |
... |
This file contains hidden or 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
buildscript { | |
.. | |
repositories { | |
jcenter() | |
google() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:3.5.3' | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |
classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.2.2' |
This file contains hidden or 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
val imageLabelOnDeviceModel = ImageLabelOnDeviceModelFast() //FritzOnDeviceModel | |
val predictor = FritzVision.ImageLabeling.getPredictor(imageLabelOnDeviceModel); //FritzVisionLabelPredictor |
This file contains hidden or 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"?> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<TextureView | |
android:id="@+id/view_finder" |