Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The hardware search button will now open the PlannerActivity, thanks …
…Zip.
  • Loading branch information
johannilsson committed Apr 25, 2010
1 parent 403b261 commit efa32e6
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 15 deletions.
Expand Up @@ -149,6 +149,14 @@ protected void onPrepareDialog(int id, Dialog dialog) {
}
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}

private DatePickerDialog.OnDateSetListener mDateSetListener =
new DatePickerDialog.OnDateSetListener() {

Expand Down
20 changes: 18 additions & 2 deletions src/com/markupartist/sthlmtraveling/DeparturesActivity.java
Expand Up @@ -156,18 +156,23 @@ private SimpleAdapter createAdapter(DepartureList departureList) {
Map<String, String> map = new HashMap<String, String>();
map.put("line", departure.getLineNumber());
map.put("destination", departure.getDestination());
//map.put("timeToDisplay", departure.getDisplayTime());
//map.put("timeSlDisplay", departure.getDisplayTime());
//map.put("timeTabled", departure.getTimeTabledDateTime().format("%H:%M"));
//map.put("timeExpected", departure.getExpectedDateTime().format("%H:%M"));
map.put("timeToDisplay", humanTimeUntil(now, departure.getExpectedDateTime()));
map.put("groupOfLine", departure.getGroupOfLine());
list.add(map);
}

SimpleAdapter adapter = new SimpleAdapter(this, list,
R.layout.departures_row,
new String[] { "line", "destination", "timeToDisplay", "groupOfLine"},
new String[] { "line", "destination", /*"timeSlDisplay", "timeTabled", "timeExpected",*/ "timeToDisplay", "groupOfLine"},
new int[] {
R.id.departure_line,
R.id.departure_destination,
//R.id.departure_timeSlDisplayTime,
//R.id.departure_timeTabled,
//R.id.departure_timeExpected,
R.id.departure_timeToDisplay,
R.id.departure_color
}
Expand All @@ -180,6 +185,9 @@ public boolean setViewValue(View view, Object data,
switch (view.getId()) {
case R.id.departure_line:
case R.id.departure_destination:
//case R.id.departure_timeTabled:
//case R.id.departure_timeSlDisplayTime:
//case R.id.departure_timeExpected:
case R.id.departure_timeToDisplay:
((TextView)view).setText(textRepresentation);
return true;
Expand Down Expand Up @@ -435,6 +443,14 @@ protected void onDestroy() {
dismissProgress();
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}

/**
* Background job for getting {@link Site}s.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/com/markupartist/sthlmtraveling/DeviationsActivity.java
Expand Up @@ -306,6 +306,14 @@ protected void onDestroy() {
dismissProgress();
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}

/**
* Background job for getting {@link Departure}s.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/com/markupartist/sthlmtraveling/FavoritesActivity.java
Expand Up @@ -115,4 +115,12 @@ protected void onDestroy() {
super.onDestroy();
mFavoritesDbAdapter.close();
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}
}
15 changes: 8 additions & 7 deletions src/com/markupartist/sthlmtraveling/PointOnMapActivity.java
Expand Up @@ -19,13 +19,7 @@
import java.io.IOException;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Paint.Style;
import android.graphics.drawable.Drawable;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
Expand All @@ -43,7 +37,6 @@
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Projection;
import com.markupartist.sthlmtraveling.graphics.FixedMyLocationOverlay;
import com.markupartist.sthlmtraveling.graphics.LabelMarker;
import com.markupartist.sthlmtraveling.provider.planner.Stop;
Expand Down Expand Up @@ -306,4 +299,12 @@ private String getStopName(Location location) {
}
return name;
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}
}
14 changes: 9 additions & 5 deletions src/com/markupartist/sthlmtraveling/RouteDetailActivity.java
Expand Up @@ -29,24 +29,20 @@
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.location.Location;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.format.Time;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.SimpleAdapter.ViewBinder;

import com.markupartist.sthlmtraveling.provider.FavoritesDbAdapter;
import com.markupartist.sthlmtraveling.provider.deviation.Deviation;
import com.markupartist.sthlmtraveling.provider.planner.Planner;
import com.markupartist.sthlmtraveling.provider.planner.Route;
import com.markupartist.sthlmtraveling.provider.planner.RouteDetail;
Expand Down Expand Up @@ -415,7 +411,15 @@ public void sendSms(boolean reducedPrice) {

startActivity(intent);
}


@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}

/**
* Background task for fetching route details.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/com/markupartist/sthlmtraveling/RoutesActivity.java
Expand Up @@ -984,6 +984,14 @@ public static Uri createRoutesUri(Stop startPoint, Stop endPoint, Time time,
return routesUri;
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}

private class RoutesAdapter extends BaseAdapter {

private Context mContext;
Expand Down
Expand Up @@ -170,4 +170,11 @@ private void onCreateShortCut(String siteName) {
finish();
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}
}
9 changes: 9 additions & 0 deletions src/com/markupartist/sthlmtraveling/SettingsActivity.java
Expand Up @@ -2,6 +2,7 @@

import com.markupartist.sthlmtraveling.service.DeviationService;

import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
Expand Down Expand Up @@ -49,4 +50,12 @@ protected void onPause() {
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}
}
1 change: 0 additions & 1 deletion src/com/markupartist/sthlmtraveling/StartActivity.java
Expand Up @@ -58,5 +58,4 @@ protected void onCreate(Bundle savedInstanceState) {
// Start background service.
DeviationService.startAsRepeating(getApplicationContext());
}

}
8 changes: 8 additions & 0 deletions src/com/markupartist/sthlmtraveling/ViewOnMapActivity.java
Expand Up @@ -243,4 +243,12 @@ public boolean onZoom(ZoomEvent zoomEvent, ManagedOverlay managedOverlay) {
});
mOverlayManager.populate();
}

@Override
public boolean onSearchRequested() {
Intent i = new Intent(this, StartActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
return true;
}
}

0 comments on commit efa32e6

Please sign in to comment.