Skip to content

Commit

Permalink
feat: changes in the views example
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Del Pino <idelpino@teclib.com>
  • Loading branch information
Ivan Del Pino authored and ajsb85 committed Dec 14, 2018
1 parent fe1ff81 commit 5485005
Showing 1 changed file with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,52 @@
package org.flyve.example_kotlin

import android.Manifest
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.support.v7.app.AppCompatActivity
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*
import org.flyve.inventory.InventoryTask

class MainActivity : AppCompatActivity() {

val LOG = "inventory.example"

override fun onCreate(savedInstanceState: Bundle?) {
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
callTestActivity.setOnClickListener {
startActivity(Intent(this, SecondActivity::class.java))
}
permission()
textHello.setOnClickListener({ generateTask() })
}

private fun permission() {
ActivityCompat.requestPermissions(this@MainActivity,
arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA), 1)
}

private fun generateTask() {
InventoryTask.showFILog = true
// val categories: Array<String> = arrayOf("Hardware", "OperatingSystem")
val inventoryTask = InventoryTask(this@MainActivity, "example-app-kotlin", false)
// val categories: Array<String> = arrayOf("Hardware", "OperatingSystem")
val appVersion = "example-app-kotlin"
val inventoryTask = InventoryTask(this@MainActivity, appVersion, false)
inventoryTask.tag = "Android Lenovo"
inventoryTask.getXML( object : InventoryTask.OnTaskCompleted {
inventoryTask.getXML(object : InventoryTask.OnTaskCompleted {
override fun onTaskSuccess(data: String) {
Log.d(LOG, data)
}

override fun onTaskError(error: Throwable) {
Log.e(LOG, error.message)
}
} )
inventoryTask.getJSON( object : InventoryTask.OnTaskCompleted {
})
inventoryTask.getJSON(object : InventoryTask.OnTaskCompleted {
override fun onTaskSuccess(data: String?) {
Log.d(LOG, data)
}
Expand All @@ -36,6 +56,5 @@ class MainActivity : AppCompatActivity() {
}

})

}
}

0 comments on commit 5485005

Please sign in to comment.