Add reason for location permission

feature/top10
Aurelien Hubert 7 years ago
parent 79da55d59e
commit e16044e182
  1. 5
      app/src/main/java/net/pokeranalytics/android/ui/fragment/LocationDataFragment.kt

@ -13,6 +13,7 @@ import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.LocationRow import net.pokeranalytics.android.ui.view.rowrepresentable.LocationRow
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow
import net.pokeranalytics.android.util.NULL_TEXT
import timber.log.Timber import timber.log.Timber
/** /**
@ -66,7 +67,7 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
override fun stringForRow(row: RowRepresentable): String { override fun stringForRow(row: RowRepresentable): String {
return when (row) { return when (row) {
SimpleRow.NAME -> location.name SimpleRow.NAME -> if (location.name.isNotEmpty())location.name else NULL_TEXT
else -> return super.stringForRow(row) else -> return super.stringForRow(row)
} }
} }
@ -136,6 +137,8 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS
rows.clear() rows.clear()
rows.add(SimpleRow.NAME) rows.add(SimpleRow.NAME)
rows.add(LocationRow.LOCATION_PERMISSION_SWITCH) rows.add(LocationRow.LOCATION_PERMISSION_SWITCH)
// Add info row to explain why we need the location permission
rows.add(CustomizableRowRepresentable(customViewType = RowViewType.INFO, resId = R.string.location_when_in_use_usage_description))
if (isLookingForPlaces) { if (isLookingForPlaces) {
rows.add(LocationRow.LOCATION_LOADER) rows.add(LocationRow.LOCATION_LOADER)

Loading…
Cancel
Save