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-07-12 16:38:50 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0057d46b5bfb0f103684cb80745360365fbd3462
0057d46b
1 parent
dcf414db
cosmote intent dl fixes
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
23 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelematicsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
warply_android_sdk/src/main/res/layout/activity_telematics.xml
warply_android_sdk/build.gradle
View file @
0057d46
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.6rc6
3
'
PUBLISH_VERSION
=
'4.5.4.6rc6
4
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelematicsActivity.java
View file @
0057d46
...
...
@@ -22,6 +22,7 @@ import android.view.WindowManager;
import
android.widget.EditText
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
...
...
@@ -90,6 +91,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
private
String
mStartTimestamp
=
""
,
mStopTimestamp
=
""
;
private
final
int
RECORDS_INTERVAL
=
5000
;
private
EditText
mEtLimit
,
mEtSampleTime
;
private
RelativeLayout
mRlMainScroll
;
// ===========================================================
...
...
@@ -105,6 +107,7 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
mIvBack
=
findViewById
(
R
.
id
.
iv_telematics_close
);
mLlTripButton
=
findViewById
(
R
.
id
.
ll_activate_button
);
mLlTripButton
.
setOnClickListener
(
this
);
mLlTripButton
.
setOnTouchListener
(
mTripTouchListener
);
mTvTripButton
=
findViewById
(
R
.
id
.
tv_trip_button
);
mLlTelematicsMain
=
findViewById
(
R
.
id
.
ll_telematics_main
);
mTvSensorData
=
findViewById
(
R
.
id
.
tv_sensor_data
);
...
...
@@ -116,6 +119,8 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
mTvTouchCount
=
findViewById
(
R
.
id
.
tv_touch
);
mEtLimit
=
findViewById
(
R
.
id
.
et_acceleration
);
mEtSampleTime
=
findViewById
(
R
.
id
.
et_save
);
mRlMainScroll
=
findViewById
(
R
.
id
.
rl_main_scroll
);
mRlMainScroll
.
setOnTouchListener
(
mScrollTouchListener
);
locationManager
=
(
LocationManager
)
getSystemService
(
Context
.
LOCATION_SERVICE
);
previousLocation
=
null
;
...
...
@@ -200,6 +205,8 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
}
if
(
view
.
getId
()
==
R
.
id
.
ll_activate_button
)
{
if
(
mIsTripStarted
)
{
mEtLimit
.
setEnabled
(
true
);
mEtSampleTime
.
setEnabled
(
true
);
unregisterSensor
();
stopLocationUpdates
();
initViews
();
...
...
@@ -210,6 +217,8 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
Snackbar
.
make
(
mLlTelematicsMain
,
"Please fill the Cut off field"
,
Snackbar
.
LENGTH_SHORT
).
show
();
return
;
}
mEtLimit
.
setEnabled
(
false
);
mEtSampleTime
.
setEnabled
(
false
);
mTouchHandler
=
new
Handler
();
mTouchRunnable
=
new
Runnable
()
{
@Override
...
...
@@ -292,28 +301,45 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
}
}
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
// return super.onTouchEvent(event);
if
(
mIsTripStarted
)
{
// touchCount++;
// mTvTouchCount.setText(String.valueOf(touchCount));
// return true;
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
touchCount
++;
mTvTouchCount
.
setText
(
String
.
valueOf
(
touchCount
));
mTouchHandler
.
post
(
mTouchRunnable
);
return
true
;
case
MotionEvent
.
ACTION_UP
:
mTouchHandler
.
removeCallbacks
(
mTouchRunnable
);
return
true
;
}
return
false
;
}
return
false
;
}
// @Override
// public boolean dispatchTouchEvent(MotionEvent event) {
// if (mIsTripStarted) {
// switch (event.getAction()) {
// case MotionEvent.ACTION_DOWN:
// touchCount++;
// mTvTouchCount.setText(String.valueOf(touchCount));
// mTouchHandler.post(mTouchRunnable);
// return true;
// case MotionEvent.ACTION_UP:
// mTouchHandler.removeCallbacks(mTouchRunnable);
// return true;
// }
// }
// return super.dispatchTouchEvent(event);
// }
// @Override
// public boolean onTouchEvent(MotionEvent event) {
//// return super.onTouchEvent(event);
// if (mIsTripStarted) {
//// touchCount++;
//// mTvTouchCount.setText(String.valueOf(touchCount));
//// return true;
//
// switch (event.getAction()) {
// case MotionEvent.ACTION_DOWN:
// touchCount++;
// mTvTouchCount.setText(String.valueOf(touchCount));
// mTouchHandler.post(mTouchRunnable);
// return true;
// case MotionEvent.ACTION_UP:
// mTouchHandler.removeCallbacks(mTouchRunnable);
// return true;
// }
// return false;
// }
// return false;
// }
// ===========================================================
// Methods
...
...
@@ -495,6 +521,39 @@ public class TelematicsActivity extends Activity implements View.OnClickListener
}
}
private
final
View
.
OnTouchListener
mTripTouchListener
=
new
View
.
OnTouchListener
()
{
@Override
public
boolean
onTouch
(
View
view
,
MotionEvent
motionEvent
)
{
if
(
mIsTripStarted
)
{
if
(
motionEvent
.
getAction
()
==
MotionEvent
.
ACTION_UP
)
{
mTouchHandler
.
removeCallbacks
(
mTouchRunnable
);
onClick
(
view
);
return
true
;
}
}
return
false
;
}
};
private
final
View
.
OnTouchListener
mScrollTouchListener
=
new
View
.
OnTouchListener
()
{
@Override
public
boolean
onTouch
(
View
view
,
MotionEvent
motionEvent
)
{
if
(
mIsTripStarted
)
{
switch
(
motionEvent
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
touchCount
++;
mTvTouchCount
.
setText
(
String
.
valueOf
(
touchCount
));
mTouchHandler
.
post
(
mTouchRunnable
);
return
true
;
case
MotionEvent
.
ACTION_UP
:
mTouchHandler
.
removeCallbacks
(
mTouchRunnable
);
return
true
;
}
}
return
false
;
}
};
// // Low-pass filter function using Exponential Moving Average (EMA)
// private float lowPassFilter(float currentValue) {
// float filteredValue = alpha * currentValue + (1 - alpha) * previousFilteredValue;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
0057d46
...
...
@@ -43,6 +43,7 @@ import android.net.http.SslError;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.webkit.GeolocationPermissions.Callback
;
import
android.webkit.JavascriptInterface
;
import
android.webkit.SslErrorHandler
;
...
...
@@ -75,6 +76,7 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URISyntaxException
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
...
...
@@ -107,6 +109,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
private
static
final
String
URL_ACTION_RSMS
=
"rsms"
;
private
static
final
String
URL_ACTION_MAIL
=
"mailto"
;
private
static
final
String
URL_ACTION_MARKET
=
"market"
;
private
static
final
String
URL_ACTION_INTENT
=
"intent"
;
private
static
final
String
URL_ACTION_MARKET_AUTHORITY
=
"play.google.com"
;
private
static
final
String
TAG_STEPS_WORKER
=
"ly.warp.sdk.services.WarplyHealthService"
;
...
...
@@ -789,6 +792,21 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
webpage
);
getContext
().
startActivity
(
intent
);
return
true
;
}
else
if
(
scheme
.
equalsIgnoreCase
(
URL_ACTION_INTENT
))
{
try
{
Intent
intent
=
Intent
.
parseUri
(
strUrl
,
Intent
.
URI_INTENT_SCHEME
);
// String fallbackUrl = intent.getStringExtra("browser_fallback_url");
String
data
=
intent
.
getData
().
toString
();
if
(!
TextUtils
.
isEmpty
(
data
))
{
// view.loadUrl(fallbackUrl);
Uri
webpage
=
Uri
.
parse
(
data
);
Intent
intentWebpage
=
new
Intent
(
Intent
.
ACTION_VIEW
,
webpage
);
getContext
().
startActivity
(
intentWebpage
);
return
true
;
}
}
catch
(
URISyntaxException
e
)
{
return
true
;
}
}
return
false
;
}
...
...
warply_android_sdk/src/main/res/layout/activity_telematics.xml
View file @
0057d46
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment