Archived
Implemented canteen scraper/parser functionality
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package com.denizk0461.studip.fragment
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@@ -10,6 +10,7 @@ import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.denizk0461.studip.BuildConfig
|
||||
import com.denizk0461.studip.activity.FetcherActivity
|
||||
import com.denizk0461.studip.data.Misc
|
||||
import com.denizk0461.studip.databinding.FragmentSettingsBinding
|
||||
|
||||
@@ -31,15 +32,15 @@ class SettingsFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
var toast2 = makeToast("2")
|
||||
var toast22 = makeToast("22")
|
||||
var toast222 = makeToast("222")
|
||||
|
||||
// binding.layoutQuarter.setOnClickListener {
|
||||
// isQuarterChecked = !isQuarterChecked
|
||||
// binding.switchQuarter.isChecked = isQuarterChecked
|
||||
// }
|
||||
|
||||
binding.buttonRefreshSchedule.setOnClickListener {
|
||||
launchWebView()
|
||||
}
|
||||
|
||||
binding.switchQuarter.setOnClickListener {
|
||||
isQuarterChecked = !isQuarterChecked
|
||||
}
|
||||
@@ -47,24 +48,15 @@ class SettingsFragment : Fragment() {
|
||||
binding.buttonAppVersion.setOnClickListener {
|
||||
when (appVersionClick) {
|
||||
19 -> {
|
||||
toast2.show()
|
||||
appVersionClick += 1
|
||||
}
|
||||
20 -> {
|
||||
toast2.cancel()
|
||||
toast22.show()
|
||||
appVersionClick += 1
|
||||
}
|
||||
21 -> {
|
||||
toast22.cancel()
|
||||
toast222.show()
|
||||
appVersionClick += 1
|
||||
}
|
||||
22 -> {
|
||||
toast222.cancel()
|
||||
toast2 = makeToast("2")
|
||||
toast22 = makeToast("22")
|
||||
toast222 = makeToast("222")
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(Misc.mysteryLink)))
|
||||
appVersionClick = 0
|
||||
}
|
||||
@@ -72,13 +64,16 @@ class SettingsFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
binding.appVersionText.text = BuildConfig.VERSION_NAME
|
||||
@SuppressLint("SetTextI18n")
|
||||
binding.appVersionText.text = "${BuildConfig.VERSION_NAME}-${if (BuildConfig.DEBUG) "debug" else "release"}"
|
||||
}
|
||||
|
||||
private fun makeToast(text: String): Toast = Toast.makeText(context, text, Toast.LENGTH_SHORT)
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
private fun launchWebView() {
|
||||
startActivity(Intent(context, FetcherActivity::class.java))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user