added moodle webview
This commit is contained in:
		@ -126,11 +126,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            R.id.nav_moodle -> {
 | 
			
		||||
//                val moodleFragment = MoodleFragment()
 | 
			
		||||
//
 | 
			
		||||
//                val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
 | 
			
		||||
//                fragmentTransaction.replace(R.id.fragment_container, moodleFragment)
 | 
			
		||||
//                fragmentTransaction.commit()
 | 
			
		||||
                val moodleFragment = MoodleFragment()
 | 
			
		||||
 | 
			
		||||
                val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
 | 
			
		||||
                fragmentTransaction.replace(R.id.fragment_container, moodleFragment)
 | 
			
		||||
                fragmentTransaction.commit()
 | 
			
		||||
            }
 | 
			
		||||
            R.id.nav_settings -> {
 | 
			
		||||
                val settingsFragment = SettingsFragment()
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,25 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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.fragments
 | 
			
		||||
 | 
			
		||||
import android.os.Bundle
 | 
			
		||||
@ -5,8 +27,10 @@ import androidx.fragment.app.Fragment
 | 
			
		||||
import android.view.LayoutInflater
 | 
			
		||||
import android.view.View
 | 
			
		||||
import android.view.ViewGroup
 | 
			
		||||
import kotlinx.android.synthetic.main.fragment_moodle.*
 | 
			
		||||
import android.webkit.WebSettings
 | 
			
		||||
import android.webkit.WebView
 | 
			
		||||
import org.mosad.seil0.projectlaogai.R
 | 
			
		||||
import android.webkit.WebViewClient
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The moodle screen controller class
 | 
			
		||||
@ -14,18 +38,21 @@ import org.mosad.seil0.projectlaogai.R
 | 
			
		||||
 */
 | 
			
		||||
class MoodleFragment : Fragment() {
 | 
			
		||||
 | 
			
		||||
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
 | 
			
		||||
        val view: View = inflater.inflate(R.layout.fragment_settings, container, false)
 | 
			
		||||
    private lateinit var webView: WebView
 | 
			
		||||
    private lateinit var webSettings: WebSettings
 | 
			
		||||
 | 
			
		||||
        //webView.loadUrl("www.google.de")
 | 
			
		||||
    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.getSettings()
 | 
			
		||||
        //webSettings.setJavaScriptEnabled(true) // Enable Javascript
 | 
			
		||||
 | 
			
		||||
        webView.setWebViewClient(WebViewClient()) // Force links and redirects to open in the WebView instead of in a browser
 | 
			
		||||
 | 
			
		||||
        return view
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
 | 
			
		||||
        super.onViewCreated(view, savedInstanceState)
 | 
			
		||||
 | 
			
		||||
        //webView.loadUrl("www.google.de")
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user