Added Fragments and Styles
This commit is contained in:
parent
f3237419dd
commit
8de7890c37
@ -1,15 +1,19 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.3"
|
||||
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
defaultConfig {
|
||||
applicationId "de.hft.geotracker"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@ -31,7 +35,13 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
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'
|
||||
testImplementation 'junit:junit:4.13'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
|
||||
implementation"android.arch.navigation:navigation-fragment-ktx:2.2.2"
|
||||
implementation "android.arch.navigation:navigation-ui-ktx:2.2.2"
|
||||
}
|
||||
|
@ -2,11 +2,23 @@ package de.hft.geotracker
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.navigation.ui.NavigationUI
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
// val binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
||||
// val navController = this.findNavController(R.id.HostFragment)
|
||||
// NavigationUI.setupActionBarWithNavController(this, navController)
|
||||
}
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
val navController = this.findNavController(R.id.HostFragment)
|
||||
return navController.navigateUp()
|
||||
}
|
||||
}
|
||||
|
22
android/app/src/main/java/de/hft/geotracker/home.kt
Normal file
22
android/app/src/main/java/de/hft/geotracker/home.kt
Normal file
@ -0,0 +1,22 @@
|
||||
package de.hft.geotracker
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass.
|
||||
*/
|
||||
class home : Fragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_home, container, false)
|
||||
}
|
||||
|
||||
}
|
25
android/app/src/main/java/de/hft/geotracker/login.kt
Normal file
25
android/app/src/main/java/de/hft/geotracker/login.kt
Normal file
@ -0,0 +1,25 @@
|
||||
package de.hft.geotracker
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import kotlinx.android.synthetic.main.fragment_login.view.*
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass.
|
||||
*/
|
||||
class login : Fragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
// Inflate the layout for this fragment
|
||||
// val binding = DataBindingUtil.inflate(inflater, R.layout.fragment_login, container, false)
|
||||
// val binding = DataBindingUtil.inflate<FragmentTitleBinding>(inflater, R.layout.fragment_title, container, false)
|
||||
return inflater.inflate(R.layout.fragment_login, container, false)
|
||||
}
|
||||
|
||||
}
|
11
android/app/src/main/res/drawable/outlined_button.xml
Normal file
11
android/app/src/main/res/drawable/outlined_button.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<solid android:color="@android:color/transparent" />
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/logo_blue" />
|
||||
|
||||
</shape>
|
BIN
android/app/src/main/res/font/montserrat.ttf
Normal file
BIN
android/app/src/main/res/font/montserrat.ttf
Normal file
Binary file not shown.
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
android:orientation="vertical"
|
||||
android:background="@color/background_grey"
|
||||
tools:context=".MainActivity" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<fragment
|
||||
android:id="@+id/HostFragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:navGraph="@navigation/navigation"
|
||||
app:defaultNavHost="true"/>
|
||||
</LinearLayout>
|
88
android/app/src/main/res/layout/fragment_home.xml
Normal file
88
android/app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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/frameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".home">
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
<TextView
|
||||
android:id="@+id/selected_acc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="@dimen/margin16"
|
||||
android:fontFamily="@font/montserrat"
|
||||
android:text="@string/timetrack_account"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textColor="@color/logo_white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/display_acc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin16"
|
||||
android:layout_marginEnd="@dimen/margin16"
|
||||
android:text="@string/no_account"
|
||||
android:textAppearance="@style/text_style"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_start"
|
||||
style="@android:style/Widget.Material.Light.Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin16"
|
||||
android:layout_marginEnd="@dimen/margin16"
|
||||
android:layout_marginBottom="@dimen/margin16"
|
||||
android:background="@drawable/outlined_button"
|
||||
android:text="@string/btn_start_text"
|
||||
android:textAllCaps="false"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textColor="@color/logo_white"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_pause" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_pause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin16"
|
||||
android:layout_marginEnd="@dimen/margin16"
|
||||
android:background="@drawable/outlined_button"
|
||||
android:text="@string/pause"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/button_start"
|
||||
app:layout_constraintEnd_toStartOf="@+id/button_start"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/button_stop" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_stop"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin16"
|
||||
android:layout_marginEnd="@dimen/margin16"
|
||||
android:background="@drawable/outlined_button"
|
||||
android:text="@string/stop"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/button_start"
|
||||
app:layout_constraintEnd_toStartOf="@+id/button_pause"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
78
android/app/src/main/res/layout/fragment_login.xml
Normal file
78
android/app/src/main/res/layout/fragment_login.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".login">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/input_username"
|
||||
style="@style/input_field"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:colorControlNormal="@color/logo_blue"
|
||||
android:ems="10"
|
||||
android:hint="@string/username"
|
||||
android:inputType="textPersonName"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/logo_white"
|
||||
app:layout_constraintBottom_toTopOf="@+id/input_password"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.49"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/input_password"
|
||||
style="@style/input_field"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:ems="10"
|
||||
android:hint="@string/password"
|
||||
android:inputType="textPassword"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_login"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/input_username"
|
||||
app:layout_constraintVertical_bias="0.13" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_login"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@color/logo_blue"
|
||||
android:text="@string/login"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/button_signin"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/input_password" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_signin"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/outlined_button"
|
||||
android:text="@string/sign_in"
|
||||
android:textAppearance="@style/text_style"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button_login"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
22
android/app/src/main/res/navigation/navigation.xml
Normal file
22
android/app/src/main/res/navigation/navigation.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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/navigation"
|
||||
app:startDestination="@id/login">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/login"
|
||||
android:name="de.hft.geotracker.login"
|
||||
android:label="fragment_login"
|
||||
tools:layout="@layout/fragment_login" >
|
||||
<action
|
||||
android:id="@+id/action_login_to_home"
|
||||
app:destination="@id/home" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/home"
|
||||
android:name="de.hft.geotracker.home"
|
||||
android:label="fragment_home"
|
||||
tools:layout="@layout/fragment_home" />
|
||||
</navigation>
|
@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
<color name="colorPrimary">#272727</color>
|
||||
<color name="colorPrimaryDark">#272727</color>
|
||||
<color name="colorAccent">#0096ff</color>
|
||||
<color name="background_grey">#131313</color>
|
||||
<color name="logo_blue">#0096ff</color>
|
||||
<color name="logo_white">#EBE7D9</color>
|
||||
|
||||
</resources>
|
||||
|
6
android/app/src/main/res/values/dimens.xml
Normal file
6
android/app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="margin16">16dp</dimen>
|
||||
<dimen name="size12">12sp</dimen>
|
||||
<dimen name="size16">16sp</dimen>
|
||||
</resources>
|
@ -1,3 +1,15 @@
|
||||
<resources>
|
||||
<string name="app_name">Geotracker</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="timetrack_account">Selected Account:</string>
|
||||
<string name="no_account">No Account Selected</string>
|
||||
<string name="btn_start_text">START</string>
|
||||
<string name="pause">PAUSE</string>
|
||||
<string name="stop">STOP</string>
|
||||
<string name="username">Your Username or E-Mail</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="login">Login</string>
|
||||
<string name="sign_in">Sign In</string>
|
||||
</resources>
|
||||
|
@ -7,5 +7,18 @@
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
<style name="text_style">
|
||||
<item name="android:textColor">@color/logo_white</item>
|
||||
<item name="android:fontFamily">@font/montserrat</item>
|
||||
<item name="android:textSize">@dimen/size16</item>
|
||||
</style>
|
||||
<style name="input_field">
|
||||
<item name="android:textColorHint">@color/logo_blue</item>
|
||||
<item name="android:textCursorDrawable">@color/colorAccent</item>
|
||||
|
||||
<item name="android:textColor">@color/logo_white</item>
|
||||
<item name="android:fontFamily">@font/montserrat</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user