Commit 26ac65a4 authored by Lukas Bersinger's avatar Lukas Bersinger
Browse files

bugfix language change

parent 4773d3d5
......@@ -12,9 +12,6 @@ import ch.ost.rj.mge.miniproject.tasktracker.repositories.TaskRepository
import com.google.android.material.floatingactionbutton.FloatingActionButton
class MainActivity : AppCompatActivity(), TaskListFragment.OnItemClickListener {
private lateinit var listFragment: TaskListFragment
private lateinit var listEmptyFragment: TaskListEmptyFragment
private lateinit var taskListContainer: FrameLayout
private lateinit var btnAddTask: FloatingActionButton
......@@ -45,16 +42,25 @@ class MainActivity : AppCompatActivity(), TaskListFragment.OnItemClickListener {
val tasks: List<Task> = TaskRepository.getOpenTasks()
if (tasks.isNotEmpty()) {
listFragment = TaskListFragment.newInstance(tasks)
val listFragment = TaskListFragment.newInstance(tasks)
supportFragmentManager.beginTransaction()
.replace(R.id.fltTaskListContainer, listFragment)
.commit()
} else {
listEmptyFragment = TaskListEmptyFragment.newInstance()
val listEmptyFragment = TaskListEmptyFragment.newInstance()
supportFragmentManager.beginTransaction()
.replace(R.id.fltTaskListContainer, listEmptyFragment)
.commit()
}
}
override fun onPause() {
super.onPause()
val transaction = supportFragmentManager.beginTransaction()
for (fragment in supportFragmentManager.fragments) {
transaction.remove(fragment)
}
transaction.commit()
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment