Browse Source

added moodle webview

pull/20/head
Jannik 4 years ago
parent
commit
70059b4b0c
  1. 10
      app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt
  2. 45
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MoodleFragment.kt

10
app/src/main/java/org/mosad/seil0/projectlaogai/MainActivity.kt

@ -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()

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

@ -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() {
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_settings, container, false)
//webView.loadUrl("www.google.de")
val view: View = inflater.inflate(R.layout.fragment_moodle, container, false)
return view
}
webView = view.findViewById(R.id.webView)
webView.loadUrl("https://elearning.hs-offenburg.de/moodle/")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
webSettings = webView.getSettings()
//webSettings.setJavaScriptEnabled(true) // Enable Javascript
//webView.loadUrl("www.google.de")
}
webView.setWebViewClient(WebViewClient()) // Force links and redirects to open in the WebView instead of in a browser
return view
}
}

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close