Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

open nav.tum.sexy to show location #1443

Merged
merged 9 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@
android:value=".component.ui.overview.MainActivity" />
</activity>

<activity
android:name=".component.tumui.calendar.NavigatumActivity"
android:label="Navigatum"
kmodexc marked this conversation as resolved.
Show resolved Hide resolved
android:exported="false">
</activity>

<activity
android:name=".component.tumui.calendar.CreateEventActivity"
android:label="@string/activity_create_event_title"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.tum.`in`.tumcampusapp.component.tumui.calendar

import android.app.SearchManager
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -18,7 +18,6 @@ import de.tum.`in`.tumcampusapp.component.other.navigation.NavDestination
import de.tum.`in`.tumcampusapp.component.other.navigation.NavigationManager
import de.tum.`in`.tumcampusapp.component.tumui.calendar.model.CalendarItem
import de.tum.`in`.tumcampusapp.component.tumui.calendar.model.DeleteEventResponse
import de.tum.`in`.tumcampusapp.component.tumui.roomfinder.RoomFinderActivity
import de.tum.`in`.tumcampusapp.database.TcaDb
import de.tum.`in`.tumcampusapp.databinding.FragmentCalendarDetailsBinding
import de.tum.`in`.tumcampusapp.utils.Const
Expand Down Expand Up @@ -188,10 +187,10 @@ class CalendarDetailsFragment : RoundedBottomSheetDialogFragment() {
}

private fun onLocationClicked(location: String) {
val findStudyRoomIntent = Intent()
findStudyRoomIntent.putExtra(SearchManager.QUERY, Utils.extractRoomNumberFromLocation(location))
findStudyRoomIntent.setClass(requireContext(), RoomFinderActivity::class.java)
startActivity(findStudyRoomIntent)
val sendIntent: Intent = Intent(getContext(),NavigatumActivity::class.java).apply {
kmodexc marked this conversation as resolved.
Show resolved Hide resolved
putExtra("location",location)
}
startActivity(sendIntent)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.tum.`in`.tumcampusapp.component.tumui.calendar

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView

class NavigatumActivity : AppCompatActivity() {
kmodexc marked this conversation as resolved.
Show resolved Hide resolved
@SuppressLint("SetJavaScriptEnabled")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = getIntent()
val location = intent.getStringExtra("location")
val encoded_location = java.net.URLEncoder.encode(location, "utf-8")
val url = "https://nav.tum.sexy/search?q=${encoded_location}"
val webview = WebView(this)
setContentView(webview)
webview.settings.javaScriptEnabled = true
webview.loadUrl(url)
}
}