Android Open Source - City-Outdoors-Android Index Call From Project Back to project page City-Outdoors-Android .
License The source code is released under:
Copyright (c) 2012, Edinburgh Council
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are ...
If you think the Android project City-Outdoors-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package uk.co.jarofgreen.cityoutdoors.API;
/ / w w w . j a v a 2 s . c o m
import org.xml.sax.Attributes;
import uk.co.jarofgreen.cityoutdoors.OurApplication;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.sax.Element;
import android.sax.RootElement;
import android.sax.StartElementListener;
import android.util.Log;
/**
*
* @author James Baster <james@jarofgreen.co.uk>
* @copyright City of Edinburgh Council & James Baster
* @license Open Source under the 3-clause BSD License
* @url https://github.com/City-Outdoors/City-Outdoors-Android
*/
public class IndexCall extends BaseCall {
public IndexCall(Context context, OurApplication ourApplication) {
super (context, ourApplication);
}
public IndexCall(InformationNeededFromContext informationNeededFromContext) {
super (informationNeededFromContext);
}
Float startingBoundsMinLat;
Float startingBoundsMaxLat;
Float startingBoundsMinLng;
Float startingBoundsMaxLng;
Integer uploadsMaxSize;
public void execute() {
RootElement root = new RootElement("data" );
Element startingBounds = root.getChild("startingBounds" );
startingBounds.setStartElementListener(new StartElementListener(){
public void start(Attributes attributes) {
if (attributes.getValue("maxLat" ) != null) {
startingBoundsMaxLat = Float.parseFloat(attributes.getValue("maxLat" ));
Log.d("INDEXCALL" ,"startingBoundsMaxLat=" +Float.toString(startingBoundsMaxLat));
}
if (attributes.getValue("minLat" ) != null) {
startingBoundsMinLat = Float.parseFloat(attributes.getValue("minLat" ));
Log.d("INDEXCALL" ,"startingBoundsMinLat=" +Float.toString(startingBoundsMinLat));
}
if (attributes.getValue("maxLng" ) != null) {
startingBoundsMaxLng = Float.parseFloat(attributes.getValue("maxLng" ));
Log.d("INDEXCALL" ,"startingBoundsMaxLng=" +Float.toString(startingBoundsMaxLng));
}
if (attributes.getValue("minLng" ) != null) {
startingBoundsMinLng = Float.parseFloat(attributes.getValue("minLng" ));
Log.d("INDEXCALL" ,"startingBoundsMinLng=" +Float.toString(startingBoundsMinLng));
}
}
});
Element uploads = root.getChild("uploads" );
uploads.setStartElementListener(new StartElementListener(){
public void start(Attributes attributes) {
if (attributes.getValue("maxSize" ) != null) {
uploadsMaxSize = Integer.parseInt(attributes.getValue("maxSize" ));
Log.d("MAXUPLOADSSIZE" ,"uploadsMaxSize=" +Integer.toString(uploadsMaxSize));
}
}
});
setUpCall("/api/v1/index.php?showLinks=0&" );
makeCall(root);
SharedPreferences.Editor editor = informationNeededFromContext.getSettings().edit();
if (startingBoundsMaxLat != null && startingBoundsMinLat != null && startingBoundsMaxLng != null && startingBoundsMinLng != null) {
editor.putFloat("startingBoundsMaxLat" , startingBoundsMaxLat);
editor.putFloat("startingBoundsMinLat" , startingBoundsMinLat);
editor.putFloat("startingBoundsMaxLng" , startingBoundsMaxLng);
editor.putFloat("startingBoundsMinLng" , startingBoundsMinLng);
}
if (uploadsMaxSize != null) {
editor.putInt("uploadsMaxSize" , uploadsMaxSize);
}
editor.commit();
}
}
Java Source Code List uk.co.jarofgreen.cityoutdoors.OurApplication.java uk.co.jarofgreen.cityoutdoors.Storage.java uk.co.jarofgreen.cityoutdoors.API.BaseCall.java uk.co.jarofgreen.cityoutdoors.API.BaseSubmitContentOrReportCall.java uk.co.jarofgreen.cityoutdoors.API.CheckCurrentUserCall.java uk.co.jarofgreen.cityoutdoors.API.CollectionCall.java uk.co.jarofgreen.cityoutdoors.API.CollectionsCall.java uk.co.jarofgreen.cityoutdoors.API.FeatureCall.java uk.co.jarofgreen.cityoutdoors.API.FeatureFavouriteCall.java uk.co.jarofgreen.cityoutdoors.API.FeaturesCall.java uk.co.jarofgreen.cityoutdoors.API.IndexCall.java uk.co.jarofgreen.cityoutdoors.API.InformationNeededFromContext.java uk.co.jarofgreen.cityoutdoors.API.LogInOrSignUpCall.java uk.co.jarofgreen.cityoutdoors.API.SubmitFeatureCheckinQuestionFreeTextAnswerCall.java uk.co.jarofgreen.cityoutdoors.API.SubmitFeatureCheckinQuestionHigherOrLowerAnswerCall.java uk.co.jarofgreen.cityoutdoors.API.SubmitFeatureCheckinQuestionMultipleChoiceAnswerCall.java uk.co.jarofgreen.cityoutdoors.API.SubmitFeatureContentCall.java uk.co.jarofgreen.cityoutdoors.API.SubmitFeatureReportCall.java uk.co.jarofgreen.cityoutdoors.Model.BaseUploadContentOrReport.java uk.co.jarofgreen.cityoutdoors.Model.Collection.java uk.co.jarofgreen.cityoutdoors.Model.Content.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckinQuestionContent.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckinQuestionFreeText.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckinQuestionHigherOrLower.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckinQuestionMultipleChoice.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckinQuestionPossibleAnswer.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckinQuestion.java uk.co.jarofgreen.cityoutdoors.Model.FeatureCheckin.java uk.co.jarofgreen.cityoutdoors.Model.FeatureFavourite.java uk.co.jarofgreen.cityoutdoors.Model.Feature.java uk.co.jarofgreen.cityoutdoors.Model.ItemField.java uk.co.jarofgreen.cityoutdoors.Model.Item.java uk.co.jarofgreen.cityoutdoors.Model.UploadFeatureContent.java uk.co.jarofgreen.cityoutdoors.Model.UploadFeatureReport.java uk.co.jarofgreen.cityoutdoors.Service.LoadDataIfStaleService.java uk.co.jarofgreen.cityoutdoors.Service.LoadDataService.java uk.co.jarofgreen.cityoutdoors.Service.LoadUserDataService.java uk.co.jarofgreen.cityoutdoors.Service.SendFeatureContentOrReportService.java uk.co.jarofgreen.cityoutdoors.Service.SendFeatureFavouriteService.java uk.co.jarofgreen.cityoutdoors.UI.AboutActivity.java uk.co.jarofgreen.cityoutdoors.UI.AboutLegalActivity.java uk.co.jarofgreen.cityoutdoors.UI.BaseActivity.java uk.co.jarofgreen.cityoutdoors.UI.BaseListActivity.java uk.co.jarofgreen.cityoutdoors.UI.BaseMonthlyActivity.java uk.co.jarofgreen.cityoutdoors.UI.BaseNewFeatureContentOrReportActivity.java uk.co.jarofgreen.cityoutdoors.UI.BrowseMapActivity.java uk.co.jarofgreen.cityoutdoors.UI.CollectionActivity.java uk.co.jarofgreen.cityoutdoors.UI.CollectionsActivity.java uk.co.jarofgreen.cityoutdoors.UI.FavouritesActivity.java uk.co.jarofgreen.cityoutdoors.UI.FeatureActivity.java uk.co.jarofgreen.cityoutdoors.UI.FeatureCheckinQuestionExplanationActivity.java uk.co.jarofgreen.cityoutdoors.UI.FeatureChildrenActivity.java uk.co.jarofgreen.cityoutdoors.UI.LogInOrSignUpActivity.java uk.co.jarofgreen.cityoutdoors.UI.LogInTwitterActivity.java uk.co.jarofgreen.cityoutdoors.UI.MainActivity.java uk.co.jarofgreen.cityoutdoors.UI.NewFeatureContentActivity.java uk.co.jarofgreen.cityoutdoors.UI.NewFeatureReportActivity.java uk.co.jarofgreen.cityoutdoors.UI.PreferencesActivity.java uk.co.jarofgreen.cityoutdoors.UI.SendFeatureContentOrReportProgressActivity.java uk.co.jarofgreen.cityoutdoors.UI.SplashActivity.java uk.co.jarofgreen.cityoutdoors.UI.TermsAndConditionsActivity.java uk.co.jarofgreen.cityoutdoors.UI.TitleBar.java uk.co.jarofgreen.cityoutdoors.UI.ViewImageActivity.java uk.co.jarofgreen.cityoutdoors.UI.WhatsOnActivity.java uk.co.jarofgreen.cityoutdoors.UI.WildlifeActivity.java