Skip to content

Instantly share code, notes, and snippets.

View Lavanyagaur22's full-sized avatar
🚩

Lavanya gaur Lavanyagaur22

🚩
View GitHub Profile
// Get the system service for the camera manager
val manager = getSystemService(Context.CAMERA_SERVICE) as CameraManager
// Gets the first camera id
var cameraId = manager.getCameraIdList().get(0)
// Determine the rotation on the FritzVisionImage from the camera orientaion and the device rotation.
// "this" refers to the calling Context (Application, Activity, etc)
var imageRotationFromCamera = FritzVisionOrientation.getImageRotationFromCamera(this, cameraId)
/* Perform UI operations accordingly.
*/
runOnUiThread {
Log.d(TAG, "UI thread")
val bitmap = styleResult?.toBitmap()
image_view.setImageBitmap(bitmap)
}
class MainActivity : AppCompatActivity() {
private val API_KEY = "dcf6227d8ecf4968b4e1a1b5fc1c483b"
private val executor = Executors.newSingleThreadExecutor()
private val TAG = javaClass.simpleName
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
class MainActivity : AppCompatActivity() {
private val API_KEY = "dcf6227d8ecf4968b4e1a1b5fc1c483b"
private val executor = Executors.newSingleThreadExecutor()
private val TAG = javaClass.simpleName
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
<?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"
val imageLabelOnDeviceModel = ImageLabelOnDeviceModelFast() //FritzOnDeviceModel
val predictor = FritzVision.ImageLabeling.getPredictor(imageLabelOnDeviceModel); //FritzVisionLabelPredictor
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'
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'
...
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'
...
}
mutation createTask($input: TaskInput!){
createTask(input: $input){
id
version
title
description
status
creationMetadata{
createdDate
taskId