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

Commit

Permalink
open nav.tum.sexy to show location (#1443)
Browse files Browse the repository at this point in the history
* open nav.tum.sexy to show location

* calender detail call navigatumactivity

* add NavigatumActivity to manifest

* create NavigatumActivity

* remove unused import

* change namestyle

Co-authored-by: Frank Elsinga <[email protected]>

* change namestyle

Co-authored-by: Frank Elsinga <[email protected]>

* change namestyle

Co-authored-by: Frank Elsinga <[email protected]>

Co-authored-by: Frank Elsinga <[email protected]>
  • Loading branch information
2 people authored and tobiasjungmann committed Jan 13, 2023
1 parent ed5ac75 commit 082b4c5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
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"
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,6 +1,5 @@
package de.tum.`in`.tumcampusapp.component.tumui.calendar

import android.app.SearchManager
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
Expand All @@ -18,7 +17,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 +186,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 {
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() {
@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)
}
}

0 comments on commit 082b4c5

Please sign in to comment.