Add basic search field
This commit is contained in:
		
							
								
								
									
										3
									
								
								.idea/deploymentTargetDropDown.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								.idea/deploymentTargetDropDown.xml
									
									
									
										generated
									
									
									
								
							@@ -2,6 +2,9 @@
 | 
				
			|||||||
<project version="4">
 | 
					<project version="4">
 | 
				
			||||||
  <component name="deploymentTargetDropDown">
 | 
					  <component name="deploymentTargetDropDown">
 | 
				
			||||||
    <value>
 | 
					    <value>
 | 
				
			||||||
 | 
					      <entry key="MainActivity">
 | 
				
			||||||
 | 
					        <State />
 | 
				
			||||||
 | 
					      </entry>
 | 
				
			||||||
      <entry key="app">
 | 
					      <entry key="app">
 | 
				
			||||||
        <State />
 | 
					        <State />
 | 
				
			||||||
      </entry>
 | 
					      </entry>
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								.idea/gradle.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/gradle.xml
									
									
									
										generated
									
									
									
								
							@@ -1,5 +1,6 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<project version="4">
 | 
					<project version="4">
 | 
				
			||||||
 | 
					  <component name="GradleMigrationSettings" migrationVersion="1" />
 | 
				
			||||||
  <component name="GradleSettings">
 | 
					  <component name="GradleSettings">
 | 
				
			||||||
    <option name="linkedExternalProjectsSettings">
 | 
					    <option name="linkedExternalProjectsSettings">
 | 
				
			||||||
      <GradleProjectSettings>
 | 
					      <GradleProjectSettings>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,15 +3,23 @@ package com.ti.mobpo
 | 
				
			|||||||
import android.os.Bundle
 | 
					import android.os.Bundle
 | 
				
			||||||
import androidx.activity.ComponentActivity
 | 
					import androidx.activity.ComponentActivity
 | 
				
			||||||
import androidx.activity.compose.setContent
 | 
					import androidx.activity.compose.setContent
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.Arrangement
 | 
				
			||||||
import androidx.compose.foundation.layout.Box
 | 
					import androidx.compose.foundation.layout.Box
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.Column
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.Row
 | 
				
			||||||
import androidx.compose.foundation.layout.fillMaxSize
 | 
					import androidx.compose.foundation.layout.fillMaxSize
 | 
				
			||||||
import androidx.compose.foundation.layout.padding
 | 
					import androidx.compose.foundation.layout.padding
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.wrapContentSize
 | 
				
			||||||
 | 
					import androidx.compose.material3.Button
 | 
				
			||||||
import androidx.compose.material3.MaterialTheme
 | 
					import androidx.compose.material3.MaterialTheme
 | 
				
			||||||
 | 
					import androidx.compose.material3.OutlinedTextField
 | 
				
			||||||
import androidx.compose.material3.Surface
 | 
					import androidx.compose.material3.Surface
 | 
				
			||||||
import androidx.compose.material3.Text
 | 
					import androidx.compose.material3.Text
 | 
				
			||||||
import androidx.compose.runtime.Composable
 | 
					import androidx.compose.runtime.Composable
 | 
				
			||||||
 | 
					import androidx.compose.ui.Alignment
 | 
				
			||||||
import androidx.compose.ui.Modifier
 | 
					import androidx.compose.ui.Modifier
 | 
				
			||||||
import androidx.compose.ui.graphics.Color
 | 
					import androidx.compose.ui.graphics.Color
 | 
				
			||||||
 | 
					import androidx.compose.ui.res.stringResource
 | 
				
			||||||
import androidx.compose.ui.tooling.preview.Preview
 | 
					import androidx.compose.ui.tooling.preview.Preview
 | 
				
			||||||
import androidx.compose.ui.unit.dp
 | 
					import androidx.compose.ui.unit.dp
 | 
				
			||||||
import com.ti.mobpo.ui.theme.MobileSecurityTheme
 | 
					import com.ti.mobpo.ui.theme.MobileSecurityTheme
 | 
				
			||||||
@@ -23,27 +31,9 @@ class MainActivity : ComponentActivity() {
 | 
				
			|||||||
            MobileSecurityTheme {
 | 
					            MobileSecurityTheme {
 | 
				
			||||||
                // A surface container using the 'background' color from the theme
 | 
					                // A surface container using the 'background' color from the theme
 | 
				
			||||||
                Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
 | 
					                Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
 | 
				
			||||||
                    Greeting("Android")
 | 
					                    PokeSearchApp()
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
@Composable
 | 
					 | 
				
			||||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
 | 
					 | 
				
			||||||
    Surface(color = Color.Cyan) {
 | 
					 | 
				
			||||||
        Text(
 | 
					 | 
				
			||||||
            text = "Hello $name!",
 | 
					 | 
				
			||||||
            modifier = modifier.padding(24.dp)
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Preview(showBackground = true)
 | 
					 | 
				
			||||||
@Composable
 | 
					 | 
				
			||||||
fun GreetingPreview() {
 | 
					 | 
				
			||||||
    MobileSecurityTheme {
 | 
					 | 
				
			||||||
        Greeting("Android")
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										54
									
								
								app/src/main/java/com/ti/mobpo/PokeSearch.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								app/src/main/java/com/ti/mobpo/PokeSearch.kt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					package com.ti.mobpo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.Arrangement
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.Row
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.fillMaxSize
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.padding
 | 
				
			||||||
 | 
					import androidx.compose.foundation.layout.wrapContentSize
 | 
				
			||||||
 | 
					import androidx.compose.material3.Button
 | 
				
			||||||
 | 
					import androidx.compose.material3.OutlinedTextField
 | 
				
			||||||
 | 
					import androidx.compose.material3.Text
 | 
				
			||||||
 | 
					import androidx.compose.material3.TextField
 | 
				
			||||||
 | 
					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.Alignment
 | 
				
			||||||
 | 
					import androidx.compose.ui.Modifier
 | 
				
			||||||
 | 
					import androidx.compose.ui.graphics.Color
 | 
				
			||||||
 | 
					import androidx.compose.ui.res.stringResource
 | 
				
			||||||
 | 
					import androidx.compose.ui.text.TextStyle
 | 
				
			||||||
 | 
					import androidx.compose.ui.text.font.FontWeight
 | 
				
			||||||
 | 
					import androidx.compose.ui.tooling.preview.Preview
 | 
				
			||||||
 | 
					import androidx.compose.ui.unit.dp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Composable
 | 
				
			||||||
 | 
					fun PokeSearch(modifier: Modifier = Modifier.fillMaxSize().wrapContentSize(Alignment.TopCenter)) {
 | 
				
			||||||
 | 
					    var value by remember { mutableStateOf("") }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Row(
 | 
				
			||||||
 | 
					        modifier = modifier,
 | 
				
			||||||
 | 
					        verticalAlignment = Alignment.CenterVertically,
 | 
				
			||||||
 | 
					        horizontalArrangement = Arrangement.Center
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
 | 
					        OutlinedTextField(
 | 
				
			||||||
 | 
					            value = value,
 | 
				
			||||||
 | 
					            onValueChange = { value = it },
 | 
				
			||||||
 | 
					            label = { Text(stringResource(R.string.input_field_label)) },
 | 
				
			||||||
 | 
					            modifier = Modifier.weight(1f).padding(horizontal = 16.dp, vertical = 8.dp)
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					        Button(
 | 
				
			||||||
 | 
					            onClick = { /*TODO*/ },
 | 
				
			||||||
 | 
					            modifier = Modifier.padding(start = 8.dp)
 | 
				
			||||||
 | 
					        ) {
 | 
				
			||||||
 | 
					            Text(stringResource(R.string.input_search_button))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@Preview(showBackground = true)
 | 
				
			||||||
 | 
					@Composable
 | 
				
			||||||
 | 
					fun PokeSearchApp(){
 | 
				
			||||||
 | 
					    PokeSearch()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,3 +1,5 @@
 | 
				
			|||||||
<resources>
 | 
					<resources>
 | 
				
			||||||
    <string name="app_name">MobileSecurity</string>
 | 
					    <string name="app_name">MobileSecurity</string>
 | 
				
			||||||
 | 
					    <string name="input_search_button">Search</string>
 | 
				
			||||||
 | 
					    <string name="input_field_label">Enter Pokémon Name</string>
 | 
				
			||||||
</resources>
 | 
					</resources>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user