Skip to content
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
123 changes: 123 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
apply plugin: 'kotlin-android'

android {
compileSdk 32
Expand Down Expand Up @@ -58,4 +59,6 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.thousandmiles.models.discount;

import java.util.List;

public class DiscountOffer {
public String serviceProvider ;
public Double discountPrice;
public List <ServiceStationLocation> serviceStationLocations;


// Constructor of Discount offer class
DiscountOffer(String serviceProvider, double discountPrice,List <ServiceStationLocation> serviceStationLocations)
{
// This keyword refers to current instance itself
this.serviceProvider = serviceProvider;
this.discountPrice = discountPrice;
this.serviceStationLocations =serviceStationLocations;


}
public String getServiceProvider() {
return serviceProvider;
}

public void setServiceProvider(String id) {
this.serviceProvider = serviceProvider;
}

public Double getDiscountPrice() {
return discountPrice;
}

public void setDiscountPrice(String icon) {
this.discountPrice = discountPrice;
}

public List<ServiceStationLocation> getServiceStationLocations() {
return serviceStationLocations;
}

public void setServiceStationLocations(List<ServiceStationLocation> serviceStationLocations) {
this.serviceStationLocations = serviceStationLocations;
}

// return price as formatted string
public String discountPriceAsString() {
String price;
price = "USD$" + discountPrice.toString();
return price;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.thousandmiles.models.discount;

public class DiscountOverView {
public Double averageDiscountPrice;
public DiscountOffer bestDiscountOffer;

public Double getAverageDiscountPrice() {
return averageDiscountPrice;
}

public void setAverageDiscountPrice(Double averageDiscountPrice) {
this.averageDiscountPrice = averageDiscountPrice;
}

public DiscountOffer getBestDiscountOffer() {
return bestDiscountOffer;
}

public void setBestDiscountOffer(DiscountOffer bestDiscountOffer) {
this.bestDiscountOffer = bestDiscountOffer;
}
}
88 changes: 88 additions & 0 deletions app/src/main/java/com/thousandmiles/models/discount/Place.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.thousandmiles.models.discount;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONException;
import org.json.JSONObject;


public class Place {

private String id;
private String icon;
private String name;
private String vicinity;
private Double latitude;
private Double longitude;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getIcon() {
return icon;
}

public void setIcon(String icon) {
this.icon = icon;
}

public Double getLatitude() {
return latitude;
}

public void setLatitude(Double latitude) {
this.latitude = latitude;
}

public Double getLongitude() {
return longitude;
}

public void setLongitude(Double longitude) {
this.longitude = longitude;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getVicinity() {
return vicinity;
}

public void setVicinity(String vicinity) {
this.vicinity = vicinity;
}

static Place jsonToPontoReferencia(JSONObject pontoReferencia) {
try {
Place result = new Place();
JSONObject geometry = (JSONObject) pontoReferencia.get("geometry");
JSONObject location = (JSONObject) geometry.get("location");
result.setLatitude((Double) location.get("lat"));
result.setLongitude((Double) location.get("lng"));
result.setIcon(pontoReferencia.getString("icon"));
result.setName(pontoReferencia.getString("name"));
result.setVicinity(pontoReferencia.getString("vicinity"));
result.setId(pontoReferencia.getString("id"));
return result;
} catch (JSONException ex) {
Logger.getLogger(Place.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}

@Override
public String toString() {
return "Place{" + "id=" + id + ", icon=" + icon + ", name=" + name + ", latitude=" + latitude + ", longitude=" + longitude + '}';
}

}
Loading