Skip to content

Commit

Permalink
updating distance and db filling
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Apr 10, 2012
2 parents 3ac2139 + 038f338 commit 0fa0b46
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 107 deletions.
6 changes: 0 additions & 6 deletions AndroidManifest.xml
Expand Up @@ -105,12 +105,6 @@
android:theme="@android:style/Theme.NoTitleBar" >
</activity>

<!-- In App Billing Test -->
<activity
android:name="com.parking.billing.ParkingPayment"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>

<!-- In App Billing Test -->
<activity android:name="com.parking.billing.ParkingPayment"
android:theme="@android:style/Theme.NoTitleBar">
Expand Down
2 changes: 1 addition & 1 deletion res/layout/findparking.xml
Expand Up @@ -3,5 +3,5 @@
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="03XoekqGKCySL2_Gc539AzHGRor9K_F7DFAoEaA"
android:apiKey="0ZACcfr1oYhq_ijJ7msTt9UtJWbOwUNUuaE0CXQ"
android:clickable="true" />
10 changes: 6 additions & 4 deletions src/com/parking/auth/GetAccountListActivity.java
@@ -1,8 +1,5 @@
package com.parking.auth;

import com.parking.application.ParkingApplication;
import com.parking.dashboard.R;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.ListActivity;
Expand All @@ -14,7 +11,10 @@
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class GetAccountListActivity extends ListActivity {
import com.parking.application.ParkingApplication;
import com.parking.dashboard.R;

public class GetAccountListActivity extends ListActivity{
protected AccountManager accountManager;
protected Intent intent;

Expand Down Expand Up @@ -43,4 +43,6 @@ protected void onListItemClick(ListView l, View v, int position, long id) {
startActivity(intent);
finish();
}


}
11 changes: 3 additions & 8 deletions src/com/parking/billing/ParkingPayment.java
Expand Up @@ -38,7 +38,6 @@
import android.os.Handler;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
Expand All @@ -55,8 +54,6 @@

import com.parking.application.ParkingApplication;
import com.parking.auth.AsyncTaskResultNotifierInterface;
import com.parking.auth.RegisterUserActivity;
import com.parking.auth.RegisterUserAsyncTask;
import com.parking.billing.BillingConstants.PurchaseState;
import com.parking.billing.BillingConstants.ResponseCode;
import com.parking.billing.BillingService.RequestPurchase;
Expand All @@ -70,7 +67,7 @@
* A sample application that demonstrates in-app billing.
*/
public class ParkingPayment extends Activity implements OnClickListener,
OnItemSelectedListener {
OnItemSelectedListener {
private static final String TAG = ParkingPayment.class.getSimpleName();

/**
Expand Down Expand Up @@ -536,10 +533,8 @@ public void onClick(View v) {
/** Update the object */
parkingLocationObj.setDuration(mDurationTotalTimeMinutes);
parkingLocationObj.setQuantity(mTimePeriods);
parkingLocationObj.setStartTimestampMs(
System.currentTimeMillis());
parkingLocationObj.setEndTimestampMs(
System.currentTimeMillis() +
parkingLocationObj.setStartTimestampMs(System.currentTimeMillis());
parkingLocationObj.setEndTimestampMs(System.currentTimeMillis() +
mDurationTotalTimeMinutes*NUM_MILLIS_IN_A_MINUTE);

if (!mBillingService.requestPurchase(mSku, mPayloadContents)) {
Expand Down
4 changes: 3 additions & 1 deletion src/com/parking/dashboard/activity/DashboardActivity.java
Expand Up @@ -19,8 +19,9 @@
import com.parking.findparking.FindParkingTabs;
import com.parking.locatemycar.LocateMyCar;
import com.parking.paymenthistory.PaymentHistory;
import com.parking.towingcontacts.TowingContacts;
import com.parking.rulesandregulations.RulesandRegulations;
import com.parking.towingcontacts.TowingContacts;
import com.parking.utils.Utility;

public class DashboardActivity extends Activity{
private static final String TAG = DashboardActivity.class.getSimpleName();
Expand Down Expand Up @@ -131,4 +132,5 @@ protected void onResume()
Authenticator.authenticate(this.getBaseContext());
}
}

}
100 changes: 48 additions & 52 deletions src/com/parking/dbManager/DataBaseHelper.java
Expand Up @@ -49,20 +49,20 @@ public boolean createDataBase() throws IOException {
boolean retVal = true;

//TODO Uncomment, commented so that the db can be replaced
// if (dbExist) {
// Log.v(TAG, "Database Exists, we can proceed");
// } else {
try {
//Create empty DB & copy our database to the empty DB
this.getReadableDatabase();
retVal = copyDataBase();

} catch (IOException e) {
retVal = false;
throw new Error("Error copying database");
}
// }
// if (dbExist) {
// Log.v(TAG, "Database Exists, we can proceed");
// } else {

try {
//Create empty DB & copy our database to the empty DB
this.getReadableDatabase();
retVal = copyDataBase();

} catch (IOException e) {
retVal = false;
throw new Error("Error copying database");
}
// }

return retVal;
}
Expand Down Expand Up @@ -180,43 +180,42 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

public List<ParkingLocationDataEntry> dbquery(GeoPoint gp, List<ParkingLocationDataEntry> parkingLocations) {

int lat, lng;
int lat, lng;
long meterId;

Log.v(TAG, "dbquery 0 ");
String selection = "Lat LIKE '34.1%'";
Cursor parkingSpotsCursor = myDataBase.query("parking_info", null, selection, null, null, null, null);
if (parkingSpotsCursor != null)
{
if(parkingSpotsCursor.moveToFirst()){
do{

if (parkingSpotsCursor.moveToFirst()) {
do {
ParkingLocationDataEntry pSpotInfo = new ParkingLocationDataEntry();

//Lat Lon
lat = (int) (parkingSpotsCursor.getDouble(parkingSpotsCursor.getColumnIndexOrThrow("Lat")) * 1E6);
lng = (int) (parkingSpotsCursor.getDouble(parkingSpotsCursor.getColumnIndexOrThrow("Lon")) * 1E6);
Log.e(TAG, " Lat: "+lat + " Lon: "+lng);
Log.e(TAG, " Lat: " + lat + " Lon: " + lng);

GeoPoint geoPoint = new GeoPoint(lat, lng);
pSpotInfo.setGeoPoint(geoPoint);
pSpotInfo.setLatitude(lat);
pSpotInfo.setLongitude(lng);

//Meter Id
meterId = (long) parkingSpotsCursor.getInt(parkingSpotsCursor.getColumnIndexOrThrow("MeterId"));
pSpotInfo.setMeterID(meterId);



parkingLocations.add(pSpotInfo);
}while(parkingSpotsCursor.moveToNext());

} while (parkingSpotsCursor.moveToNext());
}

Log.v(TAG, "dbquery 1 > " + parkingSpotsCursor.getColumnCount() + parkingSpotsCursor.getCount());

}

return parkingLocations;

}
Expand Down Expand Up @@ -372,28 +371,25 @@ public double compare (ParkingLocationDataEntry obj1, ParkingLocationDataEntry o
}


class DistanceComparator implements Comparator<ParkingLocationDataEntry>{

@Override
public int compare(ParkingLocationDataEntry obj1, ParkingLocationDataEntry obj2){

/*
* parameter are of type Object, so we have to downcast it
* to Employee objects
*/

double dist1 = obj1.getDistance();
double dist2 = obj2.getDistance();

if(dist1 > dist2)
return 1;
else if(dist1 < dist2)
return -1;
else
return 0;
}


}
class DistanceComparator implements Comparator<ParkingLocationDataEntry> {

@Override
public int compare(ParkingLocationDataEntry obj1, ParkingLocationDataEntry obj2) {

/*
* parameter are of type Object, so we have to downcast it
* to Employee objects
*/

double dist1 = obj1.getDistance();
double dist2 = obj2.getDistance();

if (dist1 > dist2)
return 1;
else if (dist1 < dist2)
return -1;
else
return 0;
}

}
3 changes: 1 addition & 2 deletions src/com/parking/findparking/FindParkingList.java
@@ -1,10 +1,8 @@
package com.parking.findparking;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.SearchManager.OnCancelListener;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
Expand Down Expand Up @@ -59,4 +57,5 @@ public void onClick(View arg0) {

}


}
3 changes: 2 additions & 1 deletion src/com/parking/findparking/FindParkingMap.java
Expand Up @@ -31,7 +31,7 @@
import com.parking.utils.LocationUtility;
import com.parking.utils.ParkingConstants;

public class FindParkingMap extends MapActivity {
public class FindParkingMap extends MapActivity{

private static final String TAG = "FindParkingMap";
private static MapView mapView;
Expand Down Expand Up @@ -260,4 +260,5 @@ private static void updateNewLocationOnMap(Location currentNewLocation) {

}


}
11 changes: 2 additions & 9 deletions src/com/parking/findparking/FindParkingTabs.java
@@ -1,12 +1,3 @@
/*
* Copyright © 2011 QUALCOMM Incorporated. All rights reserved.
*
* This software is the confidential and proprietary information of
* QUALCOMM Incorporated ("Proprietary Information"). You shall not
* disclose such Proprietary Information, and shall use it only in
* accordance with the terms of the license agreement you entered into
* with QUALCOMM Incorporated.
*/
package com.parking.findparking;

import java.util.ArrayList;
Expand All @@ -21,6 +12,7 @@
import com.parking.dashboard.R;
import com.parking.datamanager.ParkingLocationDataEntry;


public class FindParkingTabs extends TabActivity {

public static List<ParkingLocationDataEntry> parkingLocations = new ArrayList<ParkingLocationDataEntry>();
Expand Down Expand Up @@ -53,4 +45,5 @@ public void onCreate(Bundle savedInstanceState) {

tabHost.setCurrentTab(0);
}

}
2 changes: 2 additions & 0 deletions src/com/parking/locatemycar/LocateMyCar.java
Expand Up @@ -5,4 +5,6 @@

public class LocateMyCar extends Activity{



}
8 changes: 1 addition & 7 deletions src/com/parking/paymenthistory/PaymentHistory.java
Expand Up @@ -4,17 +4,14 @@
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

import com.parking.billing.PurchaseDatabase;
import com.parking.dashboard.R;
import com.parking.dashboard.activity.DashboardActivity;
import com.parking.utils.IDashoard;

public class PaymentHistory extends ListActivity implements IDashoard{
public class PaymentHistory extends ListActivity{

private PurchaseDatabase historyTable;
private Cursor historyCursor;
Expand Down Expand Up @@ -48,7 +45,4 @@ private void queryHistory() {
startManagingCursor(historyCursor);
}

public void openHomePage(View v){
Log.e("HomeButton", "OK");
}
}
6 changes: 3 additions & 3 deletions src/com/parking/rulesandregulations/RulesandRegulations.java
Expand Up @@ -3,13 +3,11 @@

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;

import com.parking.dashboard.R;
import com.parking.dashboard.activity.DashboardActivity;

public class RulesandRegulations extends Activity {
public class RulesandRegulations extends Activity{


@Override
Expand All @@ -22,4 +20,6 @@ public void onCreate(Bundle savedInstanceState) {
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.sandiego.gov/parking/enforcement/");
}


}
1 change: 0 additions & 1 deletion src/com/parking/towingcontacts/TowingContacts.java
@@ -1,6 +1,5 @@
package com.parking.towingcontacts;


import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
Expand Down
9 changes: 0 additions & 9 deletions src/com/parking/utils/IDashoard.java

This file was deleted.

0 comments on commit 0fa0b46

Please sign in to comment.