Skip to content

Commit

Permalink
virtual-device-app: Add control module for virtual device's detail vi…
Browse files Browse the repository at this point in the history
…ew (#28486)

Signed-off-by: Jaehoon You <jaehoon.you@samsung.com>
Signed-off-by: Charles Kim <chulspro.kim@samsung.com>
  • Loading branch information
Jaehoon-You authored and pull[bot] committed Nov 8, 2023
1 parent 159f8c2 commit 6d3de99
Show file tree
Hide file tree
Showing 10 changed files with 199 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import com.matter.buildsrc.Deps
import com.matter.buildsrc.Versions

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.google.dagger.hilt.android")
id("androidx.navigation.safeargs.kotlin")
kotlin("kapt")
}

android {
namespace = "com.matter.virtual.device.app.feature.control"
compileSdk = Versions.compileSdkVersion

defaultConfig {
minSdk = Versions.minSdkVersion
targetSdk = Versions.targetSdkVersion

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = 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
dataBinding = true
}
}

dependencies {

implementation(Deps.AndroidX.core)
implementation(Deps.AndroidX.appcompat)
implementation(Deps.AndroidX.fragment)

implementation(Deps.Navigation.fragment)
implementation(Deps.Navigation.ui)

implementation(Deps.Dagger.hiltAndroid)
kapt(Deps.Dagger.hiltAndroidCompiler)

implementation(Deps.timber)

testImplementation(Deps.Test.junit)
androidTestImplementation(Deps.Test.junitExt)
androidTestImplementation(Deps.Test.espresso)
}
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.matter.virtual.device.app.feature.control

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.matter.virtual.device.app.feature.control.test", appContext.packageName)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.matter.virtual.device.app.feature.control

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import com.matter.virtual.device.app.feature.control.databinding.FragmentOnOffSwitchBinding
import dagger.hilt.android.AndroidEntryPoint
import timber.log.Timber

@AndroidEntryPoint
class OnOffSwitchFragment : Fragment() {

private lateinit var binding: FragmentOnOffSwitchBinding

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
Timber.d("onCreateView()")
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_on_off_switch, container, false)
binding.lifecycleOwner = viewLifecycleOwner

return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Timber.d("onViewCreated()")
super.onViewCreated(view, savedInstanceState)
}

override fun onResume() {
Timber.d("onResume()")
super.onResume()
}

override fun onDestroy() {
Timber.d("onDestroy()")
super.onDestroy()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation 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:id="@+id/control_nav_graph"
app:startDestination="@id/onOffSwitchFragment">

<fragment
android:id="@+id/onOffSwitchFragment"
android:name="com.matter.virtual.device.app.feature.control.OnOffSwitchFragment"
android:label="OnOffSwitchFragment"
tools:layout="@layout/fragment_on_off_switch">
<argument
android:name="setting"
app:argType="string" />
<deepLink app:uri="android-app://com.matter.virtual.device.app.feature.control/onOffSwitchFragment/{setting}" />
</fragment>
</navigation>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.matter.virtual.device.app.feature.control

import org.junit.Assert.*
import org.junit.Test

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ include(":core:data")
include(":core:domain")
include(":core:matter")
include(":core:model")
include(":feature:control")
include(":feature:main")
include(":feature:qrcode")
include(":feature:setup")

0 comments on commit 6d3de99

Please sign in to comment.