Improve various samples examples, #32

This commit is contained in:
Emux
2016-06-22 22:25:14 +03:00
parent d2f61f9bfa
commit 1bfd76c3da
7 changed files with 70 additions and 44 deletions

View File

@@ -4,6 +4,6 @@
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="21" />
android:targetSdkVersion="22" />
</manifest>

View File

@@ -1,3 +1,19 @@
/*
* Copyright 2016 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.android;
import org.oscim.core.MapPosition;
@@ -21,6 +37,12 @@ public class MapPreferences {
this.PREFERENCES_FILE = name;
}
public void clear() {
Editor editor = ctx.getSharedPreferences(PREFERENCES_FILE, Activity.MODE_PRIVATE).edit();
editor.clear();
editor.apply();
}
private void putDouble(Editor editor, String key, double value) {
editor.putLong(key, Double.doubleToLongBits(value));
}
@@ -40,8 +62,7 @@ public class MapPreferences {
putDouble(editor, KEY_LATITUDE, pos.y);
putDouble(editor, KEY_LONGITUDE, pos.x);
putDouble(editor, KEY_SCALE, pos.scale);
putDouble(editor, KEY_LATITUDE, pos.y);
editor.commit();
editor.apply();
}
private static boolean containsViewport(SharedPreferences prefs) {