Permalink
Please sign in to comment.
Showing
with
80 additions
and 42 deletions.
- +5 −0 AndroidManifest.xml
- +1 −1 res/layout/about.xml
- +0 −1 res/raw/jstaffans.json
- +15 −0 res/values/arrays.xml
- +1 −1 res/values/strings.xml
- +19 −0 res/xml/preferences.xml
- +8 −0 src/fi/bitrite/android/ws/activity/MainActivity.java
- +16 −3 src/fi/bitrite/android/ws/activity/MapSearchTabActivity.java
- +15 −0 src/fi/bitrite/android/ws/activity/SettingsActivity.java
- +0 −36 src/fi/bitrite/android/ws/model/TestHostFactory.java
@@ -1 +0,0 @@ | ||
-{"name":"jstaffans","uid":"18496","fullname":"Johannes Staffans","login":"1327603569","access":"1327603569","created":"1277825855","street":"Street1","city":"Helsinki","province":"es","postal_code":"00100","country":"fi","mobilephone":"555-1234","comments":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fermentum vulputate est. Etiam laoreet, velit nec luctus vestibulum, lectus risus egestas odio, et blandit tellus lectus consectetur nulla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis. \r\n","preferred_notice":"1 week","maxcyclists":"2","notcurrentlyavailable":"0","bed":"1","bikeshop":"2 km","campground":"10 km","food":"1","kitchenuse":"1","laundry":"1","lawnspace":"0","motel":"5 km","sag":"0","shower":"1","storage":"1","latitude":"60.226481","longitude":"24.972756"} |
@@ -0,0 +1,15 @@ | ||
+<?xml version="1.0" encoding="utf-8"?> | ||
+ | ||
+<resources> | ||
+ | ||
+ <string-array name="distanceUnits"> | ||
+ <item name="km">Kilometers</item> | ||
+ <item name="mi">Miles</item> | ||
+ </string-array> | ||
+ | ||
+ <string-array name="distanceUnitValues"> | ||
+ <item name="km">km</item> | ||
+ <item name="mi">mi</item> | ||
+ </string-array> | ||
+ | ||
+</resources> |
@@ -0,0 +1,19 @@ | ||
+<?xml version="1.0" encoding="utf-8"?> | ||
+ | ||
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> | ||
+ | ||
+ <PreferenceCategory | ||
+ android:title="Map" | ||
+ android:key="map"> | ||
+ | ||
+ <ListPreference | ||
+ android:key="distance_unit" | ||
+ android:title="Unit of distance" | ||
+ android:summary="Determines in which unit distances should be shown" | ||
+ android:defaultValue="km" | ||
+ android:entries="@array/distanceUnits" | ||
+ android:entryValues="@array/distanceUnitValues" /> | ||
+ | ||
+ </PreferenceCategory> | ||
+ | ||
+</PreferenceScreen> |
@@ -0,0 +1,15 @@ | ||
+package fi.bitrite.android.ws.activity; | ||
+ | ||
+import android.os.Bundle; | ||
+import android.preference.PreferenceActivity; | ||
+import fi.bitrite.android.ws.R; | ||
+ | ||
+public class SettingsActivity extends PreferenceActivity { | ||
+ | ||
+ @Override | ||
+ protected void onCreate(Bundle savedInstanceState) { | ||
+ super.onCreate(savedInstanceState); | ||
+ addPreferencesFromResource(R.xml.preferences); | ||
+ } | ||
+ | ||
+} |
@@ -1,36 +0,0 @@ | ||
-package fi.bitrite.android.ws.model; | ||
- | ||
-import java.io.BufferedReader; | ||
-import java.io.InputStream; | ||
-import java.io.InputStreamReader; | ||
- | ||
-import org.json.JSONObject; | ||
- | ||
-import android.content.Context; | ||
-import fi.bitrite.android.ws.R; | ||
-import fi.bitrite.android.ws.WSAndroidApplication; | ||
- | ||
-public class TestHostFactory { | ||
- | ||
- public static Host getHostFromJson() { | ||
- Context context = WSAndroidApplication.getAppContext(); | ||
- InputStream inputStream = context.getResources().openRawResource( | ||
- R.raw.jstaffans); | ||
- | ||
- InputStreamReader inputreader = new InputStreamReader(inputStream); | ||
- BufferedReader buffreader = new BufferedReader(inputreader); | ||
- | ||
- String line; | ||
- StringBuilder json = new StringBuilder(); | ||
- | ||
- try { | ||
- while ((line = buffreader.readLine()) != null) { | ||
- json.append(line); | ||
- json.append('\n'); | ||
- } | ||
- return Host.CREATOR.parse(new JSONObject(json.toString())); | ||
- } catch (Exception e) { | ||
- return null; | ||
- } | ||
- } | ||
-} |
0 comments on commit
0622f49