added settings and minor clean ups
* added a settings fragment * added jsoupe for mensa/timetable parser
This commit is contained in:
@ -23,13 +23,8 @@
|
||||
package org.mosad.seil0.projectlaogai
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.Color.*
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.support.annotation.RequiresApi
|
||||
import android.support.v4.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -75,8 +70,6 @@ class HomeFragment : Fragment() {
|
||||
txtViewMenu2.text = "Riesen Currywurst\nCurryketchup\nGitterkartoffeln\nBlattsalat"
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun addLessons() {
|
||||
|
||||
|
@ -90,13 +90,16 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||
// Handle navigation view item clicks here.
|
||||
when (item.itemId) {
|
||||
R.id.nav_home -> {
|
||||
// Handle the home action
|
||||
val homeFragment = HomeFragment()
|
||||
val fragmentTransaction: android.support.v4.app.FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, homeFragment)
|
||||
fragmentTransaction.commit()
|
||||
}
|
||||
R.id.nav_mensa -> {
|
||||
//val mensaFragment: MensaFragment = MensaFragment()
|
||||
//val fragmentTransaction: android.support.v4.app.FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
//fragmentTransaction.replace(R.id.fragment_container, mensaFragment)
|
||||
//fragmentTransaction.commit()
|
||||
val mensaFragment: MensaFragment = MensaFragment()
|
||||
val fragmentTransaction: android.support.v4.app.FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, mensaFragment)
|
||||
fragmentTransaction.commit()
|
||||
}
|
||||
R.id.nav_timetable -> {
|
||||
|
||||
@ -108,7 +111,10 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
|
||||
|
||||
}
|
||||
R.id.nav_settings -> {
|
||||
|
||||
val settingsFragment = SettingsFragment()
|
||||
val fragmentTransaction: android.support.v4.app.FragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
fragmentTransaction.replace(R.id.fragment_container, settingsFragment)
|
||||
fragmentTransaction.commit()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private const val ARG_PARAM1 = "param1"
|
||||
private const val ARG_PARAM2 = "param2"
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass.
|
||||
*
|
||||
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* ProjectLaogai
|
||||
*
|
||||
* Copyright 2018 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.mosad.seil0.projectlaogai
|
||||
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
/**
|
||||
* The settings controller class
|
||||
* contains all needed parts to display and the settings screen
|
||||
*/
|
||||
class SettingsFragment : Fragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
|
||||
val view: View = inflater.inflate(R.layout.fragment_settings, container, false)
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
return view
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user