Panagiotis Triantafyllou

cosmote intent dl fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4.6rc63'
PUBLISH_VERSION = '4.5.4.6rc64'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -40,187 +40,194 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:fillViewport="true"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
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_below="@+id/tv_sensor_data"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="Acceleration"
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="20sp" />
<TextView
android:id="@+id/tv_avg_label"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_velocity"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="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="20sp" />
<TextView
android:id="@+id/tv_orientation_label"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_avg"
android:layout_alignParentStart="true"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:text="Orientation Count"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_orientation"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_orientation_label"
android:layout_alignStart="@+id/tv_orientation_label"
android:layout_alignEnd="@+id/tv_orientation_label"
android:layout_marginTop="24dp"
android:gravity="center"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_touch_label"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_avg"
android:layout_alignParentEnd="true"
android:layout_marginTop="24dp"
android:paddingEnd="24dp"
android:layout_marginEnd="24dp"
android:text="Touch Count"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_touch"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_touch_label"
android:layout_alignStart="@+id/tv_touch_label"
android:layout_alignEnd="@+id/tv_touch_label"
android:layout_marginTop="24dp"
android:gravity="center"
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_below="@+id/tv_orientation"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="Records Saved"
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" />
<EditText
android:id="@+id/et_acceleration"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_records"
android:layout_alignParentStart="true"
android:layout_marginTop="24dp"
android:layout_marginStart="24dp"
android:hint="Cut off in m/s^2"
android:inputType="phone"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<EditText
android:id="@+id/et_save"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_records"
android:layout_alignParentEnd="true"
android:paddingEnd="24dp"
android:layout_marginTop="24dp"
android:hint="Sample Interval in ms"
android:inputType="phone"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_main_scroll"
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_below="@+id/tv_sensor_data"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="Acceleration"
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="20sp" />
<TextView
android:id="@+id/tv_avg_label"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_velocity"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="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="20sp" />
<TextView
android:id="@+id/tv_orientation_label"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_avg"
android:layout_alignParentStart="true"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:text="Orientation Count"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_orientation"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_orientation_label"
android:layout_alignStart="@+id/tv_orientation_label"
android:layout_alignEnd="@+id/tv_orientation_label"
android:layout_marginTop="24dp"
android:gravity="center"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_touch_label"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_avg"
android:layout_alignParentEnd="true"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:paddingEnd="24dp"
android:text="Touch Count"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_touch"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_touch_label"
android:layout_alignStart="@+id/tv_touch_label"
android:layout_alignEnd="@+id/tv_touch_label"
android:layout_marginTop="24dp"
android:gravity="center"
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_below="@+id/tv_orientation"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="Records Saved"
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" />
<EditText
android:id="@+id/et_acceleration"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_records"
android:layout_alignParentStart="true"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:hint="Cut off in m/s^2"
android:inputType="phone"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
<EditText
android:id="@+id/et_save"
fontPath="fonts/PeridotPE-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_records"
android:layout_alignParentEnd="true"
android:layout_marginTop="24dp"
android:hint="Sample Interval in ms"
android:inputType="phone"
android:paddingEnd="24dp"
android:textColor="@color/blue_dark"
android:textSize="16sp" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_activate_button"
......@@ -244,6 +251,6 @@
android:textColor="@color/blue_dark"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
......