Panagiotis Triantafyllou

telematics demo ui

Showing 21 changed files with 355 additions and 112 deletions
...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { ...@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
36 public void onWarplyReady() { 36 public void onWarplyReady() {
37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { 37 if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 38 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
39 - .setGuid("7000070282"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910 39 + .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -3,6 +3,7 @@ package ly.warp.sdk.activities; ...@@ -3,6 +3,7 @@ package ly.warp.sdk.activities;
3 import android.Manifest; 3 import android.Manifest;
4 import android.app.Activity; 4 import android.app.Activity;
5 import android.content.Context; 5 import android.content.Context;
6 +import android.content.Intent;
6 import android.content.pm.PackageManager; 7 import android.content.pm.PackageManager;
7 import android.content.res.Configuration; 8 import android.content.res.Configuration;
8 import android.hardware.Sensor; 9 import android.hardware.Sensor;
...@@ -63,7 +64,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener ...@@ -63,7 +64,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
63 64
64 private ImageView mIvBack; 65 private ImageView mIvBack;
65 private boolean mIsTripStarted = false; 66 private boolean mIsTripStarted = false;
66 - private LinearLayout mLlTripButton, mLlTelematicsMain; 67 + private LinearLayout mLlTripButton, mLlTelematicsMain, mLlTelematicsHistory;
67 private TextView mTvTripButton, mTvSensorData, mTvVelocity, mTvAvgVelocity, mTvRecordsSaved, 68 private TextView mTvTripButton, mTvSensorData, mTvVelocity, mTvAvgVelocity, mTvRecordsSaved,
68 mTvOrientationCount, mTvTouchCount; 69 mTvOrientationCount, mTvTouchCount;
69 private SensorManager mSensorManager; 70 private SensorManager mSensorManager;
...@@ -123,6 +124,8 @@ public class TelematicsActivity extends Activity implements View.OnClickListener ...@@ -123,6 +124,8 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
123 mEtSampleTime = findViewById(R.id.et_save); 124 mEtSampleTime = findViewById(R.id.et_save);
124 mRlMainScroll = findViewById(R.id.rl_main_scroll); 125 mRlMainScroll = findViewById(R.id.rl_main_scroll);
125 mRlMainScroll.setOnTouchListener(mScrollTouchListener); 126 mRlMainScroll.setOnTouchListener(mScrollTouchListener);
127 + mLlTelematicsHistory = findViewById(R.id.ll_telematics_history);
128 + mLlTelematicsHistory.setOnClickListener(this);
126 129
127 locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 130 locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
128 previousLocation = null; 131 previousLocation = null;
...@@ -205,6 +208,11 @@ public class TelematicsActivity extends Activity implements View.OnClickListener ...@@ -205,6 +208,11 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
205 onBackPressed(); 208 onBackPressed();
206 return; 209 return;
207 } 210 }
211 + if (view.getId() == R.id.ll_telematics_history) {
212 + Intent intent = new Intent(this, TelematicsHistoryActivity.class);
213 + startActivity(intent);
214 + return;
215 + }
208 if (view.getId() == R.id.ll_activate_button) { 216 if (view.getId() == R.id.ll_activate_button) {
209 if (mIsTripStarted) { 217 if (mIsTripStarted) {
210 mEtLimit.setEnabled(true); 218 mEtLimit.setEnabled(true);
...@@ -503,15 +511,15 @@ public class TelematicsActivity extends Activity implements View.OnClickListener ...@@ -503,15 +511,15 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
503 } 511 }
504 512
505 //TODO: uncomment if needed to write to file 513 //TODO: uncomment if needed to write to file
506 - if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) 514 +// if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
507 - != PackageManager.PERMISSION_GRANTED) { 515 +// != PackageManager.PERMISSION_GRANTED) {
508 - ActivityCompat.requestPermissions(this, 516 +// ActivityCompat.requestPermissions(this,
509 - new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 517 +// new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
510 - PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE); 518 +// PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE);
511 - } else { 519 +// } else {
512 -// saveAccelerationDataToExternalStorage(jsonArray); 520 +// saveAccelerationDataToExternalStorage(jsonArray); //TODO: uncomment if needed to write to file
513 sendAccelerationDataToServer(jsonArray); 521 sendAccelerationDataToServer(jsonArray);
514 - } 522 +// }
515 } 523 }
516 524
517 private void saveAccelerationDataToExternalStorage(JSONArray jsonArray) { 525 private void saveAccelerationDataToExternalStorage(JSONArray jsonArray) {
......
...@@ -8,6 +8,7 @@ import android.view.View; ...@@ -8,6 +8,7 @@ import android.view.View;
8 import android.widget.ImageView; 8 import android.widget.ImageView;
9 import android.widget.LinearLayout; 9 import android.widget.LinearLayout;
10 10
11 +import androidx.recyclerview.widget.ConcatAdapter;
11 import androidx.recyclerview.widget.LinearLayoutManager; 12 import androidx.recyclerview.widget.LinearLayoutManager;
12 import androidx.recyclerview.widget.RecyclerView; 13 import androidx.recyclerview.widget.RecyclerView;
13 14
...@@ -21,6 +22,7 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; ...@@ -21,6 +22,7 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
21 import ly.warp.sdk.io.models.TelematicsHistory; 22 import ly.warp.sdk.io.models.TelematicsHistory;
22 import ly.warp.sdk.utils.managers.WarplyManager; 23 import ly.warp.sdk.utils.managers.WarplyManager;
23 import ly.warp.sdk.views.adapters.TelematicsHistoryAdapter; 24 import ly.warp.sdk.views.adapters.TelematicsHistoryAdapter;
25 +import ly.warp.sdk.views.adapters.TelematicsHistoryHeaderAdapter;
24 26
25 /** 27 /**
26 * Created by Panagiotis Triantafyllou on 07/Aug/2023. 28 * Created by Panagiotis Triantafyllou on 07/Aug/2023.
...@@ -39,6 +41,7 @@ public class TelematicsHistoryActivity extends Activity implements View.OnClickL ...@@ -39,6 +41,7 @@ public class TelematicsHistoryActivity extends Activity implements View.OnClickL
39 private LinearLayout mLlTelematicsHistoryMain; 41 private LinearLayout mLlTelematicsHistoryMain;
40 private ArrayList<TelematicsHistory> mTelematicsHistoryData = new ArrayList<>(); 42 private ArrayList<TelematicsHistory> mTelematicsHistoryData = new ArrayList<>();
41 private TelematicsHistoryAdapter mAdapterTelematicsHistory; 43 private TelematicsHistoryAdapter mAdapterTelematicsHistory;
44 + private TelematicsHistoryHeaderAdapter mAdapterTelematicsHistoryHeader;
42 private boolean mTelematicsHistoryItemPressed = false; 45 private boolean mTelematicsHistoryItemPressed = false;
43 private ImageView mIvClose; 46 private ImageView mIvClose;
44 47
...@@ -85,8 +88,10 @@ public class TelematicsHistoryActivity extends Activity implements View.OnClickL ...@@ -85,8 +88,10 @@ public class TelematicsHistoryActivity extends Activity implements View.OnClickL
85 private void initViews() { 88 private void initViews() {
86 if (mTelematicsHistoryData != null && mTelematicsHistoryData.size() > 0) { 89 if (mTelematicsHistoryData != null && mTelematicsHistoryData.size() > 0) {
87 mRvTripHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); 90 mRvTripHistory.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
91 + mAdapterTelematicsHistoryHeader = new TelematicsHistoryHeaderAdapter(this);
88 mAdapterTelematicsHistory = new TelematicsHistoryAdapter(this, mTelematicsHistoryData); 92 mAdapterTelematicsHistory = new TelematicsHistoryAdapter(this, mTelematicsHistoryData);
89 - mRvTripHistory.setAdapter(mAdapterTelematicsHistory); 93 + ConcatAdapter concatAdapter = new ConcatAdapter(mAdapterTelematicsHistoryHeader, mAdapterTelematicsHistory);
94 + mRvTripHistory.setAdapter(concatAdapter);
90 mAdapterTelematicsHistory.getPositionClicks() 95 mAdapterTelematicsHistory.getPositionClicks()
91 .doOnNext(historyItem -> { 96 .doOnNext(historyItem -> {
92 if (!mTelematicsHistoryItemPressed) { 97 if (!mTelematicsHistoryItemPressed) {
......
...@@ -8,15 +8,13 @@ import android.widget.ImageView; ...@@ -8,15 +8,13 @@ import android.widget.ImageView;
8 import android.widget.LinearLayout; 8 import android.widget.LinearLayout;
9 import android.widget.TextView; 9 import android.widget.TextView;
10 10
11 +import androidx.cardview.widget.CardView;
11 12
12 import com.google.android.material.snackbar.Snackbar; 13 import com.google.android.material.snackbar.Snackbar;
13 14
14 -import java.util.ArrayList;
15 -
16 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 15 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
17 import ly.warp.sdk.R; 16 import ly.warp.sdk.R;
18 import ly.warp.sdk.io.callbacks.CallbackReceiver; 17 import ly.warp.sdk.io.callbacks.CallbackReceiver;
19 -import ly.warp.sdk.io.models.TelematicsHistory;
20 import ly.warp.sdk.io.models.TripMetrics; 18 import ly.warp.sdk.io.models.TripMetrics;
21 import ly.warp.sdk.utils.managers.WarplyManager; 19 import ly.warp.sdk.utils.managers.WarplyManager;
22 20
...@@ -36,9 +34,9 @@ public class TelematicsMetricsActivity extends Activity implements View.OnClickL ...@@ -36,9 +34,9 @@ public class TelematicsMetricsActivity extends Activity implements View.OnClickL
36 private LinearLayout mLlTelematicsMetricsMain; 34 private LinearLayout mLlTelematicsMetricsMain;
37 private ImageView mIvClose, mIvRatePositive, mIvRateNegative; 35 private ImageView mIvClose, mIvRatePositive, mIvRateNegative;
38 private int mTripId = -1; 36 private int mTripId = -1;
39 - private TextView mTvAvgSpeed, mTvNumOfTrips, mTvAccScore, mTvFocusScore, mTvReadinessScore,
40 - mTvSmoothnessScore, mTVTotalKM;
41 private TripMetrics mTripMetrics; 37 private TripMetrics mTripMetrics;
38 + private CardView mCvAvgSpeed, mCvTrips, mCvAccScore, mCvFocusScore, mCvReadinessScore,
39 + mCvSmoothnessScore, mCvTotalDistance;
42 40
43 41
44 // =========================================================== 42 // ===========================================================
...@@ -53,17 +51,17 @@ public class TelematicsMetricsActivity extends Activity implements View.OnClickL ...@@ -53,17 +51,17 @@ public class TelematicsMetricsActivity extends Activity implements View.OnClickL
53 mLlTelematicsMetricsMain = findViewById(R.id.ll_telematics_metrics_main); 51 mLlTelematicsMetricsMain = findViewById(R.id.ll_telematics_metrics_main);
54 mIvClose = findViewById(R.id.iv_metrics_close); 52 mIvClose = findViewById(R.id.iv_metrics_close);
55 mIvClose.setOnClickListener(this); 53 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); 54 mIvRatePositive = findViewById(R.id.iv_rate_positive);
64 mIvRateNegative = findViewById(R.id.iv_rate_negative); 55 mIvRateNegative = findViewById(R.id.iv_rate_negative);
65 mIvRatePositive.setOnClickListener(this); 56 mIvRatePositive.setOnClickListener(this);
66 mIvRateNegative.setOnClickListener(this); 57 mIvRateNegative.setOnClickListener(this);
58 + mCvAvgSpeed = findViewById(R.id.ly_avg_speed);
59 + mCvTrips = findViewById(R.id.ly_trips);
60 + mCvAccScore = findViewById(R.id.ly_acc_score);
61 + mCvFocusScore = findViewById(R.id.ly_focus_score);
62 + mCvReadinessScore = findViewById(R.id.ly_readiness_score);
63 + mCvSmoothnessScore = findViewById(R.id.ly_smoothness_score);
64 + mCvTotalDistance = findViewById(R.id.ly_total_distance);
67 65
68 if (mTripId > -1) 66 if (mTripId > -1)
69 WarplyManager.getTripMetrics(mTripId, mTripMetricsCallback); 67 WarplyManager.getTripMetrics(mTripId, mTripMetricsCallback);
...@@ -101,13 +99,40 @@ public class TelematicsMetricsActivity extends Activity implements View.OnClickL ...@@ -101,13 +99,40 @@ public class TelematicsMetricsActivity extends Activity implements View.OnClickL
101 99
102 private void initViews() { 100 private void initViews() {
103 if (mTripMetrics != null) { 101 if (mTripMetrics != null) {
104 - mTvAvgSpeed.setText(String.valueOf(mTripMetrics.getAvgSpeed())); 102 + TextView mCvAvgSpeedText = mCvAvgSpeed.findViewById(R.id.tv_telematics_metric_title_value);
105 - mTvNumOfTrips.setText(String.valueOf(mTripMetrics.getNumOfTrips())); 103 + TextView mCvAvgSpeedSubtitleText = mCvAvgSpeed.findViewById(R.id.tv_telematics_metric_subtitle);
106 - mTvAccScore.setText(String.valueOf(mTripMetrics.getOverallScore())); 104 + mCvAvgSpeedText.setText(String.valueOf(mTripMetrics.getAvgSpeed()));
107 - mTvFocusScore.setText(String.valueOf(mTripMetrics.getOverallFocus())); 105 + mCvAvgSpeedSubtitleText.setText("Average Speed");
108 - mTvReadinessScore.setText(String.valueOf(mTripMetrics.getReadinessScore())); 106 +
109 - mTvSmoothnessScore.setText(String.valueOf(mTripMetrics.getSmoothnessScore())); 107 + TextView mCvTripsText = mCvTrips.findViewById(R.id.tv_telematics_metric_title_value);
110 - mTVTotalKM.setText(String.valueOf(mTripMetrics.getTotalKM())); 108 + TextView mCvTripsSubtitleText = mCvTrips.findViewById(R.id.tv_telematics_metric_subtitle);
109 + mCvTripsText.setText(String.valueOf(mTripMetrics.getNumOfTrips()));
110 + mCvTripsSubtitleText.setText("Trips");
111 +
112 + TextView mCvAccScoreText = mCvAccScore.findViewById(R.id.tv_telematics_metric_title_value);
113 + TextView mCvAccScoreSubtitleText = mCvAccScore.findViewById(R.id.tv_telematics_metric_subtitle);
114 + mCvAccScoreText.setText(String.valueOf(mTripMetrics.getOverallScore()));
115 + mCvAccScoreSubtitleText.setText("Acceleration Score");
116 +
117 + TextView mCvFocusScoreText = mCvFocusScore.findViewById(R.id.tv_telematics_metric_title_value);
118 + TextView mCvFocusScoreSubtitleText = mCvFocusScore.findViewById(R.id.tv_telematics_metric_subtitle);
119 + mCvFocusScoreText.setText(String.valueOf(mTripMetrics.getOverallFocus()));
120 + mCvFocusScoreSubtitleText.setText("Focus Score");
121 +
122 + TextView mCvReadinessScoreText = mCvReadinessScore.findViewById(R.id.tv_telematics_metric_title_value);
123 + TextView mCvReadinessScoreSubtitleText = mCvReadinessScore.findViewById(R.id.tv_telematics_metric_subtitle);
124 + mCvReadinessScoreText.setText(String.valueOf(mTripMetrics.getReadinessScore()));
125 + mCvReadinessScoreSubtitleText.setText("Readiness Score");
126 +
127 + TextView mCvSmoothnessScoreText = mCvSmoothnessScore.findViewById(R.id.tv_telematics_metric_title_value);
128 + TextView mCvSmoothnessScoreSubtitleText = mCvSmoothnessScore.findViewById(R.id.tv_telematics_metric_subtitle);
129 + mCvSmoothnessScoreText.setText(String.valueOf(mTripMetrics.getSmoothnessScore()));
130 + mCvSmoothnessScoreSubtitleText.setText("Smoothness Score");
131 +
132 + TextView mCvTotalDistanceText = mCvTotalDistance.findViewById(R.id.tv_telematics_metric_title_value);
133 + TextView mCvTotalDistanceSubtitleText = mCvTotalDistance.findViewById(R.id.tv_telematics_metric_subtitle);
134 + mCvTotalDistanceText.setText(String.valueOf(mTripMetrics.getTotalKM()));
135 + mCvTotalDistanceSubtitleText.setText("Total Distance");
111 } 136 }
112 } 137 }
113 138
......
1 package ly.warp.sdk.views.adapters; 1 package ly.warp.sdk.views.adapters;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 -import android.text.TextUtils;
5 import android.view.LayoutInflater; 4 import android.view.LayoutInflater;
6 import android.view.View; 5 import android.view.View;
7 import android.view.ViewGroup; 6 import android.view.ViewGroup;
8 -import android.widget.ImageView;
9 import android.widget.TextView; 7 import android.widget.TextView;
10 8
11 -import androidx.core.content.ContextCompat;
12 -import androidx.core.text.HtmlCompat;
13 import androidx.recyclerview.widget.RecyclerView; 9 import androidx.recyclerview.widget.RecyclerView;
14 10
15 -import com.bumptech.glide.Glide;
16 -import com.bumptech.glide.load.engine.DiskCacheStrategy;
17 -
18 import java.text.ParseException; 11 import java.text.ParseException;
19 import java.text.SimpleDateFormat; 12 import java.text.SimpleDateFormat;
20 import java.util.ArrayList; 13 import java.util.ArrayList;
21 import java.util.Date; 14 import java.util.Date;
22 import java.util.Locale; 15 import java.util.Locale;
23 -import java.util.concurrent.TimeUnit;
24 16
25 import io.reactivex.Observable; 17 import io.reactivex.Observable;
26 import io.reactivex.subjects.PublishSubject; 18 import io.reactivex.subjects.PublishSubject;
27 import ly.warp.sdk.R; 19 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; 20 import ly.warp.sdk.io.models.TelematicsHistory;
31 21
32 -public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHistoryAdapter.CouponsetViewHolder> { 22 +public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHistoryAdapter.TelematicsViewHolder> {
33 23
34 private Context mContext; 24 private Context mContext;
35 private ArrayList<TelematicsHistory> mHistory; 25 private ArrayList<TelematicsHistory> mHistory;
...@@ -40,10 +30,10 @@ public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHis ...@@ -40,10 +30,10 @@ public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHis
40 this.mHistory = history; 30 this.mHistory = history;
41 } 31 }
42 32
43 - public class CouponsetViewHolder extends RecyclerView.ViewHolder { 33 + public class TelematicsViewHolder extends RecyclerView.ViewHolder {
44 private TextView tvHistoryId, tvHistoryDate; 34 private TextView tvHistoryId, tvHistoryDate;
45 35
46 - public CouponsetViewHolder(View view) { 36 + public TelematicsViewHolder(View view) {
47 super(view); 37 super(view);
48 tvHistoryId = view.findViewById(R.id.tv_telematics_history_value); 38 tvHistoryId = view.findViewById(R.id.tv_telematics_history_value);
49 tvHistoryDate = view.findViewById(R.id.tv_telematics_history_date_value); 39 tvHistoryDate = view.findViewById(R.id.tv_telematics_history_date_value);
...@@ -69,21 +59,21 @@ public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHis ...@@ -69,21 +59,21 @@ public class TelematicsHistoryAdapter extends RecyclerView.Adapter<TelematicsHis
69 } 59 }
70 60
71 @Override 61 @Override
72 - public CouponsetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 62 + public TelematicsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
73 View itemView; 63 View itemView;
74 itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.telematics_history_layout, parent, false); 64 itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.telematics_history_layout, parent, false);
75 - return new CouponsetViewHolder(itemView); 65 + return new TelematicsViewHolder(itemView);
76 } 66 }
77 67
78 @Override 68 @Override
79 - public void onBindViewHolder(final CouponsetViewHolder holder, int position) { 69 + public void onBindViewHolder(final TelematicsViewHolder holder, int position) {
80 TelematicsHistory historyItem = mHistory.get(position); 70 TelematicsHistory historyItem = mHistory.get(position);
81 71
82 - if (position % 2 == 0) { 72 +// if (position % 2 == 0) {
83 - holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.grey_light)); 73 +// holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.grey_light));
84 - } else { 74 +// } else {
85 - holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.white)); 75 +// holder.itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.white));
86 - } 76 +// }
87 77
88 if (historyItem != null) { 78 if (historyItem != null) {
89 holder.tvHistoryId.setText(String.valueOf(historyItem.getTripId())); 79 holder.tvHistoryId.setText(String.valueOf(historyItem.getTripId()));
......
1 +package ly.warp.sdk.views.adapters;
2 +
3 +import android.content.Context;
4 +import android.view.LayoutInflater;
5 +import android.view.View;
6 +import android.view.ViewGroup;
7 +
8 +import androidx.recyclerview.widget.RecyclerView;
9 +
10 +import ly.warp.sdk.R;
11 +
12 +public class TelematicsHistoryHeaderAdapter extends RecyclerView.Adapter<TelematicsHistoryHeaderAdapter.TelematicsHeaderViewHolder> {
13 +
14 + private Context mContext;
15 +
16 + public TelematicsHistoryHeaderAdapter(Context mContext) {
17 + this.mContext = mContext;
18 + }
19 +
20 + public class TelematicsHeaderViewHolder extends RecyclerView.ViewHolder {
21 + public TelematicsHeaderViewHolder(View view) {
22 + super(view);
23 + }
24 + }
25 +
26 + @Override
27 + public int getItemCount() {
28 + return 1;
29 + }
30 +
31 + @Override
32 + public TelematicsHeaderViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33 + View itemView;
34 + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.telematics_history_header_layout, parent, false);
35 + return new TelematicsHeaderViewHolder(itemView);
36 + }
37 +
38 + @Override
39 + public void onBindViewHolder(final TelematicsHeaderViewHolder holder, int position) {
40 +
41 + }
42 +}
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 </androidx.constraintlayout.widget.ConstraintLayout> 40 </androidx.constraintlayout.widget.ConstraintLayout>
41 41
42 <ScrollView 42 <ScrollView
43 - android:layout_width="wrap_content" 43 + android:layout_width="match_parent"
44 android:layout_height="match_parent"> 44 android:layout_height="match_parent">
45 45
46 <LinearLayout 46 <LinearLayout
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
54 android:layout_width="match_parent" 54 android:layout_width="match_parent"
55 android:layout_height="match_parent" 55 android:layout_height="match_parent"
56 android:background="@color/cos_light_grey3" 56 android:background="@color/cos_light_grey3"
57 - android:gravity="center_horizontal"> 57 + android:gravity="center_horizontal"
58 + android:visibility="gone">
58 59
59 <TextView 60 <TextView
60 android:id="@+id/tv_sensor_data_label" 61 android:id="@+id/tv_sensor_data_label"
...@@ -211,6 +212,7 @@ ...@@ -211,6 +212,7 @@
211 android:layout_marginTop="24dp" 212 android:layout_marginTop="24dp"
212 android:hint="Cut off in m/s^2" 213 android:hint="Cut off in m/s^2"
213 android:inputType="phone" 214 android:inputType="phone"
215 + android:text="50"
214 android:textColor="@color/blue_dark" 216 android:textColor="@color/blue_dark"
215 android:textSize="16sp" /> 217 android:textSize="16sp" />
216 218
...@@ -225,10 +227,119 @@ ...@@ -225,10 +227,119 @@
225 android:hint="Sample Interval in ms" 227 android:hint="Sample Interval in ms"
226 android:inputType="phone" 228 android:inputType="phone"
227 android:paddingEnd="24dp" 229 android:paddingEnd="24dp"
230 + android:text="2000"
228 android:textColor="@color/blue_dark" 231 android:textColor="@color/blue_dark"
229 android:textSize="16sp" /> 232 android:textSize="16sp" />
230 </RelativeLayout> 233 </RelativeLayout>
231 234
235 + <androidx.cardview.widget.CardView
236 + android:layout_width="match_parent"
237 + android:layout_height="wrap_content"
238 + android:layout_marginHorizontal="8dp"
239 + android:layout_marginTop="48dp"
240 + app:cardCornerRadius="4dp"
241 + app:cardElevation="15dp">
242 +
243 + <androidx.constraintlayout.widget.ConstraintLayout
244 + android:layout_width="match_parent"
245 + android:layout_height="match_parent"
246 + android:layout_marginHorizontal="24dp"
247 + android:layout_marginVertical="16dp"
248 + android:background="@color/white">
249 +
250 + <androidx.constraintlayout.widget.Guideline
251 + android:id="@+id/gl_vertical_60_percent"
252 + android:layout_width="wrap_content"
253 + android:layout_height="wrap_content"
254 + android:orientation="vertical"
255 + app:layout_constraintGuide_percent="0.6" />
256 +
257 + <ImageView
258 + android:id="@+id/iv_insurance_logo"
259 + android:layout_width="wrap_content"
260 + android:layout_height="wrap_content"
261 + android:src="@drawable/cosmote_insurance_logo"
262 + app:layout_constraintStart_toStartOf="parent"
263 + app:layout_constraintTop_toTopOf="parent" />
264 +
265 + <TextView
266 + android:id="@+id/tv_driving_sum"
267 + fontPath="fonts/pf_square_sans_pro_bold.ttf"
268 + android:layout_width="0dp"
269 + android:layout_height="wrap_content"
270 + android:layout_marginTop="8dp"
271 + android:text="@string/cos_telematics_sum"
272 + android:textColor="@color/cos_dark_blue"
273 + android:textSize="22sp"
274 + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_60_percent"
275 + app:layout_constraintStart_toStartOf="@+id/iv_insurance_logo"
276 + app:layout_constraintTop_toBottomOf="@+id/iv_insurance_logo" />
277 +
278 + <TextView
279 + android:id="@+id/tv_driving_sum_subtitle"
280 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
281 + android:layout_width="0dp"
282 + android:layout_height="wrap_content"
283 + android:layout_marginTop="8dp"
284 + android:text="@string/cos_telematics_sum_subtitle"
285 + android:textColor="@color/cos_dark_blue"
286 + android:textSize="16sp"
287 + app:layout_constraintEnd_toStartOf="@+id/gl_vertical_60_percent"
288 + app:layout_constraintStart_toStartOf="@+id/tv_driving_sum"
289 + app:layout_constraintTop_toBottomOf="@+id/tv_driving_sum" />
290 +
291 + <ImageView
292 + android:layout_width="100dp"
293 + android:layout_height="100dp"
294 + android:src="@drawable/telematics_score"
295 + app:layout_constraintBottom_toBottomOf="@+id/tv_driving_sum_subtitle"
296 + app:layout_constraintEnd_toEndOf="parent"
297 + app:layout_constraintTop_toTopOf="@+id/iv_insurance_logo" />
298 +
299 + <View
300 + android:id="@+id/v_seperator"
301 + android:layout_width="match_parent"
302 + android:layout_height="1dp"
303 + android:layout_marginTop="16dp"
304 + android:background="@color/cos_grey_line_tr"
305 + app:layout_constraintEnd_toEndOf="parent"
306 + app:layout_constraintStart_toStartOf="parent"
307 + app:layout_constraintTop_toBottomOf="@+id/tv_driving_sum_subtitle" />
308 +
309 + <LinearLayout
310 + android:id="@+id/ll_telematics_history"
311 + android:layout_width="140dp"
312 + android:layout_height="45dp"
313 + android:layout_gravity="center"
314 + android:layout_marginTop="16dp"
315 + android:background="@drawable/selector_button_grey"
316 + android:gravity="center"
317 + android:orientation="horizontal"
318 + android:paddingVertical="8dp"
319 + app:layout_constraintStart_toStartOf="@+id/v_seperator"
320 + app:layout_constraintTop_toBottomOf="@+id/v_seperator">
321 +
322 + <TextView
323 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
324 + android:layout_width="wrap_content"
325 + android:layout_height="wrap_content"
326 + android:gravity="center"
327 + android:includeFontPadding="false"
328 + android:text="@string/cos_telematics_history"
329 + android:textColor="@color/cos_green6"
330 + android:textSize="16sp" />
331 + </LinearLayout>
332 +
333 + <ImageView
334 + android:layout_width="110dp"
335 + android:layout_height="60dp"
336 + android:src="@drawable/telematics_score_rating"
337 + app:layout_constraintBottom_toBottomOf="@+id/ll_telematics_history"
338 + app:layout_constraintEnd_toEndOf="@+id/v_seperator"
339 + app:layout_constraintTop_toTopOf="@+id/ll_telematics_history" />
340 + </androidx.constraintlayout.widget.ConstraintLayout>
341 + </androidx.cardview.widget.CardView>
342 +
232 <LinearLayout 343 <LinearLayout
233 android:id="@+id/ll_activate_button" 344 android:id="@+id/ll_activate_button"
234 android:layout_width="match_parent" 345 android:layout_width="match_parent"
...@@ -236,19 +347,19 @@ ...@@ -236,19 +347,19 @@
236 android:layout_below="@+id/et_acceleration" 347 android:layout_below="@+id/et_acceleration"
237 android:layout_marginHorizontal="24dp" 348 android:layout_marginHorizontal="24dp"
238 android:layout_marginVertical="56dp" 349 android:layout_marginVertical="56dp"
239 - android:background="@drawable/selector_button_green_border" 350 + android:background="@drawable/selector_button_grey"
240 android:gravity="center" 351 android:gravity="center"
241 android:orientation="horizontal"> 352 android:orientation="horizontal">
242 353
243 <TextView 354 <TextView
244 android:id="@+id/tv_trip_button" 355 android:id="@+id/tv_trip_button"
245 - fontPath="fonts/PeridotPE-SemiBold.ttf" 356 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
246 android:layout_width="wrap_content" 357 android:layout_width="wrap_content"
247 android:layout_height="wrap_content" 358 android:layout_height="wrap_content"
248 android:gravity="center" 359 android:gravity="center"
249 android:includeFontPadding="false" 360 android:includeFontPadding="false"
250 android:text="@string/cos_dlg_start_trip" 361 android:text="@string/cos_dlg_start_trip"
251 - android:textColor="@color/blue_dark" 362 + android:textColor="@color/cos_green6"
252 android:textSize="16sp" /> 363 android:textSize="16sp" />
253 </LinearLayout> 364 </LinearLayout>
254 </LinearLayout> 365 </LinearLayout>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 android:id="@+id/ll_telematics_history_main" 4 android:id="@+id/ll_telematics_history_main"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 android:layout_height="match_parent" 6 android:layout_height="match_parent"
7 - android:background="@color/white" 7 + android:background="@color/cos_light_grey3"
8 android:orientation="vertical"> 8 android:orientation="vertical">
9 9
10 <androidx.constraintlayout.widget.ConstraintLayout 10 <androidx.constraintlayout.widget.ConstraintLayout
...@@ -46,6 +46,6 @@ ...@@ -46,6 +46,6 @@
46 android:clipToPadding="false" 46 android:clipToPadding="false"
47 android:orientation="vertical" 47 android:orientation="vertical"
48 android:overScrollMode="never" 48 android:overScrollMode="never"
49 - android:paddingVertical="16dp" 49 + android:paddingBottom="16dp"
50 android:scrollbars="none" /> 50 android:scrollbars="none" />
51 </LinearLayout> 51 </LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
138 android:layout_below="@+id/rl_driving" 138 android:layout_below="@+id/rl_driving"
139 android:layout_marginHorizontal="8dp" 139 android:layout_marginHorizontal="8dp"
140 android:layout_marginBottom="16dp" 140 android:layout_marginBottom="16dp"
141 + android:visibility="gone"
141 android:background="@drawable/shape_cos_white"> 142 android:background="@drawable/shape_cos_white">
142 143
143 <TextView 144 <TextView
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="255dp"
5 + android:layout_marginBottom="8dp">
6 +
7 + <ImageView
8 + android:layout_width="match_parent"
9 + android:layout_height="match_parent"
10 + android:scaleType="centerCrop"
11 + android:src="@drawable/telematics_history_header" />
12 +</LinearLayout>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 +<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 xmlns:tools="http://schemas.android.com/tools" 4 xmlns:tools="http://schemas.android.com/tools"
5 android:layout_width="match_parent" 5 android:layout_width="match_parent"
6 - android:layout_height="60dp" 6 + android:layout_height="100dp"
7 - android:background="@color/grey_light" 7 + android:layout_marginHorizontal="8dp"
8 - android:paddingVertical="8dp"> 8 + android:layout_marginTop="16dp"
9 + app:cardCornerRadius="4dp"
10 + app:cardElevation="5dp">
9 11
10 - <TextView 12 + <androidx.constraintlayout.widget.ConstraintLayout
11 - android:id="@+id/tv_telematics_history_title" 13 + android:layout_width="match_parent"
12 - fontPath="fonts/BTCosmo-Bold.ttf" 14 + android:layout_height="match_parent"
15 + android:background="@color/white">
16 +
17 + <LinearLayout
13 android:layout_width="wrap_content" 18 android:layout_width="wrap_content"
14 android:layout_height="wrap_content" 19 android:layout_height="wrap_content"
15 android:layout_marginStart="32dp" 20 android:layout_marginStart="32dp"
16 - android:ellipsize="end" 21 + android:gravity="center_horizontal"
17 - android:maxLines="1" 22 + android:orientation="vertical"
18 - android:text="TRIP ID" 23 + app:layout_constraintBottom_toBottomOf="parent"
19 - android:textColor="@color/cos_light_black"
20 - android:textSize="16sp"
21 app:layout_constraintStart_toStartOf="parent" 24 app:layout_constraintStart_toStartOf="parent"
22 - app:layout_constraintTop_toTopOf="parent" /> 25 + app:layout_constraintTop_toTopOf="parent">
23 26
24 <TextView 27 <TextView
25 - android:id="@+id/tv_telematics_history_value" 28 + android:id="@+id/tv_telematics_history_title"
26 - fontPath="fonts/BTCosmo-Regular.ttf" 29 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
27 android:layout_width="wrap_content" 30 android:layout_width="wrap_content"
28 android:layout_height="wrap_content" 31 android:layout_height="wrap_content"
29 - android:ellipsize="end" 32 + android:text="TRIP ID"
30 - android:maxLines="1" 33 + android:textColor="@color/grey"
31 - android:textColor="@color/cos_light_black" 34 + android:textSize="18sp" />
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 35
50 <TextView 36 <TextView
51 - android:id="@+id/tv_telematics_history_date_title" 37 + android:id="@+id/tv_telematics_history_value"
52 - fontPath="fonts/PeridotPE-Bold.ttf" 38 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
53 android:layout_width="wrap_content" 39 android:layout_width="wrap_content"
54 android:layout_height="wrap_content" 40 android:layout_height="wrap_content"
55 - android:layout_marginEnd="32dp" 41 + android:textColor="@color/grey"
56 - android:text="CREATED" 42 + android:textSize="18sp"
57 - android:textColor="@color/cos_light_black" 43 + tools:text="1000" />
58 - android:textSize="16sp" 44 + </LinearLayout>
59 - app:layout_constraintEnd_toStartOf="@+id/iv_telematics_open"
60 - app:layout_constraintTop_toTopOf="parent" />
61 45
62 <TextView 46 <TextView
63 android:id="@+id/tv_telematics_history_date_value" 47 android:id="@+id/tv_telematics_history_date_value"
64 - fontPath="fonts/PeridotPE-Regular.ttf" 48 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
65 android:layout_width="wrap_content" 49 android:layout_width="wrap_content"
66 android:layout_height="wrap_content" 50 android:layout_height="wrap_content"
67 - android:textColor="@color/cos_light_black" 51 + android:layout_marginEnd="32dp"
68 - android:textSize="16sp" 52 + android:textColor="@color/grey"
53 + android:textSize="18sp"
69 app:layout_constraintBottom_toBottomOf="parent" 54 app:layout_constraintBottom_toBottomOf="parent"
70 - app:layout_constraintEnd_toEndOf="@+id/tv_telematics_history_date_title" 55 + app:layout_constraintEnd_toEndOf="parent"
71 - app:layout_constraintStart_toStartOf="@+id/tv_telematics_history_date_title" 56 + app:layout_constraintTop_toTopOf="parent"
72 tools:text="07/08/2023" /> 57 tools:text="07/08/2023" />
73 -</androidx.constraintlayout.widget.ConstraintLayout>
...\ No newline at end of file ...\ No newline at end of file
58 + </androidx.constraintlayout.widget.ConstraintLayout>
59 +</androidx.cardview.widget.CardView>
...\ No newline at end of file ...\ No newline at end of file
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<androidx.cardview.widget.CardView 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="100dp"
7 + android:layout_gravity="center"
8 + app:cardCornerRadius="4dp"
9 + app:cardElevation="5dp">
10 +
11 + <androidx.constraintlayout.widget.ConstraintLayout
12 + android:layout_width="match_parent"
13 + android:layout_height="match_parent"
14 + android:background="@color/white">
15 +
16 + <LinearLayout
17 + android:layout_width="0dp"
18 + android:layout_height="wrap_content"
19 + android:layout_marginTop="16dp"
20 + android:gravity="center_horizontal"
21 + android:paddingHorizontal="8dp"
22 + app:layout_constraintEnd_toEndOf="parent"
23 + app:layout_constraintStart_toStartOf="parent"
24 + app:layout_constraintTop_toTopOf="parent">
25 +
26 + <TextView
27 + android:id="@+id/tv_telematics_metric_title_value"
28 + fontPath="fonts/pf_square_sans_pro_bold.ttf"
29 + android:layout_width="wrap_content"
30 + android:layout_height="wrap_content"
31 + android:textColor="@color/grey"
32 + android:textSize="22sp"
33 + tools:text="52" />
34 +
35 + <TextView
36 + android:id="@+id/tv_telematics_metric_title"
37 + fontPath="fonts/pf_square_sans_pro_regular.ttf"
38 + android:layout_width="wrap_content"
39 + android:layout_height="wrap_content"
40 + android:textColor="@color/grey"
41 + android:textSize="18sp"
42 + tools:text="km/h" />
43 + </LinearLayout>
44 +
45 + <TextView
46 + android:id="@+id/tv_telematics_metric_subtitle"
47 + fontPath="fonts/pf_square_sans_pro_medium.ttf"
48 + android:layout_width="wrap_content"
49 + android:layout_height="wrap_content"
50 + android:layout_marginBottom="16dp"
51 + android:textColor="@color/grey"
52 + android:textSize="18sp"
53 + app:layout_constraintBottom_toBottomOf="parent"
54 + app:layout_constraintEnd_toEndOf="parent"
55 + app:layout_constraintStart_toStartOf="parent"
56 + tools:text="Average km/h" />
57 + </androidx.constraintlayout.widget.ConstraintLayout>
58 +</androidx.cardview.widget.CardView>
...\ No newline at end of file ...\ No newline at end of file
...@@ -74,4 +74,5 @@ ...@@ -74,4 +74,5 @@
74 <color name="cos_grey_dark2">#32485A</color> 74 <color name="cos_grey_dark2">#32485A</color>
75 <color name="cos_blue6">#004B87</color> 75 <color name="cos_blue6">#004B87</color>
76 <color name="cos_skyblue4">#B8E0EF</color> 76 <color name="cos_skyblue4">#B8E0EF</color>
77 + <color name="cos_grey_line_tr">#40A9A9A9</color>
77 </resources> 78 </resources>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -176,13 +176,17 @@ ...@@ -176,13 +176,17 @@
176 <string name="lbl_take_photo_accept">Οκ</string> 176 <string name="lbl_take_photo_accept">Οκ</string>
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">Safe Driving</string>
180 - <string name="cos_telematics_history">Telematics History</string> 180 + <string name="cos_telematics_metrics">Ανάλυση</string>
181 - <string name="cos_telematics_metrics">Telematics Trip Metrics</string> 181 + <string name="cos_dlg_start_trip">Έναρξη</string>
182 - <string name="cos_dlg_start_trip">Start Trip</string> 182 + <string name="cos_dlg_stop_trip">Παύση</string>
183 - <string name="cos_dlg_stop_trip">Stop Trip</string>
184 <string name="cos_dlg_no_internet_title">Δεν υπάρχει σύνδεση</string> 183 <string name="cos_dlg_no_internet_title">Δεν υπάρχει σύνδεση</string>
185 <string name="cos_dlg_no_internet_subtitle">Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.</string> 184 <string name="cos_dlg_no_internet_subtitle">Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.</string>
185 + <string name="cos_telematics_sum">Συνολική Επίδοση Οδήγησης</string>
186 + <string name="cos_telematics_sum_subtitle">Βρίσκεστε στο top 65% των οδηγών</string>
187 + <string name="cos_telematics_history">Ιστορικό</string>
188 + <string name="cos_telematics_history_analysis_title">Ανάλυση παραμέτρων ασφαλούς οδήγησης</string>
189 + <string name="cos_telematics_history_analysis_rate">Αξιολογήστε την ανάλυση</string>
186 190
187 <string-array name="coupons_array"> 191 <string-array name="coupons_array">
188 <item>Κουπόνια</item> 192 <item>Κουπόνια</item>
......