Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2023-06-27 17:27:42 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ec14fc95acd60b904676240e22fa1ce8d82abc27
ec14fc95
1 parent
bce1f027
telematics
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
625 additions
and
28 deletions
.idea/deploymentTargetDropDown.xml
app/src/main/AndroidManifest.xml
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelematicsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
warply_android_sdk/src/main/res/layout/activity_telematics.xml
warply_android_sdk/src/main/res/layout/fragment_home.xml
warply_android_sdk/src/main/res/values/strings.xml
.idea/deploymentTargetDropDown.xml
0 → 100644
View file @
ec14fc9
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"deploymentTargetDropDown"
>
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type
value=
"RUNNING_DEVICE_TARGET"
/>
<deviceKey>
<Key>
<type
value=
"SERIAL_NUMBER"
/>
<value
value=
"R58M5262DCB"
/>
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2023-06-27T13:21:52.853768900Z"
/>
</component>
</project>
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
ec14fc9
...
...
@@ -3,6 +3,7 @@
package=
"warp.ly.android_sdk"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- Restrict Tablets -->
<!-- <supports-screens-->
...
...
@@ -23,6 +24,7 @@
android:label=
"@string/app_name"
android:largeHeap=
"true"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:requestLegacyExternalStorage=
"true"
android:theme=
"@style/AppTheme"
>
<meta-data
android:name=
"com.google.android.geo.API_KEY"
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
ec14fc9
...
...
@@ -66,6 +66,12 @@
android:theme=
"@style/SDKAppTheme"
/>
<activity
android:name=
"ly.warp.sdk.activities.TelematicsActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
android:theme=
"@style/SDKAppTheme"
/>
<activity
android:name=
"ly.warp.sdk.activities.GiftsForYouActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelematicsActivity.java
0 → 100644
View file @
ec14fc9
package
ly
.
warp
.
sdk
.
activities
;
import
android.Manifest
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.pm.PackageManager
;
import
android.hardware.Sensor
;
import
android.hardware.SensorEvent
;
import
android.hardware.SensorEventListener
;
import
android.hardware.SensorManager
;
import
android.location.Location
;
import
android.location.LocationListener
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
com.google.android.material.snackbar.Snackbar
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
/**
* Created by Panagiotis Triantafyllou on 26/June/2023.
*/
public
class
TelematicsActivity
extends
Activity
implements
View
.
OnClickListener
,
SensorEventListener
,
LocationListener
{
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private
ImageView
mIvBack
;
private
boolean
mIsTripStarted
=
false
;
private
LinearLayout
mLlTripButton
,
mLlTelematicsMain
;
private
TextView
mTvTripButton
,
mTvSensorData
,
mTvVelocity
,
mTvAvgVelocity
,
mTvRecordsSaved
;
private
SensorManager
mSensorManager
;
private
Sensor
mSensor
;
private
Handler
mHandler
,
mLoctionHandler
;
private
Runnable
mRunnable
,
mLocationRunnable
;
private
long
lastUpdate
=
0
;
private
float
lastX
,
lastY
,
lastZ
;
private
float
velocity
=
0
;
private
ArrayList
<
JSONObject
>
mAccelerationTimestamps
=
new
ArrayList
<>();
float
mAcceleration
=
0
;
private
static
final
float
ALPHA
=
0.8f
;
// Filter factor
private
static
final
float
STOP_THRESHOLD
=
8.0f
;
// Stop threshold in m/s²
private
static
final
int
PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE
=
4000
;
private
static
final
int
PERMISSION_REQUEST_ACCESS_FINE_LOCATION
=
4001
;
JSONArray
jsonArray
=
new
JSONArray
();
private
LocationManager
locationManager
;
private
static
final
int
LOCATION_UPDATE_INTERVAL
=
5000
;
double
mLatitude
=
0
;
double
mLongitude
=
0
;
// Radius of the Earth in meters
private
static
final
double
EARTH_RADIUS
=
6371000.0
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_KEEP_SCREEN_ON
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_telematics
);
mIvBack
=
findViewById
(
R
.
id
.
iv_telematics_close
);
mLlTripButton
=
findViewById
(
R
.
id
.
ll_activate_button
);
mLlTripButton
.
setOnClickListener
(
this
);
mTvTripButton
=
findViewById
(
R
.
id
.
tv_trip_button
);
mLlTelematicsMain
=
findViewById
(
R
.
id
.
ll_telematics_main
);
mTvSensorData
=
findViewById
(
R
.
id
.
tv_sensor_data
);
mTvVelocity
=
findViewById
(
R
.
id
.
tv_velocity
);
mTvAvgVelocity
=
findViewById
(
R
.
id
.
tv_avg
);
mTvRecordsSaved
=
findViewById
(
R
.
id
.
tv_records
);
mIvBack
.
setOnClickListener
(
this
);
locationManager
=
(
LocationManager
)
getSystemService
(
Context
.
LOCATION_SERVICE
);
initViews
();
}
@Override
public
void
onResume
()
{
super
.
onResume
();
requestLocationUpdates
();
// WarplyAnalyticsManager.logTrackersEvent(this, "screen", "TelematicsActivity");
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
if
(
mIsTripStarted
)
unregisterStepSensor
();
stopLocationUpdates
();
}
@Override
public
void
onSensorChanged
(
SensorEvent
sensorEvent
)
{
mTvSensorData
.
setText
(
Arrays
.
toString
(
sensorEvent
.
values
));
float
currentX
=
sensorEvent
.
values
[
0
];
float
currentY
=
sensorEvent
.
values
[
1
];
float
currentZ
=
sensorEvent
.
values
[
2
];
long
currentTime
=
System
.
currentTimeMillis
();
long
timeDifference
=
currentTime
-
lastUpdate
;
lastUpdate
=
currentTime
;
float
time
=
timeDifference
/
1000.0f
;
// Convert time difference to seconds
// Apply low-pass filter
float
filteredX
=
ALPHA
*
lastX
+
(
1
-
ALPHA
)
*
currentX
;
float
filteredY
=
ALPHA
*
lastY
+
(
1
-
ALPHA
)
*
currentY
;
float
filteredZ
=
ALPHA
*
lastZ
+
(
1
-
ALPHA
)
*
currentZ
;
// Calculate acceleration in m/s² using filtered values
float
accelerationX
=
(
filteredX
-
lastX
)
/
time
;
float
accelerationY
=
(
filteredY
-
lastY
)
/
time
;
float
accelerationZ
=
(
filteredZ
-
lastZ
)
/
time
;
// Calculate total acceleration
float
acceleration
=
(
float
)
Math
.
sqrt
(
accelerationX
*
accelerationX
+
accelerationY
*
accelerationY
+
accelerationZ
*
accelerationZ
);
// If acceleration is below the stop threshold, assume we are in a stop
if
(
acceleration
<
STOP_THRESHOLD
)
{
velocity
=
0
;
}
else
{
// Update velocity
velocity
=
acceleration
*
time
;
}
// Convert velocity to km/h
mAcceleration
=
velocity
*
3.6f
;
// Convert to km/h
mTvVelocity
.
setText
(
String
.
format
(
"%.1f"
,
mAcceleration
)
+
" km/h"
);
// Update last values
lastX
=
filteredX
;
lastY
=
filteredY
;
lastZ
=
filteredZ
;
}
@Override
public
void
onAccuracyChanged
(
Sensor
sensor
,
int
i
)
{
}
@Override
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_telematics_close
)
{
onBackPressed
();
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_activate_button
)
{
if
(
mIsTripStarted
)
{
unregisterStepSensor
();
stopLocationUpdates
();
initViews
();
mIsTripStarted
=
false
;
mTvTripButton
.
setText
(
R
.
string
.
cos_dlg_start_trip
);
}
else
{
registerStepSensor
();
mIsTripStarted
=
true
;
mTvTripButton
.
setText
(
R
.
string
.
cos_dlg_stop_trip
);
}
}
}
@Override
protected
void
attachBaseContext
(
Context
newBase
)
{
super
.
attachBaseContext
(
ViewPumpContextWrapper
.
wrap
(
newBase
));
}
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
if
(
requestCode
==
PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE
)
{
if
(
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
saveAccelerationDataToExternalStorage
(
jsonArray
);
}
else
{
Snackbar
.
make
(
mLlTelematicsMain
,
"Storage Permission Denied"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
return
;
}
if
(
requestCode
==
PERMISSION_REQUEST_ACCESS_FINE_LOCATION
)
{
if
(
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
startLocationUpdates
();
}
else
{
Snackbar
.
make
(
mLlTelematicsMain
,
"Location Permission Denied"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
}
}
@Override
public
void
onLocationChanged
(
Location
location
)
{
//TODO: uncomment and remove setText if needs revert to handler implementation
//TODO: LOCATION_UPDATE_INTERVAL = 300 when using location.getSpeed()
// float speedKmph = (location.getSpeed() * 3600) / 1000;
// mTvAvgVelocity.setText(String.format("%.1f", Math.floor(speedKmph)) + " km/h");
if
(
mLatitude
!=
0
&&
mLongitude
!=
0
)
requestLocationUpdatePeriodically
(
location
);
mLatitude
=
location
.
getLatitude
();
mLongitude
=
location
.
getLongitude
();
}
@Override
public
void
onStatusChanged
(
String
provider
,
int
status
,
Bundle
extras
)
{
// Handle status changes if needed
}
@Override
public
void
onProviderEnabled
(
String
provider
)
{
// Handle provider enabled if needed
}
@Override
public
void
onProviderDisabled
(
String
provider
)
{
// Handle provider disabled if needed
}
// ===========================================================
// Methods
// ===========================================================
private
void
initViews
()
{
mTvVelocity
.
setText
(
"0.0 km/h"
);
mTvAvgVelocity
.
setText
(
"0.0 km/h"
);
}
private
void
requestLocationUpdates
()
{
// Check if the ACCESS_FINE_LOCATION permission is granted
if
(
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
// Permission is not granted, request it
ActivityCompat
.
requestPermissions
(
this
,
new
String
[]{
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
PERMISSION_REQUEST_ACCESS_FINE_LOCATION
);
}
else
{
// Permission is granted, start requesting location updates
startLocationUpdates
();
}
}
private
void
startLocationUpdates
()
{
try
{
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
LOCATION_UPDATE_INTERVAL
,
// minimum time interval between location updates (in milliseconds)
0
,
// minimum distance between location updates (in meters)
this
);
}
catch
(
SecurityException
e
)
{
e
.
printStackTrace
();
}
}
private
void
requestLocationUpdatePeriodically
(
Location
location
)
{
mLoctionHandler
=
new
Handler
();
mLocationRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
double
speed
=
calculateSpeed
(
mLatitude
,
mLongitude
,
location
.
getLatitude
(),
location
.
getLongitude
(),
(
LOCATION_UPDATE_INTERVAL
/
1000
));
mTvAvgVelocity
.
setText
(
String
.
format
(
"%.1f"
,
Math
.
floor
(
speed
))
+
" km/h"
);
mLoctionHandler
.
postDelayed
(
this
,
LOCATION_UPDATE_INTERVAL
);
}
};
mLoctionHandler
.
postDelayed
(
mLocationRunnable
,
LOCATION_UPDATE_INTERVAL
);
}
private
double
calculateDistance
(
double
lat1
,
double
lon1
,
double
lat2
,
double
lon2
)
{
double
x
=
Math
.
toRadians
(
lon2
-
lon1
)
*
Math
.
cos
(
Math
.
toRadians
((
lat1
+
lat2
)
/
2
));
double
y
=
Math
.
toRadians
(
lat2
-
lat1
);
return
Math
.
sqrt
(
x
*
x
+
y
*
y
)
*
EARTH_RADIUS
;
}
// Function to calculate speed in meters per second
private
double
calculateSpeed
(
double
lat1
,
double
lon1
,
double
lat2
,
double
lon2
,
double
timeDifferenceInSeconds
)
{
double
distance
=
calculateDistance
(
lat1
,
lon1
,
lat2
,
lon2
);
return
(
distance
/
timeDifferenceInSeconds
)
*
3.6f
;
// Convert to km/h;
}
private
void
requestSingleLocationUpdate
()
{
try
{
locationManager
.
requestSingleUpdate
(
LocationManager
.
GPS_PROVIDER
,
this
,
null
);
}
catch
(
SecurityException
e
)
{
e
.
printStackTrace
();
Snackbar
.
make
(
mLlTelematicsMain
,
"requestSingleLocationUpdate Exception"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
}
private
void
stopLocationUpdates
()
{
locationManager
.
removeUpdates
(
this
);
if
(
mLoctionHandler
!=
null
)
mLoctionHandler
.
removeCallbacks
(
mLocationRunnable
);
}
private
void
registerStepSensor
()
{
mSensorManager
=
(
SensorManager
)
getSystemService
(
Context
.
SENSOR_SERVICE
);
mSensor
=
mSensorManager
.
getDefaultSensor
(
Sensor
.
TYPE_ACCELEROMETER
);
mSensorManager
.
registerListener
(
this
,
mSensor
,
SensorManager
.
SENSOR_DELAY_NORMAL
);
Snackbar
.
make
(
mLlTelematicsMain
,
"Sensor Registered"
,
Snackbar
.
LENGTH_SHORT
).
show
();
final
int
delay
=
1000
;
final
int
[]
recordsCount
=
{
0
};
mTvRecordsSaved
.
setText
(
String
.
valueOf
(
recordsCount
[
0
]));
mHandler
=
new
Handler
();
mRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
mAccelerationTimestamps
.
add
(
new
JSONObject
().
putOpt
(
String
.
valueOf
(
System
.
currentTimeMillis
()),
mAcceleration
));
recordsCount
[
0
]++;
mTvRecordsSaved
.
setText
(
String
.
valueOf
(
recordsCount
[
0
]));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Snackbar
.
make
(
mLlTelematicsMain
,
"Runnable Failed"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
mHandler
.
postDelayed
(
this
,
delay
);
}
};
mHandler
.
postDelayed
(
mRunnable
,
delay
);
}
private
void
unregisterStepSensor
()
{
mSensorManager
.
unregisterListener
(
this
);
mTvVelocity
.
setText
(
"0.0 km/h"
);
mTvAvgVelocity
.
setText
(
"0.0 km/h"
);
Snackbar
.
make
(
mLlTelematicsMain
,
"Sensor Unregistered"
,
Snackbar
.
LENGTH_SHORT
).
show
();
mHandler
.
removeCallbacks
(
mRunnable
);
saveAccelerationDataToFile
();
}
private
void
saveAccelerationDataToFile
()
{
jsonArray
=
new
JSONArray
();
// Convert each JSONObject in the array to JSON and add it to the JSONArray
for
(
JSONObject
jsonObject
:
mAccelerationTimestamps
)
{
jsonArray
.
put
(
jsonObject
);
}
if
(
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
ActivityCompat
.
requestPermissions
(
this
,
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE
);
}
else
{
saveAccelerationDataToExternalStorage
(
jsonArray
);
}
}
private
void
saveAccelerationDataToExternalStorage
(
JSONArray
jsonArray
)
{
String
state
=
Environment
.
getExternalStorageState
();
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
state
))
{
File
documentsDir
=
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
);
File
file
=
new
File
(
documentsDir
,
"telematics_data.json"
);
try
{
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
file
);
fileOutputStream
.
write
(
jsonArray
.
toString
().
getBytes
());
fileOutputStream
.
close
();
Snackbar
.
make
(
mLlTelematicsMain
,
"Success saving data to file"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Snackbar
.
make
(
mLlTelematicsMain
,
"Error saving acceleration data to file"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
}
else
{
Snackbar
.
make
(
mLlTelematicsMain
,
"External storage is not accessible"
,
Snackbar
.
LENGTH_SHORT
).
show
();
}
}
// // Low-pass filter function using Exponential Moving Average (EMA)
// private float lowPassFilter(float currentValue) {
// float filteredValue = alpha * currentValue + (1 - alpha) * previousFilteredValue;
// previousFilteredValue = filteredValue;
// return filteredValue;
// }
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/HomeFragment.java
View file @
ec14fc9
...
...
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.activities.ActiveCouponsActivity
;
import
ly.warp.sdk.activities.TelematicsActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
...
...
@@ -33,9 +34,7 @@ import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
public
class
HomeFragment
extends
Fragment
implements
View
.
OnClickListener
,
SwipeRefreshLayout
.
OnRefreshListener
{
private
RelativeLayout
mOptionOne
,
mOptionTwo
,
mOptionThree
;
private
RecyclerView
mRecyclerCampaigns
;
private
HomeCampaignAdapter
mAdapterCampaigns
;
private
RelativeLayout
mOptionOne
,
mOptionTwo
,
mOptionThree
,
mRlDriving
;
private
LinearLayout
mLlBillPayment
;
private
TextView
mTvUsername
,
mTvActiveCoupons
;
private
ConstraintLayout
mClActiveCoupons
;
...
...
@@ -86,17 +85,8 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
mTvUsername
.
setText
(
String
.
format
(
getResources
().
getString
(
R
.
string
.
welcome_user
),
WarplyManagerHelper
.
getConsumer
().
getFirstName
()
+
" "
+
WarplyManagerHelper
.
getConsumer
().
getLastName
()));
mRecyclerCampaigns
=
view
.
findViewById
(
R
.
id
.
rv_home_campaigns
);
mRecyclerCampaigns
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
));
mAdapterCampaigns
=
new
HomeCampaignAdapter
(
getContext
(),
WarplyManagerHelper
.
getUniqueCampaignList
().
get
(
"homescreen"
));
mRecyclerCampaigns
.
setAdapter
(
mAdapterCampaigns
);
mAdapterCampaigns
.
getPositionClicks
()
.
doOnNext
(
campaign
->
{
startActivity
(
WarpViewActivity
.
createIntentFromURL
(
getContext
(),
WarplyManagerHelper
.
constructCampaignUrl
(
campaign
)));
})
.
doOnError
(
error
->
{
})
.
subscribe
();
mRlDriving
=
view
.
findViewById
(
R
.
id
.
rl_driving
);
mRlDriving
.
setOnClickListener
(
this
);
}
@Override
...
...
@@ -117,6 +107,11 @@ public class HomeFragment extends Fragment implements View.OnClickListener, Swip
Intent
intent
=
new
Intent
(
getContext
(),
ActiveCouponsActivity
.
class
);
intent
.
putExtra
(
"couponlist"
,
WarplyManagerHelper
.
getCouponList
());
startActivity
(
intent
);
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
rl_driving
)
{
Intent
intent
=
new
Intent
(
getContext
(),
TelematicsActivity
.
class
);
startActivity
(
intent
);
}
}
...
...
warply_android_sdk/src/main/res/layout/activity_telematics.xml
0 → 100644
View file @
ec14fc9
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/ll_telematics_main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/cos_light_grey3"
android:orientation=
"vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_bill_header"
android:layout_width=
"match_parent"
android:layout_height=
"64dp"
android:background=
"@color/white"
>
<ImageView
android:id=
"@+id/iv_telematics_close"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:layout_marginStart=
"16dp"
android:scaleType=
"centerInside"
android:src=
"@drawable/ic_back"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/textView3"
fontPath=
"fonts/BTCosmo-Bold.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"@string/cos_telematics"
android:textColor=
"@color/cos_light_black"
android:textSize=
"19sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/cos_light_grey3"
android:gravity=
"center_horizontal"
>
<TextView
android:id=
"@+id/tv_sensor_data_label"
fontPath=
"fonts/PeridotPE-Regular.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:text=
"Sensor Data"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_sensor_data"
fontPath=
"fonts/PeridotPE-Bold.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_sensor_data_label"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_velocity_label"
fontPath=
"fonts/PeridotPE-Regular.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:text=
"Acceleration"
android:layout_below=
"@+id/tv_sensor_data"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_velocity"
fontPath=
"fonts/PeridotPE-Bold.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_velocity_label"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_avg_label"
fontPath=
"fonts/PeridotPE-Regular.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:text=
"Velocity"
android:layout_below=
"@+id/tv_velocity"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_avg"
fontPath=
"fonts/PeridotPE-Bold.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_avg_label"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_records_label"
fontPath=
"fonts/PeridotPE-Regular.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:text=
"Records Saved"
android:layout_below=
"@+id/tv_avg"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<TextView
android:id=
"@+id/tv_records"
fontPath=
"fonts/PeridotPE-Bold.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_records_label"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"24dp"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
<LinearLayout
android:id=
"@+id/ll_activate_button"
android:layout_width=
"match_parent"
android:layout_height=
"55dp"
android:layout_alignParentBottom=
"true"
android:layout_marginHorizontal=
"24dp"
android:layout_marginBottom=
"56dp"
android:background=
"@drawable/selector_button_green_border"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_trip_button"
fontPath=
"fonts/PeridotPE-SemiBold.ttf"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:includeFontPadding=
"false"
android:text=
"@string/cos_dlg_start_trip"
android:textColor=
"@color/blue_dark"
android:textSize=
"16sp"
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/fragment_home.xml
View file @
ec14fc9
...
...
@@ -103,29 +103,39 @@
android:background=
"@drawable/home_bg"
>
<RelativeLayout
android:id=
"@+id/rl_
home_campaigns
"
android:id=
"@+id/rl_
driving
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"50dp"
>
android:layout_height=
"140dp"
android:layout_marginHorizontal=
"8dp"
android:layout_marginTop=
"50dp"
android:layout_marginBottom=
"16dp"
android:background=
"@drawable/shape_cos_white"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_home_campaigns"
android:layout_width=
"match_parent"
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:background=
"#80FFFFFF"
android:clipToPadding=
"false"
android:orientation=
"horizontal"
android:paddingVertical=
"15dp"
android:paddingStart=
"10dp"
android:paddingEnd=
"10dp"
/>
android:layout_alignParentStart=
"true"
android:layout_centerVertical=
"true"
android:layout_marginStart=
"16dp"
android:text=
"@string/cos_telematics"
android:textColor=
"@color/blue_dark"
android:textSize=
"20sp"
/>
<ImageView
android:id=
"@+id/iv_one_logo"
android:layout_width=
"100dp"
android:layout_height=
"30dp"
android:layout_alignParentEnd=
"true"
android:layout_centerVertical=
"true"
android:layout_marginEnd=
"16dp"
android:src=
"@drawable/cosmote_one"
/>
</RelativeLayout>
<LinearLayout
android:id=
"@+id/rl_home_coupons"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/rl_
home_campaigns
"
android:layout_below=
"@id/rl_
driving
"
android:visibility=
"gone"
>
<androidx.recyclerview.widget.RecyclerView
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
ec14fc9
...
...
@@ -176,6 +176,9 @@
<string
name=
"lbl_take_photo_accept"
>
Οκ
</string>
<string
name=
"lbl_take_photo_decline"
>
Άκυρο
</string>
<string
name=
"lbl_gps_enabled"
>
Θέλετε να ενεργοποιήσετε το GPS;
</string>
<string
name=
"cos_telematics"
>
Telematics Demo
</string>
<string
name=
"cos_dlg_start_trip"
>
Start Trip
</string>
<string
name=
"cos_dlg_stop_trip"
>
Stop Trip
</string>
<string-array
name=
"coupons_array"
>
<item>
Κουπόνια
</item>
...
...
Please
register
or
login
to post a comment