mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-06 17:38:48 +00:00
FavoriteUtils: check location is really a station on persist()
This commit is contained in:
parent
d70d84b8b9
commit
4299a6fd41
1 changed files with 4 additions and 0 deletions
|
@ -23,13 +23,17 @@ import android.database.Cursor;
|
|||
import android.net.Uri;
|
||||
import de.schildbach.pte.NetworkId;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
public class FavoriteUtils {
|
||||
public static Uri persist(final ContentResolver contentResolver, final int type, final NetworkId networkId,
|
||||
final Location station) {
|
||||
checkArgument(station.type == LocationType.STATION, "not a station: %s", station);
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(FavoriteStationsProvider.KEY_TYPE, type);
|
||||
values.put(FavoriteStationsProvider.KEY_STATION_NETWORK, networkId.name());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue