diff --git a/android/app/build.gradle b/android/app/build.gradle index d508896..0eab8f5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 - buildToolsVersion "29.0.3" + buildToolsVersion '29.0.3' dataBinding { enabled = true } @@ -36,7 +36,7 @@ dependencies { implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.material:material:1.1.0' + implementation 'com.google.android.material:material:1.2.0-alpha06' implementation 'androidx.preference:preference:1.1.1' testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' diff --git a/android/app/src/main/java/de/hft/geotracker/MainActivity.kt b/android/app/src/main/java/de/hft/geotracker/MainActivity.kt index aeea9a6..67651f1 100644 --- a/android/app/src/main/java/de/hft/geotracker/MainActivity.kt +++ b/android/app/src/main/java/de/hft/geotracker/MainActivity.kt @@ -1,24 +1,46 @@ package de.hft.geotracker import android.annotation.SuppressLint +import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import android.view.Menu +import android.view.MenuInflater +import android.view.MenuItem +import android.view.Window import android.widget.ArrayAdapter +import android.widget.AutoCompleteTextView import android.widget.Spinner import androidx.navigation.findNavController import androidx.databinding.DataBindingUtil import androidx.navigation.ui.NavigationUI +import com.google.android.material.textfield.TextInputLayout class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + setSupportActionBar(findViewById(R.id.my_toolbar)) setContentView(R.layout.activity_home) + // val binding = DataBindingUtil.setContentView(this, R.layout.activity_main) // val navController = this.findNavController(R.id.HostFragment) // NavigationUI.setupActionBarWithNavController(this, navController) +// val dropdown : TextInputLayout = findViewById(R.id.filled_exposed_dropdown) + /*val editTextFilledExposedDropdown : AutoCompleteTextView = findViewById(R.id.filled_exposed_dropdown) + ArrayAdapter.createFromResource(this, R.array.accounts, R.layout.spinner_layout).also { + arrayAdapter -> arrayAdapter.setDropDownViewResource(R.layout.spinner_layout) + editTextFilledExposedDropdown.setAdapter(arrayAdapter) + }*/ + + /*val array = arrayOf("Test1", "Test2") + val a : ArrayAdapter = ArrayAdapter(this, R.layout.spinner_layout, array) + val editTextFilledExposedDropdown : AutoCompleteTextView = findViewById(R.id.filled_exposed_dropdown) + editTextFilledExposedDropdown.setAdapter(a)*/ + val spinner: Spinner = findViewById(R.id.account_spinner) // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter.createFromResource(this, R.array.accounts, android.R.layout.simple_spinner_item).also { adapter -> @@ -26,15 +48,32 @@ class MainActivity : AppCompatActivity() { adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) // Apply the adapter to the spinner spinner.adapter = adapter + } + } + override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { + R.id.settings -> { + // User chose the "Settings" item, show the app settings UI... + var intent = Intent(this, Settings::class.java) + startActivity(intent) + println("test") + true + } + R.id.logout -> { + // User chose the "Settings" item, show the app settings UI... + var intent = Intent(this, Login::class.java) + startActivity(intent) + true + } + else -> { + // If we got here, the user's action was not recognized. + // Invoke the superclass to handle it. + println("test") + super.onOptionsItemSelected(item) } } override fun onBackPressed() { + } - } - override fun onSupportNavigateUp(): Boolean { - val navController = this.findNavController(R.id.HostFragment) - return navController.navigateUp() - } } diff --git a/android/app/src/main/res/drawable-v24/outlined_button_filled.xml b/android/app/src/main/res/drawable-v24/outlined_button_filled.xml new file mode 100644 index 0000000..b4d018c --- /dev/null +++ b/android/app/src/main/res/drawable-v24/outlined_button_filled.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/drawable/ic_search_black_24dp.xml b/android/app/src/main/res/drawable/ic_search_black_24dp.xml new file mode 100644 index 0000000..e69de29 diff --git a/android/app/src/main/res/drawable/outlined_button.xml b/android/app/src/main/res/drawable/outlined_button.xml index 88ffb77..7b98209 100644 --- a/android/app/src/main/res/drawable/outlined_button.xml +++ b/android/app/src/main/res/drawable/outlined_button.xml @@ -3,7 +3,7 @@ android:shape="rectangle" > - + diff --git a/android/app/src/main/res/layout/activity_home.xml b/android/app/src/main/res/layout/activity_home.xml index bf47fdc..f74b28f 100644 --- a/android/app/src/main/res/layout/activity_home.xml +++ b/android/app/src/main/res/layout/activity_home.xml @@ -1,5 +1,6 @@ - + + + -