ProjectLaogai/app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt

59 lines
1.9 KiB
Kotlin

/**
* ProjectLaogai
*
* Copyright 2019 <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.fragments
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebSettings
import android.webkit.WebView
import org.mosad.seil0.projectlaogai.R
import android.webkit.WebViewClient
/**
* The moodle screen controller class
* contains all needed parts to display and the moodle screen
*/
class MoodleFragment : Fragment() {
private lateinit var webView: WebView
private lateinit var webSettings: WebSettings
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view: View = inflater.inflate(R.layout.fragment_moodle, container, false)
webView = view.findViewById(R.id.webView)
webView.loadUrl("https://elearning.hs-offenburg.de/moodle/")
webSettings = webView.settings
//webSettings.setJavaScriptEnabled(true) // Enable Javascript
webView.webViewClient = WebViewClient() // Force links and redirects to open in the WebView instead of in a browser
return view
}
}