Compare commits
2 Commits
47e716672d
...
035393578f
| Author | SHA1 | Date | |
|---|---|---|---|
| 035393578f | |||
| c712cf800d |
6
.idea/AndroidProjectSystem.xml
generated
Normal file
6
.idea/AndroidProjectSystem.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AndroidProjectSystem">
|
||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/deploymentTargetSelector.xml
generated
8
.idea/deploymentTargetSelector.xml
generated
@ -4,6 +4,14 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-03-18T16:06:30.698647383Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=d3e11beb" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
|
||||
3
.idea/inspectionProfiles/Project_Default.xml
generated
3
.idea/inspectionProfiles/Project_Default.xml
generated
@ -49,6 +49,9 @@
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewParameterProviderOnFirstParameter" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?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.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
|
||||
@ -17,7 +18,6 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.TVController">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.example.tvcontroller
|
||||
|
||||
import android.util.Log
|
||||
|
||||
object DeviceService {
|
||||
fun createIntegration(name: String, code: String) {
|
||||
Log.i("DeviceService", "Creating integration for $name with code $code")
|
||||
}
|
||||
}
|
||||
@ -14,12 +14,13 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
@ -30,6 +31,7 @@ import com.example.tvcontroller.ui.theme.TVControllerTheme
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.example.tvcontroller.ui.AppViewModel
|
||||
|
||||
@ -50,11 +52,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
bluetoothService.cleanUp()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ -151,19 +148,3 @@ fun RemoteScreen(modifier: Modifier = Modifier) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsScreen(modifier: Modifier = Modifier, appViewModel: AppViewModel = viewModel()) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
if (appViewModel.isBluetoothEnabled()) {
|
||||
Text(text = "Settings Screen", modifier = modifier)
|
||||
}else{
|
||||
Text(text = "Bluetooth is disabled. Please enable it in settings.", modifier = modifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
89
app/src/main/java/com/example/tvcontroller/SettingsScreen.kt
Normal file
89
app/src/main/java/com/example/tvcontroller/SettingsScreen.kt
Normal file
@ -0,0 +1,89 @@
|
||||
package com.example.tvcontroller
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.example.tvcontroller.ui.AppViewModel
|
||||
|
||||
@Composable
|
||||
fun SettingsScreen(appViewModel: AppViewModel = viewModel()) {
|
||||
var serverUrl by remember { mutableStateOf("") }
|
||||
var deviceName by remember { mutableStateOf(android.os.Build.MANUFACTURER + " " + android.os.Build.MODEL) }
|
||||
var registrationCode by remember { mutableStateOf("") }
|
||||
|
||||
fun connect() {
|
||||
Log.i("SettingsScreen", "Save settings: $serverUrl, $deviceName, $registrationCode")
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(16.dp, 16.dp)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.settings_title),
|
||||
style = MaterialTheme.typography.displaySmall
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(8.dp))
|
||||
Text(
|
||||
text = stringResource(id = R.string.server_settings_heading),
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.server_connection_label) + ": " + stringResource(id = R.string.connection_state_disconnected),
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
OutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = serverUrl,
|
||||
onValueChange = { serverUrl = it },
|
||||
label = { Text(stringResource(id = R.string.server_url_label)) }
|
||||
)
|
||||
OutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = deviceName,
|
||||
onValueChange = { deviceName = it },
|
||||
label = { Text(stringResource(id = R.string.device_name_label)) }
|
||||
)
|
||||
OutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = registrationCode,
|
||||
onValueChange = { registrationCode = it },
|
||||
label = { Text(stringResource(id = R.string.registration_code_label)) }
|
||||
)
|
||||
OutlinedButton(onClick = { connect() }, modifier = Modifier.fillMaxWidth()) {
|
||||
Text(
|
||||
stringResource(id = R.string.connect_button_label)
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.padding(8.dp))
|
||||
Text(
|
||||
text = stringResource(id = R.string.controller_settings_heading),
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
if (appViewModel.isBluetoothEnabled()) {
|
||||
Text(text = "Controller settings: Bluetooth is enabled.", style = MaterialTheme.typography.bodyMedium)
|
||||
} else {
|
||||
Text(text = "Bluetooth is disabled. Please enable it in settings.", style = MaterialTheme.typography.bodyMedium)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,13 @@
|
||||
<resources>
|
||||
<string name="app_name">TV Controller</string>
|
||||
<string name="settings_title">Settings</string>
|
||||
<string name="server_url_label">Server URL</string>
|
||||
<string name="device_name_label">Device name</string>
|
||||
<string name="registration_code_label">Registration code</string>
|
||||
<string name="server_settings_heading">Server settings</string>
|
||||
<string name="controller_settings_heading">Controller settings</string>
|
||||
<string name="server_connection_label">Connection state</string>
|
||||
<string name="connection_state_disconnected">disconnected</string>
|
||||
<string name="save_button_label">Save</string>
|
||||
<string name="connect_button_label">Connect</string>
|
||||
</resources>
|
||||
@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.7.2"
|
||||
agp = "8.9.0"
|
||||
kotlin = "2.0.0"
|
||||
coreKtx = "1.10.1"
|
||||
junit = "4.13.2"
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Fri Nov 29 18:05:14 CET 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Loading…
Reference in New Issue
Block a user