Skip to content

Commit

Permalink
Implement basic list of floor plans and simple AR Fragment that can h…
Browse files Browse the repository at this point in the history
…ost a cloud anchor
  • Loading branch information
morhenny committed Nov 15, 2022
0 parents commit 971b865
Show file tree
Hide file tree
Showing 61 changed files with 1,798 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
70 changes: 70 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlinx-serialization'
id 'androidx.navigation.safeargs.kotlin'
id 'com.google.secrets_gradle_plugin' version '0.4'
}

android {
namespace 'de.morhenn.ar_localization'
compileSdk 33

defaultConfig {
applicationId "de.morhenn.ar_localization"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
aaptOptions {
noCompress 'filamat', 'ktx'
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

// Navigation component
implementation "androidx.navigation:navigation-fragment-ktx:2.5.3"
implementation "androidx.navigation:navigation-ui-ktx:2.5.3"

// Play services
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
//OAuth
implementation 'com.google.android.gms:play-services-auth:20.3.0'

// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"

//JSON serialization
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2'

// SceneView
implementation 'io.github.sceneview:arsceneview:0.6.1-SNAPSHOT'

implementation 'com.google.ar:core:1.34.0' //need min 1.33 for new cloud console endpoint
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
31 changes: 31 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Arlocalization"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file not shown.
Binary file added app/src/main/assets/models/cube.glb
Binary file not shown.
12 changes: 12 additions & 0 deletions app/src/main/java/de/morhenn/ar_localization/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.morhenn.ar_localization

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
24 changes: 24 additions & 0 deletions app/src/main/java/de/morhenn/ar_localization/MyApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package de.morhenn.ar_localization

import android.app.Application
import de.morhenn.ar_localization.utils.FileLog

class MyApplication : Application() {

companion object {
@JvmField
var initialized = false
const val TAG = "ArLocalizationApp"
}

override fun onCreate() {
super.onCreate()
if (!initialized) {
initialized = true
//initialize all static utils

FileLog.init(applicationContext, true)
Thread.setDefaultUncaughtExceptionHandler { _, e -> FileLog.fatal(e) }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package de.morhenn.ar_localization.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import de.morhenn.ar_localization.databinding.ItemFloorPlanListBinding
import de.morhenn.ar_localization.model.FloorPlan

class FloorPlanListAdapter(private val floorPlanList: List<FloorPlan>) : RecyclerView.Adapter<FloorPlanListAdapter.ViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val binding = ItemFloorPlanListBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return ViewHolder(binding)
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.bind(floorPlanList[position], position)
}

override fun getItemCount(): Int {
return floorPlanList.size
}

class ViewHolder(private val binding: ItemFloorPlanListBinding) : RecyclerView.ViewHolder(binding.root) {

fun bind(floorPlan: FloorPlan, position: Int) {
binding.floorPlanListItemName.text = floorPlan.name
binding.floorPlanListItemInfo.text = floorPlan.info
}
}

}
Loading

0 comments on commit 971b865

Please # to comment.