Skip to content

Commit

Permalink
Merge pull request #152 from XYOracleNetwork/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Phillip Lorenzo authored May 15, 2020
2 parents b62e88e + 38232b5 commit fe46769
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Including BLE, TCP/IP, Bound Witnessing, and Bridging. Use this instead of `sdk
## Gradle Build

```gradle
compile 'network.xyo:sdk-xyo-android:3.1.34'
compile 'network.xyo:sdk-xyo-android:3.1.38'
```

## Maven Build
Expand All @@ -41,7 +41,7 @@ Including BLE, TCP/IP, Bound Witnessing, and Bridging. Use this instead of `sdk
<dependency>
<groupId>network.xyo</groupId>
<artifactId>sdk-xyo-android</artifactId>
<version>3.1.34</version>
<version>3.1.38</version>
<type>pom</type>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion xyo-android-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ task printVersion {
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
ndkVersion "21.0.6113669"
ndkVersion "21.1.6352462"

versionProps['VERSION_PATCH'] = patch.toString()
versionProps.store(versionPropsFile.newWriter(), null)
Expand Down
4 changes: 2 additions & 2 deletions xyo-android-library/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu May 07 04:42:24 UTC 2020
VERSION_PATCH=36
#Fri May 15 16:08:25 UTC 2020
VERSION_PATCH=38
2 changes: 1 addition & 1 deletion xyo-android-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'maven-publish'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
ndkVersion "21.0.6113669"
ndkVersion "21.1.6352462"
defaultConfig {
applicationId "network.xyo.sdk.sample"
minSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package network.xyo.sdk.sample

import android.Manifest
import android.content.Context
import android.content.pm.PackageManager
import android.location.LocationManager
import android.util.Log
import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
Expand All @@ -23,31 +25,66 @@ import network.xyo.sdkobjectmodelkotlin.structure.XyoIterableStructure

@kotlin.ExperimentalUnsignedTypes
class MainActivity : AppCompatActivity() {

lateinit var node: XyoNode

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GlobalScope.launch {
// initializeXyoSimpleWithGps()
//initializeXyoSimple()
// initializeXyoBleClientOnly()
//initializeXyoBleServerOnly()
initializeXyoBleOnly()
ui {
setContentView(R.layout.activity_main)
val navView: BottomNavigationView = findViewById(R.id.nav_view)

val navController = findNavController(R.id.nav_host_fragment)
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(
setOf(
R.id.navigation_ble_client, R.id.navigation_ble_server, R.id.navigation_tcpip_client, R.id.navigation_tcpip_server
)

checkPermissions()
}

private fun checkPermissions () {
// check if we already have the permission
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {

// if we do, continue the setup process
setupNodeAndUI()
return
}

// if we do not, request the permission
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), 1)
}


// this gets called when the user takes action on a permission request
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)

if (requestCode != 1) {
return
}

// recheck the permissions
checkPermissions()
}

private fun setupNodeAndUI () = GlobalScope.launch {
// initializeXyoSimpleWithGps()
// initializeXyoSimple()
// initializeXyoBleClientOnly()
// initializeXyoBleServerOnly()
initializeXyoBleOnly()
ui {

setContentView(R.layout.activity_main)
val navView: BottomNavigationView = findViewById(R.id.nav_view)

val navController = findNavController(R.id.nav_host_fragment)
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(
setOf(
R.id.navigation_ble_client, R.id.navigation_ble_server, R.id.navigation_tcpip_client, R.id.navigation_tcpip_server
)
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
}
)
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
}
}

Expand Down

0 comments on commit fe46769

Please sign in to comment.