|
|
|
|
@ -7,13 +7,12 @@ import net.pokeranalytics.android.R |
|
|
|
|
import net.pokeranalytics.android.model.realm.Location |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource |
|
|
|
|
import net.pokeranalytics.android.ui.helpers.PlacePickerManager |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor |
|
|
|
|
import net.pokeranalytics.android.ui.view.RowViewType |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.LocationRow |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow |
|
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable |
|
|
|
|
import timber.log.Timber |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -93,22 +92,13 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onRowSelected(position: Int, row: RowRepresentable, fromAction: Boolean) { |
|
|
|
|
|
|
|
|
|
// If we click on a location row, save the location |
|
|
|
|
// If we click on a location row, save the location (and finish activity) |
|
|
|
|
placesForRows[row]?.place?.let { place -> |
|
|
|
|
location.setPlace(place) |
|
|
|
|
saveData() |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
when (row) { |
|
|
|
|
LocationRow.LOCATE_ME -> { |
|
|
|
|
isLookingForPlaces = true |
|
|
|
|
PlacePickerManager.create(parentActivity, row, this) |
|
|
|
|
rowRepresentableAdapter.refreshRow(row) |
|
|
|
|
} |
|
|
|
|
else -> super.onRowSelected(position, row, fromAction) |
|
|
|
|
} |
|
|
|
|
super.onRowSelected(position, row, fromAction) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
|
@ -196,7 +186,6 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (success && places.size > 0) { |
|
|
|
|
locationActivated = true |
|
|
|
|
rowPlaces.clear() |
|
|
|
|
placesForRows.clear() |
|
|
|
|
|
|
|
|
|
@ -208,6 +197,7 @@ class LocationDataFragment : EditableDataFragment(), StaticRowRepresentableDataS |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
locationActivated = true |
|
|
|
|
isLookingForPlaces = false |
|
|
|
|
updateAdapterUI() |
|
|
|
|
} else { |
|
|
|
|
|