├── .gitignore ├── .idea └── copyright │ └── profiles_settings.xml ├── README.md ├── SpaceScout ├── .gitignore ├── build.gradle ├── libs │ ├── signpost-commonshttp4-1.2.1.2.jar │ ├── signpost-core-1.2.1.2.jar │ └── signpost-jetty6-1.2.1.2.jar └── src │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── fonts │ │ │ ├── Manteka.ttf │ │ │ └── MavenPro-Bold.ttf │ ├── ic_launcher-web.png │ ├── java │ │ └── edu │ │ │ └── uw │ │ │ └── spacescout_android │ │ │ ├── CustomClusterRenderer.java │ │ │ ├── CustomClusteringAlgorithm.java │ │ │ ├── CustomDialogFragment.java │ │ │ ├── FavSpacesActivity.java │ │ │ ├── FilterSpacesActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── NavMenuListAdapter.java │ │ │ ├── SettingsActivity.java │ │ │ ├── SettingsFragment.java │ │ │ ├── SpaceDetailsActivity.java │ │ │ ├── SpaceListArrayAdapter.java │ │ │ ├── SpaceListFragment.java │ │ │ ├── SpaceMapFragment.java │ │ │ ├── TimePickerFragment.java │ │ │ ├── TouchableWrapper.java │ │ │ ├── model │ │ │ ├── Building.java │ │ │ ├── Buildings.java │ │ │ ├── Space.java │ │ │ └── Spaces.java │ │ │ └── util │ │ │ ├── JSONParser.java │ │ │ └── JSONProcessor.java │ └── res │ │ ├── anim │ │ ├── fadein.xml │ │ └── fadeout.xml │ │ ├── drawable-hdpi │ │ ├── drawer_shadow.9.png │ │ ├── ic_drawer.png │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ ├── drawer_shadow.9.png │ │ ├── ic_drawer.png │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ ├── drawer_shadow.9.png │ │ ├── ic_drawer.png │ │ ├── ic_launcher.png │ │ └── nav_search.png │ │ ├── drawable-xxhdpi │ │ ├── action_search.png │ │ ├── action_space_list.png │ │ ├── action_space_map.png │ │ ├── btn_filter_white.png │ │ ├── drawer_shadow.9.png │ │ ├── fav_heart_check.png │ │ ├── fav_heart_uncheck.png │ │ ├── filter_reset.png │ │ ├── ic_drawer.png │ │ ├── ic_launcher.png │ │ ├── map_pin_blue.png │ │ ├── nav_all_spaces.png │ │ ├── nav_fav_spaces.png │ │ ├── nav_map_view.png │ │ ├── nav_search.png │ │ ├── nav_slist.png │ │ ├── radio_off.png │ │ ├── radio_off_pressed.png │ │ ├── radio_on.png │ │ ├── radio_on_pressed.png │ │ ├── seat_icon.png │ │ ├── space_img.jpg │ │ └── space_img_lrg.jpeg │ │ ├── drawable │ │ ├── actionbar_bg.xml │ │ ├── activated_background.xml │ │ ├── custom_dayname_bg.xml │ │ ├── custom_dayname_bg_closed.xml │ │ ├── custom_filter_action_button.xml │ │ ├── custom_radio.xml │ │ ├── custom_space_details_bg.xml │ │ ├── custom_spinner.xml │ │ ├── custom_spinner_txt_bg.xml │ │ ├── custom_spinner_txt_hlight.xml │ │ ├── filter_btn_bg.xml │ │ └── filter_reset_btn.xml │ │ ├── layout │ │ ├── activity_settings.xml │ │ ├── custom_pagetitle_actionbar.xml │ │ ├── custom_space_list_row.xml │ │ ├── custom_spinner_row.xml │ │ ├── custom_spinner_text.xml │ │ ├── custom_time_picker.xml │ │ ├── custom_title_actionbar.xml │ │ ├── dialog_custom_title.xml │ │ ├── fragment_space_list.xml │ │ ├── fragment_space_map.xml │ │ ├── layout_main.xml │ │ ├── layout_space_details.xml │ │ ├── layout_space_favs.xml │ │ ├── layout_space_filter.xml │ │ └── navdrawer_item.xml │ │ ├── menu │ │ ├── filter_spaces.xml │ │ ├── menu_list.xml │ │ └── menu_main.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ ├── values │ │ ├── color.xml │ │ ├── dimens.xml │ │ ├── settings.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── settings.xml │ └── test │ ├── AndroidManifest.xml │ └── java │ └── edu │ └── uw │ └── spacescout_android │ └── test │ ├── HandleHttpResponseTest.java │ └── JSONProcessorTest.java ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # API Key File 2 | */values/apikey.xml 3 | */values/urls.xml 4 | */values/secrets.xml 5 | 6 | # Suggested files to be ignored from stackoverflow 7 | .gradle 8 | /local.properties 9 | /.idea/workspace.xml 10 | /.idea/libraries 11 | .idea/modules.xml 12 | .idea/.name 13 | .idea/compiler.xml 14 | .idea/encodings.xml 15 | .idea/gradle.xml 16 | .idea/misc.xml 17 | .idea/scopes/scope_settings.xml 18 | .idea/vcs.xml 19 | .DS_Store 20 | /build 21 | *.iml -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This app has been superseded by https://github.com/uw-it-aca/scout-android 2 | 3 | 4 | spacescout-android 5 | ================== 6 | This is the Android client for SpaceScout. It connects to services provided by https://github.com/uw-it-aca/spotseeker_server 7 | 8 | Test server can be created based on https://github.com/uw-it-aca/spacescout_builds 9 | 10 | This project is currently undergoing development. 11 | 12 | [Design Spec](https://github.com/uw-it-aca/spacescout-android/wiki/Design-Spec) 13 | 14 | Guides and docs in Wiki. 15 | -------------------------------------------------------------------------------- /SpaceScout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /SpaceScout/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:1.1.2' 7 | } 8 | } 9 | apply plugin: 'com.android.application' 10 | 11 | repositories { 12 | mavenCentral() 13 | jcenter() 14 | } 15 | 16 | android { 17 | compileSdkVersion 22 18 | buildToolsVersion '22.0.0' 19 | 20 | defaultConfig { 21 | applicationId "edu.uw.spacescout_android" 22 | minSdkVersion 16 23 | targetSdkVersion 22 24 | versionCode 1 25 | versionName "1.0-ALPHA" 26 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 27 | } 28 | sourceSets { 29 | androidTest.setRoot('test') 30 | androidTest.java.srcDirs = ['src/test/java'] 31 | } 32 | 33 | packagingOptions { 34 | exclude 'META-INF/LICENSE.txt' 35 | exclude 'LICENSE.txt' 36 | } 37 | 38 | testOptions { 39 | unitTests.returnDefaultValues = true 40 | } 41 | } 42 | 43 | dependencies { 44 | // testCompile 'junit:junit:4.12' 45 | testCompile 'com.android.support.test:testing-support-lib:+' 46 | androidTestCompile 'com.android.support.test:testing-support-lib:+' 47 | 48 | compile 'com.android.support:support-v4:22+' 49 | compile 'com.google.android.gms:play-services:7+' 50 | compile 'com.google.maps.android:android-maps-utils:0.3+' 51 | compile files('libs/signpost-jetty6-1.2.1.2.jar') 52 | compile files('libs/signpost-core-1.2.1.2.jar') 53 | compile files('libs/signpost-commonshttp4-1.2.1.2.jar') 54 | } 55 | -------------------------------------------------------------------------------- /SpaceScout/libs/signpost-commonshttp4-1.2.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/libs/signpost-commonshttp4-1.2.1.2.jar -------------------------------------------------------------------------------- /SpaceScout/libs/signpost-core-1.2.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/libs/signpost-core-1.2.1.2.jar -------------------------------------------------------------------------------- /SpaceScout/libs/signpost-jetty6-1.2.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/libs/signpost-jetty6-1.2.1.2.jar -------------------------------------------------------------------------------- /SpaceScout/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 42 | 45 | 46 | 51 | 54 | 55 | 56 | 59 | 60 | 64 | 67 | 68 | 72 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /SpaceScout/src/main/assets/fonts/Manteka.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/assets/fonts/Manteka.ttf -------------------------------------------------------------------------------- /SpaceScout/src/main/assets/fonts/MavenPro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/assets/fonts/MavenPro-Bold.ttf -------------------------------------------------------------------------------- /SpaceScout/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/CustomClusterRenderer.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Context; 5 | import android.location.Location; 6 | import android.os.AsyncTask; 7 | import android.util.Log; 8 | 9 | import com.google.android.gms.maps.GoogleMap; 10 | import com.google.android.gms.maps.model.CameraPosition; 11 | import com.google.android.gms.maps.model.Marker; 12 | import com.google.android.gms.maps.model.VisibleRegion; 13 | import com.google.maps.android.clustering.Cluster; 14 | import com.google.maps.android.clustering.ClusterManager; 15 | import com.google.maps.android.clustering.view.DefaultClusterRenderer; 16 | 17 | import edu.uw.spacescout_android.model.Space; 18 | 19 | /** 20 | * Created by aazri3 on 4/2/15. 21 | * 22 | * Custom cluster renderer. Used to override defaults that include: 23 | * - minimum number of markers in a cluster 24 | * - onCameraChange listener 25 | */ 26 | public class CustomClusterRenderer extends DefaultClusterRenderer implements 27 | GoogleMap.OnCameraChangeListener { 28 | 29 | private static final String TAG = "CustomClusterRenderer"; 30 | 31 | private Context mContext; 32 | private GoogleMap map; 33 | 34 | //TODO: drawing custom markers & clustered markers 35 | /** 36 | * Draw markers using IconGenerator. 37 | */ 38 | // private final IconGenerator mIconGenerator; 39 | // private final IconGenerator mClusterIconGenerator; 40 | // private final ImageView mImageView; 41 | 42 | public CustomClusterRenderer(Context context, GoogleMap map, ClusterManager clusterManager) { 43 | super(context, map, clusterManager); 44 | 45 | this.mContext = context; 46 | this.map = map; 47 | 48 | // mIconGenerator = new IconGenerator(context); 49 | // mClusterIconGenerator = new IconGenerator(context); 50 | 51 | // View multiProfile = getLayoutInflater().inflate(R.layout.multi_profile, null); 52 | // mClusterIconGenerator.setContentView(multiProfile); 53 | 54 | // mImageView = new ImageView(context); 55 | // mIconGenerator.setContentView(mImageView); 56 | } 57 | 58 | // @Override 59 | // protected void onBeforeClusterItemRendered(Space space, MarkerOptions markerOptions) { 60 | // // Draw a single person. 61 | // // Set the info window to show their name. 62 | //// mImageView.setImageResource(person.profilePhoto); 63 | //// Bitmap icon = mIconGenerator.makeIcon(); 64 | //// markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)).title(person.name); 65 | // } 66 | 67 | // @Override 68 | // protected void onBeforeClusterRendered(Cluster cluster, MarkerOptions markerOptions) { 69 | // // Draw multiple people. 70 | // // Note: this method runs on the UI thread. Don't spend too much time in here (like in this example). 71 | //// List profilePhotos = new ArrayList(Math.min(4, cluster.getSize())); 72 | //// int width = mDimension; 73 | //// int height = mDimension; 74 | //// 75 | //// for (Person p : cluster.getItems()) { 76 | //// // Draw 4 at most. 77 | //// if (profilePhotos.size() == 4) break; 78 | //// Drawable drawable = getResources().getDrawable(p.profilePhoto); 79 | //// drawable.setBounds(0, 0, width, height); 80 | //// profilePhotos.add(drawable); 81 | //// } 82 | //// MultiDrawable multiDrawable = new MultiDrawable(profilePhotos); 83 | //// multiDrawable.setBounds(0, 0, width, height); 84 | //// 85 | //// mClusterImageView.setImageDrawable(multiDrawable); 86 | //// Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize())); 87 | //// markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon)); 88 | // } 89 | 90 | @Override 91 | protected boolean shouldRenderAsCluster(Cluster cluster) { 92 | // Always render clusters. 93 | return cluster.getSize() > 1; 94 | } 95 | 96 | // TODO: Maybe should consider not sending another request after zooming out a certain distance 97 | @Override 98 | public void onCameraChange(CameraPosition cameraPosition) { 99 | dismissDefaultDialog(); 100 | Log.d(TAG, "onCameraChange detected"); 101 | 102 | // TODO: May want to look at ThreadPoolExecutor & SynchronousQueue for a different impl 103 | // Cancel any running AsyncTask before we start a new request 104 | // MainActivity.currItem tracks the current item we're requesting for - "buidlings" or "spaces" 105 | if (((MainActivity) mContext).currItem != null) { 106 | if (((MainActivity) mContext).currItem.equals("spaces") && 107 | (((MainActivity) mContext).getJson.getStatus() == AsyncTask.Status.PENDING || 108 | ((MainActivity) mContext).getJson.getStatus() == AsyncTask.Status.RUNNING)) { 109 | ((MainActivity) mContext).getJson.cancel(true); 110 | } else { 111 | buildAndSendRequest(); 112 | } 113 | } 114 | 115 | } 116 | 117 | public void buildAndSendRequest() { 118 | Log.d(TAG, "Build & send new request."); 119 | // Get the latlng bounds to calculate radius distance 120 | VisibleRegion vr = map.getProjection().getVisibleRegion(); 121 | double rightLat = vr.latLngBounds.northeast.latitude; 122 | double rightLon = vr.latLngBounds.northeast.longitude; 123 | // Get the top right corner of the screen 124 | Location topRightCorner = new Location("topRightCorner"); 125 | topRightCorner.setLatitude(rightLat); 126 | topRightCorner.setLongitude(rightLon); 127 | // Get the center 128 | Location center = new Location("center"); 129 | center.setLatitude(vr.latLngBounds.getCenter().latitude); 130 | center.setLongitude(vr.latLngBounds.getCenter().longitude); 131 | // Calculate radius 132 | int radius = Math.round(center.distanceTo(topRightCorner)); 133 | int smallerRadius = (int) (radius - Math.round(0.065 * radius)); 134 | 135 | String baseUrl = mContext.getResources().getString(R.string.baseUrl); 136 | String url = baseUrl + "spot/?center_latitude=" + center.getLatitude() + 137 | "¢er_longitude=" + center.getLongitude() + "&distance=" + 138 | smallerRadius + "&limit=0"; 139 | ((MainActivity) mContext).connectToServer(url, "spaces"); 140 | } 141 | 142 | private void dismissDefaultDialog() { 143 | AlertDialog dialog = ((MainActivity) mContext).getUsedDialogue("Connection Issue"); 144 | if (dialog != null) { 145 | if (dialog.isShowing()) { 146 | dialog.dismiss(); 147 | ((MainActivity) mContext).alertDialogues.clear(); 148 | } 149 | } 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/CustomClusteringAlgorithm.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | 4 | import com.google.android.gms.maps.model.LatLng; 5 | import com.google.maps.android.clustering.Cluster; 6 | import com.google.maps.android.clustering.ClusterItem; 7 | import com.google.maps.android.clustering.algo.Algorithm; 8 | import com.google.maps.android.clustering.algo.StaticCluster; 9 | import com.google.maps.android.geometry.Bounds; 10 | import com.google.maps.android.geometry.Point; 11 | import com.google.maps.android.projection.SphericalMercatorProjection; 12 | import com.google.maps.android.quadtree.PointQuadTree; 13 | 14 | import java.util.ArrayList; 15 | import java.util.Collection; 16 | import java.util.Collections; 17 | import java.util.HashMap; 18 | import java.util.HashSet; 19 | import java.util.List; 20 | import java.util.Map; 21 | import java.util.Set; 22 | 23 | import edu.uw.spacescout_android.model.Space; 24 | 25 | 26 | /** 27 | * Created by gupta37 on 5/16/14. 28 | * 29 | * For clustering markers on Google Maps our own way. 30 | */ 31 | 32 | public class CustomClusteringAlgorithm implements Algorithm { 33 | public static final int MAX_DISTANCE_AT_ZOOM = 40; 34 | 35 | private final Collection> mItems = new ArrayList<>(); 36 | private final PointQuadTree> mQuadTree = new PointQuadTree<>(0, 1, 0, 1); 37 | 38 | // something about the earth being spherical 39 | private static final SphericalMercatorProjection PROJECTION = new SphericalMercatorProjection(1); 40 | 41 | // adds item (markers) to the map 42 | @Override 43 | public void addItem(T item) { 44 | final QuadItem quadItem = new QuadItem<>(item); 45 | synchronized (mQuadTree) { 46 | mItems.add(quadItem); 47 | mQuadTree.add(quadItem); 48 | } 49 | } 50 | 51 | @Override 52 | public void addItems(Collection items) { 53 | for (T item : items) { 54 | addItem(item); 55 | } 56 | } 57 | 58 | @Override 59 | public void clearItems() { 60 | synchronized (mQuadTree) { 61 | mItems.clear(); 62 | mQuadTree.clear(); 63 | } 64 | } 65 | 66 | // Must be implemented but is never used. 67 | @Override 68 | public void removeItem(T item) { 69 | // TODO: delegate QuadItem#hashCode and QuadItem#equals to its item. Probably not needed though. 70 | throw new UnsupportedOperationException("NonHierarchicalDistanceBasedAlgorithm.remove not implemented"); 71 | } 72 | 73 | // TODO: Add buildings to the mix 74 | // This is where the fun's at. 75 | @Override 76 | public Set> getClusters(double zoom) { 77 | final int discreteZoom = (int) zoom; 78 | final double zoomSpecificSpan = MAX_DISTANCE_AT_ZOOM / Math.pow(2, discreteZoom) / 100 /*256*/; 79 | 80 | final Set> visitedCandidates = new HashSet<>(); 81 | final Set> results = new HashSet<>(); 82 | final Map, Double> distanceToCluster = new HashMap<>(); 83 | final Map, StaticCluster> itemToCluster = new HashMap<>(); 84 | 85 | synchronized (mQuadTree) { 86 | for (QuadItem candidate : mItems) { 87 | if (visitedCandidates.contains(candidate)) { 88 | // Candidate is already part of another cluster. 89 | continue; 90 | } 91 | 92 | Bounds searchBounds = createBoundsFromSpan(candidate.getPoint(), zoomSpecificSpan); 93 | Collection> clusterItems; 94 | clusterItems = mQuadTree.search(searchBounds); 95 | if (clusterItems.size() == 1) { 96 | // Only the current marker is in range. Just add the single item to the results. 97 | results.add(candidate); 98 | visitedCandidates.add(candidate); 99 | distanceToCluster.put(candidate, 0d); 100 | continue; 101 | } 102 | StaticCluster cluster = new StaticCluster<>(candidate.mClusterItem.getPosition()); 103 | results.add(cluster); 104 | 105 | for (QuadItem clusterItem : clusterItems) { 106 | Double existingDistance = distanceToCluster.get(clusterItem); 107 | double distance = distanceSquared(clusterItem.getPoint(), candidate.getPoint()); 108 | if (existingDistance != null) { 109 | // Item already belongs to another cluster. Check if it's closer to this cluster. 110 | if (existingDistance < distance) { 111 | continue; 112 | } 113 | 114 | // Move item to the closer cluster. 115 | itemToCluster.get(clusterItem).remove(clusterItem.mClusterItem); 116 | } 117 | distanceToCluster.put(clusterItem, distance); 118 | cluster.add(clusterItem.mClusterItem); 119 | itemToCluster.put(clusterItem, cluster); 120 | } 121 | visitedCandidates.addAll(clusterItems); 122 | } 123 | } 124 | return results; 125 | } 126 | 127 | @Override 128 | public Collection getItems() { 129 | final List items = new ArrayList<>(); 130 | synchronized (mQuadTree) { 131 | for (QuadItem quadItem : mItems) { 132 | items.add(quadItem.mClusterItem); 133 | } 134 | } 135 | return items; 136 | } 137 | 138 | private double distanceSquared(Point a, Point b) { 139 | return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y); 140 | } 141 | 142 | private Bounds createBoundsFromSpan(Point p, double span) { 143 | // TODO: Use a span that takes into account the visual size of the marker, not just its 144 | 145 | double halfSpan = span / 2; 146 | return new Bounds( 147 | p.x - halfSpan, p.x + halfSpan, 148 | p.y - halfSpan, p.y + halfSpan); 149 | } 150 | 151 | private static class QuadItem implements PointQuadTree.Item, Cluster { 152 | private final T mClusterItem; 153 | private final Point mPoint; 154 | private final LatLng mPosition; 155 | private Set singletonSet; 156 | 157 | private QuadItem(T item) { 158 | mClusterItem = item; 159 | mPosition = item.getPosition(); 160 | mPoint = PROJECTION.toPoint(mPosition); 161 | singletonSet = Collections.singleton(mClusterItem); 162 | } 163 | 164 | @Override 165 | public Point getPoint() { 166 | return mPoint; 167 | } 168 | 169 | @Override 170 | public LatLng getPosition() { 171 | return mPosition; 172 | } 173 | 174 | @Override 175 | public Set getItems() { 176 | return singletonSet; 177 | } 178 | 179 | @Override 180 | public int getSize() { 181 | return 1; 182 | } 183 | } 184 | } -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/CustomDialogFragment.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.AlertDialog; 4 | import android.app.Dialog; 5 | import android.app.DialogFragment; 6 | import android.content.DialogInterface; 7 | import android.os.Bundle; 8 | import android.util.Log; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.widget.Button; 12 | import android.widget.TextView; 13 | import android.widget.TimePicker; 14 | 15 | /** 16 | * Created by ajay alfred on 11/5/13. 17 | * 18 | * Custom dialog fragment (duh..) :P 19 | */ 20 | 21 | public class CustomDialogFragment extends DialogFragment { 22 | 23 | private View titleView; 24 | private View timeView; 25 | public String[] arrToDisplay; 26 | public boolean[] arrSelectBool; 27 | public String dialogType; 28 | public String dialogSelect; 29 | public int singleSelect; 30 | 31 | public CustomDialogFragment() { 32 | //empty constructor 33 | } 34 | 35 | public interface FilterDialogActionsListener { 36 | void postFilterDialogActions(String dType, boolean[] boolArray, String[] displayArray, int singleSelect); 37 | } 38 | 39 | @Override 40 | public Dialog onCreateDialog(Bundle savedInstanceState) { 41 | 42 | LayoutInflater inflater = getActivity().getLayoutInflater(); 43 | 44 | //intialize custom dialog title view 45 | titleView = inflater.inflate(R.layout.dialog_custom_title, null); 46 | TextView title = (TextView) titleView.findViewById(R.id.dialogTitle); 47 | title.setText(getArguments().getString("dialogTitle")); 48 | 49 | timeView = inflater.inflate(R.layout.custom_time_picker, null); 50 | 51 | //get array and bool to display 52 | arrToDisplay = getArguments().getStringArray("arrayToDisplay"); 53 | 54 | //get type of dialog 55 | dialogType = getArguments().getString("dialogType"); 56 | 57 | if (dialogType.equalsIgnoreCase("SpaceType")) { 58 | arrSelectBool = getArguments().getBooleanArray("arrSpaceTypeBool"); 59 | } 60 | else if (dialogType.equalsIgnoreCase("SpaceLoc")) { 61 | singleSelect = getArguments().getInt("singleSelect"); 62 | } 63 | else if (dialogType.equalsIgnoreCase("SpaceNoise")) { 64 | arrSelectBool = getArguments().getBooleanArray("arrSpaceNoiseBool"); 65 | } 66 | else if (dialogType.equalsIgnoreCase("SpaceTimeFromDay")) { 67 | singleSelect = getArguments().getInt("singleSelect"); 68 | } 69 | else if (dialogType.equalsIgnoreCase("SpaceFromTime")) { 70 | TimePicker timePicker = (TimePicker) timeView.findViewById(R.id.timePicker); 71 | timePicker.setCurrentHour(getArguments().getInt("hour")); 72 | timePicker.setCurrentMinute(getArguments().getInt("minute")); 73 | } 74 | else if (dialogType.equalsIgnoreCase("SpaceTimeToDay")) { 75 | singleSelect = getArguments().getInt("singleSelect"); 76 | } 77 | else if (dialogType.equalsIgnoreCase("SpaceToTime")) { 78 | TimePicker timePicker = (TimePicker) timeView.findViewById(R.id.timePicker); 79 | timePicker.setCurrentHour(getArguments().getInt("hour")); 80 | timePicker.setCurrentMinute(getArguments().getInt("minute")); 81 | } 82 | else if (dialogType.equalsIgnoreCase("SpaceResources")) { 83 | arrSelectBool = getArguments().getBooleanArray("arrSpaceResourcesBool"); 84 | } 85 | else if (dialogType.equalsIgnoreCase("SpaceFood")) { 86 | arrSelectBool = getArguments().getBooleanArray("arrSpaceFoodBool"); 87 | } 88 | 89 | //get dialog select type 90 | dialogSelect = getArguments().getString("dialogSelect"); 91 | 92 | 93 | AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this.getActivity(), R.style.popupStyle); 94 | 95 | // set dialog message 96 | alertDialogBuilder 97 | .setCancelable(false) 98 | .setCustomTitle(titleView); 99 | 100 | if (dialogSelect.equalsIgnoreCase("multi")) { 101 | alertDialogBuilder.setMultiChoiceItems(arrToDisplay, arrSelectBool, new DialogInterface.OnMultiChoiceClickListener() { 102 | public void onClick(DialogInterface dialogInterface, int item, boolean isChecked) { 103 | if (isChecked) { 104 | Log.i("INFO", "checked item -> " + item); 105 | arrSelectBool[item] = isChecked; 106 | } 107 | if (!isChecked) { 108 | Log.i("INFO", "unchecked -> " + item); 109 | arrSelectBool[item] = isChecked; 110 | } 111 | 112 | 113 | } 114 | }) 115 | .setPositiveButton("OK", new DialogInterface.OnClickListener() { 116 | public void onClick(DialogInterface dialog, int id) { 117 | FilterDialogActionsListener callingActivity = (FilterDialogActionsListener) getActivity(); 118 | callingActivity.postFilterDialogActions(dialogType, arrSelectBool, arrToDisplay, 0); 119 | dialog.dismiss(); 120 | } 121 | }) 122 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 123 | public void onClick(DialogInterface dialog, int id) { 124 | dialog.cancel(); 125 | } 126 | }); 127 | } 128 | 129 | else if (dialogSelect.equalsIgnoreCase("time")) { 130 | alertDialogBuilder.setView(timeView) 131 | .setPositiveButton("Done", new DialogInterface.OnClickListener() { 132 | public void onClick(DialogInterface dialog, int id) { 133 | TimePicker timePicker = (TimePicker) timeView.findViewById(R.id.timePicker); 134 | int hour = timePicker.getCurrentHour(); 135 | int minute = timePicker.getCurrentMinute(); 136 | int item = 0; 137 | arrToDisplay[0] = Integer.toString(hour); 138 | arrToDisplay[1] = Integer.toString(minute); 139 | 140 | FilterDialogActionsListener callingActivity = (FilterDialogActionsListener) getActivity(); 141 | callingActivity.postFilterDialogActions(dialogType, arrSelectBool, arrToDisplay, item); 142 | 143 | dialog.dismiss(); 144 | } 145 | }) 146 | .setCustomTitle(null); 147 | } 148 | 149 | else 150 | { 151 | alertDialogBuilder.setSingleChoiceItems(arrToDisplay, singleSelect, new DialogInterface.OnClickListener() { 152 | public void onClick(DialogInterface dialog, int item) { 153 | Log.i("INFO", "selected -> " + item); 154 | FilterDialogActionsListener callingActivity = (FilterDialogActionsListener) getActivity(); 155 | callingActivity.postFilterDialogActions(dialogType, arrSelectBool, arrToDisplay, item); 156 | dialog.dismiss(); 157 | } 158 | }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 159 | public void onClick(DialogInterface dialog, int id) { 160 | dialog.cancel(); 161 | } 162 | }); 163 | } 164 | 165 | 166 | // create alert dialog 167 | AlertDialog dialog = alertDialogBuilder.create(); 168 | 169 | dialog.setOnShowListener(new DialogInterface.OnShowListener() { 170 | @Override 171 | public void onShow(DialogInterface dialog) { 172 | Button positiveButton = ((AlertDialog) dialog) 173 | .getButton(AlertDialog.BUTTON_POSITIVE); 174 | positiveButton.setBackgroundResource(R.drawable.custom_filter_action_button); 175 | positiveButton.setTextColor(getResources().getColor(R.color.white)); 176 | 177 | Button negativeButton = ((AlertDialog) dialog) 178 | .getButton(AlertDialog.BUTTON_NEGATIVE); 179 | negativeButton.setBackgroundResource(R.drawable.custom_filter_action_button); 180 | negativeButton.setTextColor(getResources().getColor(R.color.white)); 181 | } 182 | }); 183 | 184 | return dialog; 185 | } 186 | 187 | public String toString() { 188 | return getClass().getName() + "@" + Integer.toHexString(hashCode()); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/FavSpacesActivity.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | import android.view.LayoutInflater; 9 | import android.view.Menu; 10 | import android.view.MenuItem; 11 | import android.view.View; 12 | import android.widget.AdapterView; 13 | import android.widget.ListView; 14 | import android.widget.TextView; 15 | 16 | import org.json.JSONArray; 17 | 18 | /** 19 | * Created by ajay alfred on 11/5/13. 20 | * 21 | * Displays user's favorite spaces. 22 | * Currently uses dummy data. 23 | */ 24 | 25 | public class FavSpacesActivity extends Activity { 26 | 27 | //URL to get JSON Array 28 | private static String url = "http://students.washington.edu/ajalfred/space_scout/space_76.json"; 29 | 30 | //Setting variables 31 | private TextView jsonText = null; 32 | private View view; 33 | public String spaceTitles[]; 34 | 35 | //JSON Array 36 | private JSONArray info = null; 37 | 38 | @Override 39 | public void onCreate(Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | 42 | getActionBar().setDisplayShowCustomEnabled(true); 43 | getActionBar().setDisplayShowTitleEnabled(false); 44 | 45 | LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 46 | View v = inflater.inflate(R.layout.custom_pagetitle_actionbar, null); 47 | 48 | TextView pageTitle = (TextView) v.findViewById(R.id.pageTitle); 49 | pageTitle.setText("FAVORITE SPACES"); 50 | 51 | getActionBar().setCustomView(v); 52 | 53 | overridePendingTransition(R.anim.fadein, R.anim.fadeout); 54 | 55 | //set layout view 56 | setContentView(R.layout.layout_space_favs); 57 | 58 | // new JSONParse().execute(); 59 | 60 | spaceTitles = new String[]{"Commons Room 106","Commons Room 108", "Commons Room 107", 61 | "Commons Room 110", "Commons Room 111", "Commons Room 122"}; 62 | 63 | ListView listView = (ListView) findViewById(R.id.lvSpaceList); 64 | 65 | // SpaceListArrayAdapter spaceListArrayAdapter = new SpaceListArrayAdapter(this, spaceTitles); 66 | // listView.setAdapter(spaceListArrayAdapter); 67 | 68 | // listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 69 | // @Override 70 | // public void onItemClick(AdapterView adapterView, View view, int i, long l) { 71 | // Log.i("info","Item -> "+spaceTitles[i]); 72 | // Intent intent = new Intent(getBaseContext(), SpaceDetailsActivity.class); 73 | // intent.putExtra("spaceTitle",spaceTitles[i]); 74 | // startActivity(intent); 75 | // } 76 | // }); 77 | } 78 | 79 | // private class JSONParse extends AsyncTask { 80 | // private ProgressDialog pDialog; 81 | // @Override 82 | // protected void onPreExecute() { 83 | // super.onPreExecute(); 84 | // 85 | // //get TextView 86 | // jsonText = (TextView)findViewById(R.id.json_txt); 87 | // 88 | // pDialog = new ProgressDialog(SpaceListActivity.this); 89 | // pDialog.setMessage("Getting Data ..."); 90 | // pDialog.setIndeterminate(false); 91 | // pDialog.setCancelable(true); 92 | // pDialog.show(); 93 | // 94 | // } 95 | // 96 | // @Override 97 | // protected JSONObject doInBackground(String... args) { 98 | // JSONParser jParser = new JSONParser(); 99 | // 100 | // // Getting JSON from URL 101 | // JSONObject json = jParser.getJSONFromUrl(url); 102 | // return json; 103 | // } 104 | // @Override 105 | // protected void onPostExecute(JSONObject json) { 106 | // pDialog.dismiss(); 107 | // 108 | // try { 109 | // // Getting JSON Array 110 | // JSONObject info = json.getJSONObject("location"); 111 | // 112 | // String toDisplay = "name -> "+info.getString("building_name")+"\n"; 113 | // toDisplay += "floor -> "+info.getString("floor")+"\n"; 114 | // toDisplay += "lat -> "+info.getString("latitude")+"\n"; 115 | // toDisplay += "long -> "+info.getString("longitude")+"\n"; 116 | // 117 | // jsonText.setText(toDisplay); 118 | // 119 | //// JSONObject c = info.getJSONObject(0); 120 | //// 121 | //// // Storing JSON item in a Variable 122 | //// String id = c.getString(TAG_ID); 123 | //// String name = c.getString(TAG_NAME); 124 | //// String email = c.getString(TAG_EMAIL); 125 | //// 126 | //// //Set JSON Data in TextView 127 | //// uid.setText(id); 128 | //// name1.setText(name); 129 | //// email1.setText(email); 130 | // } 131 | // catch(JSONException e){ 132 | // e.printStackTrace(); 133 | // } 134 | // 135 | // } 136 | // } 137 | 138 | @Override 139 | public boolean onCreateOptionsMenu(Menu menu) { 140 | return super.onCreateOptionsMenu(menu); 141 | } 142 | 143 | @Override 144 | public boolean onOptionsItemSelected(MenuItem item) { 145 | switch (item.getItemId()) { 146 | case android.R.id.home: 147 | finish(); 148 | } 149 | return true; 150 | } 151 | 152 | @Override 153 | public void onResume() { 154 | super.onResume(); 155 | } 156 | 157 | public String toString() { 158 | return getClass().getName() + "@" + Integer.toHexString(hashCode()); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/FilterSpacesActivity.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.Menu; 8 | import android.view.MenuInflater; 9 | import android.view.MenuItem; 10 | import android.view.View; 11 | import android.widget.ScrollView; 12 | import android.widget.SeekBar; 13 | import android.widget.TextView; 14 | import android.widget.Toast; 15 | 16 | import java.text.SimpleDateFormat; 17 | import java.util.Calendar; 18 | 19 | /** 20 | * Created by ajay alfred on 11/5/13. 21 | * 22 | * Space filtering dialog. 23 | */ 24 | 25 | public class FilterSpacesActivity extends Activity implements CustomDialogFragment.FilterDialogActionsListener { 26 | 27 | private CustomDialogFragment customDialog = new CustomDialogFragment(); 28 | 29 | public String[] arrToDisplay; 30 | public boolean[] arrSpaceTypeBool; 31 | public int arrSpaceLocBool; 32 | public int arrFromDayBool; 33 | public int arrToDayBool; 34 | public int fromHour = 13; 35 | public int fromMinute = 13; 36 | public int toHour; 37 | public int toMinute; 38 | public boolean[] arrSpaceNoiseBool; 39 | public boolean[] arrSpaceResourcesBool; 40 | public boolean[] arrSpaceFoodBool; 41 | public TextView spaceType, spaceLoc, spaceNoise, spaceCapacity, spaceFromDay, spaceFromTime, spaceToDay, spaceToTime; 42 | public TextView spaceResources, spaceFood; 43 | 44 | private boolean initLoad; 45 | 46 | public int singleSelect; 47 | 48 | public FilterSpacesActivity() { 49 | initLoad = true; 50 | } 51 | 52 | @Override 53 | public void onCreate(Bundle savedInstanceState) { 54 | super.onCreate(savedInstanceState); 55 | 56 | getActionBar().setDisplayShowCustomEnabled(true); 57 | getActionBar().setDisplayShowTitleEnabled(false); 58 | 59 | LayoutInflater inflator = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 60 | View v = inflator.inflate(R.layout.custom_pagetitle_actionbar, null); 61 | 62 | TextView pageTitle = (TextView) v.findViewById(R.id.pageTitle); 63 | pageTitle.setText("FILTER SPACES"); 64 | 65 | getActionBar().setCustomView(v); 66 | 67 | //set layout view 68 | setContentView(R.layout.layout_space_filter); 69 | 70 | if(initLoad){ 71 | //space type list 72 | arrToDisplay = getResources().getStringArray(R.array.space_type_list); 73 | arrSpaceTypeBool = new boolean[arrToDisplay.length]; 74 | for (int i = 0; i < arrSpaceTypeBool.length; i++) { 75 | arrSpaceTypeBool[i] = false; 76 | } 77 | 78 | //space loc single select bool 79 | arrSpaceLocBool = 0; 80 | 81 | //space noise 82 | arrSpaceNoiseBool = new boolean[arrToDisplay.length]; 83 | for (int i = 0; i < arrSpaceNoiseBool.length; i++) { 84 | arrSpaceNoiseBool[i] = false; 85 | } 86 | 87 | //space from day 88 | arrFromDayBool = 0; 89 | 90 | //space to day 91 | arrToDayBool = 0; 92 | 93 | //space resources 94 | arrSpaceResourcesBool = new boolean[arrToDisplay.length]; 95 | for (int i = 0; i < arrSpaceResourcesBool.length; i++) { 96 | arrSpaceResourcesBool[i] = false; 97 | } 98 | 99 | //space food 100 | arrSpaceFoodBool = new boolean[arrToDisplay.length]; 101 | for (int i = 0; i < arrSpaceFoodBool.length; i++) { 102 | arrSpaceFoodBool[i] = false; 103 | } 104 | } 105 | 106 | spaceType = (TextView) findViewById(R.id.spinnerSpaceType); 107 | spaceType.setOnClickListener(new View.OnClickListener() { 108 | @Override 109 | public void onClick(View view) { 110 | 111 | arrToDisplay = getResources().getStringArray(R.array.space_type_list); 112 | 113 | Bundle dialogBundle = new Bundle(); 114 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 115 | dialogBundle.putBooleanArray("arrSpaceTypeBool", arrSpaceTypeBool); 116 | dialogBundle.putString("dialogType", "SpaceType"); 117 | dialogBundle.putString("dialogSelect", "multi"); 118 | dialogBundle.putString("dialogTitle", "Select a space type"); 119 | customDialog.setArguments(dialogBundle); 120 | customDialog.show(getFragmentManager(),"space type dialog"); 121 | 122 | } 123 | }); 124 | 125 | spaceLoc = (TextView) findViewById(R.id.spinnerSpaceLoc); 126 | spaceLoc.setOnClickListener(new View.OnClickListener() { 127 | @Override 128 | public void onClick(View view) { 129 | 130 | arrToDisplay = getResources().getStringArray(R.array.space_loc_list); 131 | 132 | Bundle dialogBundle = new Bundle(); 133 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 134 | dialogBundle.putInt("singleSelect", arrSpaceLocBool); 135 | dialogBundle.putString("dialogType", "SpaceLoc"); 136 | dialogBundle.putString("dialogSelect", "single"); 137 | dialogBundle.putString("dialogTitle", "Select a location"); 138 | customDialog.setArguments(dialogBundle); 139 | customDialog.show(getFragmentManager(),"space loc dialog"); 140 | } 141 | }); 142 | 143 | spaceNoise = (TextView) findViewById(R.id.spinnerSpaceNoise); 144 | spaceNoise.setOnClickListener(new View.OnClickListener() { 145 | @Override 146 | public void onClick(View view) { 147 | 148 | arrToDisplay = getResources().getStringArray(R.array.space_noise_list); 149 | 150 | Bundle dialogBundle = new Bundle(); 151 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 152 | dialogBundle.putBooleanArray("arrSpaceNoiseBool", arrSpaceNoiseBool); 153 | dialogBundle.putString("dialogType", "SpaceNoise"); 154 | dialogBundle.putString("dialogSelect", "multi"); 155 | dialogBundle.putString("dialogTitle", "Noise level"); 156 | customDialog.setArguments(dialogBundle); 157 | customDialog.show(getFragmentManager(),"space noise dialog"); 158 | } 159 | }); 160 | 161 | SeekBar spaceCapacity = (SeekBar) findViewById(R.id.seekerCapacity); 162 | spaceCapacity.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { 163 | 164 | TextView spaceCapValue = (TextView) findViewById(R.id.seekerCapacityValue); 165 | 166 | @Override 167 | public void onProgressChanged(SeekBar seekBar, int progress, boolean b) { 168 | int val = progress / 5; 169 | spaceCapValue.setText("Seats: "+val); 170 | } 171 | 172 | @Override 173 | public void onStartTrackingTouch(SeekBar seekBar) {} 174 | 175 | @Override 176 | public void onStopTrackingTouch(SeekBar seekBar) {} 177 | 178 | }); 179 | 180 | spaceFromDay = (TextView) findViewById(R.id.spinnerSpaceFromDay); 181 | spaceFromDay.setOnClickListener(new View.OnClickListener() { 182 | @Override 183 | public void onClick(View view) { 184 | 185 | arrToDisplay = getResources().getStringArray(R.array.space_timings_daylist); 186 | 187 | Bundle dialogBundle = new Bundle(); 188 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 189 | dialogBundle.putInt("singleSelect", arrFromDayBool); 190 | dialogBundle.putString("dialogType", "SpaceTimeFromDay"); 191 | dialogBundle.putString("dialogSelect", "single"); 192 | dialogBundle.putString("dialogTitle", "Select a day"); 193 | customDialog.setArguments(dialogBundle); 194 | customDialog.show(getFragmentManager(),"from day dialog"); 195 | } 196 | }); 197 | 198 | spaceFromTime = (TextView) findViewById(R.id.spinnerSpaceFromTime); 199 | 200 | //initial time setup 201 | if(initLoad){ 202 | final Calendar c = Calendar.getInstance(); 203 | SimpleDateFormat displayFormat = new SimpleDateFormat("hh:mm a"); 204 | spaceFromTime.setText(displayFormat.format(c.getTime())); 205 | fromHour = c.get(Calendar.HOUR_OF_DAY); 206 | fromMinute = c.get(Calendar.MINUTE); 207 | } 208 | 209 | spaceFromTime.setOnClickListener(new View.OnClickListener() { 210 | @Override 211 | public void onClick(View view) { 212 | arrToDisplay = getResources().getStringArray(R.array.space_timings_daylist); 213 | Bundle dialogBundle = new Bundle(); 214 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 215 | dialogBundle.putString("dialogType", "SpaceFromTime"); 216 | dialogBundle.putString("dialogSelect", "time"); 217 | dialogBundle.putString("dialogTitle", "Select time"); 218 | dialogBundle.putInt("hour", fromHour); 219 | dialogBundle.putInt("minute", fromMinute); 220 | customDialog.setArguments(dialogBundle); 221 | customDialog.show(getFragmentManager(),"from time dialog"); 222 | } 223 | }); 224 | 225 | spaceToDay = (TextView) findViewById(R.id.spinnerSpaceToDay); 226 | spaceToDay.setOnClickListener(new View.OnClickListener() { 227 | @Override 228 | public void onClick(View view) { 229 | 230 | arrToDisplay = getResources().getStringArray(R.array.space_timings_daylist); 231 | 232 | Bundle dialogBundle = new Bundle(); 233 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 234 | dialogBundle.putInt("singleSelect", arrToDayBool); 235 | dialogBundle.putString("dialogType", "SpaceTimeToDay"); 236 | dialogBundle.putString("dialogSelect", "single"); 237 | dialogBundle.putString("dialogTitle", "Select a day"); 238 | customDialog.setArguments(dialogBundle); 239 | customDialog.show(getFragmentManager(),"to day dialog"); 240 | } 241 | }); 242 | 243 | spaceToTime = (TextView) findViewById(R.id.spinnerSpaceToTime); 244 | //initial time setup 245 | if(initLoad){ 246 | final Calendar c = Calendar.getInstance(); 247 | c.add(Calendar.HOUR, 1); 248 | SimpleDateFormat displayFormat = new SimpleDateFormat("hh:mm a"); 249 | spaceToTime.setText(displayFormat.format(c.getTime())); 250 | toHour = c.get(Calendar.HOUR_OF_DAY); 251 | toMinute = c.get(Calendar.MINUTE); 252 | } 253 | 254 | spaceToTime.setOnClickListener(new View.OnClickListener() { 255 | @Override 256 | public void onClick(View view) { 257 | arrToDisplay = getResources().getStringArray(R.array.space_timings_daylist); 258 | Bundle dialogBundle = new Bundle(); 259 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 260 | dialogBundle.putString("dialogType", "SpaceToTime"); 261 | dialogBundle.putString("dialogSelect", "time"); 262 | dialogBundle.putString("dialogTitle", "Select time"); 263 | dialogBundle.putInt("hour", toHour); 264 | dialogBundle.putInt("minute", toMinute); 265 | customDialog.setArguments(dialogBundle); 266 | customDialog.show(getFragmentManager(),"to time dialog"); 267 | } 268 | }); 269 | 270 | spaceResources = (TextView) findViewById(R.id.spinnerSpaceResources); 271 | spaceResources.setOnClickListener(new View.OnClickListener() { 272 | @Override 273 | public void onClick(View view) { 274 | 275 | arrToDisplay = getResources().getStringArray(R.array.space_resources_list); 276 | 277 | Bundle dialogBundle = new Bundle(); 278 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 279 | dialogBundle.putBooleanArray("arrSpaceResourcesBool", arrSpaceResourcesBool); 280 | dialogBundle.putString("dialogType", "SpaceResources"); 281 | dialogBundle.putString("dialogSelect", "multi"); 282 | dialogBundle.putString("dialogTitle", "Resources"); 283 | customDialog.setArguments(dialogBundle); 284 | customDialog.show(getFragmentManager(),"space resources dialog"); 285 | } 286 | }); 287 | 288 | spaceFood = (TextView) findViewById(R.id.spinnerSpaceFood); 289 | spaceFood.setOnClickListener(new View.OnClickListener() { 290 | @Override 291 | public void onClick(View view) { 292 | 293 | arrToDisplay = getResources().getStringArray(R.array.space_food_list); 294 | 295 | Bundle dialogBundle = new Bundle(); 296 | dialogBundle.putStringArray("arrayToDisplay", arrToDisplay); 297 | dialogBundle.putBooleanArray("arrSpaceFoodBool", arrSpaceFoodBool); 298 | dialogBundle.putString("dialogType", "SpaceFood"); 299 | dialogBundle.putString("dialogSelect", "multi"); 300 | dialogBundle.putString("dialogTitle", "Food/Coffee"); 301 | customDialog.setArguments(dialogBundle); 302 | customDialog.show(getFragmentManager(),"space food dialog"); 303 | } 304 | }); 305 | 306 | } 307 | 308 | @Override 309 | public boolean onCreateOptionsMenu(Menu menu) { 310 | MenuInflater inflater = getMenuInflater(); 311 | inflater.inflate(R.menu.filter_spaces, menu); 312 | return super.onCreateOptionsMenu(menu); 313 | } 314 | 315 | @Override 316 | public boolean onOptionsItemSelected(MenuItem item) { 317 | switch (item.getItemId()) { 318 | case android.R.id.home: 319 | finish(); 320 | 321 | case R.id.action_filter_reset: 322 | ScrollView scrollView = (ScrollView) findViewById(R.id.scrollerFilterPage); 323 | Toast toast = Toast.makeText(getBaseContext(), "Filters Reset", Toast.LENGTH_SHORT); 324 | toast.show(); 325 | scrollView.smoothScrollTo(0,0); 326 | } 327 | return true; 328 | // 329 | } 330 | 331 | @Override 332 | public void onResume() { 333 | super.onResume(); 334 | } 335 | 336 | 337 | public void postFilterDialogActions(String dType, boolean[] boolArray, String[] displayArray, int singleSelect) { 338 | 339 | //flip bool flag for initial load 340 | initLoad = false; 341 | String temp = ""; 342 | 343 | if (dType.equalsIgnoreCase("SpaceType")) { 344 | arrSpaceTypeBool = boolArray; 345 | for(int i=0; i alertDialogues; 78 | public WeakHashMap toasts; 79 | public Buildings buildings; 80 | public Spaces spaces; 81 | public String campus; 82 | public AsyncTask getJson; 83 | 84 | NavMenuListAdapter mNavMenuAdapter; 85 | String[] navItemTitle; 86 | int[] navItemIcon; 87 | 88 | @Override 89 | protected void onCreate(Bundle savedInstanceState) { 90 | super.onCreate(savedInstanceState); 91 | 92 | getActionBar().setDisplayShowCustomEnabled(true); 93 | getActionBar().setDisplayShowTitleEnabled(false); 94 | 95 | // overridePendingTransition(R.anim.fadein, R.anim.fadeout); 96 | 97 | //set content to layout_main 98 | setContentView(R.layout.layout_main); 99 | 100 | //get the title 101 | mTitle = mDrawerTitle = getTitle(); 102 | 103 | //Generate nav menu item title 104 | navItemTitle = new String[]{"All Spaces", "Filter Spaces", "Favorite Spaces"}; 105 | navItemIcon = new int[]{R.drawable.nav_all_spaces, R.drawable.nav_search, R.drawable.nav_fav_spaces}; 106 | 107 | //Locate drawer_layout and drawer ListView in layout_main.xml 108 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 109 | mDrawerList = (ListView) findViewById(R.id.left_drawer); 110 | 111 | // set a custom shadow that overlays the main content when the drawer opens 112 | mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); 113 | 114 | //pass string arrays to NavMenuListAdapter 115 | mNavMenuAdapter = new NavMenuListAdapter(this.getBaseContext(), navItemTitle, navItemIcon); 116 | 117 | //set the NavMenuListAdapter to the ListView 118 | mDrawerList.setAdapter(mNavMenuAdapter); 119 | mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); 120 | 121 | // ActionBarDrawerToggle ties together the the proper interactions 122 | // between the sliding drawer and the action bar app icon 123 | mDrawerToggle = new ActionBarDrawerToggle( 124 | this, /* host Activity */ 125 | mDrawerLayout, /* DrawerLayout object */ 126 | R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ 127 | R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ 128 | R.string.navigation_drawer_close /* "close drawer" description for accessibility */ 129 | ) { 130 | public void onDrawerClosed(View view) { 131 | getActionBar().setTitle(mTitle); 132 | invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 133 | } 134 | 135 | public void onDrawerOpened(View drawerView) { 136 | getActionBar().setTitle(mDrawerTitle); 137 | invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 138 | } 139 | }; 140 | mDrawerLayout.setDrawerListener(mDrawerToggle); 141 | 142 | // enable ActionBar app icon to behave as action to toggle nav drawer 143 | getActionBar().setDisplayHomeAsUpEnabled(true); 144 | getActionBar().setHomeButtonEnabled(true); 145 | 146 | LayoutInflater inflator = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 147 | View v = inflator.inflate(R.layout.custom_title_actionbar, null); 148 | 149 | Typeface typeface = Typeface.createFromAsset(this.getAssets(), "fonts/Manteka.ttf"); 150 | 151 | TextView titleSpace = (TextView) v.findViewById(R.id.titleSpace); 152 | TextView titleScout = (TextView) v.findViewById(R.id.titleScout); 153 | titleSpace.setTypeface(typeface); 154 | titleScout.setTypeface(typeface); 155 | 156 | getActionBar().setCustomView(v); 157 | 158 | // for use the REST section 159 | alertDialogues = new WeakHashMap<>(); 160 | toasts = new WeakHashMap<>(); 161 | jParser = new JSONParser(this); 162 | 163 | // TODO: Need to consider campus selection when settings is set up 164 | campus = "seattle"; 165 | 166 | fragSpaceMap = new SpaceMapFragment(); 167 | fragSpaceList = new SpaceListFragment(); 168 | 169 | // If no saved state: 170 | // get buildings in a campus, 171 | // get spaces based on first position on campus & lay them, 172 | // & select the first item on the nav list. 173 | if (savedInstanceState == null) { 174 | // Default url is set in res > values > .xml that you should create yourself (and not add in git) 175 | String baseUrl = getResources().getString(R.string.baseUrl); 176 | connectToServer(baseUrl + "buildings?campus=" + campus, "buildings"); 177 | 178 | // // Default position is set in res/values/settings.xml 179 | // String centerLat = getResources().getString(R.string.default_center_latitude); 180 | // String centerLon = getResources().getString(R.string.default_center_longitude); 181 | // 182 | // // From calculations, 220 is the (rounded-off) radiance distance 183 | // // of the default zoom level (17.2f) 184 | // String defaultUrl = baseUrl + "spot/?center_latitude=" + centerLat + 185 | // "¢er_longitude=" + centerLon + "&distance=220&open_now=true"; 186 | // connectToServer(defaultUrl, "spaces"); 187 | 188 | selectItem(0); 189 | } 190 | } 191 | 192 | // returns the prepared googlemap from SpaceMapFragment 193 | public GoogleMap getMap() { 194 | return fragSpaceMap.getMap(); 195 | } 196 | 197 | @Override 198 | public boolean onCreateOptionsMenu(Menu menu) { 199 | MenuInflater inflater = getMenuInflater(); 200 | inflater.inflate(R.menu.menu_main, menu); 201 | return super.onCreateOptionsMenu(menu); 202 | } 203 | 204 | /* Called whenever we call invalidateOptionsMenu() */ 205 | @Override 206 | public boolean onPrepareOptionsMenu(Menu menu) { 207 | // If the nav drawer is open, hide action items related to the content view 208 | boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); 209 | 210 | // generalFrag = fragmentManager.findFragmentByTag("SPACE_LIST"); 211 | if (fragSpaceList != null && !drawerOpen 212 | && fragSpaceList.isVisible()) { 213 | 214 | menu.findItem(R.id.action_space_list).setVisible(false); 215 | } else { 216 | menu.findItem(R.id.action_space_map).setVisible(false); 217 | } 218 | 219 | return super.onPrepareOptionsMenu(menu); 220 | } 221 | 222 | @Override 223 | protected void onDestroy() { 224 | super.onDestroy(); 225 | } 226 | 227 | @Override 228 | public boolean onOptionsItemSelected(MenuItem item) { 229 | 230 | // The action bar home/up action should open or close the drawer. 231 | // ActionBarDrawerToggle will take care of this. 232 | if (mDrawerToggle.onOptionsItemSelected(item)) { 233 | return true; 234 | } 235 | 236 | // Handle action buttons 237 | Intent intent; 238 | switch(item.getItemId()) { 239 | //on click of space list action item 240 | case R.id.action_space_list: 241 | Bundle bundle = new Bundle(); 242 | bundle.putParcelableArrayList("spaces", spaces.getAll()); 243 | 244 | fragSpaceList.setArguments(bundle); 245 | getSupportFragmentManager().beginTransaction() 246 | .replace(R.id.container, fragSpaceList) 247 | .addToBackStack(null).commit(); 248 | 249 | invalidateOptionsMenu(); 250 | break; 251 | 252 | case R.id.action_space_map: 253 | getSupportFragmentManager().beginTransaction() 254 | .replace(R.id.container, fragSpaceMap, "fragSpaceMap") 255 | .addToBackStack(null).commit(); 256 | invalidateOptionsMenu(); 257 | break; 258 | 259 | case R.id.action_settings: 260 | intent = new Intent(this, SettingsActivity.class); 261 | startActivity(intent); 262 | break; 263 | 264 | case R.id.action_search: 265 | intent = new Intent(this, FilterSpacesActivity.class); 266 | startActivity(intent); 267 | mDrawerList.setItemChecked(1, true); 268 | break; 269 | } 270 | return super.onOptionsItemSelected(item); 271 | } 272 | 273 | /* The click listener for ListView in the navigation drawer */ 274 | private class DrawerItemClickListener implements ListView.OnItemClickListener { 275 | @Override 276 | public void onItemClick(AdapterView parent, View view, int position, long id) { 277 | selectItem(position); 278 | } 279 | } 280 | 281 | private void selectItem(int position) { 282 | Intent intent; 283 | // Locate Position 284 | switch (position) { 285 | case 0: 286 | getSupportFragmentManager().beginTransaction().replace(R.id.container, fragSpaceMap, "fragSpaceMap").commit(); 287 | invalidateOptionsMenu(); 288 | break; 289 | case 1: 290 | intent = new Intent(this, FilterSpacesActivity.class); 291 | startActivity(intent); 292 | invalidateOptionsMenu(); 293 | break; 294 | case 2: 295 | intent = new Intent(this, FavSpacesActivity.class); 296 | startActivity(intent); 297 | invalidateOptionsMenu(); 298 | break; 299 | case 3: 300 | Toast.makeText(getApplicationContext(), "Settings", Toast.LENGTH_SHORT).show(); 301 | break; 302 | case 4: 303 | Toast.makeText(getApplicationContext(), "About SpaceScout", Toast.LENGTH_SHORT).show(); 304 | break; 305 | } 306 | mDrawerList.setItemChecked(position, true); 307 | mDrawerLayout.closeDrawer(mDrawerList); 308 | mDrawerToggle.syncState(); 309 | } 310 | 311 | @Override 312 | public void setTitle(CharSequence title) { 313 | mTitle = title; 314 | getActionBar().setTitle(mTitle); 315 | } 316 | 317 | /** 318 | * When using the ActionBarDrawerToggle, you must call it during 319 | * onPostCreate() and onConfigurationChanged()... 320 | */ 321 | @Override 322 | protected void onPostCreate(Bundle savedInstanceState) { 323 | super.onPostCreate(savedInstanceState); 324 | // Sync the toggle state after onRestoreInstanceState has occurred. 325 | mDrawerToggle.syncState(); 326 | } 327 | 328 | @Override 329 | public void onConfigurationChanged(Configuration newConfig) { 330 | super.onConfigurationChanged(newConfig); 331 | // Pass any configuration change to the drawer toggls 332 | mDrawerToggle.onConfigurationChanged(newConfig); 333 | } 334 | 335 | // Set the custom action bar with SpaceScout title 336 | @Override 337 | public void onResume() { 338 | super.onResume(); 339 | LayoutInflater inflator = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 340 | View v = inflator.inflate(R.layout.custom_title_actionbar, null); 341 | 342 | Typeface typeface = Typeface.createFromAsset(this.getAssets(), "fonts/Manteka.ttf"); 343 | 344 | TextView titleSpace = (TextView) v.findViewById(R.id.titleSpace); 345 | TextView titleScout = (TextView) v.findViewById(R.id.titleScout); 346 | titleSpace.setTypeface(typeface); 347 | titleScout.setTypeface(typeface); 348 | 349 | getActionBar().setCustomView(v); 350 | } 351 | 352 | @Override 353 | public void onBackPressed() { 354 | if(getSupportFragmentManager().getBackStackEntryCount() > 0) 355 | getSupportFragmentManager().popBackStack(); 356 | else 357 | super.onBackPressed(); 358 | } 359 | 360 | /*** The REST is here ***/ 361 | 362 | public void connectToServer(String url, String item) { 363 | // TODO: Check internet status 364 | currItem = item; 365 | getJson = new getBuildingsOrSpaces(url, item).execute(); 366 | } 367 | 368 | // TODO: Show a circular progress bar when async in progress - pDialog not a good choice 369 | // Asynchronously get JSON data from API. 370 | // Requires URL for request & item ("buildings" or "spaces"). 371 | // Sets global variables based on item string passed. 372 | private class getBuildingsOrSpaces extends AsyncTask { 373 | // private ProgressDialog pDialog; 374 | private String url; 375 | private String item; 376 | protected int statusCode; 377 | 378 | public getBuildingsOrSpaces(String url, String item) { 379 | this.url = url; 380 | this.item = item; 381 | } 382 | 383 | @Override 384 | protected void onPreExecute() { 385 | super.onPreExecute(); 386 | // pDialog = new ProgressDialog(MainActivity.this); 387 | // this.pDialog.setMessage("Filling spaces"); 388 | // pDialog.show(); 389 | } 390 | 391 | @Override 392 | protected JSONArray doInBackground(String... args){ 393 | JSONArray json = getJSONFromUrl(url); 394 | statusCode = jParser.getStatusCode(); 395 | 396 | return json; 397 | } 398 | 399 | // This is run instead of onPostExecute() if cancel(true) is called from outside 400 | @Override 401 | protected void onCancelled() { 402 | jParser.abortConnection(); 403 | // if (pDialog.isShowing()) 404 | // pDialog.dismiss(); 405 | Log.d(TAG, "AsyncTask cancelled"); 406 | fragSpaceMap.sendPostCancelRequest(); 407 | 408 | super.onCancelled(); 409 | } 410 | 411 | @Override 412 | protected void onPostExecute(JSONArray json) { 413 | // if (pDialog.isShowing()) 414 | // pDialog.dismiss() 415 | 416 | if (json == null) { 417 | handleHttpResponse(statusCode, url, item); 418 | } else { 419 | switch (item) { 420 | case "spaces": 421 | spaces = JSONProcessor.modelSpaces(json); 422 | fragSpaceMap.DisplayClustersByDistance(spaces); 423 | break; 424 | case "buildings": 425 | buildings = JSONProcessor.modelBuildings(json); 426 | break; 427 | } 428 | } 429 | } 430 | } 431 | 432 | private JSONArray getJSONFromUrl(String url) { 433 | JSONArray json = new JSONArray(); 434 | try { 435 | json = jParser.getJSONFromUrl(url); 436 | } catch (IOException e) { 437 | e.printStackTrace(); 438 | } 439 | return json; 440 | } 441 | 442 | // handle different status codes 443 | // only continue processing json if code 200 & json is not empty 444 | public void handleHttpResponse(int statusCode, String url, String item) { 445 | switch (statusCode) { 446 | case -1: 447 | Log.d(TAG, "Request was cancelled"); 448 | break; 449 | case 200: 450 | if (item.equals("spaces")) { 451 | Toast toast = Toast.makeText(this, "Sorry, no spaces found", Toast.LENGTH_SHORT); 452 | toasts.put("Sorry, no spaces found", toast); 453 | toast.show(); 454 | } 455 | break; 456 | case 401: 457 | if (item.equals("spaces")) 458 | showStatusDialog("Authentication Issue", "Check key & secret.", url, item); 459 | break; 460 | default: 461 | if (item.equals("spaces")) 462 | showStatusDialog("Connection Issue", "Can't connect to server. Status code: " + 463 | statusCode + ".", url, item); 464 | break; 465 | } 466 | } 467 | 468 | // creates and shows a new dialog modal 469 | // let's user retry connecting to the server 470 | private void showStatusDialog(String title, String message, String url, String item) { 471 | fragSpaceMap.disableMap(true); 472 | 473 | final String theUrl = url; 474 | final String theItem = item; 475 | 476 | AlertDialog.Builder dialogueBuilder = new AlertDialog.Builder(this) 477 | .setTitle(title) 478 | .setMessage(message) 479 | .setPositiveButton("Try Again", new DialogInterface.OnClickListener() { 480 | public void onClick(DialogInterface dialog, int which) { 481 | // retry 482 | Log.d("oauth", "Retrying connection."); 483 | connectToServer(theUrl, theItem); 484 | fragSpaceMap.disableMap(false); 485 | } 486 | }) 487 | .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { 488 | public void onClick(DialogInterface dialog, int which) { 489 | // do nothing 490 | dialog.dismiss(); 491 | fragSpaceMap.disableMap(false); 492 | } 493 | }) 494 | .setIcon(android.R.drawable.ic_dialog_alert); 495 | AlertDialog dialogue = dialogueBuilder.create(); 496 | dialogue.setCanceledOnTouchOutside(false); 497 | alertDialogues.put(title, dialogue); 498 | dialogue.show(); 499 | 500 | Log.d("oauth", "Showing dialogue " + title); 501 | } 502 | 503 | public AlertDialog getUsedDialogue(String key) { 504 | return alertDialogues.get(key); 505 | } 506 | } -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/NavMenuListAdapter.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.BaseAdapter; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | /** 13 | * Created by ajay alfred on 11/4/13. 14 | * 15 | * Adapter for navigation menu. 16 | */ 17 | 18 | public class NavMenuListAdapter extends BaseAdapter { 19 | 20 | //declare variables 21 | Context context; 22 | String[] mTitle; 23 | int[] mIcon; 24 | LayoutInflater inflater; 25 | 26 | public NavMenuListAdapter (Context context, String[] title, int[] icon) { 27 | this.context = context; 28 | this.mTitle = title; 29 | this.mIcon = icon; 30 | } 31 | 32 | 33 | @Override 34 | public int getCount() { 35 | return mTitle.length; 36 | } 37 | 38 | @Override 39 | public Object getItem(int position) { 40 | return mTitle[position]; 41 | } 42 | 43 | @Override 44 | public long getItemId(int position) { 45 | return position; 46 | } 47 | 48 | @Override 49 | public View getView(int position, View convertView, ViewGroup parent) { 50 | 51 | //declare variables 52 | TextView navItemText; 53 | ImageView imgIcon; 54 | 55 | inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 56 | View itemView = inflater.inflate(R.layout.navdrawer_item, parent, false); 57 | 58 | //locate the TextView in navdrawer_item 59 | navItemText = (TextView) itemView.findViewById(R.id.itemText); 60 | 61 | //this is where the custom font for the nav items is initialized 62 | //this isn't working for now 63 | String fontPath = "fonts/MavenPro-Bold.ttf"; 64 | Typeface typeface = Typeface.createFromAsset(context.getAssets(), fontPath); 65 | navItemText.setTypeface(typeface); 66 | 67 | //locate ImageView in navdrawer_item.xml 68 | imgIcon = (ImageView) itemView.findViewById(R.id.icon); 69 | 70 | //set the result into textView 71 | navItemText.setText(mTitle[position]); 72 | 73 | //set the results into ImageView 74 | imgIcon.setImageResource(mIcon[position]); 75 | 76 | return itemView; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.Menu; 8 | import android.view.MenuItem; 9 | import android.view.View; 10 | import android.widget.TextView; 11 | 12 | 13 | public class SettingsActivity extends Activity { 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_settings); 19 | 20 | // Set up action bar 21 | getActionBar().setDisplayShowCustomEnabled(true); 22 | getActionBar().setDisplayShowTitleEnabled(false); 23 | LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 24 | View v = inflater.inflate(R.layout.custom_pagetitle_actionbar, null); 25 | TextView pageTitle = (TextView) v.findViewById(R.id.pageTitle); 26 | pageTitle.setText("SETTINGS"); 27 | getActionBar().setCustomView(v); 28 | 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/SettingsFragment.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.Fragment; 4 | import android.content.SharedPreferences; 5 | import android.os.Bundle; 6 | import android.preference.ListPreference; 7 | import android.preference.Preference; 8 | import android.preference.PreferenceFragment; 9 | import android.preference.PreferenceManager; 10 | import android.util.Log; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | 15 | 16 | /** 17 | * A placeholder fragment containing a simple view. 18 | */ 19 | public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { 20 | private static final String TAG = "SettingsFragment"; 21 | 22 | public SettingsFragment() { 23 | } 24 | 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | addPreferencesFromResource(R.xml.settings); 29 | 30 | ListPreference campusPref = (ListPreference) findPreference("setting_campus"); 31 | if (campusPref != null && campusPref.getEntry() != null) { 32 | campusPref.setSummary(campusPref.getEntry()); 33 | } 34 | 35 | getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); 36 | 37 | // Preference loginPref = findPreference("setting_login"); 38 | // loginPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 39 | // @Override 40 | // public boolean onPreferenceClick(Preference preference) { 41 | // Log.d(TAG, "Logged In! - sike..just clicked"); 42 | // return false; 43 | // } 44 | // }); 45 | } 46 | 47 | @Override 48 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { 49 | Preference pref = findPreference(key); 50 | 51 | Log.d(TAG, "Preference changed!"); 52 | if (pref instanceof ListPreference) { 53 | ListPreference campusPref = (ListPreference) pref; 54 | campusPref.setSummary(campusPref.getEntry()); 55 | } 56 | } 57 | 58 | @Override 59 | public void onDestroy() { 60 | super.onDestroy(); 61 | 62 | getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/SpaceDetailsActivity.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.widget.ImageView; 10 | import android.widget.LinearLayout; 11 | import android.widget.TextView; 12 | 13 | import java.util.ArrayList; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | import edu.uw.spacescout_android.model.Space; 18 | 19 | 20 | public class SpaceDetailsActivity extends Activity { 21 | private static final String TAG = "SpaceDetailsActivity"; 22 | 23 | private Space space; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | 29 | setContentView(R.layout.layout_space_details); 30 | 31 | // Set up action bar 32 | getActionBar().setDisplayShowCustomEnabled(true); 33 | getActionBar().setDisplayShowTitleEnabled(false); 34 | LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 35 | View v = inflater.inflate(R.layout.custom_pagetitle_actionbar, null); 36 | TextView pageTitle = (TextView) v.findViewById(R.id.pageTitle); 37 | pageTitle.setText("SPACE DETAILS"); 38 | getActionBar().setCustomView(v); 39 | 40 | setContentView(R.layout.layout_space_details); 41 | 42 | space = (Space) getIntent().getSerializableExtra("space"); 43 | 44 | ImageView imgView = (ImageView) findViewById(R.id.spaceCarouselImage); 45 | ImageView imgHeart = (ImageView) findViewById(R.id.spaceFavIcon); 46 | TextView txtTitle = (TextView) findViewById(R.id.spaceTitle); 47 | TextView txtType = (TextView) findViewById(R.id.spaceType); 48 | TextView txtCapacity = (TextView) findViewById(R.id.spaceCapacity); 49 | ImageView imgCapacity = (ImageView) findViewById(R.id.image_capacity); 50 | TextView txtDesc = (TextView) findViewById(R.id.locationDesc); 51 | TextView txtMapsLink = (TextView) findViewById(R.id.mapsLink); 52 | // TODO: Currently, the available_hours textviews are set in LinearLayouts. May want to programmatically add them in or hide/unhide 53 | LinearLayout layoutResources = (LinearLayout) findViewById(R.id.layout_resources); 54 | LinearLayout layoutFood = (LinearLayout) findViewById(R.id.layout_food); 55 | LinearLayout layoutNoise = (LinearLayout) findViewById(R.id.layout_noise); 56 | LinearLayout layoutLight = (LinearLayout) findViewById(R.id.layout_light); 57 | 58 | txtTitle.setText(space.getName()); 59 | 60 | // Grabbing the types and their matching text 61 | String[] arrayRaw = getResources().getStringArray(R.array.space_type_key); 62 | String[] arrayTypes = getResources().getStringArray(R.array.space_type_list); 63 | Map arrayMap = new HashMap<>(); 64 | for (int i = 0; i < arrayTypes.length; i++) { 65 | arrayMap.put(arrayRaw[i], arrayTypes[i]); 66 | } 67 | 68 | // TODO: probably wanna change this to be done in the model 69 | // fencepost - set the types with their nice text if it exists in strings.xml 70 | ArrayList types = space.getTypes(); 71 | String type; 72 | if (arrayMap.containsKey(types.get(0))) { 73 | type = arrayMap.get(types.get(0)); 74 | } else { 75 | type = types.get(0); 76 | } 77 | for (int i = 1; i < types.size(); i++) { 78 | String key = types.get(i); 79 | if (arrayMap.containsKey(key)) { 80 | type += arrayMap.get(key); 81 | } 82 | type += ", " + key; 83 | } 84 | txtType.setText(type); 85 | 86 | if(space.getCapacity() > 0) { 87 | txtCapacity.setText("" + space.getCapacity()); 88 | } else { 89 | txtCapacity.setVisibility(View.GONE); 90 | imgCapacity.setVisibility(View.GONE); 91 | } 92 | 93 | txtDesc.setText((String) space.getExtended_info().get("location_description")); 94 | 95 | Log.d(TAG, "Started details page for: " + space.getName()); 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/SpaceListArrayAdapter.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ArrayAdapter; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | import edu.uw.spacescout_android.model.Space; 17 | 18 | /** 19 | * Created by ajay alfred on 11/6/13. 20 | * 21 | * Adapter for SpaceListFragment. 22 | */ 23 | 24 | public class SpaceListArrayAdapter extends ArrayAdapter { 25 | private static final String TAG = "SpaceListArrayAdapter"; 26 | 27 | //define variables 28 | private final Context context; 29 | private final ArrayList values; 30 | private Map arrayMap; 31 | 32 | public SpaceListArrayAdapter(Context context, ArrayList values) { 33 | super(context, R.layout.custom_space_list_row, values); 34 | this.context = context; 35 | this.values = values; 36 | 37 | // Grabbing the types and their matching text 38 | String[] arrayRaw = context.getResources().getStringArray(R.array.space_type_key); 39 | String[] arrayTypes = context.getResources().getStringArray(R.array.space_type_list); 40 | arrayMap = new HashMap<>(); 41 | for (int i = 0; i < arrayTypes.length; i++) { 42 | arrayMap.put(arrayRaw[i], arrayTypes[i]); 43 | } 44 | } 45 | 46 | @Override 47 | public View getView(int index, View convertView, ViewGroup parent) { 48 | Space space = (Space) values.get(index); 49 | 50 | //get LayoutInflater to inflate space list row XML 51 | LayoutInflater inflater = (LayoutInflater) context 52 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 53 | 54 | //get space list row view group 55 | // TODO: Should use view holder pattern 56 | View rowView = inflater.inflate(R.layout.custom_space_list_row, parent, false); 57 | 58 | //get the different views inside the view group 59 | //spaceThumb 60 | ImageView imgSpaceThumb = (ImageView) rowView.findViewById(R.id.spaceThumb); 61 | 62 | //spaceTitle & spaceDesc 63 | TextView txtSpaceTitle = (TextView) rowView.findViewById(R.id.spaceTitle); 64 | TextView txtSpaceType = (TextView) rowView.findViewById(R.id.spaceType); 65 | 66 | //spaceLocation & spaceSeatCount 67 | TextView txtSpaceLoc = (TextView) rowView.findViewById(R.id.spaceLocation); 68 | TextView txtSpaceSeatCount = (TextView) rowView.findViewById(R.id.spaceSeatCount); 69 | ImageView imgSeat = (ImageView) rowView.findViewById(R.id.seatIcon); 70 | 71 | //this is where all the changing is supposed to happen 72 | 73 | txtSpaceTitle.setText(space.getName()); 74 | 75 | // fencepost - set the types with their nice text if it exists in strings.xml 76 | ArrayList types = space.getTypes(); 77 | String type; 78 | if (arrayMap.containsKey(types.get(0))) { 79 | type = arrayMap.get(types.get(0)); 80 | } else { 81 | type = types.get(0); 82 | } 83 | for (int i = 1; i < types.size(); i++) { 84 | String key = types.get(i); 85 | if (arrayMap.containsKey(key)) { 86 | type += arrayMap.get(key); 87 | } 88 | type += ", " + key; 89 | } 90 | txtSpaceType.setText(type); 91 | 92 | // TODO: The layout needs to account for longer descriptions 93 | txtSpaceLoc.setText((String) space.getExtended_info().get("location_description")); 94 | 95 | if(space.getCapacity() > 0) { 96 | txtSpaceSeatCount.setText("" + space.getCapacity()); 97 | } else { 98 | txtSpaceSeatCount.setVisibility(View.GONE); 99 | imgSeat.setVisibility(View.GONE); 100 | } 101 | 102 | return rowView; 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/SpaceListFragment.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.content.Intent; 4 | import android.support.v4.app.Fragment; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.AdapterView; 10 | import android.widget.ListView; 11 | import android.widget.TextView; 12 | 13 | import org.json.JSONArray; 14 | 15 | import java.util.ArrayList; 16 | 17 | import edu.uw.spacescout_android.model.Space; 18 | 19 | /** 20 | * Created by ajay alfred on 11/5/13. 21 | * 22 | * This class displays spaces in a list that corresponds to the results of spaces on maps. 23 | * For now just displays dummy data. 24 | * 25 | */ 26 | 27 | public class SpaceListFragment extends Fragment { 28 | private static final String TAG = "SpaceListFragment"; 29 | 30 | private View view; 31 | 32 | @Override 33 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 34 | Bundle bundle) { 35 | super.onCreate(bundle); 36 | 37 | final ArrayList spaces = (ArrayList) getArguments().get("spaces"); 38 | 39 | if(view == null) 40 | view = inflater.inflate(R.layout.fragment_space_list, container, false); 41 | ListView listView = (ListView) view.findViewById(R.id.lvSpaceList); 42 | 43 | final SpaceListArrayAdapter spaceListArrayAdapter = new SpaceListArrayAdapter(getActivity(), spaces); 44 | listView.setAdapter(spaceListArrayAdapter); 45 | 46 | listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 47 | @Override 48 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 49 | Space space = (Space) spaces.get(i); 50 | 51 | Intent next = new Intent(getActivity(), SpaceDetailsActivity.class); 52 | next.putExtra("space", space); 53 | startActivity(next); 54 | getActivity().overridePendingTransition(R.anim.fadein, R.anim.fadein); 55 | 56 | } 57 | }); 58 | 59 | return view; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/SpaceMapFragment.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.os.Bundle; 7 | import android.preference.PreferenceManager; 8 | import android.support.v4.app.Fragment; 9 | import android.support.v4.app.FragmentTransaction; 10 | import android.util.Log; 11 | import android.view.LayoutInflater; 12 | import android.view.Menu; 13 | import android.view.MenuInflater; 14 | import android.view.MenuItem; 15 | import android.view.View; 16 | import android.view.ViewGroup; 17 | 18 | import com.google.android.gms.maps.CameraUpdateFactory; 19 | import com.google.android.gms.maps.GoogleMap; 20 | import com.google.android.gms.maps.OnMapReadyCallback; 21 | import com.google.android.gms.maps.SupportMapFragment; 22 | import com.google.android.gms.maps.UiSettings; 23 | import com.google.android.gms.maps.model.LatLng; 24 | import com.google.android.gms.maps.model.PolylineOptions; 25 | import com.google.maps.android.clustering.Cluster; 26 | import com.google.maps.android.clustering.ClusterManager; 27 | import com.google.maps.android.clustering.algo.PreCachingAlgorithmDecorator; 28 | import com.google.maps.android.ui.IconGenerator; 29 | 30 | import java.lang.reflect.Array; 31 | import java.util.ArrayList; 32 | 33 | import edu.uw.spacescout_android.model.Space; 34 | import edu.uw.spacescout_android.model.Spaces; 35 | 36 | /** 37 | * Created by ajay alfred on 11/5/13. 38 | * Modified by azri92. 39 | * 40 | * This class displays spaces on a Google map and its markers/clusters. 41 | * Implements OnMapReadyCallback for callback method for preparing the map. 42 | * Requests to server is initiated in onCameraChange within CustomClusterRenderer 43 | */ 44 | 45 | public class SpaceMapFragment extends Fragment implements OnMapReadyCallback, 46 | ClusterManager.OnClusterClickListener, ClusterManager.OnClusterItemClickListener { 47 | private final String TAG = "SpaceMapFragment"; 48 | 49 | // TODO: Should change based on User's preference (campus) 50 | private LatLng campusCenter; 51 | 52 | private GoogleMap map; 53 | private View view; 54 | private ClusterManager mClusterManager; 55 | private CustomClusterRenderer mClusterRenderer; 56 | 57 | public TouchableWrapper mTouchView; 58 | public IconGenerator tc; 59 | 60 | public PolylineOptions line; 61 | 62 | public SpaceMapFragment() { 63 | ///empty constructor required for fragment subclasses 64 | } 65 | 66 | @Override 67 | public void onActivityCreated(Bundle savedInstanceState) { 68 | super.onActivityCreated(savedInstanceState); 69 | 70 | // setRetainInstance(true); 71 | 72 | SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map); 73 | if(mapFragment == null) { // azri92: not sure if this actually helps 74 | mapFragment = SupportMapFragment.newInstance(); 75 | getChildFragmentManager().beginTransaction().replace(R.id.map, mapFragment).commit(); 76 | } 77 | mapFragment.getMapAsync(this); 78 | 79 | SharedPreferences center_setting = PreferenceManager.getDefaultSharedPreferences(getActivity()); 80 | String center = center_setting.getString("setting_campus", null); 81 | 82 | Log.d(TAG, "Got the center: " + center); 83 | 84 | // TODO: Center comes up as null the first couple of times this method is fired... Not sure why yet. 85 | if (center != null) { 86 | String[] lat_long = center.split(", "); 87 | campusCenter = new LatLng(Float.parseFloat(lat_long[0]), Float.parseFloat(lat_long[1])); 88 | } else { 89 | campusCenter = new LatLng(Float.parseFloat(getResources().getString(R.string.default_center_latitude)), 90 | Float.parseFloat(getResources().getString(R.string.default_center_longitude))); 91 | } 92 | // tc = new IconGenerator(getActivity()); 93 | } 94 | 95 | @Override 96 | // Map zoom controls and rotation gesture disabled. 97 | public void onMapReady(GoogleMap googleMap) { 98 | map = googleMap; 99 | UiSettings uiSettings = map.getUiSettings(); 100 | uiSettings.setZoomControlsEnabled(false); 101 | uiSettings.setRotateGesturesEnabled(false); 102 | map.setMapType(GoogleMap.MAP_TYPE_NORMAL); 103 | setUpClustererAndCenterMap(); 104 | } 105 | 106 | public GoogleMap getMap() { 107 | return map; 108 | } 109 | 110 | // Setting up the ClusterManager which would contain all the clusters. 111 | // Sets custom cluster renderer and algorithm. 112 | public void setUpClustererAndCenterMap() { 113 | Log.d(TAG, "setUpClustererAndCenterMap fired"); 114 | if (mClusterManager == null) { 115 | // Initialize the manager with the context and the map. 116 | mClusterManager = new ClusterManager<>(getActivity(), map); 117 | mClusterRenderer = new CustomClusterRenderer(getActivity(), map, mClusterManager); 118 | // To enable OnCameraChange in cluster renderer 119 | map.setOnCameraChangeListener(mClusterRenderer); 120 | // map.setOnCameraChangeListener(mClusterManager); // use this instead to also enable re-clustering on zoom 121 | // To enable marker/cluster listeners in ClusterManager 122 | map.setOnMarkerClickListener(mClusterManager); 123 | mClusterManager.setRenderer(mClusterRenderer); // use a our custom renderer 124 | mClusterManager.setOnClusterClickListener(this); // to override onClusterClick 125 | mClusterManager.setOnClusterItemClickListener(this); // to override onClusterItemClick 126 | // use our custom algorithm to cluster markers 127 | mClusterManager.setAlgorithm(new PreCachingAlgorithmDecorator<>(new CustomClusteringAlgorithm<>())); 128 | } 129 | map.moveCamera(CameraUpdateFactory.newLatLngZoom(campusCenter, 17.2f)); 130 | } 131 | 132 | // Called when a cluster marker is clicked 133 | @Override 134 | public boolean onClusterClick(Cluster cluster) { 135 | ArrayList spaces = (ArrayList) cluster.getItems(); 136 | 137 | Bundle bundle = new Bundle(); 138 | bundle.putParcelableArrayList("spaces", spaces); 139 | 140 | SpaceListFragment spaceListFragment = new SpaceListFragment(); 141 | spaceListFragment.setArguments(bundle); 142 | getActivity().getSupportFragmentManager().beginTransaction() 143 | .replace(R.id.container, spaceListFragment, "spaceListFragment") 144 | .addToBackStack(null).commit(); 145 | 146 | return true; 147 | } 148 | 149 | // Called when a cluster item (one marker) is clicked 150 | @Override 151 | public boolean onClusterItemClick(Space space) { 152 | // TODO: Implement savedInstanceState to save last center coords before moving on to another fragment 153 | Intent next = new Intent(getActivity(), SpaceDetailsActivity.class); 154 | next.putExtra("space", space); 155 | startActivity(next); 156 | getActivity().overridePendingTransition(R.anim.fadein, R.anim.fadein); 157 | 158 | // TODO: Maybe instead of removing them, we should save them & avoid making a request when arriving back from another fragment 159 | // clear map of all markers, etc 160 | // map.clear(); 161 | 162 | return true; 163 | } 164 | 165 | // for use by getBuildingsOrSpaces asynctask in MainActivity 166 | public void sendPostCancelRequest() { 167 | mClusterRenderer.buildAndSendRequest(); 168 | } 169 | 170 | // Implement TouchableWrapper if you want to use gesture recognition 171 | @Override 172 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 173 | Bundle bundle) { 174 | super.onCreate(bundle); 175 | 176 | if(view == null) 177 | view = inflater.inflate(R.layout.fragment_space_map, container, false); 178 | 179 | // mTouchView = new TouchableWrapper(getActivity()); 180 | // TODO: need to avoid restarting fragment on backpress 181 | if(view.getParent() != null) { 182 | ((ViewGroup)view.getParent()).removeView(view); 183 | } 184 | // mTouchView.addView(view); 185 | // return mTouchView; 186 | return view; 187 | } 188 | 189 | // @Override 190 | // public void onResume() { 191 | // super.onResume(); 192 | // Log.d(TAG, "onResume called"); 193 | //// setUpMap(); 194 | // } 195 | 196 | // // Setting up a Map 197 | // private void setUpMap() { 198 | // if (map != null) 199 | // return; 200 | // map = mapFragment.getMap(); 201 | // if(map == null) 202 | // return; 203 | // } 204 | 205 | // TODO: save current conditions here to be reloaded 206 | // @Override 207 | // public void onSaveInstanceState (Bundle savedInstanceState) { 208 | // 209 | // } 210 | 211 | // This method displays the clusters on the map by clustering by distance 212 | // It takes the json data as parameter 213 | public void DisplayClustersByDistance(Spaces spaces){ 214 | mClusterManager.clearItems(); 215 | 216 | // Looping through Spaces model to obtain each Space 217 | for(int i = 0; i < spaces.size(); i++){ 218 | mClusterManager.addItem(spaces.get(i)); 219 | } 220 | mClusterManager.cluster(); 221 | } 222 | 223 | public void disableMap(boolean disable) { 224 | if (map != null) { 225 | if (disable) { 226 | map.getUiSettings().setAllGesturesEnabled(false); 227 | } else { 228 | map.getUiSettings().setAllGesturesEnabled(true); 229 | } 230 | } 231 | } 232 | 233 | // // TODO: Remove this method and integrate clustering by building in clustering 234 | // // This method displays the clusters on the map by clustering by Building Names 235 | // // It takes the json data as parameter 236 | // public void DisplayClustersByBuilding(JSONArray mJson){ 237 | // 238 | // // HashMap to keep track of all buildings with their building objects 239 | // HashMap building_cluster = new HashMap(); 240 | // try { 241 | // 242 | // // Builder object to build bound for all clusters/markers 243 | // LatLngBounds.Builder builder = new LatLngBounds.Builder(); 244 | // 245 | // // Looping through all json data 246 | // for(int i = 0; i < mJson.length(); i++){ 247 | // JSONObject curr = mJson.getJSONObject(i); 248 | // JSONObject info = curr.getJSONObject("extended_info"); 249 | // 250 | // JSONObject location = curr.getJSONObject("location"); 251 | // double lng = Double.parseDouble(location.getString("longitude")); 252 | // double lat = Double.parseDouble(location.getString("latitude")); 253 | // String name = curr.getString("name"); 254 | // String building_name = location.getString("building_name"); 255 | // String campus = info.getString("campus"); 256 | // 257 | // if(campus.equals("seattle") && (!building_cluster.containsKey(building_name))){ 258 | // LatLng currLoc = new LatLng(lat, lng); 259 | // 260 | // // Creating Building Objects with location, building name 261 | // Building buil = new Building(building_name); 262 | // building_cluster.put(building_name, buil); 263 | // builder.include(currLoc); 264 | // }else if(building_cluster.containsKey(building_name)){ 265 | // 266 | // // Increasing the number of spots in the current building 267 | // Building temp = building_cluster.get(building_name); 268 | // temp.increaseSpots(); 269 | // } 270 | // } 271 | // 272 | // // Iterating through the hashmap of all buildings to add to the maps 273 | // for (String key : building_cluster.keySet()) { 274 | // Building b = building_cluster.get(key); 275 | // addMarkerToMap(b.getPosition(), b.getSpots()); 276 | // } 277 | // 278 | // LatLngBounds bounds = builder.build(); 279 | // map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 70)); 280 | // } catch (JSONException e) { 281 | // e.printStackTrace(); 282 | // } 283 | // } 284 | // 285 | // // This adds a marker to the map with IconGenerator class 286 | // // The method takes the LatLng object location and text to be put on the marker/cluster as an Integer 287 | // protected void addMarkerToMap(LatLng loc, int text) { 288 | // IconGenerator iconFactory = new IconGenerator(getActivity()); 289 | // addIcon(iconFactory, Integer.toString(text), loc); 290 | // } 291 | // 292 | // // This is the helper method for adding a marker to the map 293 | // // This is invoked by addMarkerToMap 294 | // private void addIcon(IconGenerator iconFactory, String text, LatLng position) { 295 | // iconFactory.setStyle(IconGenerator.STYLE_PURPLE); 296 | // Bitmap bmp = iconFactory.makeIcon(text); 297 | // MarkerOptions markerOptions = new MarkerOptions(). 298 | // icon(BitmapDescriptorFactory.fromBitmap(bmp)). 299 | // position(position). 300 | // anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV()); 301 | // 302 | // map.addMarker(markerOptions); 303 | // } 304 | 305 | } 306 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/TimePickerFragment.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.app.Dialog; 4 | import android.app.DialogFragment; 5 | import android.app.TimePickerDialog; 6 | import android.os.Bundle; 7 | import android.text.format.DateFormat; 8 | import android.widget.TimePicker; 9 | 10 | import java.util.Calendar; 11 | 12 | /** 13 | * Created by ajay alfred on 11/5/13. 14 | * 15 | * A time picker - not used yet. 16 | */ 17 | 18 | public class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener { 19 | 20 | @Override 21 | public Dialog onCreateDialog(Bundle savedInstanceState) { 22 | // Use the current time as the default values for the picker 23 | final Calendar c = Calendar.getInstance(); 24 | int hour = c.get(Calendar.HOUR_OF_DAY); 25 | int minute = c.get(Calendar.MINUTE); 26 | 27 | TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(), this, hour, minute, 28 | DateFormat.is24HourFormat(getActivity())); 29 | 30 | // Create a new instance of TimePickerDialog and return it 31 | return timePickerDialog; 32 | } 33 | 34 | public void onTimeSet(TimePicker view, int hourOfDay, int minute) { 35 | // Do something with the time chosen by the user 36 | } 37 | 38 | public String toString() { 39 | return getClass().getName() + "@" + Integer.toHexString(hashCode()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/TouchableWrapper.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.widget.FrameLayout; 8 | 9 | import com.google.android.gms.maps.CameraUpdateFactory; 10 | import com.google.android.gms.maps.GoogleMap; 11 | 12 | /** 13 | * Created by gupta37 on 5/23/14. 14 | * 15 | * Intercepts touch events on View. Uses Activity for context. 16 | */ 17 | 18 | public class TouchableWrapper extends FrameLayout { 19 | private static final String TAG = "TouchableWrapper"; 20 | 21 | // private UpdateMapAfterUserInteraction updateMapAfterUserInteraction; 22 | private Context mContext; 23 | private static boolean mapIsTouched = false; 24 | 25 | public TouchableWrapper(Context context) { 26 | super(context); 27 | mContext = context; 28 | // Force the host activity to implement the UpdateMapAfterUserInteraction Interface 29 | // try { 30 | // updateMapAfterUserInteraction = (MainActivity) context; 31 | // } catch (ClassCastException e) { 32 | // throw new ClassCastException(context.toString() + " must implement UpdateMapAfterUserInteraction"); 33 | // } 34 | } 35 | 36 | @Override 37 | public boolean dispatchTouchEvent(@NonNull MotionEvent event) { 38 | int motion = event.getActionMasked(); 39 | 40 | // For testing purposes 41 | if (motion != MotionEvent.ACTION_MOVE) 42 | Log.d(TAG, "Motion is " + motionToString(motion)); 43 | 44 | if (motion == MotionEvent.ACTION_DOWN || 45 | motion == MotionEvent.ACTION_HOVER_ENTER || 46 | motion == MotionEvent.ACTION_POINTER_DOWN) { 47 | mapIsTouched = true; 48 | } else if (motion == MotionEvent.ACTION_UP) { 49 | mapIsTouched = false; 50 | } else if (motion == MotionEvent.ACTION_HOVER_EXIT || 51 | motion == MotionEvent.ACTION_POINTER_UP) { 52 | mapIsTouched = false; 53 | ((MainActivity) mContext).getMap().moveCamera(CameraUpdateFactory.newCameraPosition( 54 | ((MainActivity) mContext).getMap().getCameraPosition())); 55 | } 56 | 57 | return super.dispatchTouchEvent(event); 58 | } 59 | 60 | public boolean mapIsTouched() { 61 | return mapIsTouched; 62 | } 63 | 64 | // Given an action int, returns a string description. For curiosity. 65 | public static String motionToString(int action) { 66 | switch (action) { 67 | 68 | case MotionEvent.ACTION_DOWN: return "Down"; 69 | case MotionEvent.ACTION_POINTER_DOWN: return "Pointer Down"; 70 | case MotionEvent.ACTION_HOVER_ENTER: return "Hover enter"; 71 | case MotionEvent.ACTION_HOVER_EXIT: return "Hover exit"; 72 | case MotionEvent.ACTION_UP: return "Up"; 73 | case MotionEvent.ACTION_POINTER_UP: return "Pointer Up"; 74 | case MotionEvent.ACTION_OUTSIDE: return "Outside"; 75 | case MotionEvent.ACTION_CANCEL: return "Cancel"; 76 | } 77 | return "not listed"; 78 | } 79 | 80 | // public interface UpdateMapAfterUserInteraction { 81 | // void onUpdateMapAfterUserInteraction(); 82 | // } 83 | } 84 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/model/Building.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.model; 2 | 3 | import com.google.android.gms.maps.model.LatLng; 4 | 5 | /** 6 | * Created by gupta37 on 5/22/14. 7 | * 8 | * Building item for clustering. 9 | */ 10 | 11 | public class Building { 12 | private final String mName; 13 | private LatLng mPosition; 14 | private int mSpots; 15 | 16 | public Building(String name){ 17 | mName = name; 18 | } 19 | 20 | public LatLng getPosition(){ 21 | return mPosition; 22 | } 23 | 24 | public int getSpots(){ 25 | return mSpots; 26 | } 27 | 28 | public String getName(){ 29 | return mName; 30 | } 31 | 32 | public void increaseSpots(){ 33 | mSpots += 1; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/model/Buildings.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by aazri3 on 4/21/15. 8 | * 9 | * Holds a list of Building(s). 10 | */ 11 | public class Buildings { 12 | private List buildings; 13 | 14 | public Buildings() { 15 | buildings = new ArrayList<>(); 16 | } 17 | 18 | public void add(Building building) { 19 | buildings.add(building); 20 | } 21 | 22 | public Building get(int i) { 23 | return buildings.get(i); 24 | } 25 | 26 | public int size() { 27 | return buildings.size(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/model/Space.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.model; 2 | 3 | import com.google.android.gms.maps.model.LatLng; 4 | import com.google.maps.android.clustering.ClusterItem; 5 | 6 | import java.io.Serializable; 7 | import java.util.ArrayList; 8 | import java.util.Date; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * Created by gupta37 on 5/13/14. Modified by aazri3/azri92. 15 | * 16 | * Contains all the details of a Space. 17 | * Implements ClusterItem for marker clustering. 18 | * Implements Serializable (including inner classes) for Fragment-to-Fragment 19 | * transfer in a Bundle object. 20 | */ 21 | 22 | 23 | public class Space implements ClusterItem, Serializable { 24 | private final int id; 25 | private final String name; 26 | private ArrayList types; 27 | private double lat; 28 | private double lng; 29 | private double height_from_sea_level; 30 | private String building_name; 31 | private String floor; 32 | private String room_number; 33 | private int capacity; 34 | private String display_access_restrictions; 35 | private List images; 36 | private Map available_hours; 37 | private String organization; 38 | private String manager; 39 | private Map extended_info; // Object because it can be int, string, etc 40 | private String last_modified; 41 | // private boolean isOpen; 42 | 43 | public Space(int id, double lat, double lng, String name) { 44 | this.id = id; 45 | this.lat = lat; 46 | this.lng = lng; 47 | this.name = name; 48 | images = new ArrayList<>(); 49 | available_hours = new HashMap<>(); 50 | extended_info = new HashMap<>(); 51 | } 52 | 53 | /** classed items **/ 54 | 55 | public static class ImageInfo implements Serializable { 56 | final int id; 57 | public String url; 58 | public String content_type; 59 | public int width; 60 | public int height; 61 | public Date creation_date; 62 | // public String modification_date; 63 | public String user_name; 64 | // public String upload_application; 65 | public String thumbnail_root; 66 | public String description; 67 | // public int display_index; 68 | 69 | public ImageInfo(int id) { 70 | this.id = id; 71 | } 72 | } 73 | 74 | // You would parse through this in a for loop, calling the methods 75 | // for the start & end time 76 | public static class Hours implements Serializable { 77 | protected List hours; // A list of Date[] arrays - operating hours 78 | 79 | public Hours(List hours) { 80 | // this.hours = new ArrayList<>(); 81 | this.hours = hours; 82 | } 83 | 84 | public Date getStart(int i) { 85 | if (i > hours.size()) 86 | throw new NullPointerException("This space does not have that many hours"); 87 | 88 | // String[] array = hours.get(i); 89 | // String hour = array[0]; 90 | // DateFormat formatter = new SimpleDateFormat("HH:mm"); 91 | // return formatter.parse(hour); 92 | 93 | return hours.get(i)[0]; 94 | } 95 | 96 | public Date getEnd(int i) { 97 | if (i > hours.size()) 98 | throw new NullPointerException("This space does not have that many hours"); 99 | 100 | // String[] array = hours.get(i); 101 | // String hour = array[1]; 102 | // DateFormat formatter = new SimpleDateFormat("HH:mm"); 103 | // return formatter.parse(hour); 104 | return hours.get(i)[1]; 105 | } 106 | 107 | public int size() { 108 | return hours.size(); 109 | } 110 | } 111 | 112 | /** Getters **/ 113 | 114 | public int getId() { 115 | return id; 116 | } 117 | 118 | public String getName() { 119 | return name; 120 | } 121 | 122 | public ArrayList getTypes() { 123 | return types; 124 | } 125 | 126 | @Override 127 | public LatLng getPosition() { 128 | return new LatLng(lat, lng); 129 | } 130 | 131 | public double getHeight_from_sea_level() { 132 | return height_from_sea_level; 133 | } 134 | 135 | public String getBuilding() { 136 | return building_name; 137 | } 138 | 139 | public String getFloor() { 140 | return floor; 141 | } 142 | 143 | public String getRoom_number() { 144 | return room_number; 145 | } 146 | 147 | public int getCapacity() { 148 | return capacity; 149 | } 150 | 151 | public String getDisplay_access_restrictions() { 152 | return display_access_restrictions; 153 | } 154 | 155 | public List getImages() { 156 | return images; 157 | } 158 | 159 | public Map getAvailable_hours() { 160 | return available_hours; 161 | } 162 | 163 | public String getOrganization() { 164 | return organization; 165 | } 166 | 167 | public String getManager() { 168 | return manager; 169 | } 170 | 171 | public Map getExtended_info() { 172 | return extended_info; 173 | } 174 | 175 | public String getLast_modified() { 176 | return last_modified; 177 | } 178 | 179 | 180 | /** Setters **/ 181 | 182 | public void setTypes(ArrayList types) { 183 | this.types = types; 184 | } 185 | 186 | public void setHeight_from_sea_level(Double height_from_sea_level) { 187 | this.height_from_sea_level = height_from_sea_level; 188 | } 189 | 190 | public void setBuilding(String buildingName) { 191 | this.building_name = buildingName; 192 | } 193 | 194 | public void setFloor(String floor) { 195 | this.floor = floor; 196 | } 197 | 198 | public void setRoom_number(String room_number) { 199 | this.room_number = room_number; 200 | } 201 | 202 | 203 | public void setCapacity(int capacity) { 204 | this.capacity = capacity; 205 | } 206 | 207 | public void setDisplay_access_restrictions(String display_access_restrictions) { 208 | this.display_access_restrictions = display_access_restrictions; 209 | } 210 | 211 | public void setImages(ArrayList images) { 212 | this.images = images; 213 | } 214 | 215 | public void setAvailable_hours(Map available_hours) { 216 | this.available_hours = available_hours; 217 | } 218 | 219 | public void setOrganization(String organization) { 220 | this.organization = organization; 221 | } 222 | 223 | public void setManager(String manager) { 224 | this.manager = manager; 225 | } 226 | 227 | public void setExtended_info(Map extended_info) { 228 | this.extended_info = extended_info; 229 | } 230 | 231 | public void setLast_modified(String last_modified) { 232 | this.last_modified = last_modified; 233 | } 234 | 235 | /** other methods **/ 236 | public boolean isOpen() { 237 | // TODO: set isOpen 238 | // Should be checked the instant it's asked because time 239 | // is not constant. 240 | return false; 241 | } 242 | } -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/model/Spaces.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by aazri3 on 4/1/15. 8 | * 9 | * Holds a list of Space(s). 10 | */ 11 | 12 | public class Spaces { 13 | private ArrayList spaces; 14 | 15 | public Spaces() { 16 | spaces = new ArrayList<>(); 17 | } 18 | 19 | public void add(Space space) { 20 | spaces.add(space); 21 | } 22 | 23 | public Space get(int i) { 24 | return spaces.get(i); 25 | } 26 | 27 | public int size() { 28 | return spaces.size(); 29 | } 30 | 31 | public ArrayList getAll() { 32 | return spaces; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/util/JSONParser.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.util; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | import org.apache.http.HttpEntity; 7 | import org.apache.http.HttpResponse; 8 | import org.apache.http.client.ClientProtocolException; 9 | import org.apache.http.client.HttpClient; 10 | import org.apache.http.client.methods.HttpGet; 11 | import org.apache.http.conn.HttpHostConnectException; 12 | import org.apache.http.impl.client.DefaultHttpClient; 13 | import org.json.JSONArray; 14 | import org.json.JSONException; 15 | 16 | import java.io.BufferedReader; 17 | import java.io.IOException; 18 | import java.io.InputStream; 19 | import java.io.InputStreamReader; 20 | import java.io.Reader; 21 | import java.io.UnsupportedEncodingException; 22 | 23 | import edu.uw.spacescout_android.R; 24 | import oauth.signpost.OAuthConsumer; 25 | import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer; 26 | 27 | /** 28 | * Created by ajay alfred on 11/5/13. 29 | * Modified by azri azmi 30 | * 31 | * Used to establish an HTTP connection to given URL and process the received JSON file. 32 | * Returns null if HTTP response is other than 200 (success). 33 | * 34 | */ 35 | 36 | public class JSONParser { 37 | private static final String TAG = "JSONParser"; 38 | 39 | static JSONArray jObj = null; 40 | static InputStream is = null; 41 | static String json = ""; 42 | private Context appContext; 43 | private int statusCode; 44 | private HttpGet httpGet; 45 | private HttpClient httpClient; 46 | 47 | // constructor 48 | public JSONParser(Context c) { 49 | appContext = c; 50 | } 51 | 52 | private static String readAll(Reader rd) throws IOException { 53 | StringBuilder sb = new StringBuilder(); 54 | int cp; 55 | while ((cp = rd.read()) != -1) { 56 | sb.append((char) cp); 57 | } 58 | return sb.toString(); 59 | } 60 | 61 | // Connects to the server with the url. Signs the request with signpost for OAuth 1.0. 62 | // Handled exceptions: HttpHostConnectException 63 | public JSONArray getJSONFromUrl(String url) throws IOException { 64 | 65 | OAuthConsumer consumer = new CommonsHttpOAuthConsumer( 66 | appContext.getResources().getString(R.string.consumerKey), 67 | appContext.getResources().getString(R.string.consumerSecret)); 68 | 69 | // Making HTTP request 70 | try { 71 | httpClient = new DefaultHttpClient(); 72 | httpGet = new HttpGet(url); 73 | consumer.sign(httpGet); 74 | // TODO: May want to return null if httpClient is null & think about handling false "no spaces" toast 75 | if (httpClient != null) { 76 | HttpResponse response = httpClient.execute(httpGet); 77 | statusCode = response.getStatusLine().getStatusCode(); 78 | switch (statusCode) { 79 | case 200: 80 | HttpEntity httpEntity = response.getEntity(); 81 | is = httpEntity.getContent(); 82 | break; 83 | case 401: 84 | Log.d("oauth", "Can't authenticate. Check key & secret"); 85 | return null; 86 | default: 87 | Log.d("oauth", "Can't connect to server. Status code " + statusCode + "."); 88 | return null; 89 | } 90 | } else { 91 | return null; 92 | } 93 | } catch (UnsupportedEncodingException | ClientProtocolException e) { 94 | Log.v(TAG, e.toString()); 95 | } catch (HttpHostConnectException e) { 96 | Log.d("oauth", "Server is probably down or request was canceled."); 97 | return null; 98 | } catch (Exception e) { 99 | Log.v(TAG, e.toString()); 100 | } 101 | 102 | try { 103 | //TODO: BufferedReader also gives out an internal error when request is cancelled 104 | BufferedReader reader = new BufferedReader(new InputStreamReader( 105 | is, "iso-8859-1"), 8); 106 | StringBuilder sb = new StringBuilder(); 107 | String line; 108 | while ((line = reader.readLine()) != null) { 109 | sb.append(line).append("\n"); 110 | } 111 | is.close(); 112 | json = sb.toString(); 113 | } catch (Exception e) { 114 | Log.v("Buffer Error", "Error converting result " + e.toString()); 115 | } 116 | 117 | // try parse the string to a JSON object 118 | try { 119 | jObj = new JSONArray(json); 120 | } catch (JSONException e) { 121 | Log.v(TAG, "Error parsing data " + e.toString()); 122 | } 123 | 124 | // return JSON String 125 | return jObj; 126 | } 127 | 128 | public void abortConnection() { 129 | if (httpClient != null) { 130 | httpGet.abort(); 131 | } 132 | if (httpClient != null) { 133 | httpClient.getConnectionManager().shutdown(); 134 | httpClient = null; 135 | } 136 | statusCode = -1; 137 | } 138 | 139 | public int getStatusCode() { 140 | return statusCode; 141 | } 142 | } -------------------------------------------------------------------------------- /SpaceScout/src/main/java/edu/uw/spacescout_android/util/JSONProcessor.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.util; 2 | 3 | import android.util.ArrayMap; 4 | 5 | import org.json.JSONArray; 6 | import org.json.JSONException; 7 | import org.json.JSONObject; 8 | 9 | import java.text.DateFormat; 10 | import java.text.ParseException; 11 | import java.text.SimpleDateFormat; 12 | import java.util.ArrayList; 13 | import java.util.Date; 14 | import java.util.HashMap; 15 | import java.util.Iterator; 16 | import java.util.List; 17 | import java.util.Locale; 18 | import java.util.Map; 19 | 20 | import edu.uw.spacescout_android.model.Building; 21 | import edu.uw.spacescout_android.model.Buildings; 22 | import edu.uw.spacescout_android.model.Space; 23 | import edu.uw.spacescout_android.model.Spaces; 24 | 25 | /** 26 | * Created by aazri3 on 4/10/15. 27 | * 28 | * This class processes JSONArray into model objects. 29 | * Using "opt" for accessing json data returns a null if the key does not exist. 30 | */ 31 | public class JSONProcessor { 32 | // Accepts a JSONArray 33 | // Returns a Spaces object (a List of Space objects) 34 | public static Spaces modelSpaces(JSONArray json) { 35 | Spaces spaces = new Spaces(); 36 | 37 | try { 38 | for (int i = 0; i < json.length(); i++) { 39 | JSONObject curr = json.getJSONObject(i); 40 | 41 | int id = Integer.parseInt(curr.getString("id")); 42 | String name = curr.getString("name"); 43 | JSONObject location = curr.getJSONObject("location"); 44 | double lng = location.getDouble("longitude"); 45 | double lat = Double.parseDouble(location.getString("latitude")); 46 | 47 | Space space = new Space(id, lat, lng, name); 48 | 49 | JSONArray jsonTypes = curr.getJSONArray("type"); 50 | ArrayList types = new ArrayList<>(); 51 | for (int j = 0; j < jsonTypes.length(); j++) { 52 | types.add(jsonTypes.getString(j)); 53 | } 54 | space.setTypes(types); 55 | 56 | if (location.get("height_from_sea_level") != JSONObject.NULL) 57 | space.setHeight_from_sea_level(location.getDouble("height_from_sea_level")); 58 | space.setBuilding(location.getString("building_name")); 59 | space.setFloor(location.getString("floor")); 60 | space.setRoom_number(location.getString("room_number")); 61 | if (curr.opt("capacity") != null && curr.opt("capacity") != JSONObject.NULL) 62 | space.setCapacity(curr.getInt("capacity")); 63 | space.setDisplay_access_restrictions(curr.getString("display_access_restrictions")); 64 | space.setOrganization(curr.getString("organization")); 65 | space.setManager(curr.getString("manager")); 66 | space.setLast_modified(curr.getString("last_modified")); 67 | 68 | if (curr.get("images") != null) { 69 | JSONArray jsonImages = curr.getJSONArray("images"); 70 | ArrayList images = new ArrayList<>(); 71 | for (int k = 0; k < jsonImages.length(); k++) { 72 | JSONObject jsonImage = jsonImages.getJSONObject(k); 73 | Space.ImageInfo image = new Space.ImageInfo(jsonImage.getInt("id")); 74 | image.content_type = jsonImage.optString("content_type"); 75 | image.width = jsonImage.getInt("width"); 76 | image.height = jsonImage.getInt("height"); 77 | 78 | DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US); 79 | try { 80 | image.creation_date = formatter.parse(jsonImage.getString("creation_date")); 81 | } catch (Exception e) { 82 | e.printStackTrace(); 83 | } 84 | 85 | image.user_name = jsonImage.optString("user_name"); 86 | image.thumbnail_root = jsonImage.getString("thumbnail_root"); 87 | image.description = jsonImage.getString("description"); 88 | 89 | images.add(image); 90 | } 91 | space.setImages(images); 92 | } 93 | 94 | // TODO: Need to look into Date object for isOpen & filtering 95 | Map availableHours = new HashMap<>(); 96 | String[] days = new String[]{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}; 97 | JSONObject allHours = curr.getJSONObject("available_hours"); 98 | for (String day : days) { 99 | JSONArray hoursByDay = allHours.getJSONArray(day); 100 | List hours = new ArrayList<>(); 101 | for (int m = 0; m < hoursByDay.length(); m++) { 102 | Date[] window = new Date[2]; 103 | JSONArray hour = hoursByDay.getJSONArray(m); 104 | SimpleDateFormat formatter = new SimpleDateFormat("HH:mm", Locale.US); 105 | try { 106 | window[0] = formatter.parse(hour.getString(0)); 107 | window[1] = formatter.parse(hour.getString(1)); 108 | } catch (ParseException e) { 109 | e.printStackTrace(); 110 | } 111 | hours.add(window); 112 | } 113 | availableHours.put(day, new Space.Hours(hours)); // map day with array of hours 114 | } 115 | space.setAvailable_hours(availableHours); // put everything inside 116 | 117 | Map extendedInfo = new HashMap<>(); 118 | JSONObject jsonInfo = curr.getJSONObject("extended_info"); 119 | Iterator info = jsonInfo.keys(); 120 | while (info.hasNext()) { 121 | String key = info.next(); 122 | extendedInfo.put(key, jsonInfo.get(key)); 123 | } 124 | space.setExtended_info(extendedInfo); 125 | 126 | spaces.add(space); 127 | } 128 | } catch (JSONException e) { 129 | e.printStackTrace(); 130 | } 131 | 132 | return spaces; 133 | } 134 | 135 | // TODO: model Buildings 136 | public static Buildings modelBuildings(JSONArray json) { 137 | Buildings buildings = new Buildings(); 138 | for (int i = 0; i < json.length(); i++) { 139 | try { 140 | buildings.add(new Building(json.getString(i))); 141 | } catch (JSONException e) { 142 | e.printStackTrace(); 143 | } 144 | } 145 | return buildings; 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/anim/fadein.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/anim/fadeout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-mdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-mdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-mdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-mdpi/ic_drawer.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xhdpi/nav_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xhdpi/nav_search.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/action_search.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/action_space_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/action_space_list.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/action_space_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/action_space_map.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/btn_filter_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/btn_filter_white.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/fav_heart_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/fav_heart_check.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/fav_heart_uncheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/fav_heart_uncheck.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/filter_reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/filter_reset.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/ic_drawer.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/map_pin_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/map_pin_blue.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/nav_all_spaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/nav_all_spaces.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/nav_fav_spaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/nav_fav_spaces.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/nav_map_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/nav_map_view.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/nav_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/nav_search.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/nav_slist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/nav_slist.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/radio_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/radio_off.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/radio_off_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/radio_off_pressed.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/radio_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/radio_on.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/radio_on_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/radio_on_pressed.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/seat_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/seat_icon.png -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/space_img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/space_img.jpg -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable-xxhdpi/space_img_lrg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/SpaceScout/src/main/res/drawable-xxhdpi/space_img_lrg.jpeg -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/actionbar_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/activated_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_dayname_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_dayname_bg_closed.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_filter_action_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_radio.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_space_details_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_spinner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_spinner_txt_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/custom_spinner_txt_hlight.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/filter_btn_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/drawable/filter_reset_btn.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/activity_settings.xml: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/custom_pagetitle_actionbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/custom_space_list_row.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 23 | 24 | 33 | 34 | 43 | 44 | 53 | 54 | 55 | 56 | 65 | 66 | 76 | 77 | 88 | 89 | 90 | 91 | 98 | 99 | 111 | 112 | 121 | 122 | 123 | 124 | 125 | 126 | 131 | 132 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/custom_spinner_row.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/custom_spinner_text.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/custom_time_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/custom_title_actionbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 19 | 20 | 31 | 32 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/dialog_custom_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 21 | 22 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/fragment_space_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/fragment_space_map.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/layout_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 12 | 16 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/layout_space_favs.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/layout/navdrawer_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 28 | 29 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/menu/filter_spaces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/menu/menu_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | 11 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ff525783 4 | #ff7a7fb1 5 | #9984bbdc 6 | #FFFFFFFF 7 | #515151 8 | #25000000 9 | #25000000 10 | #ffc6c6c6 11 | #ffdfdfdf 12 | #ff7fb6d7 13 | #ff4b4b4b 14 | #ff4b4b4b 15 | #ff6d6c6c 16 | #ff6d6c6c 17 | #ff6699C9 18 | #525783 19 | #686d9b 20 | #126699b9 21 | #126699b9 22 | #306699b9 23 | #434D7A 24 | #951e95cc 25 | #95ffffff 26 | #ff84bbdc 27 | #ff6db0d4 28 | #fff7f7f7 29 | #388EADCB 30 | #90bdbdcb 31 | 32 | #FFFF00 33 | #FF00FF 34 | #FF0000 35 | #C0C0C0 36 | #808080 37 | #808000 38 | #800080 39 | #800000 40 | #00FFFF 41 | #00FF00 42 | #ff008c8c 43 | #008000 44 | #0000FF 45 | #000080 46 | #000000 47 | #FFFFF0 48 | #FFFFE0 49 | #FFFF00 50 | #FFFAFA 51 | #FFFAF0 52 | #FFFACD 53 | #FFF8DC 54 | #FFF5EE 55 | #FFF0F5 56 | #FFEFD5 57 | #FFEBCD 58 | #FFE4E1 59 | #FFE4C4 60 | #FFE4B5 61 | #FFDEAD 62 | #FFDAB9 63 | #FFD700 64 | #FFC0CB 65 | #FFB6C1 66 | #FFA500 67 | #FFA07A 68 | #FF8C00 69 | #FF7F50 70 | #FF69B4 71 | #FF6347 72 | #FF4500 73 | #FF1493 74 | #FF00FF 75 | #FF00FF 76 | #FF0000 77 | #FDF5E6 78 | #FAFAD2 79 | #FAF0E6 80 | #FAEBD7 81 | #FA8072 82 | #F8F8FF 83 | #F5FFFA 84 | #F5F5F5 85 | #F5F5DC 86 | #F5DEB3 87 | #F4A460 88 | #F0FFFF 89 | #F0FFF0 90 | #F0F8FF 91 | #F0E68C 92 | #F08080 93 | #EEE8AA 94 | #EE82EE 95 | #E9967A 96 | #E6E6FA 97 | #E0FFFF 98 | #DEB887 99 | #DDA0DD 100 | #DCDCDC 101 | #DC143C 102 | #DB7093 103 | #DAA520 104 | #DA70D6 105 | #D8BFD8 106 | #D3D3D3 107 | #D2B48C 108 | #D2691E 109 | #CD853F 110 | #CD5C5C 111 | #C71585 112 | #C0C0C0 113 | #BDB76B 114 | #BC8F8F 115 | #BA55D3 116 | #B8860B 117 | #B22222 118 | #B0E0E6 119 | #B0C4DE 120 | #AFEEEE 121 | #ADFF2F 122 | #ADD8E6 123 | #A9A9A9 124 | #A52A2A 125 | #A0522D 126 | #9ACD32 127 | #9932CC 128 | #98FB98 129 | #9400D3 130 | #9370DB 131 | #90EE90 132 | #8FBC8F 133 | #8B4513 134 | #8B008B 135 | #8B0000 136 | #8A2BE2 137 | #87CEFA 138 | #87CEEB 139 | #808080 140 | #808000 141 | #800080 142 | #800000 143 | #7FFFD4 144 | #7FFF00 145 | #7CFC00 146 | #7B68EE 147 | #778899 148 | #708090 149 | #6B8E23 150 | #6A5ACD 151 | #696969 152 | #66CDAA 153 | #6495ED 154 | #5F9EA0 155 | #556B2F 156 | #4B0082 157 | #48D1CC 158 | #4682B4 159 | #4169E1 160 | #40E0D0 161 | #3CB371 162 | #32CD32 163 | #2F4F4F 164 | #2E8B57 165 | #228B22 166 | #20B2AA 167 | #1E90FF 168 | #191970 169 | #00FFFF 170 | #00FFFF 171 | #00FF7F 172 | #00FF00 173 | #00FA9A 174 | #00CED1 175 | #00BFFF 176 | #008B8B 177 | #008080 178 | #008000 179 | #006400 180 | #0000FF 181 | #0000CD 182 | #00008B 183 | #000080 184 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 8 | 235dp 9 | 10 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/values/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 47.655263166697765 5 | -122.30669233862307 6 | 7 | 8 | 9 | 47.655263166697765, -122.30669233862307 10 | 47.24473, -122.43855 11 | 47.761168, -122.190577 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SpaceScout 5 | Space List 6 | Filter Spaces 7 | Open navigation drawer 8 | Close navigation drawer 9 | Search Spaces 10 | List View 11 | Map View 12 | Settings 13 | FILTER SPACES 14 | Type of space 15 | Location 16 | Capacity 17 | Show spaces open 18 | Show reservable spaces only? 19 | ENVIRONMENT 20 | Noise Level 21 | Lighting 22 | Resources 23 | Food/Coffee 24 | Yes 25 | No 26 | No preference 27 | 28 | 29 | 30 | Search Spaces 31 | Space List 32 | My Favorite Spaces 33 | Suggest New Space 34 | Settings 35 | About SpaceScout 36 | 37 | 38 | 39 | Study Room 40 | Open Space 41 | Study Area 42 | Lounge 43 | Computer Lab 44 | Cafe 45 | Production Studio 46 | Outdoor Area 47 | Conference / Classroom 48 | Alcove / Nook 49 | 50 | 51 | 52 | study_room 53 | open 54 | study_area 55 | lounge 56 | computer_lab 57 | cafe 58 | studio 59 | outdoor 60 | classroom 61 | alcove 62 | 63 | 64 | 65 | Entire Campus 66 | Alder Hall 67 | Allen Library(ALB) 68 | Allen Library (ALB) North 69 | Allen Library (ALB) South 70 | Architecture Hall (ARC) 71 | Art Building (ART) 72 | Burke Memorial-Washington State Museum (BMM) 73 | Computer Science and Engineering Building (CSE) 74 | Electrical Engineering Building (EEB) 75 | Engineering Library (ELB) 76 | Fishery Sciences (FSH) 77 | Gould Hall (GLD) 78 | Gowen Hall (GWN) 79 | Haggett Hall (HGT) 80 | Hitchcock Hall (HCK) 81 | Hutchinson Hall (HUT) 82 | Intramural Activities Building (IMA) 83 | Magnuson Health Sciences Center A (HSA) 84 | Magnuson Health Sciences Center C (HSC) 85 | Magnuson Health Sciences Center D (HSD) 86 | Magnuson Health Sciences Center E (HSE) 87 | Magnuson Health Sciences Center I (HSI) 88 | Magnuson Health Sciences Center T (HST) 89 | Mary Gates Hall (MGH) 90 | McCarty Hall (MCC) 91 | McMohan Hall (MCM) 92 | Miller Hall (MLR) 93 | Music Building (MUS) 94 | Odegaard Undergraduate Library (OUGL) 95 | Paccar Hall (PCAR) 96 | Padelford Hall (PDL) 97 | Physics/Astronomy Building (PAB) Tower 98 | Poplar Hall (UTO) 99 | Social Work/Speech & Hearing Sciences Building (SWS) 100 | South Campus Center (SOCC) 101 | Suzzallo Library (SUZ) 102 | William H. Foege Genome Sciences (GNOM) 103 | William H. Gates Hall (LAW) 104 | 105 | 106 | 107 | 108 | MON 109 | TUE 110 | WED 111 | THU 112 | FRI 113 | SAT 114 | SUN 115 | 116 | 117 | 118 | Silent 119 | Low hum 120 | Chatter 121 | 122 | 123 | 124 | Whiteboard 125 | Large Display (for laptop) 126 | Outlets 127 | Projector 128 | Computer 129 | Printing 130 | Scanning 131 | 132 | 133 | 134 | In space 135 | In building 136 | In neighboring building 137 | 138 | 139 | 140 | SettingsActivity 141 | Campus 142 | Selected Campus 143 | Choose your default campus 144 | 145 | UW Seattle 146 | UW Tacoma 147 | UW Bothell 148 | 149 | 150 | Profile 151 | Log In 152 | Log in to save/view favorites 153 | Log Out 154 | 155 | 156 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 12 | 13 | 14 | 18 | 19 | 20 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SpaceScout/src/main/res/xml/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SpaceScout/src/test/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /SpaceScout/src/test/java/edu/uw/spacescout_android/test/HandleHttpResponseTest.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.test; 2 | 3 | import android.app.AlertDialog; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | import android.test.ActivityInstrumentationTestCase2; 7 | 8 | import edu.uw.spacescout_android.MainActivity; 9 | 10 | import org.junit.After; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | import org.junit.runner.RunWith; 14 | 15 | /** 16 | * Tests HTTP Response handling in SpaceMapActivity. 17 | * Test cases: 0 (No response), 401 (Unauthorized), 300 (random other), 18 | * 200 w/ null json (no Spaces found). 19 | * Depends on MainActivity as the Activity that accesses SpaceMapFragment. 20 | */ 21 | 22 | // TODO: Test breaks when conenction is successful. Need to change. 23 | 24 | @RunWith(AndroidJUnit4.class) 25 | public class HandleHttpResponseTest extends ActivityInstrumentationTestCase2 { 26 | private MainActivity mActivity; 27 | 28 | public HandleHttpResponseTest() { 29 | super(MainActivity.class); 30 | } 31 | 32 | @Before 33 | public void setUp() throws Exception { 34 | super.setUp(); 35 | injectInstrumentation(InstrumentationRegistry.getInstrumentation()); 36 | // setActivityInitialTouchMode(false); 37 | 38 | // TODO: try to override onCreate 39 | mActivity = getActivity(); 40 | } 41 | 42 | @Test 43 | public void testPreConditions() { 44 | assertNotNull(mActivity); 45 | getActivity().finish(); 46 | } 47 | 48 | @Test 49 | public void testStatusZero() throws Throwable { 50 | dismissDefaultDialog(); 51 | // calls method weith dummy status & null JSON 52 | getInstrumentation().runOnMainSync(new Runnable() { 53 | @Override 54 | public void run() { 55 | checkDialog(0, "Connection Issue"); 56 | getActivity().finish(); 57 | } 58 | }); 59 | } 60 | 61 | @Test 62 | public void testStatus401() throws Throwable { 63 | dismissDefaultDialog(); 64 | // getInstrumentation().waitForIdleSync(); 65 | getInstrumentation().runOnMainSync(new Runnable() { 66 | @Override 67 | public void run() { 68 | checkDialog(401, "Authentication Issue"); 69 | getActivity().finish(); 70 | } 71 | }); 72 | } 73 | 74 | @Test 75 | public void testStatus200Null() throws Throwable { 76 | dismissDefaultDialog(); 77 | getInstrumentation().runOnMainSync(new Runnable() { 78 | @Override 79 | public void run() { 80 | mActivity.handleHttpResponse(200, "", ""); 81 | // check that toast with given text key exists 82 | assertTrue(mActivity.toasts.containsKey("Sorry, no spaces found")); 83 | getActivity().finish(); 84 | getActivity().finish(); 85 | } 86 | }); 87 | } 88 | 89 | @Test 90 | public void testStatus300() throws Throwable { 91 | dismissDefaultDialog(); 92 | getInstrumentation().runOnMainSync(new Runnable() { 93 | @Override 94 | public void run() { 95 | checkDialog(300, "Connection Issue"); 96 | getActivity().finish(); 97 | } 98 | }); 99 | } 100 | 101 | // Dismisses the default dialogue when the activity fails to connect to the real server 102 | private void dismissDefaultDialog() { 103 | AlertDialog dialog = mActivity.getUsedDialogue("Connection Issue"); 104 | if (dialog != null) { 105 | if (dialog.isShowing()) { 106 | dialog.dismiss(); 107 | mActivity.alertDialogues.clear(); 108 | } 109 | } 110 | // resets the alertDialogues weakHashMap 111 | } 112 | 113 | // Asserts whether the correct dialogue is shown given the status codes 114 | private void checkDialog(int status, String title) { 115 | mActivity.handleHttpResponse(status, "", ""); 116 | // gets the alert dialogue with given title (will error out if doesn't exist) 117 | AlertDialog dialog = mActivity.getUsedDialogue(title); 118 | assertTrue (dialog.isShowing()); 119 | dialog.dismiss(); 120 | } 121 | 122 | @After 123 | public void tearDown() throws Exception { 124 | super.tearDown(); 125 | } 126 | } -------------------------------------------------------------------------------- /SpaceScout/src/test/java/edu/uw/spacescout_android/test/JSONProcessorTest.java: -------------------------------------------------------------------------------- 1 | package edu.uw.spacescout_android.test; 2 | 3 | import android.support.test.runner.AndroidJUnit4; 4 | 5 | import junit.framework.TestCase; 6 | 7 | import org.json.JSONArray; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | import org.junit.runners.JUnit4; 11 | 12 | import java.util.ArrayList; 13 | import java.util.Collection; 14 | import java.util.List; 15 | 16 | import edu.uw.spacescout_android.model.Building; 17 | import edu.uw.spacescout_android.model.Buildings; 18 | import edu.uw.spacescout_android.util.JSONProcessor; 19 | 20 | import static org.junit.Assert.assertTrue; 21 | 22 | /** 23 | * Created by aazri3 on 5/29/15. 24 | * 25 | * Test case: 26 | * Use: Demo JSON 27 | */ 28 | 29 | @RunWith(AndroidJUnit4.class) 30 | public class JSONProcessorTest extends TestCase{ 31 | 32 | // @BeforeClass 33 | // public static void oneTimeSetup() throws Exception { 34 | // 35 | // } 36 | 37 | // @After 38 | // public void tearDown() throws Exception { 39 | // 40 | // } 41 | 42 | @Test 43 | public void testModelSpaces() throws Exception { 44 | Boolean test = true; 45 | assertTrue(test); 46 | } 47 | 48 | @Test 49 | public void testModelBuildings() throws Exception { 50 | 51 | List list = new ArrayList<>(); 52 | list.add("Odegaard"); 53 | list.add("Suzallo"); 54 | list.add("Paccar"); 55 | JSONArray jsonBuildings = new JSONArray(list); 56 | 57 | Buildings buildings = JSONProcessor.modelBuildings(jsonBuildings); 58 | assertTrue(buildings.size() == 3); 59 | 60 | Building firstBuilding = buildings.get(0); 61 | assertTrue(firstBuilding.getName().equals("Odegaard")); 62 | } 63 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | dependencies { 5 | classpath 'com.android.tools.build:gradle:1.1.2' 6 | } 7 | repositories { 8 | jcenter() 9 | } 10 | } 11 | allprojects { 12 | repositories { 13 | jcenter() 14 | } 15 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uw-it-aca/spacescout-android/b10ee32e9a4a79c2a23f68c71456086a4df3470f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 29 10:57:42 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':SpaceScout' 2 | --------------------------------------------------------------------------------