Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycle Atlanta Android multi-region architecture implementation #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ xcuserdata
# We're using source-control, so this is a "feature" that we do not want!

*.moved-aside

.gradle
/local.properties
/.idea/
*.iml
.DS_Store
/build/
41 changes: 11 additions & 30 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.gatech.ppl.cycleatlanta"
android:versionCode="2"
android:versionName="2.0" >

<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="15" />
>

<uses-feature
android:glEsVersion="0x00020000"
Expand All @@ -24,14 +19,18 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>

<uses-sdk android:minSdkVersion="11"></uses-sdk>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:name=".Application"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="edu.gatech.ppl.cycleatlanta.TabsConfig"
android:label="@string/app_name" >
Expand All @@ -41,26 +40,17 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="edu.gatech.ppl.cycleatlanta.MainInputActivity"
android:label="@string/title_activity_main_input" >
</activity>
<activity
android:name="edu.gatech.ppl.cycleatlanta.TripPurposeActivity"
android:label="@string/title_activity_trip_purpose" >
</activity>
<activity
android:name="edu.gatech.ppl.cycleatlanta.UserInfoActivity"
android:label="@string/title_activity_user_info" >
</activity>
<provider
android:name=".provider.ObaProvider"
android:authorities="${databaseAuthority}"/>
<activity
android:name="edu.gatech.ppl.cycleatlanta.TripMapActivity"
android:label="@string/title_activity_trip_map" >
</activity>
<activity
android:name="edu.gatech.ppl.cycleatlanta.SavedTripsActivity"
android:label="@string/title_activity_saved_trips" >
</activity>
<activity
android:name="edu.gatech.ppl.cycleatlanta.TripDetailActivity"
android:label="@string/title_activity_trip_detail" >
Expand All @@ -77,25 +67,16 @@
android:name="edu.gatech.ppl.cycleatlanta.NoteMapActivity"
android:label="@string/title_activity_note_map" >
</activity>
<activity
android:name="edu.gatech.ppl.cycleatlanta.SavedNotesActivity"
android:label="@string/title_activity_saved_notes" >
</activity>

<service
android:name="edu.gatech.ppl.cycleatlanta.RecordingService"
android:enabled="true"
android:exported="true" >
</service>

<activity
android:name="edu.gatech.ppl.cycleatlanta.MainActivity"
android:label="@string/title_activity_main" >
</activity>

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyC2yCvl0Jt-gnztoITh7WTBABv3KdLeD1o" />
android:value="AIzaSyB0nRhRzcprm2h9panNqdBsFzVXRI5JOtE" />
</application>

</manifest>
98 changes: 98 additions & 0 deletions Cycle-Atlanta-Android.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Cycle-Atlanta-Android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build-types/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/8.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="jackson-core-2.6.2" level="project" />
<orderEntry type="library" exported="" name="play-services-location-8.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-maps-8.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-basement-8.3.0" level="project" />
<orderEntry type="library" exported="" name="jackson-annotations-2.6.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-8.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="jackson-databind-2.6.2" level="project" />
</component>
</module>
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Cycle-Atlanta-Android

Cycle Atlanta Android is a multi-region app to collect data from bicyclists.

Cycle Atlanta Android provides:

1. Collecting bicyclists' route information
1. A list of bicyclists' previous trips
1. Ability to add notes to trips


### Prerequisites for both Android Studio and Gradle

1. Clone this repository
1. Install [Java Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)

### Building in Android Studio

1. Download, install, and run the latest version of [Android Studio](http://developer.android.com/sdk/installing/studio.html).
1. At the welcome screen select `Import Project`, browse to the location of this repository and select it then select Ok.
1. Open the Android SDK Manager (Tools->Android->SDK Manager) and add a checkmark for the necessary API level (see `compileSdkVersion` in [`onebusaway-android/build.gradle`](onebusaway-android/build.gradle)) then select OK.
1. Connect a [debugging enabled](https://developer.android.com/tools/device.html) Android device to your computer or setup an Android Virtual Device (Tools->Andorid->AVD Manager).
1. Open the "Build Variants" window (it appears as a vertical button on left side of workspace by default) & choose **obaGoogleDebug** to select the Google Play version, or **obaAmazonDebug** to select the Fire Phone.
1. Click the green play button (or Alt+Shift+F10) to build and run the project!

### Building from the command line using Gradle

1. Set the `JAVA_HOME` environmental variables to point to your JDK folder (e.g. `C:\Program Files\Java\jdk1.6.0_27`)
1. Download and install the [Android SDK](http://developer.android.com/sdk/index.html). Make sure to install the Google APIs for your API level (e.g. 17), the Android SDK Build-tools version for your `buildToolsVersion` version, the Android Support Repository and the Google Repository.
1. Set the `ANDROID_HOME` environmental variable to your Android SDK location.
1. To start the app, run `adb shell am start -n com.joulespersecond.seattlebusbot/org.onebusaway.android.ui.HomeActivity` (alternately, you can manually start the app)

### Release builds

To build a release build, you need to create a `gradle.properties` file that points to a `secure.properties` file, and a `secure.properties` file that points to your keystore and alias.

The `gradle.properties` file is located in the onebusaway-android directory and has the contents:
```
secure.properties=<full_path_to_secure_properties_file>
```

The `secure.properties` file (in the location specified in gradle.properties) has the contents:
```
key.store=<full_path_to_keystore_file>
key.alias=<key_alias_name>
```

Note that the paths in these files always use the Unix path separator `/`, even on Windows. If you use the Windows path separator `\` you will get the error `No value has been specified for property 'signingConfig.keyAlias'.`

### Deploying Cycle Atlanta in Your City

1. Set up your own server and database. See [this page](https://github.com/CUTR-at-USF/cycleatlanta.org/tree/regions) to setup server instructuions.
2. Add your region specs to [this spreadsheet](https://docs.google.com/spreadsheets/d/1g9ROmJh-jhQxU_YfxeovIfAx9EAb3MEvpROx8Aa1-u4/edit#gid=0).

Binary file added apk/Cycle Atlanta.apk
Binary file not shown.
81 changes: 77 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
apply plugin: 'android'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}

allprojects {
repositories {
mavenCentral()
}
}

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':google-play-services_lib')
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.2'
compile 'com.google.android.gms:play-services-location:8.3.0'
}

android {
compileSdkVersion 14
buildToolsVersion "18.1.1"
compileSdkVersion 19
buildToolsVersion "21.0.0"

packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}

sourceSets {
main {
Expand All @@ -32,4 +53,56 @@ android {
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}

buildTypes {
debug {
buildConfigField "boolean", "USE_FIXED_REGION", "false" // Supports multi-region
// Below fields need to be defined so flavor builds, but will not be used by app
//buildConfigField "String", "DATABASE_AUTHORITY", "\"edu.gatech.ppl.cycleatlanta\""
manifestPlaceholders = [databaseAuthority: "edu.gatech.ppl.cycleatlanta"]
buildConfigField "String", "FIXED_REGION_NAME", "null"
buildConfigField "String", "FIXED_REGION_OBA_BASE_URL", "null"
buildConfigField "String", "FIXED_REGION_SIRI_BASE_URL", "null"
buildConfigField "double", "FIXED_REGION_BOUNDS_LAT", "0"
buildConfigField "double", "FIXED_REGION_BOUNDS_LON", "0"
buildConfigField "double", "FIXED_REGION_BOUNDS_LAT_SPAN", "0"
buildConfigField "double", "FIXED_REGION_BOUNDS_LON_SPAN", "0"
buildConfigField "String", "FIXED_REGION_LANG", "null"
buildConfigField "String", "FIXED_REGION_CONTACT_EMAIL", "null"
buildConfigField "boolean", "FIXED_REGION_SUPPORTS_OBA_DISCOVERY_APIS", "true"
buildConfigField "boolean", "FIXED_REGION_SUPPORTS_OBA_REALTIME_APIS", "true"
buildConfigField "boolean", "FIXED_REGION_SUPPORTS_SIRI_REALTIME_APIS", "false"
buildConfigField "String", "FIXED_REGION_TWITTER_URL", "null"
buildConfigField "String", "FIXED_REGION_STOP_INFO_URL", "null"
}

release {
// buildConfigField "String", "DATABASE_AUTHORITY", "\"edu.gatech.ppl.cycleatlanta\""
manifestPlaceholders = [databaseAuthority: "edu.gatech.ppl.cycleatlanta"]
buildConfigField "boolean", "USE_FIXED_REGION", "false" // Supports multi-region
// Below fields need to be defined so flavor builds, but will not be used by app
buildConfigField "String", "FIXED_REGION_NAME", "null"
buildConfigField "String", "FIXED_REGION_OBA_BASE_URL", "null"
buildConfigField "String", "FIXED_REGION_SIRI_BASE_URL", "null"
buildConfigField "double", "FIXED_REGION_BOUNDS_LAT", "0"
buildConfigField "double", "FIXED_REGION_BOUNDS_LON", "0"
buildConfigField "double", "FIXED_REGION_BOUNDS_LAT_SPAN", "0"
buildConfigField "double", "FIXED_REGION_BOUNDS_LON_SPAN", "0"
buildConfigField "String", "FIXED_REGION_LANG", "null"
buildConfigField "String", "FIXED_REGION_CONTACT_EMAIL", "null"
buildConfigField "boolean", "FIXED_REGION_SUPPORTS_OBA_DISCOVERY_APIS", "true"
buildConfigField "boolean", "FIXED_REGION_SUPPORTS_OBA_REALTIME_APIS", "true"
buildConfigField "boolean", "FIXED_REGION_SUPPORTS_SIRI_REALTIME_APIS", "false"
buildConfigField "String", "FIXED_REGION_TWITTER_URL", "null"
buildConfigField "String", "FIXED_REGION_STOP_INFO_URL", "null"
}
}

applicationVariants.all {
variant ->
def authority;
authority = '"' + "edu.gatech.ppl.cycleatlanta" + '"'
// Must keep the original OBA authority
variant.buildConfigField "String", "DATABASE_AUTHORITY", authority
}
}
Loading