Panagiotis Triantafyllou

telematics additions

...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
3 # The app uuid the warply sdk need to connect to the engage server 3 # The app uuid the warply sdk need to connect to the engage server
4 # dev f83dfde1145e4c2da69793abb2f579af 4 # dev f83dfde1145e4c2da69793abb2f579af
5 # prod 0086a2088301440792091b9f814c2267 5 # prod 0086a2088301440792091b9f814c2267
6 -Uuid=0086a2088301440792091b9f814c2267 6 +Uuid=f83dfde1145e4c2da69793abb2f579af
7 7
8 # If we need to see logs in Logcat 8 # If we need to see logs in Logcat
9 Debug=false 9 Debug=false
...@@ -11,7 +11,7 @@ Debug=false ...@@ -11,7 +11,7 @@ Debug=false
11 # Production or Development environment of the engage server 11 # Production or Development environment of the engage server
12 # Production: https://engage.warp.ly 12 # Production: https://engage.warp.ly
13 # Development: https://engage-stage.warp.ly 13 # Development: https://engage-stage.warp.ly
14 -BaseURL=https://engage.warp.ly 14 +BaseURL=https://engage-stage.warp.ly
15 15
16 # For Verify Ticket request 16 # For Verify Ticket request
17 VerifyURL=/partners/cosmote/verify 17 VerifyURL=/partners/cosmote/verify
......
...@@ -66,11 +66,23 @@ ...@@ -66,11 +66,23 @@
66 android:theme="@style/SDKAppTheme" /> 66 android:theme="@style/SDKAppTheme" />
67 67
68 <!-- android:screenOrientation="portrait"--> 68 <!-- android:screenOrientation="portrait"-->
69 -<!-- <activity--> 69 + <activity
70 -<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"--> 70 + android:name="ly.warp.sdk.activities.TelematicsActivity"
71 -<!-- android:exported="false"--> 71 + android:exported="false"
72 -<!-- android:configChanges="orientation|screenSize"--> 72 + android:configChanges="orientation|screenSize"
73 -<!-- android:theme="@style/SDKAppTheme" />--> 73 + android:theme="@style/SDKAppTheme" />
74 +
75 + <activity
76 + android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"
77 + android:exported="false"
78 + android:configChanges="orientation|screenSize"
79 + android:theme="@style/SDKAppTheme" />
80 +
81 + <activity
82 + android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"
83 + android:exported="false"
84 + android:configChanges="orientation|screenSize"
85 + android:theme="@style/SDKAppTheme" />
74 86
75 <activity 87 <activity
76 android:name="ly.warp.sdk.activities.GiftsForYouActivity" 88 android:name="ly.warp.sdk.activities.GiftsForYouActivity"
......
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.content.Context;
5 +import android.content.Intent;
6 +import android.os.Bundle;
7 +import android.view.View;
8 +import android.widget.ImageView;
9 +import android.widget.LinearLayout;
10 +
11 +import androidx.recyclerview.widget.LinearLayoutManager;
12 +import androidx.recyclerview.widget.RecyclerView;
13 +
14 +import com.google.android.material.snackbar.Snackbar;
15 +
16 +import java.util.ArrayList;
17 +
18 +import io.github.inflationx.viewpump.ViewPumpContextWrapper;
19 +import ly.warp.sdk.R;
20 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
21 +import ly.warp.sdk.io.models.TelematicsHistory;
22 +import ly.warp.sdk.utils.managers.WarplyManager;
23 +import ly.warp.sdk.views.adapters.TelematicsHistoryAdapter;
24 +
25 +/**
26 + * Created by Panagiotis Triantafyllou on 07/Aug/2023.
27 + */
28 +public class TelematicsHistoryActivity extends Activity implements View.OnClickListener {
29 +
30 + // ===========================================================
31 + // Constants
32 + // ===========================================================
33 +
34 + // ===========================================================
35 + // Fields
36 + // ===========================================================
37 +
38 + private RecyclerView mRvTripHistory;
39 + private LinearLayout mLlTelematicsHistoryMain;
40 + private ArrayList<TelematicsHistory> mTelematicsHistoryData = new ArrayList<>();
41 + private TelematicsHistoryAdapter mAdapterTelematicsHistory;
42 + private boolean mTelematicsHistoryItemPressed = false;
43 + private ImageView mIvClose;
44 +
45 +
46 + // ===========================================================
47 + // Methods for/from SuperClass/Interfaces
48 + // ===========================================================
49 +
50 + @Override
51 + public void onCreate(Bundle savedInstanceState) {
52 + super.onCreate(savedInstanceState);
53 + setContentView(R.layout.activity_telematics_history);
54 + mRvTripHistory = findViewById(R.id.rv_trip_history);
55 + mLlTelematicsHistoryMain = findViewById(R.id.ll_telematics_history_main);
56 + mIvClose = findViewById(R.id.iv_telematics_history_close);
57 + mIvClose.setOnClickListener(this);
58 +
59 + WarplyManager.getTelematicsHistory(mTelematicsHistoryCallback);
60 + }
61 +
62 + @Override
63 + public void onResume() {
64 + super.onResume();
65 +// WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelematicsActivity");
66 + mTelematicsHistoryItemPressed = false;
67 + }
68 +
69 + @Override
70 + public void onClick(View view) {
71 + if (view.getId() == R.id.iv_telematics_history_close) {
72 + onBackPressed();
73 + }
74 + }
75 +
76 + @Override
77 + protected void attachBaseContext(Context newBase) {
78 + super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
79 + }
80 +
81 + // ===========================================================
82 + // Methods
83 + // ===========================================================
84 +
85 + private void initViews() {
86 + if (mTelematicsHistoryData != null && mTelematicsHistoryData.size() > 0) {
87 + mRvTripHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
88 + mAdapterTelematicsHistory = new TelematicsHistoryAdapter(this, mTelematicsHistoryData);
89 + mRvTripHistory.setAdapter(mAdapterTelematicsHistory);
90 + mAdapterTelematicsHistory.getPositionClicks()
91 + .doOnNext(historyItem -> {
92 + if (!mTelematicsHistoryItemPressed) {
93 + mTelematicsHistoryItemPressed = true;
94 +// WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName()));
95 + Intent intent = new Intent(TelematicsHistoryActivity.this, TelematicsMetricsActivity.class);
96 + intent.putExtra("trip_id", historyItem.getTripId());
97 + startActivity(intent);
98 + }
99 + })
100 + .doOnError(error -> {
101 + })
102 + .subscribe();
103 + } else {
104 + //TODO: empty list view
105 + }
106 + }
107 +
108 + private final CallbackReceiver<ArrayList<TelematicsHistory>> mTelematicsHistoryCallback = new CallbackReceiver<ArrayList<TelematicsHistory>>() {
109 + @Override
110 + public void onSuccess(ArrayList<TelematicsHistory> result) {
111 + mTelematicsHistoryData.clear();
112 + mTelematicsHistoryData.addAll(result);
113 + Snackbar.make(mLlTelematicsHistoryMain, "Success getting history", Snackbar.LENGTH_SHORT).show();
114 + initViews();
115 + }
116 +
117 + @Override
118 + public void onFailure(int errorCode) {
119 + Snackbar.make(mLlTelematicsHistoryMain, "Error getting history", Snackbar.LENGTH_SHORT).show();
120 + }
121 + };
122 +
123 + // ===========================================================
124 + // Inner and Anonymous Classes
125 + // ===========================================================
126 +
127 +}
1 +package ly.warp.sdk.activities;
2 +
3 +import android.app.Activity;
4 +import android.content.Context;
5 +import android.os.Bundle;
6 +import android.view.View;
7 +import android.widget.ImageView;
8 +import android.widget.LinearLayout;
9 +import android.widget.TextView;
10 +
11 +
12 +import com.google.android.material.snackbar.Snackbar;
13 +
14 +import java.util.ArrayList;
15 +
16 +import io.github.inflationx.viewpump.ViewPumpContextWrapper;
17 +import ly.warp.sdk.R;
18 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
19 +import ly.warp.sdk.io.models.TelematicsHistory;
20 +import ly.warp.sdk.io.models.TripMetrics;
21 +import ly.warp.sdk.utils.managers.WarplyManager;
22 +
23 +/**
24 + * Created by Panagiotis Triantafyllou on 07/Aug/2023.
25 + */
26 +public class TelematicsMetricsActivity extends Activity implements View.OnClickListener {
27 +
28 + // ===========================================================
29 + // Constants
30 + // ===========================================================
31 +
32 + // ===========================================================
33 + // Fields
34 + // ===========================================================
35 +
36 + private LinearLayout mLlTelematicsMetricsMain;
37 + private ImageView mIvClose, mIvRatePositive, mIvRateNegative;
38 + private int mTripId = -1;
39 + private TextView mTvAvgSpeed, mTvNumOfTrips, mTvAccScore, mTvFocusScore, mTvReadinessScore,
40 + mTvSmoothnessScore, mTVTotalKM;
41 + private TripMetrics mTripMetrics;
42 +
43 +
44 + // ===========================================================
45 + // Methods for/from SuperClass/Interfaces
46 + // ===========================================================
47 +
48 + @Override
49 + public void onCreate(Bundle savedInstanceState) {
50 + super.onCreate(savedInstanceState);
51 + setContentView(R.layout.activity_telematics_metrics);
52 + mTripId = getIntent().getIntExtra("trip_id", -1);
53 + mLlTelematicsMetricsMain = findViewById(R.id.ll_telematics_metrics_main);
54 + mIvClose = findViewById(R.id.iv_metrics_close);
55 + mIvClose.setOnClickListener(this);
56 + mTvAvgSpeed = findViewById(R.id.tv_metrics_speed_value);
57 + mTvNumOfTrips = findViewById(R.id.tv_metrics_trips_value);
58 + mTvAccScore = findViewById(R.id.tv_metrics_acceleration_value);
59 + mTvFocusScore = findViewById(R.id.tv_metrics_focus_value);
60 + mTvReadinessScore = findViewById(R.id.tv_metrics_readiness_value);
61 + mTvSmoothnessScore = findViewById(R.id.tv_metrics_smoothness_value);
62 + mTVTotalKM = findViewById(R.id.tv_metrics_total_value);
63 + mIvRatePositive = findViewById(R.id.iv_rate_positive);
64 + mIvRateNegative = findViewById(R.id.iv_rate_negative);
65 + mIvRatePositive.setOnClickListener(this);
66 + mIvRateNegative.setOnClickListener(this);
67 +
68 + if (mTripId > -1)
69 + WarplyManager.getTripMetrics(mTripId, mTripMetricsCallback);
70 + }
71 +
72 + @Override
73 + public void onResume() {
74 + super.onResume();
75 +// WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelematicsActivity");
76 + }
77 +
78 + @Override
79 + public void onClick(View view) {
80 + if (view.getId() == R.id.iv_metrics_close) {
81 + onBackPressed();
82 + return;
83 + }
84 + if (view.getId() == R.id.iv_rate_positive) {
85 + WarplyManager.rateTrip(mTripId, true, mRateTripCallback);
86 + return;
87 + }
88 + if (view.getId() == R.id.iv_rate_negative) {
89 + WarplyManager.rateTrip(mTripId, false, mRateTripCallback);
90 + }
91 + }
92 +
93 + @Override
94 + protected void attachBaseContext(Context newBase) {
95 + super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
96 + }
97 +
98 + // ===========================================================
99 + // Methods
100 + // ===========================================================
101 +
102 + private void initViews() {
103 + if (mTripMetrics != null) {
104 + mTvAvgSpeed.setText(String.valueOf(mTripMetrics.getAvgSpeed()));
105 + mTvNumOfTrips.setText(String.valueOf(mTripMetrics.getNumOfTrips()));
106 + mTvAccScore.setText(String.valueOf(mTripMetrics.getOverallScore()));
107 + mTvFocusScore.setText(String.valueOf(mTripMetrics.getOverallFocus()));
108 + mTvReadinessScore.setText(String.valueOf(mTripMetrics.getReadinessScore()));
109 + mTvSmoothnessScore.setText(String.valueOf(mTripMetrics.getSmoothnessScore()));
110 + mTVTotalKM.setText(String.valueOf(mTripMetrics.getTotalKM()));
111 + }
112 + }
113 +
114 + private final CallbackReceiver<TripMetrics> mTripMetricsCallback = new CallbackReceiver<TripMetrics>() {
115 + @Override
116 + public void onSuccess(TripMetrics result) {
117 + mTripMetrics = result;
118 + Snackbar.make(mLlTelematicsMetricsMain, "Success getting history", Snackbar.LENGTH_SHORT).show();
119 + initViews();
120 + }
121 +
122 + @Override
123 + public void onFailure(int errorCode) {
124 + Snackbar.make(mLlTelematicsMetricsMain, "Error getting history", Snackbar.LENGTH_SHORT).show();
125 + }
126 + };
127 +
128 + private final CallbackReceiver<Integer> mRateTripCallback = new CallbackReceiver<Integer>() {
129 + @Override
130 + public void onSuccess(Integer result) {
131 + Snackbar.make(mLlTelematicsMetricsMain, "Success rate trip", Snackbar.LENGTH_SHORT).show();
132 + }
133 +
134 + @Override
135 + public void onFailure(int errorCode) {
136 + Snackbar.make(mLlTelematicsMetricsMain, "Error rate trip", Snackbar.LENGTH_SHORT).show();
137 + }
138 + };
139 +
140 + // ===========================================================
141 + // Inner and Anonymous Classes
142 + // ===========================================================
143 +
144 +}
...@@ -23,6 +23,7 @@ import java.util.ArrayList; ...@@ -23,6 +23,7 @@ import java.util.ArrayList;
23 import ly.warp.sdk.R; 23 import ly.warp.sdk.R;
24 import ly.warp.sdk.activities.ActiveCouponsActivity; 24 import ly.warp.sdk.activities.ActiveCouponsActivity;
25 import ly.warp.sdk.activities.TelematicsActivity; 25 import ly.warp.sdk.activities.TelematicsActivity;
26 +import ly.warp.sdk.activities.TelematicsHistoryActivity;
26 import ly.warp.sdk.activities.WarpViewActivity; 27 import ly.warp.sdk.activities.WarpViewActivity;
27 import ly.warp.sdk.io.callbacks.CallbackReceiver; 28 import ly.warp.sdk.io.callbacks.CallbackReceiver;
28 import ly.warp.sdk.io.models.Campaign; 29 import ly.warp.sdk.io.models.Campaign;
...@@ -34,7 +35,7 @@ import ly.warp.sdk.views.adapters.HomeCampaignAdapter; ...@@ -34,7 +35,7 @@ import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
34 35
35 public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener { 36 public class HomeFragment extends Fragment implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
36 37
37 - private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mRlDriving; 38 + private RelativeLayout mOptionOne, mOptionTwo, mOptionThree, mRlDriving, mRlDrivingHistory;
38 private LinearLayout mLlBillPayment; 39 private LinearLayout mLlBillPayment;
39 private TextView mTvUsername, mTvActiveCoupons; 40 private TextView mTvUsername, mTvActiveCoupons;
40 private ConstraintLayout mClActiveCoupons; 41 private ConstraintLayout mClActiveCoupons;
...@@ -87,6 +88,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -87,6 +88,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
87 88
88 mRlDriving = view.findViewById(R.id.rl_driving); 89 mRlDriving = view.findViewById(R.id.rl_driving);
89 mRlDriving.setOnClickListener(this); 90 mRlDriving.setOnClickListener(this);
91 + mRlDrivingHistory = view.findViewById(R.id.rl_driving_history);
92 + mRlDrivingHistory.setOnClickListener(this);
90 } 93 }
91 94
92 @Override 95 @Override
...@@ -112,6 +115,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip ...@@ -112,6 +115,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
112 if (view.getId() == R.id.rl_driving) { 115 if (view.getId() == R.id.rl_driving) {
113 Intent intent = new Intent(getContext(), TelematicsActivity.class); 116 Intent intent = new Intent(getContext(), TelematicsActivity.class);
114 startActivity(intent); 117 startActivity(intent);
118 + return;
119 + }
120 + if (view.getId() == R.id.rl_driving_history) {
121 + Intent intent = new Intent(getContext(), TelematicsHistoryActivity.class);
122 + startActivity(intent);
115 } 123 }
116 } 124 }
117 125
......
1 +/*
2 + * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 + *
4 + * Redistribution and use in source and binary forms, without modification, are
5 + * permitted provided that the following conditions are met:
6 + *
7 + * 1. Redistributions of source code must retain the above copyright notice,
8 + * this list of conditions and the following disclaimer.
9 + *
10 + * 2. Redistributions in binary form must reproduce the above copyright notice,
11 + * this list of conditions and the following disclaimer in the documentation
12 + * and/or other materials provided with the distribution.
13 + *
14 + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 + */
25 +
26 +package ly.warp.sdk.io.models;
27 +
28 +import android.os.Parcel;
29 +import android.os.Parcelable;
30 +
31 +import org.json.JSONException;
32 +import org.json.JSONObject;
33 +
34 +import java.io.Serializable;
35 +import java.util.Date;
36 +
37 +import ly.warp.sdk.utils.WarpUtils;
38 +import ly.warp.sdk.utils.constants.WarpConstants;
39 +
40 +/**
41 + * Created by Panagiotis Triantafyllou on 07-Aug-23.
42 + */
43 +
44 +public class TelematicsHistory implements Parcelable, Serializable {
45 +
46 + private static final long serialVersionUID = -4754964462459705285L;
47 +
48 + /* Constants used to export the campaign in JSON formal and vice versa */
49 +
50 + private static final String TRIP_ID = "trip_id";
51 + private static final String CREATED = "created";
52 +
53 + /* Member variables of the Campaign object */
54 +
55 + private int tripId = -1;
56 + private String created = "";
57 +
58 + /**
59 + * Basic constructor used to create an object from a String, representing a
60 + * JSON Object
61 + *
62 + * @param json The String, representing the JSON Object
63 + * @throws JSONException Thrown if the String cannot be converted to JSON
64 + */
65 + public TelematicsHistory(String json) throws JSONException {
66 + this(new JSONObject(json));
67 + }
68 +
69 + public TelematicsHistory() {
70 + this.tripId = -1;
71 + this.created = "";
72 + }
73 +
74 + /**
75 + * Constructor used to create an Object from a given JSON Object
76 + *
77 + * @param json JSON Object used to create the Coupon
78 + */
79 + public TelematicsHistory(JSONObject json) {
80 + if (json != null) {
81 + this.tripId = json.optInt(TRIP_ID);
82 + this.created = json.optString(CREATED);
83 + }
84 + }
85 +
86 + public TelematicsHistory(Parcel source) {
87 + this.tripId = source.readInt();
88 + this.created = source.readString();
89 + }
90 +
91 + @Override
92 + public void writeToParcel(Parcel dest, int flags) {
93 + dest.writeInt(this.tripId);
94 + dest.writeString(this.created);
95 + }
96 +
97 + /**
98 + * Converts the Coupon into a JSON Object
99 + *
100 + * @return The JSON Object created from this Coupon
101 + */
102 + public JSONObject toJSONObject() {
103 + JSONObject jObj = new JSONObject();
104 + try {
105 + jObj.putOpt(TRIP_ID, this.tripId);
106 + jObj.putOpt(CREATED, this.created);
107 + } catch (JSONException e) {
108 + if (WarpConstants.DEBUG) {
109 + e.printStackTrace();
110 + }
111 + }
112 + return jObj;
113 + }
114 +
115 + /**
116 + * String representation of the Coupon, as a JSON object
117 + *
118 + * @return A String representation of JSON object
119 + */
120 + public String toString() {
121 + if (toJSONObject() != null)
122 + return toJSONObject().toString();
123 + return null;
124 + }
125 +
126 + /**
127 + * String representation of the Coupon, as a human readable JSON object
128 + *
129 + * @return A human readable String representation of JSON object
130 + */
131 + public String toHumanReadableString() {
132 + String humanReadableString = null;
133 + try {
134 + humanReadableString = toJSONObject().toString(2);
135 + } catch (JSONException e) {
136 + WarpUtils.warn("Failed converting Coupon JSON object to String", e);
137 + }
138 + return humanReadableString;
139 + }
140 +
141 + // ================================================================================
142 + // Getters
143 + // ================================================================================
144 +
145 +
146 + public int getTripId() {
147 + return tripId;
148 + }
149 +
150 + public void setTripId(int tripId) {
151 + this.tripId = tripId;
152 + }
153 +
154 + public String getCreated() {
155 + return created;
156 + }
157 +
158 + public void setCreated(String created) {
159 + this.created = created;
160 + }
161 +
162 + @Override
163 + public int describeContents() {
164 + return 0;
165 + }
166 +
167 + public static final Creator<TelematicsHistory> CREATOR = new Creator<TelematicsHistory>() {
168 + public TelematicsHistory createFromParcel(Parcel source) {
169 + return new TelematicsHistory(source);
170 + }
171 +
172 + public TelematicsHistory[] newArray(int size) {
173 + return new TelematicsHistory[size];
174 + }
175 + };
176 +}
1 +/*
2 + * Copyright 2010-2013 Warply Ltd. All rights reserved.
3 + *
4 + * Redistribution and use in source and binary forms, without modification, are
5 + * permitted provided that the following conditions are met:
6 + *
7 + * 1. Redistributions of source code must retain the above copyright notice,
8 + * this list of conditions and the following disclaimer.
9 + *
10 + * 2. Redistributions in binary form must reproduce the above copyright notice,
11 + * this list of conditions and the following disclaimer in the documentation
12 + * and/or other materials provided with the distribution.
13 + *
14 + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
15 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
17 + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20 + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23 + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 + */
25 +
26 +package ly.warp.sdk.io.models;
27 +
28 +import android.os.Parcel;
29 +import android.os.Parcelable;
30 +
31 +import org.json.JSONException;
32 +import org.json.JSONObject;
33 +
34 +import java.io.Serializable;
35 +
36 +import ly.warp.sdk.utils.WarpUtils;
37 +import ly.warp.sdk.utils.constants.WarpConstants;
38 +
39 +/**
40 + * Created by Panagiotis Triantafyllou on 07-Aug-23.
41 + */
42 +
43 +public class TripMetrics implements Parcelable, Serializable {
44 +
45 + private static final long serialVersionUID = -4754964462459705285L;
46 +
47 + /* Constants used to export the campaign in JSON formal and vice versa */
48 +
49 + private static final String AVG_SPEED = "average_speed";
50 + private static final String NUM_OF_TRIPS = "num_of_trips";
51 + private static final String OVERALL_SCORE = "overall_acceleration_score";
52 + private static final String OVERALL_FOCUS = "overall_focus_score";
53 + private static final String READINESS_SCORE = "readiness_score";
54 + private static final String SMOOTHNESS_SCORE = "smoothness_score";
55 + private static final String TOTAL_KM = "total_km";
56 +
57 + /* Member variables of the Campaign object */
58 +
59 + private double avgSpeed = 0.0d;
60 + private int numOfTrips = 0;
61 + private double overallScore = 0.0d;
62 + private double overallFocus = 0.0d;
63 + private double readinessScore = 0.0d;
64 + private double smoothnessScore = 0.0d;
65 + private double totalKM = 0.0d;
66 +
67 + /**
68 + * Basic constructor used to create an object from a String, representing a
69 + * JSON Object
70 + *
71 + * @param json The String, representing the JSON Object
72 + * @throws JSONException Thrown if the String cannot be converted to JSON
73 + */
74 + public TripMetrics(String json) throws JSONException {
75 + this(new JSONObject(json));
76 + }
77 +
78 + public TripMetrics() {
79 + this.avgSpeed = 0.0d;
80 + this.numOfTrips = 0;
81 + this.overallScore = 0.0d;
82 + this.overallFocus = 0.0d;
83 + this.readinessScore = 0.0d;
84 + this.smoothnessScore = 0.0d;
85 + this.totalKM = 00.0d;
86 + }
87 +
88 + /**
89 + * Constructor used to create an Object from a given JSON Object
90 + *
91 + * @param json JSON Object used to create the Coupon
92 + */
93 + public TripMetrics(JSONObject json) {
94 + if (json != null) {
95 + this.avgSpeed = json.optDouble(AVG_SPEED);
96 + this.numOfTrips = json.optInt(NUM_OF_TRIPS);
97 + this.overallScore = json.optDouble(OVERALL_SCORE);
98 + this.overallFocus = json.optDouble(OVERALL_FOCUS);
99 + this.readinessScore = json.optDouble(READINESS_SCORE);
100 + this.smoothnessScore = json.optDouble(SMOOTHNESS_SCORE);
101 + this.totalKM = json.optDouble(TOTAL_KM);
102 + }
103 + }
104 +
105 + public TripMetrics(Parcel source) {
106 + this.avgSpeed = source.readDouble();
107 + this.numOfTrips = source.readInt();
108 + this.overallScore = source.readDouble();
109 + this.overallFocus = source.readDouble();
110 + this.readinessScore = source.readDouble();
111 + this.smoothnessScore = source.readDouble();
112 + this.totalKM = source.readDouble();
113 + }
114 +
115 + @Override
116 + public void writeToParcel(Parcel dest, int flags) {
117 + dest.writeDouble(this.avgSpeed);
118 + dest.writeInt(this.numOfTrips);
119 + dest.writeDouble(this.overallScore);
120 + dest.writeDouble(this.overallFocus);
121 + dest.writeDouble(this.readinessScore);
122 + dest.writeDouble(this.smoothnessScore);
123 + dest.writeDouble(this.totalKM);
124 + }
125 +
126 + /**
127 + * Converts the Coupon into a JSON Object
128 + *
129 + * @return The JSON Object created from this Coupon
130 + */
131 + public JSONObject toJSONObject() {
132 + JSONObject jObj = new JSONObject();
133 + try {
134 + jObj.putOpt(AVG_SPEED, this.avgSpeed);
135 + jObj.putOpt(NUM_OF_TRIPS, this.numOfTrips);
136 + jObj.putOpt(OVERALL_SCORE, this.overallScore);
137 + jObj.putOpt(OVERALL_FOCUS, this.overallFocus);
138 + jObj.putOpt(READINESS_SCORE, this.readinessScore);
139 + jObj.putOpt(SMOOTHNESS_SCORE, this.smoothnessScore);
140 + jObj.putOpt(TOTAL_KM, this.totalKM);
141 + } catch (JSONException e) {
142 + if (WarpConstants.DEBUG) {
143 + e.printStackTrace();
144 + }
145 + }
146 + return jObj;
147 + }
148 +
149 + /**
150 + * String representation of the Coupon, as a JSON object
151 + *
152 + * @return A String representation of JSON object
153 + */
154 + public String toString() {
155 + if (toJSONObject() != null)
156 + return toJSONObject().toString();
157 + return null;
158 + }
159 +
160 + /**
161 + * String representation of the Coupon, as a human readable JSON object
162 + *
163 + * @return A human readable String representation of JSON object
164 + */
165 + public String toHumanReadableString() {
166 + String humanReadableString = null;
167 + try {
168 + humanReadableString = toJSONObject().toString(2);
169 + } catch (JSONException e) {
170 + WarpUtils.warn("Failed converting Coupon JSON object to String", e);
171 + }
172 + return humanReadableString;
173 + }
174 +
175 + // ================================================================================
176 + // Getters
177 + // ================================================================================
178 +
179 +
180 + public double getAvgSpeed() {
181 + return avgSpeed;
182 + }
183 +
184 + public void setAvgSpeed(double avgSpeed) {
185 + this.avgSpeed = avgSpeed;
186 + }
187 +
188 + public int getNumOfTrips() {
189 + return numOfTrips;
190 + }
191 +
192 + public void setNumOfTrips(int numOfTrips) {
193 + this.numOfTrips = numOfTrips;
194 + }
195 +
196 + public double getOverallScore() {
197 + return overallScore;
198 + }
199 +
200 + public void setOverallScore(double overallScore) {
201 + this.overallScore = overallScore;
202 + }
203 +
204 + public double getOverallFocus() {
205 + return overallFocus;
206 + }
207 +
208 + public void setOverallFocus(double overallFocus) {
209 + this.overallFocus = overallFocus;
210 + }
211 +
212 + public double getReadinessScore() {
213 + return readinessScore;
214 + }
215 +
216 + public void setReadinessScore(double readinessScore) {
217 + this.readinessScore = readinessScore;
218 + }
219 +
220 + public double getSmoothnessScore() {
221 + return smoothnessScore;
222 + }
223 +
224 + public void setSmoothnessScore(double smoothnessScore) {
225 + this.smoothnessScore = smoothnessScore;
226 + }
227 +
228 + public double getTotalKM() {
229 + return totalKM;
230 + }
231 +
232 + public void setTotalKM(double totalKM) {
233 + this.totalKM = totalKM;
234 + }
235 +
236 + @Override
237 + public int describeContents() {
238 + return 0;
239 + }
240 +
241 + public static final Creator<TripMetrics> CREATOR = new Creator<TripMetrics>() {
242 + public TripMetrics createFromParcel(Parcel source) {
243 + return new TripMetrics(source);
244 + }
245 +
246 + public TripMetrics[] newArray(int size) {
247 + return new TripMetrics[size];
248 + }
249 + };
250 +}
...@@ -100,6 +100,42 @@ public interface ApiService { ...@@ -100,6 +100,42 @@ public interface ApiService {
100 @Header(WarpConstants.HEADER_SIGNATURE) String signature, 100 @Header(WarpConstants.HEADER_SIGNATURE) String signature,
101 @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); 101 @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
102 102
103 + @Headers("Content-Type: application/json")
104 + @POST("/oauth/{appUuid}/context")
105 + Call<ResponseBody> getTelematicsHistoy(@Path("appUuid") String appUuid,
106 + @Body RequestBody request,
107 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
108 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
109 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
110 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
111 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
112 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
113 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
114 +
115 + @Headers("Content-Type: application/json")
116 + @POST("/oauth/{appUuid}/context")
117 + Call<ResponseBody> getTripMetrics(@Path("appUuid") String appUuid,
118 + @Body RequestBody request,
119 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
120 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
121 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
122 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
123 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
124 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
125 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
126 +
127 + @Headers("Content-Type: application/json")
128 + @POST("/oauth/{appUuid}/context")
129 + Call<ResponseBody> rateTrip(@Path("appUuid") String appUuid,
130 + @Body RequestBody request,
131 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
132 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
133 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
134 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
135 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
136 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
137 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
138 +
103 // =========================================================== 139 // ===========================================================
104 // Getter & Setter 140 // Getter & Setter
105 // =========================================================== 141 // ===========================================================
......
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.text.TextUtils;
5 +import android.view.LayoutInflater;
6 +import android.view.View;
7 +import android.view.ViewGroup;
8 +import android.widget.ImageView;
9 +import android.widget.TextView;
10 +
11 +import androidx.core.content.ContextCompat;
12 +import androidx.core.text.HtmlCompat;
13 +import androidx.recyclerview.widget.RecyclerView;
14 +
15 +import com.bumptech.glide.Glide;
16 +import com.bumptech.glide.load.engine.DiskCacheStrategy;
17 +
18 +import java.text.ParseException;
19 +import java.text.SimpleDateFormat;
20 +import java.util.ArrayList;
21 +import java.util.Date;
22 +import java.util.Locale;
23 +import java.util.concurrent.TimeUnit;
24 +
25 +import io.reactivex.Observable;
26 +import io.reactivex.subjects.PublishSubject;
27 +import ly.warp.sdk.R;
28 +import ly.warp.sdk.io.models.Couponset;
29 +import ly.warp.sdk.io.models.CouponsetsList;
30 +import ly.warp.sdk.io.models.TelematicsHistory;
31 +
32 +public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHistoryAdapter.CouponsetViewHolder> {
33 +
34 + private Context mContext;
35 + private ArrayList<TelematicsHistory> mHistory;
36 + private final PublishSubject<TelematicsHistory> onClickSubject = PublishSubject.create();
37 +
38 + public TelematicsHistoryAdapter(Context mContext, ArrayList<TelematicsHistory> history) {
39 + this.mContext = mContext;
40 + this.mHistory = history;
41 + }
42 +
43 + public class CouponsetViewHolder extends RecyclerView.ViewHolder {
44 + private TextView tvHistoryId, tvHistoryDate;
45 +
46 + public CouponsetViewHolder(View view) {
47 + super(view);
48 + tvHistoryId = view.findViewById(R.id.tv_telematics_history_value);
49 + tvHistoryDate = view.findViewById(R.id.tv_telematics_history_date_value);
50 + }
51 + }
52 +
53 + @Override
54 + public int getItemCount() {
55 + if (mHistory == null)
56 + return 0;
57 + else
58 + return mHistory.size();
59 + }
60 +
61 + public TelematicsHistory getItem(int id) {
62 + return mHistory.get(id);
63 + }
64 +
65 + public void updateData(ArrayList<TelematicsHistory> history) {
66 + mHistory.clear();
67 + mHistory.addAll(history);
68 + notifyDataSetChanged();
69 + }
70 +
71 + @Override
72 + public CouponsetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
73 + View itemView;
74 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.telematics_history_layout, parent, false);
75 + return new CouponsetViewHolder(itemView);
76 + }
77 +
78 + @Override
79 + public void onBindViewHolder(final CouponsetViewHolder holder, int position) {
80 + TelematicsHistory historyItem = mHistory.get(position);
81 +
82 + if (position % 2 == 0) {
83 + holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.grey_light));
84 + } else {
85 + holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.white));
86 + }
87 +
88 + if (historyItem != null) {
89 + holder.tvHistoryId.setText(String.valueOf(historyItem.getTripId()));
90 +
91 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss", Locale.US);
92 + Date newDate = new Date();
93 + try {
94 + newDate = simpleDateFormat.parse(historyItem.getCreated());
95 + } catch (ParseException e) {
96 + e.printStackTrace();
97 + }
98 + simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
99 + holder.tvHistoryDate.setText(String.valueOf(simpleDateFormat.format(newDate != null ? newDate : "")));
100 +
101 + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(historyItem));
102 + }
103 + }
104 +
105 + public Observable<TelematicsHistory> getPositionClicks() {
106 + return onClickSubject.cache();
107 + }
108 +}
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + android:id="@+id/ll_telematics_history_main"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent"
7 + android:background="@color/white"
8 + android:orientation="vertical">
9 +
10 + <androidx.constraintlayout.widget.ConstraintLayout
11 + android:id="@+id/cl_telematics_history_header"
12 + android:layout_width="match_parent"
13 + android:layout_height="64dp"
14 + android:background="@color/white">
15 +
16 + <ImageView
17 + android:id="@+id/iv_telematics_history_close"
18 + android:layout_width="48dp"
19 + android:layout_height="48dp"
20 + android:layout_marginStart="16dp"
21 + android:scaleType="centerInside"
22 + android:src="@drawable/ic_back"
23 + app:layout_constraintBottom_toBottomOf="parent"
24 + app:layout_constraintStart_toStartOf="parent"
25 + app:layout_constraintTop_toTopOf="parent" />
26 +
27 + <TextView
28 + android:id="@+id/textView3"
29 + fontPath="fonts/BTCosmo-Bold.ttf"
30 + android:layout_width="wrap_content"
31 + android:layout_height="wrap_content"
32 + android:gravity="center"
33 + android:text="@string/cos_telematics_history"
34 + android:textColor="@color/cos_light_black"
35 + android:textSize="19sp"
36 + app:layout_constraintBottom_toBottomOf="parent"
37 + app:layout_constraintEnd_toEndOf="parent"
38 + app:layout_constraintStart_toStartOf="parent"
39 + app:layout_constraintTop_toTopOf="parent" />
40 + </androidx.constraintlayout.widget.ConstraintLayout>
41 +
42 + <androidx.recyclerview.widget.RecyclerView
43 + android:id="@+id/rv_trip_history"
44 + android:layout_width="match_parent"
45 + android:layout_height="wrap_content"
46 + android:clipToPadding="false"
47 + android:orientation="vertical"
48 + android:overScrollMode="never"
49 + android:paddingVertical="16dp"
50 + android:scrollbars="none" />
51 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + android:id="@+id/ll_telematics_metrics_main"
5 + android:layout_width="match_parent"
6 + android:layout_height="match_parent"
7 + android:background="@color/white"
8 + android:orientation="vertical">
9 +
10 + <androidx.constraintlayout.widget.ConstraintLayout
11 + android:id="@+id/cl_metrics_header"
12 + android:layout_width="match_parent"
13 + android:layout_height="64dp"
14 + android:background="@color/white">
15 +
16 + <ImageView
17 + android:id="@+id/iv_metrics_close"
18 + android:layout_width="48dp"
19 + android:layout_height="48dp"
20 + android:layout_marginStart="16dp"
21 + android:scaleType="centerInside"
22 + android:src="@drawable/ic_back"
23 + app:layout_constraintBottom_toBottomOf="parent"
24 + app:layout_constraintStart_toStartOf="parent"
25 + app:layout_constraintTop_toTopOf="parent" />
26 +
27 + <TextView
28 + android:id="@+id/textView3"
29 + fontPath="fonts/BTCosmo-Bold.ttf"
30 + android:layout_width="wrap_content"
31 + android:layout_height="wrap_content"
32 + android:gravity="center"
33 + android:text="@string/cos_telematics_metrics"
34 + android:textColor="@color/cos_light_black"
35 + android:textSize="19sp"
36 + app:layout_constraintBottom_toBottomOf="parent"
37 + app:layout_constraintEnd_toEndOf="parent"
38 + app:layout_constraintStart_toStartOf="parent"
39 + app:layout_constraintTop_toTopOf="parent" />
40 + </androidx.constraintlayout.widget.ConstraintLayout>
41 +
42 + <LinearLayout
43 + android:layout_width="match_parent"
44 + android:layout_height="wrap_content"
45 + android:orientation="horizontal">
46 +
47 + <TextView
48 + android:id="@+id/tv_metrics_speed_title"
49 + fontPath="fonts/PeridotPE-Regular.ttf"
50 + android:layout_width="wrap_content"
51 + android:layout_height="wrap_content"
52 + android:layout_marginStart="24dp"
53 + android:text="AVG_SPEED: "
54 + android:textColor="@color/cos_light_black"
55 + android:textSize="16sp" />
56 +
57 + <TextView
58 + android:id="@+id/tv_metrics_speed_value"
59 + fontPath="fonts/PeridotPE-Bold.ttf"
60 + android:layout_width="wrap_content"
61 + android:layout_height="wrap_content"
62 + android:layout_marginEnd="32dp"
63 + android:textColor="@color/cos_light_black"
64 + android:textSize="16sp" />
65 + </LinearLayout>
66 +
67 + <LinearLayout
68 + android:layout_width="match_parent"
69 + android:layout_height="wrap_content"
70 + android:orientation="horizontal">
71 +
72 + <TextView
73 + android:id="@+id/tv_metrics_trips_title"
74 + fontPath="fonts/PeridotPE-Regular.ttf"
75 + android:layout_width="wrap_content"
76 + android:layout_height="wrap_content"
77 + android:layout_marginStart="24dp"
78 + android:text="NUM_OF_TRIPS: "
79 + android:textColor="@color/cos_light_black"
80 + android:textSize="16sp" />
81 +
82 + <TextView
83 + android:id="@+id/tv_metrics_trips_value"
84 + fontPath="fonts/PeridotPE-Bold.ttf"
85 + android:layout_width="wrap_content"
86 + android:layout_height="wrap_content"
87 + android:layout_marginEnd="32dp"
88 + android:textColor="@color/cos_light_black"
89 + android:textSize="16sp" />
90 + </LinearLayout>
91 +
92 + <LinearLayout
93 + android:layout_width="match_parent"
94 + android:layout_height="wrap_content"
95 + android:orientation="horizontal">
96 +
97 + <TextView
98 + android:id="@+id/tv_metrics_acceleration_title"
99 + fontPath="fonts/PeridotPE-Regular.ttf"
100 + android:layout_width="wrap_content"
101 + android:layout_height="wrap_content"
102 + android:layout_marginStart="24dp"
103 + android:text="ACC_SCORE: "
104 + android:textColor="@color/cos_light_black"
105 + android:textSize="16sp" />
106 +
107 + <TextView
108 + android:id="@+id/tv_metrics_acceleration_value"
109 + fontPath="fonts/PeridotPE-Bold.ttf"
110 + android:layout_width="wrap_content"
111 + android:layout_height="wrap_content"
112 + android:layout_marginEnd="32dp"
113 + android:textColor="@color/cos_light_black"
114 + android:textSize="16sp" />
115 + </LinearLayout>
116 +
117 + <LinearLayout
118 + android:layout_width="match_parent"
119 + android:layout_height="wrap_content"
120 + android:orientation="horizontal">
121 +
122 + <TextView
123 + android:id="@+id/tv_metrics_focus_title"
124 + fontPath="fonts/PeridotPE-Regular.ttf"
125 + android:layout_width="wrap_content"
126 + android:layout_height="wrap_content"
127 + android:layout_marginStart="24dp"
128 + android:text="FOCUS_SCORE: "
129 + android:textColor="@color/cos_light_black"
130 + android:textSize="16sp" />
131 +
132 + <TextView
133 + android:id="@+id/tv_metrics_focus_value"
134 + fontPath="fonts/PeridotPE-Bold.ttf"
135 + android:layout_width="wrap_content"
136 + android:layout_height="wrap_content"
137 + android:layout_marginEnd="32dp"
138 + android:textColor="@color/cos_light_black"
139 + android:textSize="16sp" />
140 + </LinearLayout>
141 +
142 + <LinearLayout
143 + android:layout_width="match_parent"
144 + android:layout_height="wrap_content"
145 + android:orientation="horizontal">
146 +
147 + <TextView
148 + android:id="@+id/tv_metrics_readiness_title"
149 + fontPath="fonts/PeridotPE-Regular.ttf"
150 + android:layout_width="wrap_content"
151 + android:layout_height="wrap_content"
152 + android:layout_marginStart="24dp"
153 + android:text="READINESS_SCORE: "
154 + android:textColor="@color/cos_light_black"
155 + android:textSize="16sp" />
156 +
157 + <TextView
158 + android:id="@+id/tv_metrics_readiness_value"
159 + fontPath="fonts/PeridotPE-Bold.ttf"
160 + android:layout_width="wrap_content"
161 + android:layout_height="wrap_content"
162 + android:layout_marginEnd="32dp"
163 + android:textColor="@color/cos_light_black"
164 + android:textSize="16sp" />
165 + </LinearLayout>
166 +
167 + <LinearLayout
168 + android:layout_width="match_parent"
169 + android:layout_height="wrap_content"
170 + android:orientation="horizontal">
171 +
172 + <TextView
173 + android:id="@+id/tv_metrics_smoothness_title"
174 + fontPath="fonts/PeridotPE-Regularttf"
175 + android:layout_width="wrap_content"
176 + android:layout_height="wrap_content"
177 + android:layout_marginStart="24dp"
178 + android:text="SMOOTHNESS_SCORE: "
179 + android:textColor="@color/cos_light_black"
180 + android:textSize="16sp" />
181 +
182 + <TextView
183 + android:id="@+id/tv_metrics_smoothness_value"
184 + fontPath="fonts/PeridotPE-Bold.ttf"
185 + android:layout_width="wrap_content"
186 + android:layout_height="wrap_content"
187 + android:layout_marginEnd="32dp"
188 + android:textColor="@color/cos_light_black"
189 + android:textSize="16sp" />
190 + </LinearLayout>
191 +
192 + <LinearLayout
193 + android:layout_width="match_parent"
194 + android:layout_height="wrap_content"
195 + android:orientation="horizontal">
196 +
197 + <TextView
198 + android:id="@+id/tv_metrics_total_title"
199 + fontPath="fonts/PeridotPE-Regular.ttf"
200 + android:layout_width="wrap_content"
201 + android:layout_height="wrap_content"
202 + android:layout_marginStart="24dp"
203 + android:text="TOTAL_KM: "
204 + android:textColor="@color/cos_light_black"
205 + android:textSize="16sp" />
206 +
207 + <TextView
208 + android:id="@+id/tv_metrics_total_value"
209 + fontPath="fonts/PeridotPE-Bold.ttf"
210 + android:layout_width="wrap_content"
211 + android:layout_height="wrap_content"
212 + android:layout_marginEnd="32dp"
213 + android:textColor="@color/cos_light_black"
214 + android:textSize="16sp" />
215 + </LinearLayout>
216 +
217 + <TextView
218 + android:id="@+id/tv_metrics_total_title"
219 + fontPath="fonts/PeridotPE-Regular.ttf"
220 + android:layout_width="wrap_content"
221 + android:layout_height="wrap_content"
222 + android:layout_gravity="center_horizontal"
223 + android:layout_marginTop="64dp"
224 + android:text="Rate"
225 + android:textColor="@color/cos_light_black"
226 + android:textSize="18sp" />
227 +
228 + <LinearLayout
229 + android:layout_width="match_parent"
230 + android:layout_height="wrap_content"
231 + android:layout_marginTop="12dp"
232 + android:gravity="center_horizontal"
233 + android:orientation="horizontal">
234 +
235 + <ImageView
236 + android:id="@+id/iv_rate_positive"
237 + android:layout_width="48dp"
238 + android:layout_height="48dp"
239 + android:layout_marginEnd="16dp"
240 + android:src="@drawable/rate_positive" />
241 +
242 + <ImageView
243 + android:id="@+id/iv_rate_negative"
244 + android:layout_width="48dp"
245 + android:layout_height="48dp"
246 + android:layout_marginStart="16dp"
247 + android:src="@drawable/rate_negative" />
248 + </LinearLayout>
249 +
250 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
105 <RelativeLayout 105 <RelativeLayout
106 android:id="@+id/rl_driving" 106 android:id="@+id/rl_driving"
107 android:layout_width="match_parent" 107 android:layout_width="match_parent"
108 - android:layout_height="140dp" 108 + android:layout_height="70dp"
109 android:layout_marginHorizontal="8dp" 109 android:layout_marginHorizontal="8dp"
110 android:layout_marginTop="50dp" 110 android:layout_marginTop="50dp"
111 android:layout_marginBottom="16dp" 111 android:layout_marginBottom="16dp"
...@@ -131,11 +131,39 @@ ...@@ -131,11 +131,39 @@
131 android:src="@drawable/cosmote_one" /> 131 android:src="@drawable/cosmote_one" />
132 </RelativeLayout> 132 </RelativeLayout>
133 133
134 + <RelativeLayout
135 + android:id="@+id/rl_driving_history"
136 + android:layout_width="match_parent"
137 + android:layout_height="70dp"
138 + android:layout_below="@+id/rl_driving"
139 + android:layout_marginHorizontal="8dp"
140 + android:layout_marginBottom="16dp"
141 + android:background="@drawable/shape_cos_white">
142 +
143 + <TextView
144 + android:layout_width="wrap_content"
145 + android:layout_height="wrap_content"
146 + android:layout_alignParentStart="true"
147 + android:layout_centerVertical="true"
148 + android:layout_marginStart="16dp"
149 + android:text="@string/cos_telematics_history"
150 + android:textColor="@color/blue_dark"
151 + android:textSize="20sp" />
152 +
153 + <ImageView
154 + android:layout_width="100dp"
155 + android:layout_height="30dp"
156 + android:layout_alignParentEnd="true"
157 + android:layout_centerVertical="true"
158 + android:layout_marginEnd="16dp"
159 + android:src="@drawable/cosmote_one" />
160 + </RelativeLayout>
161 +
134 <LinearLayout 162 <LinearLayout
135 android:id="@+id/rl_home_coupons" 163 android:id="@+id/rl_home_coupons"
136 android:layout_width="match_parent" 164 android:layout_width="match_parent"
137 android:layout_height="wrap_content" 165 android:layout_height="wrap_content"
138 - android:layout_below="@id/rl_driving" 166 + android:layout_below="@+id/rl_driving_history"
139 android:visibility="gone"> 167 android:visibility="gone">
140 168
141 <androidx.recyclerview.widget.RecyclerView 169 <androidx.recyclerview.widget.RecyclerView
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + xmlns:app="http://schemas.android.com/apk/res-auto"
4 + xmlns:tools="http://schemas.android.com/tools"
5 + android:layout_width="match_parent"
6 + android:layout_height="60dp"
7 + android:background="@color/grey_light"
8 + android:paddingVertical="8dp">
9 +
10 + <TextView
11 + android:id="@+id/tv_telematics_history_title"
12 + fontPath="fonts/BTCosmo-Bold.ttf"
13 + android:layout_width="wrap_content"
14 + android:layout_height="wrap_content"
15 + android:layout_marginStart="32dp"
16 + android:ellipsize="end"
17 + android:maxLines="1"
18 + android:text="TRIP ID"
19 + android:textColor="@color/cos_light_black"
20 + android:textSize="16sp"
21 + app:layout_constraintStart_toStartOf="parent"
22 + app:layout_constraintTop_toTopOf="parent" />
23 +
24 + <TextView
25 + android:id="@+id/tv_telematics_history_value"
26 + fontPath="fonts/BTCosmo-Regular.ttf"
27 + android:layout_width="wrap_content"
28 + android:layout_height="wrap_content"
29 + android:ellipsize="end"
30 + android:maxLines="1"
31 + android:textColor="@color/cos_light_black"
32 + android:textSize="16sp"
33 + app:layout_constraintBottom_toBottomOf="parent"
34 + app:layout_constraintEnd_toEndOf="@+id/tv_telematics_history_title"
35 + app:layout_constraintStart_toStartOf="@+id/tv_telematics_history_title"
36 + tools:text="1" />
37 +
38 + <ImageView
39 + android:id="@+id/iv_telematics_open"
40 + android:layout_width="48dp"
41 + android:layout_height="48dp"
42 + android:layout_marginStart="16dp"
43 + android:rotation="180"
44 + android:scaleType="centerInside"
45 + android:src="@drawable/ic_back"
46 + app:layout_constraintBottom_toBottomOf="parent"
47 + app:layout_constraintEnd_toEndOf="parent"
48 + app:layout_constraintTop_toTopOf="parent" />
49 +
50 + <TextView
51 + android:id="@+id/tv_telematics_history_date_title"
52 + fontPath="fonts/PeridotPE-Bold.ttf"
53 + android:layout_width="wrap_content"
54 + android:layout_height="wrap_content"
55 + android:layout_marginEnd="32dp"
56 + android:text="CREATED"
57 + android:textColor="@color/cos_light_black"
58 + android:textSize="16sp"
59 + app:layout_constraintEnd_toStartOf="@+id/iv_telematics_open"
60 + app:layout_constraintTop_toTopOf="parent" />
61 +
62 + <TextView
63 + android:id="@+id/tv_telematics_history_date_value"
64 + fontPath="fonts/PeridotPE-Regular.ttf"
65 + android:layout_width="wrap_content"
66 + android:layout_height="wrap_content"
67 + android:textColor="@color/cos_light_black"
68 + android:textSize="16sp"
69 + app:layout_constraintBottom_toBottomOf="parent"
70 + app:layout_constraintEnd_toEndOf="@+id/tv_telematics_history_date_title"
71 + app:layout_constraintStart_toStartOf="@+id/tv_telematics_history_date_title"
72 + tools:text="07/08/2023" />
73 +</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
...@@ -177,6 +177,8 @@ ...@@ -177,6 +177,8 @@
177 <string name="lbl_take_photo_decline">Άκυρο</string> 177 <string name="lbl_take_photo_decline">Άκυρο</string>
178 <string name="lbl_gps_enabled">Θέλετε να ενεργοποιήσετε το GPS;</string> 178 <string name="lbl_gps_enabled">Θέλετε να ενεργοποιήσετε το GPS;</string>
179 <string name="cos_telematics">Telematics Demo</string> 179 <string name="cos_telematics">Telematics Demo</string>
180 + <string name="cos_telematics_history">Telematics History</string>
181 + <string name="cos_telematics_metrics">Telematics Trip Metrics</string>
180 <string name="cos_dlg_start_trip">Start Trip</string> 182 <string name="cos_dlg_start_trip">Start Trip</string>
181 <string name="cos_dlg_stop_trip">Stop Trip</string> 183 <string name="cos_dlg_stop_trip">Stop Trip</string>
182 <string name="cos_dlg_no_internet_title">Δεν υπάρχει σύνδεση</string> 184 <string name="cos_dlg_no_internet_title">Δεν υπάρχει σύνδεση</string>
......