Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<activity
android:name=".ui.section.VisitedPollingStationsActivity"
android:parentActivityName=".ui.main.MainActivity"
android:label="@string/title_visited_stations"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import ro.code4.monitorizarevot.helper.LocaleManager
import ro.code4.monitorizarevot.interfaces.Layout
import ro.code4.monitorizarevot.interfaces.ViewModelSetter

Expand All @@ -13,6 +14,7 @@ abstract class ViewModelFragment<out T : BaseViewModel> : BaseAnalyticsFragment(
lateinit var mContext: Context

override fun onAttach(context: Context) {
LocaleManager.wrapContext(context)
super.onAttach(context)
mContext = context
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PollingStationViewModel : BaseViewModel() {
private val nextLiveData = SingleLiveEvent<Void>()
private val nextToMainLiveData = SingleLiveEvent<Void>()
private val titleLiveData = MutableLiveData<String>()
private val pollingStationLiveData = MutableLiveData<String>()
private val pollingStationLiveData = MutableLiveData<Pair<Int, String>>()
private val arrivalTimeLiveData = MutableLiveData<String>()
private val departureTimeLiveData = MutableLiveData<String>()
private val selectedPollingStationLiveData = MutableLiveData<Pair<Int?, Int?>>()
Expand All @@ -43,15 +43,11 @@ class PollingStationViewModel : BaseViewModel() {
fun departureTime(): LiveData<String> = departureTimeLiveData
fun selectedPollingStation(): LiveData<Pair<Int?, Int?>> = selectedPollingStationLiveData

fun pollingStation(): LiveData<String> = pollingStationLiveData
fun pollingStation(): LiveData<Pair<Int, String>> = pollingStationLiveData

fun getPollingStationBarText() {
pollingStationLiveData.postValue(
app.getString(
R.string.polling_station,
selectedPollingStationNumber,
selectedCounty.name
)
Pair(selectedPollingStationNumber, selectedCounty.name)
)
getSelectedPollingStation()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class VisitedPollingStationsActivity : BaseActivity<VisitedPollingStationsViewMo
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_minimalist_arrow)
setTitle(R.string.title_visited_stations)

visitedStationsAdapter = VisitedStationsAdapter(this) { station ->
if (callingActivity?.className == PollingStationActivity::class.java.name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class PollingStationDetailsFragment : ViewModelFragment<PollingStationViewModel>
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel.pollingStation().observe(viewLifecycleOwner, Observer {
pollingStationBarText.text = it
pollingStationBarText.text = getString(
R.string.polling_station, it.first, it.second
)
})
viewModel.setTitle(getString(R.string.title_polling_station))
viewModel.getPollingStationBarText()
Expand Down