Comments (7)
Work is being done in this branch:
https://github.com/paulcwatts/onebusaway-android/tree/feature/MultiRegion
from onebusaway-android.
Just an fyi for those following this ticket - I'll be picking up work on this issue.
from onebusaway-android.
Working technical details for the OTP Server Directory, as well as OBA Mobile App changes, are here:
https://github.com/OneBusAway/onebusaway/wiki/Multi-Region
from onebusaway-android.
Equivalent edits are also taking place with OBA Windows Phone app (See https://onebusawaywp7.codeplex.com/workitem/19392#)
from onebusaway-android.
As of 5/16/2013, one of the last major features that needs to be implemented is the initial fetch of regions from the Regions REST API on first app startup after install. This needs to be woven into the existing startup logic, and will add additional latency to startup because of the need to fetch info over the network. Therefore, we need to find a way to show the user that this fetch is happening.
One option is a splashscreen.
After some googling it seems that the design pattern of using a splash screen, and especially a splashscreen in a separate Activity, is something to be avoided.
Android docs:
http://developer.android.com/design/patterns/help.html
http://developer.android.com/training/articles/perf-anr.html
Various articles:
http://cyrilmottier.com/2012/05/03/splash-screens-are-evil-dont-use-them/
http://blog.iangclifton.com/2011/01/01/android-splash-screens-done-right/
Also, none of the Google Android apps (Maps, Google+, Voice, Play, Music, etc.) use splash screens, but just indeterminate progress dialogs within fragments (it appears), presumable with AsyncTasks in the background. Chrome uses a progress bar just under the URL text box, presumably since it’s easier to count the progress of rendering page components.
Advantages of using something like a AsyncTask with a progress dialog include not having to worry about the Activity stack, etc., and it would also be reusable within other Activities/Fragments as well. I think it also gives the user a more uniform experience, since they can see the main OBA screen in the background while we’re loading, instead of throwing them to a separate splash screen.
So, as of right now, our plan is to do an initial implementation that’s similar to the OpenTripPlanner (OTP) Android app using a AsyncTask and ProgressDialog.
OTP Android on Google Play:
https://play.google.com/store/apps/details?id=edu.usf.cutr.opentripplanner.android
OTP Source that fetches OTP regions info on startup:
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/blob/master/src/edu/usf/cutr/opentripplanner/android/fragments/MainFragment.java#L402
from onebusaway-android.
Documenting discussion between Paul and I re: how to handle starred and recent stops/routes lists on region switch. Per below discussion, current plan is to add a new database column.
Asking the user to restart the app is mostly just a precaution, because the backup is copying over the DB file while it could potentially be using it. I'm not sure if we want to be doing this often, because I suspect it could be possible to corrupt the user's DB.
Another option is adding the region ID as a column in the database. When they are saved, the ID of the current region is saved. When they are displayed in a list, we display only those that match either the current region or NULL (for compatibility with existing users).
Obviously this won't handle every case, but it may work for now. Eventually it might be easier to be able to have every activity be able to specifically set the region/context in its requests.
Paul
Paul,
Just realized that we haven’t discussed how to handle the starred and recent stops and routes lists in the context of a region switch. Currently, they just remain on the screen, and if the user taps on them they get the “Sorry that stops wasn’t found” message, which obviously isn’t good.
The easy approach is just to wipe them clean on region switch, but that seems lazy.
How about we use the Backup feature on region switch to save and restore these items?
For example if we are switching from Region A to Region B, we would:
-
Backup the starred/recent stops and routes for the Region A to a file “db_A.backup”
-
Try to restore from a file “db_B.backup” if it exists
I noticed that after executing a restoring a backup in the current OBA app, it asks the user to restart the application. Assuming this is a reasonable approach, what would we need to do to refresh the application state without restarting the app?
Sean
from onebusaway-android.
An issue not discussed above is how to handle inserting or querying stops/routes when Application.get().getCurrentRegion() == null
. Current region can be null when the user enters their own custom API URL via Preferences->OneBusAway API Server
.
Setting regionId when inserting stops/routes is obvious - when stops/routes are inserted and the current regionId is null, the regionId should be set to null.
Seems we have two options for querying routes/stops when current region is null:
- If the current region is null, we should return all stops/routes saved in the database (including those with regionId == null).
- If the current region is null, we should return stops/routes
where regionId = null
.
I'm leaning towards 1 above. Its likely that only power users/admins/developers will be using this feature, and we should err on the side of showing them too much info rather than too little. One potential use case for why we should return all stops is a OBA Server Admin testing on a new OBA server version (i.e., a production OBA instance already exists in the same area). Admin could use recent/starred stops/routes saved on the device from the production server (that have a regionId) to test on a test server with a custom API URL (where the current region would be null).
Or, if we want 2 above, we strictly only show stops/routes that were viewed or starred either while a custom API URL is entered or before the app was updated to a new version that supports regions.
@paulcwatts what do you think?
from onebusaway-android.
Related Issues (20)
- Make background location permission configurable for rebranded apps in build.gradle HOT 1
- accessibility: items not read on main screen with screen reader
- Start with map view with routes and vehicles visible? HOT 1
- Fit and Finish Review HOT 4
- Get CI passing again HOT 1
- Dark Mode Override Doesn't 'Stick' HOT 1
- User Bug Report: Notifications and reminders of bus arrivals have stopped working HOT 1
- Save, Reuse, and Share Planned Trips HOT 1
- Visibility Issue: Circular Progress Loader Color Blend with Header Background
- HTML Parsing Issue : Incorrect parsing of HTML tags in Situation Dialog
- UI - Bike sharing floating action button incorrect spacing
- Improve support for development against a local server
- Edit text issue in Trip Planner. HOT 8
- Trip Planner Bug - APP crashes
- Enhancement: "About"Activity layout needs to be enhanced
- Map and the rest of the app are out of sync on dark mode
- Crashes on clicking news/situations/alerts on stops. HOT 1
- Activity is restarted on orientation HOT 1
- Vehicle labels bounce around vehicle icon when selected on map HOT 3
- Crashes on clicking temporary detour HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onebusaway-android.