Converted Fragments in Activities
This commit is contained in:
parent
3abd63cda2
commit
e78258597f
@ -9,6 +9,12 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".login">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -11,7 +11,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_home)
|
||||||
// val binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
// val binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
||||||
// val navController = this.findNavController(R.id.HostFragment)
|
// val navController = this.findNavController(R.id.HostFragment)
|
||||||
// NavigationUI.setupActionBarWithNavController(this, navController)
|
// NavigationUI.setupActionBarWithNavController(this, navController)
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +1,30 @@
|
|||||||
package de.hft.geotracker
|
package de.hft.geotracker
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.databinding.DataBindingUtil
|
import android.widget.TextView
|
||||||
import kotlinx.android.synthetic.main.fragment_login.view.*
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple [Fragment] subclass.
|
* A simple [Fragment] subclass.
|
||||||
*/
|
*/
|
||||||
class login : Fragment() {
|
class login : AppCompatActivity() {
|
||||||
|
lateinit var login : TextView
|
||||||
override fun onCreateView(
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
super.onCreate(savedInstanceState)
|
||||||
savedInstanceState: Bundle?): View? {
|
setContentView(R.layout.activity_login)
|
||||||
// Inflate the layout for this fragment
|
login = findViewById(R.id.button_login)
|
||||||
// val binding = DataBindingUtil.inflate(inflater, R.layout.fragment_login, container, false)
|
login.setOnClickListener {
|
||||||
// val binding = DataBindingUtil.inflate<FragmentTitleBinding>(inflater, R.layout.fragment_title, container, false)
|
login()
|
||||||
return inflater.inflate(R.layout.fragment_login, container, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private fun login() {
|
||||||
|
val intent = Intent(this, MainActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
android:id="@+id/frameLayout"
|
android:id="@+id/frameLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".home">
|
android:background="@color/background_grey"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<!-- TODO: Update blank fragment layout -->
|
||||||
<TextView
|
<TextView
|
@ -4,6 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/background_grey"
|
||||||
tools:context=".login">
|
tools:context=".login">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
@ -9,14 +9,10 @@
|
|||||||
android:id="@+id/login"
|
android:id="@+id/login"
|
||||||
android:name="de.hft.geotracker.login"
|
android:name="de.hft.geotracker.login"
|
||||||
android:label="fragment_login"
|
android:label="fragment_login"
|
||||||
tools:layout="@layout/fragment_login" >
|
tools:layout="@layout/activity_login" />
|
||||||
<action
|
<activity
|
||||||
android:id="@+id/action_login_to_home"
|
android:id="@+id/mainActivity"
|
||||||
app:destination="@id/home" />
|
android:name="de.hft.geotracker.MainActivity"
|
||||||
</fragment>
|
android:label="activity_home"
|
||||||
<fragment
|
tools:layout="@layout/activity_home" />
|
||||||
android:id="@+id/home"
|
|
||||||
android:name="de.hft.geotracker.home"
|
|
||||||
android:label="fragment_home"
|
|
||||||
tools:layout="@layout/fragment_home" />
|
|
||||||
</navigation>
|
</navigation>
|
Loading…
Reference in New Issue
Block a user