Skip to content

Commit

Permalink
WIP: Get rid of the tower map app bar menu and make the map full screen
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrowlands committed Oct 30, 2024
1 parent 4dc9275 commit 5a7c582
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
import android.view.View
import android.view.ViewGroup
import androidx.core.app.ActivityCompat
Expand All @@ -30,7 +29,6 @@ import timber.log.Timber
*/
class MainGnssFragment : Fragment() {

private var menu: Menu? = null
private var selectedTab: Int = 0
private val _tabChangeLiveData = MutableLiveData<Int>()
val tabChangeLiveData: LiveData<Int> get() = _tabChangeLiveData
Expand Down Expand Up @@ -59,8 +57,6 @@ class MainGnssFragment : Fragment() {
viewPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
// Update menu based on the selected tab
menu?.setGroupVisible(R.id.gnss_status_group, position == 0)
selectedTab = position
_tabChangeLiveData.value = position
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ import android.location.LocationListener
import android.location.LocationManager
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.core.view.MenuProvider
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.navigation.fragment.findNavController
import com.craxiom.networksurvey.R
import com.craxiom.networksurvey.SimChangeReceiver
import com.craxiom.networksurvey.listeners.ICellularSurveyRecordListener
import com.craxiom.networksurvey.model.CellularProtocol
Expand All @@ -39,7 +34,7 @@ import java.util.Collections
/**
* A map view of all the towers in the area as pulled from the NS Tower Service.
*/
class TowerMapFragment : AServiceDataFragment(), MenuProvider, ICellularSurveyRecordListener {
class TowerMapFragment : AServiceDataFragment(), ICellularSurveyRecordListener {
private var viewModel: TowerMapViewModel? = null
private lateinit var composeView: ComposeView
private var servingCell: ServingCellInfo? = null
Expand Down Expand Up @@ -72,8 +67,6 @@ class TowerMapFragment : AServiceDataFragment(), MenuProvider, ICellularSurveyRe
val viewModel = ViewModelProvider(requireActivity())[SharedViewModel::class.java]
servingCell = viewModel.latestServingCellInfo

activity?.addMenuProvider(this, getViewLifecycleOwner())

composeView = ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
}
Expand Down Expand Up @@ -113,18 +106,6 @@ class TowerMapFragment : AServiceDataFragment(), MenuProvider, ICellularSurveyRe
super.onDestroy()
}

override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.cellular_map_menu, menu)
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
if (menuItem.itemId == R.id.action_open_tower_map_info) {
showTowerMapInfoDialog()
return true
}
return false
}

override fun onSurveyServiceConnected(service: NetworkSurveyService?) {
if (service == null) return
service.registerCellularSurveyRecordListener(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fun QrCodeShareInCompose(paddingValues: PaddingValues) {
fun TowerMapInCompose(paddingValues: PaddingValues) {
AndroidViewBinding(
ContainerTowerMapFragmentBinding::inflate,
modifier = Modifier.padding(paddingValues = paddingValues)
//modifier = Modifier.padding(paddingValues = paddingValues)
) {
}
}
Expand Down
9 changes: 0 additions & 9 deletions networksurvey/src/main/res/menu/cellular_details_menu.xml

This file was deleted.

22 changes: 0 additions & 22 deletions networksurvey/src/main/res/menu/gnss_main_menu.xml

This file was deleted.

9 changes: 0 additions & 9 deletions networksurvey/src/main/res/menu/wifi_networks_menu.xml

This file was deleted.

0 comments on commit 5a7c582

Please sign in to comment.