-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
virtual-device-app: Add control module for virtual device's detail vi…
…ew (#28486) Signed-off-by: Jaehoon You <jaehoon.you@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com>
- Loading branch information
1 parent
2dbaccd
commit 3983627
Showing
10 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
63 changes: 63 additions & 0 deletions
63
examples/virtual-device-app/android/App/feature/control/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
21 changes: 21 additions & 0 deletions
21
examples/virtual-device-app/android/App/feature/control/proguard-rules.pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
22 changes: 22 additions & 0 deletions
22
...androidTest/java/com/matter/virtual/device/app/feature/control/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
examples/virtual-device-app/android/App/feature/control/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
44 changes: 44 additions & 0 deletions
44
...ontrol/src/main/java/com/matter/virtual/device/app/feature/control/OnOffSwitchFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ual-device-app/android/App/feature/control/src/main/res/layout/fragment_on_off_switch.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
18 changes: 18 additions & 0 deletions
18
...tual-device-app/android/App/feature/control/src/main/res/navigation/control_nav_graph.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
16 changes: 16 additions & 0 deletions
16
...re/control/src/test/java/com/matter/virtual/device/app/feature/control/ExampleUnitTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters