Panagiotis Triantafyllou

telematics additions

......@@ -3,7 +3,7 @@
# The app uuid the warply sdk need to connect to the engage server
# dev f83dfde1145e4c2da69793abb2f579af
# prod 0086a2088301440792091b9f814c2267
Uuid=0086a2088301440792091b9f814c2267
Uuid=f83dfde1145e4c2da69793abb2f579af
# If we need to see logs in Logcat
Debug=false
......@@ -11,7 +11,7 @@ Debug=false
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL=https://engage.warp.ly
BaseURL=https://engage-stage.warp.ly
# For Verify Ticket request
VerifyURL=/partners/cosmote/verify
......
......@@ -66,11 +66,23 @@
android:theme="@style/SDKAppTheme" />
<!-- android:screenOrientation="portrait"-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name="ly.warp.sdk.activities.TelematicsActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"
android:exported="false"
android:configChanges="orientation|screenSize"
android:theme="@style/SDKAppTheme" />
<activity
android:name="ly.warp.sdk.activities.GiftsForYouActivity"
......
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.TelematicsHistory;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.TelematicsHistoryAdapter;
/**
* Created by Panagiotis Triantafyllou on 07/Aug/2023.
*/
public class TelematicsHistoryActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private RecyclerView mRvTripHistory;
private LinearLayout mLlTelematicsHistoryMain;
private ArrayList<TelematicsHistory> mTelematicsHistoryData = new ArrayList<>();
private TelematicsHistoryAdapter mAdapterTelematicsHistory;
private boolean mTelematicsHistoryItemPressed = false;
private ImageView mIvClose;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_telematics_history);
mRvTripHistory = findViewById(R.id.rv_trip_history);
mLlTelematicsHistoryMain = findViewById(R.id.ll_telematics_history_main);
mIvClose = findViewById(R.id.iv_telematics_history_close);
mIvClose.setOnClickListener(this);
WarplyManager.getTelematicsHistory(mTelematicsHistoryCallback);
}
@Override
public void onResume() {
super.onResume();
// WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelematicsActivity");
mTelematicsHistoryItemPressed = false;
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_telematics_history_close) {
onBackPressed();
}
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
if (mTelematicsHistoryData != null && mTelematicsHistoryData.size() > 0) {
mRvTripHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterTelematicsHistory = new TelematicsHistoryAdapter(this, mTelematicsHistoryData);
mRvTripHistory.setAdapter(mAdapterTelematicsHistory);
mAdapterTelematicsHistory.getPositionClicks()
.doOnNext(historyItem -> {
if (!mTelematicsHistoryItemPressed) {
mTelematicsHistoryItemPressed = true;
// WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
Intent intent = new Intent(TelematicsHistoryActivity.this, TelematicsMetricsActivity.class);
intent.putExtra("trip_id", historyItem.getTripId());
startActivity(intent);
}
})
.doOnError(error -> {
})
.subscribe();
} else {
//TODO: empty list view
}
}
private final CallbackReceiver<ArrayList<TelematicsHistory>> mTelematicsHistoryCallback = new CallbackReceiver<ArrayList<TelematicsHistory>>() {
@Override
public void onSuccess(ArrayList<TelematicsHistory> result) {
mTelematicsHistoryData.clear();
mTelematicsHistoryData.addAll(result);
Snackbar.make(mLlTelematicsHistoryMain, "Success getting history", Snackbar.LENGTH_SHORT).show();
initViews();
}
@Override
public void onFailure(int errorCode) {
Snackbar.make(mLlTelematicsHistoryMain, "Error getting history", Snackbar.LENGTH_SHORT).show();
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
package ly.warp.sdk.activities;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.TelematicsHistory;
import ly.warp.sdk.io.models.TripMetrics;
import ly.warp.sdk.utils.managers.WarplyManager;
/**
* Created by Panagiotis Triantafyllou on 07/Aug/2023.
*/
public class TelematicsMetricsActivity extends Activity implements View.OnClickListener {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private LinearLayout mLlTelematicsMetricsMain;
private ImageView mIvClose, mIvRatePositive, mIvRateNegative;
private int mTripId = -1;
private TextView mTvAvgSpeed, mTvNumOfTrips, mTvAccScore, mTvFocusScore, mTvReadinessScore,
mTvSmoothnessScore, mTVTotalKM;
private TripMetrics mTripMetrics;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_telematics_metrics);
mTripId = getIntent().getIntExtra("trip_id", -1);
mLlTelematicsMetricsMain = findViewById(R.id.ll_telematics_metrics_main);
mIvClose = findViewById(R.id.iv_metrics_close);
mIvClose.setOnClickListener(this);
mTvAvgSpeed = findViewById(R.id.tv_metrics_speed_value);
mTvNumOfTrips = findViewById(R.id.tv_metrics_trips_value);
mTvAccScore = findViewById(R.id.tv_metrics_acceleration_value);
mTvFocusScore = findViewById(R.id.tv_metrics_focus_value);
mTvReadinessScore = findViewById(R.id.tv_metrics_readiness_value);
mTvSmoothnessScore = findViewById(R.id.tv_metrics_smoothness_value);
mTVTotalKM = findViewById(R.id.tv_metrics_total_value);
mIvRatePositive = findViewById(R.id.iv_rate_positive);
mIvRateNegative = findViewById(R.id.iv_rate_negative);
mIvRatePositive.setOnClickListener(this);
mIvRateNegative.setOnClickListener(this);
if (mTripId > -1)
WarplyManager.getTripMetrics(mTripId, mTripMetricsCallback);
}
@Override
public void onResume() {
super.onResume();
// WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelematicsActivity");
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_metrics_close) {
onBackPressed();
return;
}
if (view.getId() == R.id.iv_rate_positive) {
WarplyManager.rateTrip(mTripId, true, mRateTripCallback);
return;
}
if (view.getId() == R.id.iv_rate_negative) {
WarplyManager.rateTrip(mTripId, false, mRateTripCallback);
}
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
// ===========================================================
// Methods
// ===========================================================
private void initViews() {
if (mTripMetrics != null) {
mTvAvgSpeed.setText(String.valueOf(mTripMetrics.getAvgSpeed()));
mTvNumOfTrips.setText(String.valueOf(mTripMetrics.getNumOfTrips()));
mTvAccScore.setText(String.valueOf(mTripMetrics.getOverallScore()));
mTvFocusScore.setText(String.valueOf(mTripMetrics.getOverallFocus()));
mTvReadinessScore.setText(String.valueOf(mTripMetrics.getReadinessScore()));
mTvSmoothnessScore.setText(String.valueOf(mTripMetrics.getSmoothnessScore()));
mTVTotalKM.setText(String.valueOf(mTripMetrics.getTotalKM()));
}
}
private final CallbackReceiver<TripMetrics> mTripMetricsCallback = new CallbackReceiver<TripMetrics>() {
@Override
public void onSuccess(TripMetrics result) {
mTripMetrics = result;
Snackbar.make(mLlTelematicsMetricsMain, "Success getting history", Snackbar.LENGTH_SHORT).show();
initViews();
}
@Override
public void onFailure(int errorCode) {
Snackbar.make(mLlTelematicsMetricsMain, "Error getting history", Snackbar.LENGTH_SHORT).show();
}
};
private final CallbackReceiver<Integer> mRateTripCallback = new CallbackReceiver<Integer>() {
@Override
public void onSuccess(Integer result) {
Snackbar.make(mLlTelematicsMetricsMain, "Success rate trip", Snackbar.LENGTH_SHORT).show();
}
@Override
public void onFailure(int errorCode) {
Snackbar.make(mLlTelematicsMetricsMain, "Error rate trip", Snackbar.LENGTH_SHORT).show();
}
};
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
......@@ -23,6 +23,7 @@ import java.util.ArrayList;
import ly.warp.sdk.R;
import ly.warp.sdk.activities.ActiveCouponsActivity;
import ly.warp.sdk.activities.TelematicsActivity;
import ly.warp.sdk.activities.TelematicsHistoryActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
......@@ -34,7 +35,7 @@ import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mRlDriving;
private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mRlDriving, mRlDrivingHistory;
private LinearLayout mLlBillPayment;
private TextView mTvUsername, mTvActiveCoupons;
private ConstraintLayout mClActiveCoupons;
......@@ -87,6 +88,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
mRlDriving = view.findViewById(R.id.rl_driving);
mRlDriving.setOnClickListener(this);
mRlDrivingHistory = view.findViewById(R.id.rl_driving_history);
mRlDrivingHistory.setOnClickListener(this);
}
@Override
......@@ -112,6 +115,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
if (view.getId() == R.id.rl_driving) {
Intent intent = new Intent(getContext(), TelematicsActivity.class);
startActivity(intent);
return;
}
if (view.getId() == R.id.rl_driving_history) {
Intent intent = new Intent(getContext(), TelematicsHistoryActivity.class);
startActivity(intent);
}
}
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.Date;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 07-Aug-23.
*/
public class TelematicsHistory implements Parcelable, Serializable {
private static final long serialVersionUID = -4754964462459705285L;
/* Constants used to export the campaign in JSON formal and vice versa */
private static final String TRIP_ID = "trip_id";
private static final String CREATED = "created";
/* Member variables of the Campaign object */
private int tripId = -1;
private String created = "";
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
*
* @param json The String, representing the JSON Object
* @throws JSONException Thrown if the String cannot be converted to JSON
*/
public TelematicsHistory(String json) throws JSONException {
this(new JSONObject(json));
}
public TelematicsHistory() {
this.tripId = -1;
this.created = "";
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Coupon
*/
public TelematicsHistory(JSONObject json) {
if (json != null) {
this.tripId = json.optInt(TRIP_ID);
this.created = json.optString(CREATED);
}
}
public TelematicsHistory(Parcel source) {
this.tripId = source.readInt();
this.created = source.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.tripId);
dest.writeString(this.created);
}
/**
* Converts the Coupon into a JSON Object
*
* @return The JSON Object created from this Coupon
*/
public JSONObject toJSONObject() {
JSONObject jObj = new JSONObject();
try {
jObj.putOpt(TRIP_ID, this.tripId);
jObj.putOpt(CREATED, this.created);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
}
}
return jObj;
}
/**
* String representation of the Coupon, as a JSON object
*
* @return A String representation of JSON object
*/
public String toString() {
if (toJSONObject() != null)
return toJSONObject().toString();
return null;
}
/**
* String representation of the Coupon, as a human readable JSON object
*
* @return A human readable String representation of JSON object
*/
public String toHumanReadableString() {
String humanReadableString = null;
try {
humanReadableString = toJSONObject().toString(2);
} catch (JSONException e) {
WarpUtils.warn("Failed converting Coupon JSON object to String", e);
}
return humanReadableString;
}
// ================================================================================
// Getters
// ================================================================================
public int getTripId() {
return tripId;
}
public void setTripId(int tripId) {
this.tripId = tripId;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<TelematicsHistory> CREATOR = new Creator<TelematicsHistory>() {
public TelematicsHistory createFromParcel(Parcel source) {
return new TelematicsHistory(source);
}
public TelematicsHistory[] newArray(int size) {
return new TelematicsHistory[size];
}
};
}
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
* Created by Panagiotis Triantafyllou on 07-Aug-23.
*/
public class TripMetrics implements Parcelable, Serializable {
private static final long serialVersionUID = -4754964462459705285L;
/* Constants used to export the campaign in JSON formal and vice versa */
private static final String AVG_SPEED = "average_speed";
private static final String NUM_OF_TRIPS = "num_of_trips";
private static final String OVERALL_SCORE = "overall_acceleration_score";
private static final String OVERALL_FOCUS = "overall_focus_score";
private static final String READINESS_SCORE = "readiness_score";
private static final String SMOOTHNESS_SCORE = "smoothness_score";
private static final String TOTAL_KM = "total_km";
/* Member variables of the Campaign object */
private double avgSpeed = 0.0d;
private int numOfTrips = 0;
private double overallScore = 0.0d;
private double overallFocus = 0.0d;
private double readinessScore = 0.0d;
private double smoothnessScore = 0.0d;
private double totalKM = 0.0d;
/**
* Basic constructor used to create an object from a String, representing a
* JSON Object
*
* @param json The String, representing the JSON Object
* @throws JSONException Thrown if the String cannot be converted to JSON
*/
public TripMetrics(String json) throws JSONException {
this(new JSONObject(json));
}
public TripMetrics() {
this.avgSpeed = 0.0d;
this.numOfTrips = 0;
this.overallScore = 0.0d;
this.overallFocus = 0.0d;
this.readinessScore = 0.0d;
this.smoothnessScore = 0.0d;
this.totalKM = 00.0d;
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Coupon
*/
public TripMetrics(JSONObject json) {
if (json != null) {
this.avgSpeed = json.optDouble(AVG_SPEED);
this.numOfTrips = json.optInt(NUM_OF_TRIPS);
this.overallScore = json.optDouble(OVERALL_SCORE);
this.overallFocus = json.optDouble(OVERALL_FOCUS);
this.readinessScore = json.optDouble(READINESS_SCORE);
this.smoothnessScore = json.optDouble(SMOOTHNESS_SCORE);
this.totalKM = json.optDouble(TOTAL_KM);
}
}
public TripMetrics(Parcel source) {
this.avgSpeed = source.readDouble();
this.numOfTrips = source.readInt();
this.overallScore = source.readDouble();
this.overallFocus = source.readDouble();
this.readinessScore = source.readDouble();
this.smoothnessScore = source.readDouble();
this.totalKM = source.readDouble();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeDouble(this.avgSpeed);
dest.writeInt(this.numOfTrips);
dest.writeDouble(this.overallScore);
dest.writeDouble(this.overallFocus);
dest.writeDouble(this.readinessScore);
dest.writeDouble(this.smoothnessScore);
dest.writeDouble(this.totalKM);
}
/**
* Converts the Coupon into a JSON Object
*
* @return The JSON Object created from this Coupon
*/
public JSONObject toJSONObject() {
JSONObject jObj = new JSONObject();
try {
jObj.putOpt(AVG_SPEED, this.avgSpeed);
jObj.putOpt(NUM_OF_TRIPS, this.numOfTrips);
jObj.putOpt(OVERALL_SCORE, this.overallScore);
jObj.putOpt(OVERALL_FOCUS, this.overallFocus);
jObj.putOpt(READINESS_SCORE, this.readinessScore);
jObj.putOpt(SMOOTHNESS_SCORE, this.smoothnessScore);
jObj.putOpt(TOTAL_KM, this.totalKM);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
}
}
return jObj;
}
/**
* String representation of the Coupon, as a JSON object
*
* @return A String representation of JSON object
*/
public String toString() {
if (toJSONObject() != null)
return toJSONObject().toString();
return null;
}
/**
* String representation of the Coupon, as a human readable JSON object
*
* @return A human readable String representation of JSON object
*/
public String toHumanReadableString() {
String humanReadableString = null;
try {
humanReadableString = toJSONObject().toString(2);
} catch (JSONException e) {
WarpUtils.warn("Failed converting Coupon JSON object to String", e);
}
return humanReadableString;
}
// ================================================================================
// Getters
// ================================================================================
public double getAvgSpeed() {
return avgSpeed;
}
public void setAvgSpeed(double avgSpeed) {
this.avgSpeed = avgSpeed;
}
public int getNumOfTrips() {
return numOfTrips;
}
public void setNumOfTrips(int numOfTrips) {
this.numOfTrips = numOfTrips;
}
public double getOverallScore() {
return overallScore;
}
public void setOverallScore(double overallScore) {
this.overallScore = overallScore;
}
public double getOverallFocus() {
return overallFocus;
}
public void setOverallFocus(double overallFocus) {
this.overallFocus = overallFocus;
}
public double getReadinessScore() {
return readinessScore;
}
public void setReadinessScore(double readinessScore) {
this.readinessScore = readinessScore;
}
public double getSmoothnessScore() {
return smoothnessScore;
}
public void setSmoothnessScore(double smoothnessScore) {
this.smoothnessScore = smoothnessScore;
}
public double getTotalKM() {
return totalKM;
}
public void setTotalKM(double totalKM) {
this.totalKM = totalKM;
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<TripMetrics> CREATOR = new Creator<TripMetrics>() {
public TripMetrics createFromParcel(Parcel source) {
return new TripMetrics(source);
}
public TripMetrics[] newArray(int size) {
return new TripMetrics[size];
}
};
}
......@@ -100,6 +100,42 @@ public interface ApiService {
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/oauth/{appUuid}/context")
Call<ResponseBody> getTelematicsHistoy(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/oauth/{appUuid}/context")
Call<ResponseBody> getTripMetrics(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
@Headers("Content-Type: application/json")
@POST("/oauth/{appUuid}/context")
Call<ResponseBody> rateTrip(@Path("appUuid") String appUuid,
@Body RequestBody request,
@Header(WarpConstants.HEADER_DATE) String timeStamp,
@Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
@Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
@Header(WarpConstants.HEADER_CHANNEL) String channel,
@Header(WarpConstants.HEADER_WEB_ID) String webId,
@Header(WarpConstants.HEADER_SIGNATURE) String signature,
@Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
// ===========================================================
// Getter & Setter
// ===========================================================
......
......@@ -96,7 +96,9 @@ import ly.warp.sdk.io.models.ProductList;
import ly.warp.sdk.io.models.SharingList;
import ly.warp.sdk.io.models.TagsCategoriesList;
import ly.warp.sdk.io.models.TagsList;
import ly.warp.sdk.io.models.TelematicsHistory;
import ly.warp.sdk.io.models.TransactionsList;
import ly.warp.sdk.io.models.TripMetrics;
import ly.warp.sdk.io.models.UnifiedCoupon;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
import ly.warp.sdk.io.request.CosmoteCouponSharingRequest;
......@@ -2038,8 +2040,8 @@ public class WarplyManager {
e.printStackTrace();
}
if (jobjTelematicsResponse != null && jobjTelematicsResponse.has("status") && jobjTelematicsResponse.optString("status", "2").equals("1")) {
Integer status = new Integer(jobjTelematicsResponse.optString("status", "2"));
if (jobjTelematicsResponse != null && jobjTelematicsResponse.has("status") && jobjTelematicsResponse.optInt("status", 2) == 1) {
Integer status = new Integer(jobjTelematicsResponse.optInt("status", 2));
receiver.onSuccess(status);
} else {
receiver.onFailure(2);
......@@ -2052,9 +2054,158 @@ public class WarplyManager {
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
// LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
// dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
// EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
}
public static void getTelematicsHistory(final CallbackReceiver<ArrayList<TelematicsHistory>> receiver) {
WarpUtils.log("************* WARPLY User Telematics History Request ********************");
WarpUtils.log("[WARP Trace] WARPLY User Telematics History Request is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
getTelematicsHistory(service, new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> responseTelematics) {
if (responseTelematics.code() == 200 && responseTelematics.body() != null) {
JSONObject jobjTelematicsResponse = null;
try {
jobjTelematicsResponse = new JSONObject(responseTelematics.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjTelematicsResponse != null && jobjTelematicsResponse.has("status") && jobjTelematicsResponse.optInt("status", 2) == 1) {
JSONObject finalJobjTelematicsResponse = jobjTelematicsResponse;
ArrayList<TelematicsHistory> telematicsHistoryList = new ArrayList<>();
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
JSONArray jTelematicsHistoryBody = null;
try {
jTelematicsHistoryBody = finalJobjTelematicsResponse.optJSONArray("result");
if (jTelematicsHistoryBody != null && jTelematicsHistoryBody.length() > 0) {
for (int i = 0; i < jTelematicsHistoryBody.length(); i++) {
TelematicsHistory tempHis = new TelematicsHistory(jTelematicsHistoryBody.optJSONObject(i));
telematicsHistoryList.add(tempHis);
}
}
} catch (Exception e) {
e.printStackTrace();
}
new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(telematicsHistoryList));
executor.shutdownNow();
});
} else {
receiver.onFailure(2);
}
} else {
receiver.onFailure(responseTelematics.code());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
// LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
// dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
// EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
}
public static void getTripMetrics(int tripId, final CallbackReceiver<TripMetrics> receiver) {
WarpUtils.log("************* WARPLY User Trip Metrics Request ********************");
WarpUtils.log("[WARP Trace] WARPLY User Trip Metrics Request is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
getTripMetrics(service, tripId, new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> responseTelematics) {
if (responseTelematics.code() == 200 && responseTelematics.body() != null) {
JSONObject jobjTelematicsResponse = null;
try {
jobjTelematicsResponse = new JSONObject(responseTelematics.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjTelematicsResponse != null && jobjTelematicsResponse.has("status") && jobjTelematicsResponse.optInt("status", 2) == 1) {
JSONObject finalJobjCouponsResponse = jobjTelematicsResponse;
final TripMetrics[] tripData = {new TripMetrics()};
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
JSONObject jMetricsBody = null;
try {
jMetricsBody = finalJobjCouponsResponse.optJSONObject("result");
if (jMetricsBody != null) {
if (jMetricsBody.keys().hasNext()) {
String parent = jMetricsBody.keys().next();
JSONObject jobj = jMetricsBody.optJSONObject(parent);
if (jobj != null) {
tripData[0] = new TripMetrics(jobj);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(tripData[0]));
executor.shutdownNow();
});
} else {
receiver.onFailure(2);
}
} else {
receiver.onFailure(responseTelematics.code());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
// LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
// dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
// EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
}
public static void rateTrip(int tripId, boolean isPositive, final CallbackReceiver<Integer> receiver) {
WarpUtils.log("************* WARPLY User Rate Trip Request ********************");
WarpUtils.log("[WARP Trace] WARPLY User Rate Trip Request is active");
WarpUtils.log("**************************************************");
ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class);
rateTrip(service, tripId, isPositive, new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> responseTelematics) {
if (responseTelematics.code() == 200 && responseTelematics.body() != null) {
JSONObject jobjTelematicsResponse = null;
try {
jobjTelematicsResponse = new JSONObject(responseTelematics.body().string());
} catch (Exception e) {
e.printStackTrace();
}
if (jobjTelematicsResponse != null && jobjTelematicsResponse.has("status") && jobjTelematicsResponse.optInt("status", 2) == 1) {
Integer status = new Integer(jobjTelematicsResponse.optInt("status", 2));
receiver.onSuccess(status);
} else {
receiver.onFailure(2);
}
} else {
receiver.onFailure(responseTelematics.code());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
// LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
// dynatraceEvent.setEventName("custom_error_couponsets_sm_loyalty");
// EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
receiver.onFailure(2);
}
});
......@@ -2658,11 +2809,125 @@ public class WarplyManager {
jsonParams.put("raw_data", rawDataObj);
jsonParamsTelematics.put("telematics", jsonParams);
RequestBody couponsetsRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsTelematics)).toString());
RequestBody telematicsDataRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsTelematics)).toString());
Call<ResponseBody> telematicsCall = service.getCouponsets(
Call<ResponseBody> telematicsCall = service.sendTelematicsData(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
couponsetsRequest,
telematicsDataRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp),
"Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
);
telematicsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
callback.onResponse(call, response);
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
callback.onFailure(call, t);
}
});
}
private static void getTelematicsHistory(ApiService service, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsTelematics = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "get_all_trip_ids");
jsonParamsTelematics.put("telematics", jsonParams);
RequestBody telematicsHistoryRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsTelematics)).toString());
Call<ResponseBody> telematicsCall = service.getTelematicsHistoy(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
telematicsHistoryRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp),
"Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
);
telematicsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
callback.onResponse(call, response);
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
callback.onFailure(call, t);
}
});
}
private static void getTripMetrics(ApiService service, int tripId, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsTelematics = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "get_scoring");
jsonParams.put("trip_id", tripId);
jsonParamsTelematics.put("telematics", jsonParams);
RequestBody telematicsHistoryRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsTelematics)).toString());
Call<ResponseBody> telematicsCall = service.getTripMetrics(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
telematicsHistoryRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
"mobile",
webId,
WarpUtils.produceSignature(apiKey + timeStamp),
"Bearer " + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token")
);
telematicsCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
callback.onResponse(call, response);
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
callback.onFailure(call, t);
}
});
}
private static void rateTrip(ApiService service, int tripId, boolean isPositive, Callback<ResponseBody> callback) {
String timeStamp = DateFormat.format("yyyy-MM-dd hh:mm:ss", System.currentTimeMillis()).toString();
String apiKey = WarpUtils.getApiKey(Warply.getWarplyContext());
String webId = WarpUtils.getWebId(Warply.getWarplyContext());
Map<String, Object> jsonParamsTelematics = new ArrayMap<>();
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("action", "update_rating");
jsonParams.put("trip_id", tripId);
jsonParams.put("rating", isPositive ? 1 : 0);
jsonParamsTelematics.put("telematics", jsonParams);
RequestBody telematicsHistoryRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsTelematics)).toString());
Call<ResponseBody> telematicsCall = service.rateTrip(
WarplyProperty.getAppUuid(Warply.getWarplyContext()),
telematicsHistoryRequest,
timeStamp,
"android:" + Warply.getWarplyContext().getPackageName(),
new WarplyDeviceInfoCollector(Warply.getWarplyContext()).getUniqueDeviceId(),
......
package ly.warp.sdk.views.adapters;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.core.text.HtmlCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import ly.warp.sdk.R;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
import ly.warp.sdk.io.models.TelematicsHistory;
public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHistoryAdapter.CouponsetViewHolder> {
private Context mContext;
private ArrayList<TelematicsHistory> mHistory;
private final PublishSubject<TelematicsHistory> onClickSubject = PublishSubject.create();
public TelematicsHistoryAdapter(Context mContext, ArrayList<TelematicsHistory> history) {
this.mContext = mContext;
this.mHistory = history;
}
public class CouponsetViewHolder extends RecyclerView.ViewHolder {
private TextView tvHistoryId, tvHistoryDate;
public CouponsetViewHolder(View view) {
super(view);
tvHistoryId = view.findViewById(R.id.tv_telematics_history_value);
tvHistoryDate = view.findViewById(R.id.tv_telematics_history_date_value);
}
}
@Override
public int getItemCount() {
if (mHistory == null)
return 0;
else
return mHistory.size();
}
public TelematicsHistory getItem(int id) {
return mHistory.get(id);
}
public void updateData(ArrayList<TelematicsHistory> history) {
mHistory.clear();
mHistory.addAll(history);
notifyDataSetChanged();
}
@Override
public CouponsetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView;
itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.telematics_history_layout, parent, false);
return new CouponsetViewHolder(itemView);
}
@Override
public void onBindViewHolder(final CouponsetViewHolder holder, int position) {
TelematicsHistory historyItem = mHistory.get(position);
if (position % 2 == 0) {
holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.grey_light));
} else {
holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.white));
}
if (historyItem != null) {
holder.tvHistoryId.setText(String.valueOf(historyItem.getTripId()));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss", Locale.US);
Date newDate = new Date();
try {
newDate = simpleDateFormat.parse(historyItem.getCreated());
} catch (ParseException e) {
e.printStackTrace();
}
simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
holder.tvHistoryDate.setText(String.valueOf(simpleDateFormat.format(newDate != null ? newDate : "")));
holder.itemView.setOnClickListener(v -> onClickSubject.onNext(historyItem));
}
}
public Observable<TelematicsHistory> getPositionClicks() {
return onClickSubject.cache();
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_telematics_history_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_telematics_history_header"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@color/white">
<ImageView
android:id="@+id/iv_telematics_history_close"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cos_telematics_history"
android:textColor="@color/cos_light_black"
android:textSize="19sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_trip_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical"
android:overScrollMode="never"
android:paddingVertical="16dp"
android:scrollbars="none" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_telematics_metrics_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_metrics_header"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="@color/white">
<ImageView
android:id="@+id/iv_metrics_close"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView3"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cos_telematics_metrics"
android:textColor="@color/cos_light_black"
android:textSize="19sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_speed_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="AVG_SPEED: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_speed_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_trips_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="NUM_OF_TRIPS: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_trips_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_acceleration_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="ACC_SCORE: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_acceleration_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_focus_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="FOCUS_SCORE: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_focus_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_readiness_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="READINESS_SCORE: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_readiness_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_smoothness_title"
fontPath="fonts/PeridotPE-Regularttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="SMOOTHNESS_SCORE: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_smoothness_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_metrics_total_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:text="TOTAL_KM: "
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_metrics_total_value"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:textColor="@color/cos_light_black"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/tv_metrics_total_title"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="64dp"
android:text="Rate"
android:textColor="@color/cos_light_black"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_rate_positive"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="16dp"
android:src="@drawable/rate_positive" />
<ImageView
android:id="@+id/iv_rate_negative"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:src="@drawable/rate_negative" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -105,7 +105,7 @@
<RelativeLayout
android:id="@+id/rl_driving"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_height="70dp"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="50dp"
android:layout_marginBottom="16dp"
......@@ -131,11 +131,39 @@
android:src="@drawable/cosmote_one" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_driving_history"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_below="@+id/rl_driving"
android:layout_marginHorizontal="8dp"
android:layout_marginBottom="16dp"
android:background="@drawable/shape_cos_white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:text="@string/cos_telematics_history"
android:textColor="@color/blue_dark"
android:textSize="20sp" />
<ImageView
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:src="@drawable/cosmote_one" />
</RelativeLayout>
<LinearLayout
android:id="@+id/rl_home_coupons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_driving"
android:layout_below="@+id/rl_driving_history"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/grey_light"
android:paddingVertical="8dp">
<TextView
android:id="@+id/tv_telematics_history_title"
fontPath="fonts/BTCosmo-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:ellipsize="end"
android:maxLines="1"
android:text="TRIP ID"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_telematics_history_value"
fontPath="fonts/BTCosmo-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tv_telematics_history_title"
app:layout_constraintStart_toStartOf="@+id/tv_telematics_history_title"
tools:text="1" />
<ImageView
android:id="@+id/iv_telematics_open"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:rotation="180"
android:scaleType="centerInside"
android:src="@drawable/ic_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_telematics_history_date_title"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:text="CREATED"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
app:layout_constraintEnd_toStartOf="@+id/iv_telematics_open"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_telematics_history_date_value"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tv_telematics_history_date_title"
app:layout_constraintStart_toStartOf="@+id/tv_telematics_history_date_title"
tools:text="07/08/2023" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -177,6 +177,8 @@
<string name="lbl_take_photo_decline">Άκυρο</string>
<string name="lbl_gps_enabled">Θέλετε να ενεργοποιήσετε το GPS;</string>
<string name="cos_telematics">Telematics Demo</string>
<string name="cos_telematics_history">Telematics History</string>
<string name="cos_telematics_metrics">Telematics Trip Metrics</string>
<string name="cos_dlg_start_trip">Start Trip</string>
<string name="cos_dlg_stop_trip">Stop Trip</string>
<string name="cos_dlg_no_internet_title">Δεν υπάρχει σύνδεση</string>
......