Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
23_126
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
23-126
23_126
Commits
dbddd657
Commit
dbddd657
authored
Oct 11, 2023
by
Weesinghe W.M.P.D
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'IT20212018_Rewarding_System' into 'master'
Add Rewarding system code See merge request
!4
parents
df2a8f82
3c24358b
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
321 additions
and
10 deletions
+321
-10
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+15
-1
app/src/main/java/com/example/thetrek/PredictReward.java
app/src/main/java/com/example/thetrek/PredictReward.java
+107
-0
app/src/main/java/com/example/thetrek/screens/locationsHandler/AddLocations.java
...xample/thetrek/screens/locationsHandler/AddLocations.java
+19
-0
app/src/main/java/com/example/thetrek/screens/locationsHandler/MapVedioActivity.java
...le/thetrek/screens/locationsHandler/MapVedioActivity.java
+29
-0
app/src/main/res/drawable/background.jpeg
app/src/main/res/drawable/background.jpeg
+0
-0
app/src/main/res/layout/activity_add_locations.xml
app/src/main/res/layout/activity_add_locations.xml
+19
-2
app/src/main/res/layout/activity_get_physical.xml
app/src/main/res/layout/activity_get_physical.xml
+2
-1
app/src/main/res/layout/activity_locations_crud.xml
app/src/main/res/layout/activity_locations_crud.xml
+4
-2
app/src/main/res/layout/activity_mapvedio.xml
app/src/main/res/layout/activity_mapvedio.xml
+49
-0
app/src/main/res/layout/activity_rewarding_screen.xml
app/src/main/res/layout/activity_rewarding_screen.xml
+4
-2
app/src/main/res/layout/activity_rewards.xml
app/src/main/res/layout/activity_rewards.xml
+2
-1
app/src/main/res/layout/predict_reward.xml
app/src/main/res/layout/predict_reward.xml
+69
-0
app/src/main/res/layout/reward_item.xml
app/src/main/res/layout/reward_item.xml
+2
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
dbddd657
...
@@ -142,6 +142,13 @@
...
@@ -142,6 +142,13 @@
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
android:value=
""
/>
android:value=
""
/>
</activity>
</activity>
<activity
android:name=
".PredictReward"
android:exported=
"false"
>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<activity
<activity
android:name=
".HomeActivity"
android:name=
".HomeActivity"
android:exported=
"false"
>
android:exported=
"false"
>
...
@@ -190,6 +197,13 @@
...
@@ -190,6 +197,13 @@
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
android:value=
""
/>
android:value=
""
/>
</activity>
</activity>
<activity
android:name=
".screens.locationsHandler.MapVedioActivity"
android:exported=
"false"
>
<meta-data
android:name=
"android.app.lib_name"
android:value=
""
/>
</activity>
<activity
<activity
android:name=
".MainActivityRecognition"
android:name=
".MainActivityRecognition"
android:exported=
"false"
>
android:exported=
"false"
>
...
@@ -249,7 +263,7 @@
...
@@ -249,7 +263,7 @@
android:value=
"required"
/>
android:value=
"required"
/>
<meta-data
<meta-data
android:name=
"com.google.android.ar.API_KEY"
android:name=
"com.google.android.ar.API_KEY"
android:value=
"AIzaSyA
ynx5iCqfkqmUyUp3b2FNzf3OCm1dOrbU
"
android:value=
"AIzaSyA
N5kiFNbLfInKmkge47ycTB01mcMG48IY
"
/>
/>
<meta-data
<meta-data
android:name=
"com.google.android.geo.API_KEY"
android:name=
"com.google.android.geo.API_KEY"
...
...
app/src/main/java/com/example/thetrek/PredictReward.java
0 → 100644
View file @
dbddd657
package
com.example.thetrek
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.android.volley.Request
;
import
com.android.volley.RequestQueue
;
import
com.android.volley.Response
;
import
com.android.volley.VolleyError
;
import
com.android.volley.toolbox.StringRequest
;
import
com.android.volley.toolbox.Volley
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
PredictReward
extends
AppCompatActivity
{
EditText
Latitude
,
Longitude
,
Elevation
;
Button
predict
;
TextView
Reward
;
String
url
=
"https://trek-7f4725930ac3.herokuapp.com/predict"
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
predict_reward
);
Latitude
=
findViewById
(
R
.
id
.
latitude
);
Longitude
=
findViewById
(
R
.
id
.
longitude
);
Elevation
=
findViewById
(
R
.
id
.
elevation
);
predict
=
findViewById
(
R
.
id
.
predict
);
Reward
=
findViewById
(
R
.
id
.
reward
);
predict
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
// hit the API -> Volley
StringRequest
stringRequest
=
new
StringRequest
(
Request
.
Method
.
POST
,
url
,
new
Response
.
Listener
<
String
>()
{
@Override
public
void
onResponse
(
String
response
)
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
response
);
String
data
=
jsonObject
.
getString
(
"placement"
);
switch
(
data
)
{
case
"0"
:
Reward
.
setText
(
"\uD83C\uDF1F \"Reward level 0 recieved!\" \uD83C\uDF1F"
);
break
;
case
"1"
:
Reward
.
setText
(
"\uD83C\uDF1F \"Reward level 1 recieved!\" \uD83C\uDF1F"
);
break
;
case
"2"
:
Reward
.
setText
(
"\uD83C\uDF1F \"Reward level 2 recieved!\" \uD83C\uDF1F"
);
break
;
case
"3"
:
Reward
.
setText
(
"\uD83C\uDF1F \"Reward level 3 recieved!\" \uD83C\uDF1F"
);
break
;
case
"4"
:
Reward
.
setText
(
"\uD83C\uDF1F \"Reward level 4 recieved!\" \uD83C\uDF1F"
);
break
;
case
"5"
:
Reward
.
setText
(
"\uD83C\uDF1F \"Reward level 5 recieved!\" \uD83C\uDF1F"
);
break
;
default
:
Reward
.
setText
(
"\uD83C\uDF1F \"No any reward recieved!\" \uD83C\uDF1F"
);
break
;
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
},
new
Response
.
ErrorListener
()
{
@Override
public
void
onErrorResponse
(
VolleyError
error
)
{
Toast
.
makeText
(
PredictReward
.
this
,
error
.
getMessage
(),
Toast
.
LENGTH_SHORT
).
show
();
}
}){
@Override
protected
Map
<
String
,
String
>
getParams
(){
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"Latitude"
,
Latitude
.
getText
().
toString
());
params
.
put
(
"Longitude"
,
Longitude
.
getText
().
toString
());
params
.
put
(
"Elevation"
,
Elevation
.
getText
().
toString
());
return
params
;
}
};
RequestQueue
queue
=
Volley
.
newRequestQueue
(
PredictReward
.
this
);
queue
.
add
(
stringRequest
);
}
});
}
}
app/src/main/java/com/example/thetrek/screens/locationsHandler/AddLocations.java
View file @
dbddd657
...
@@ -9,6 +9,7 @@ import android.widget.Button;
...
@@ -9,6 +9,7 @@ import android.widget.Button;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.example.thetrek.PredictReward
;
import
com.example.thetrek.R
;
import
com.example.thetrek.R
;
import
com.example.thetrek.db.LocationDAO
;
import
com.example.thetrek.db.LocationDAO
;
import
com.example.thetrek.screens.findPlaces.FindPlacesActivity
;
import
com.example.thetrek.screens.findPlaces.FindPlacesActivity
;
...
@@ -61,8 +62,26 @@ public class AddLocations extends AppCompatActivity {
...
@@ -61,8 +62,26 @@ public class AddLocations extends AppCompatActivity {
v
.
getContext
().
startActivity
(
intent
);
v
.
getContext
().
startActivity
(
intent
);
}
}
});
});
Button
userGuideButton
=
(
Button
)
findViewById
(
R
.
id
.
btn_MapVedioActivity_userGuide
);
userGuideButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Intent
intent
=
new
Intent
(
v
.
getContext
(),
MapVedioActivity
.
class
);
v
.
getContext
().
startActivity
(
intent
);
}
});
Button
rewardPredictor
=
(
Button
)
findViewById
(
R
.
id
.
btn_predictor
);
rewardPredictor
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Intent
intent
=
new
Intent
(
v
.
getContext
(),
PredictReward
.
class
);
v
.
getContext
().
startActivity
(
intent
);
}
});
}
}
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
...
...
app/src/main/java/com/example/thetrek/screens/locationsHandler/MapVedioActivity.java
0 → 100644
View file @
dbddd657
package
com.example.thetrek.screens.locationsHandler
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.webkit.WebChromeClient
;
import
android.webkit.WebView
;
import
com.example.thetrek.R
;
public
class
MapVedioActivity
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_mapvedio
);
WebView
webView
=
findViewById
(
R
.
id
.
webView
);
String
video
=
"<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/vkrg4rqKfVU?si=YmgwAsVkGZ2_HG9w\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>"
;
webView
.
loadData
(
video
,
"text/html"
,
"utf-8"
);
webView
.
getSettings
().
setJavaScriptEnabled
(
true
);
webView
.
setWebChromeClient
(
new
WebChromeClient
());
WebView
webView2
=
findViewById
(
R
.
id
.
webView2
);
String
video2
=
"<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/XZJcS9wU9Ec?si=XfSWIvA1UhFzKY6X\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen></iframe>"
;
webView2
.
loadData
(
video2
,
"text/html"
,
"utf-8"
);
webView2
.
getSettings
().
setJavaScriptEnabled
(
true
);
webView2
.
setWebChromeClient
(
new
WebChromeClient
());
}
}
\ No newline at end of file
app/src/main/res/drawable/background.jpeg
0 → 100644
View file @
dbddd657
17.1 KB
app/src/main/res/layout/activity_add_locations.xml
View file @
dbddd657
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".screens.locationsHandler.AddLocations"
>
tools:context=
".screens.locationsHandler.AddLocations"
android:background=
"@drawable/background"
>
<LinearLayout
<LinearLayout
android:layout_width=
"375dp"
android:layout_width=
"375dp"
...
@@ -63,6 +64,22 @@
...
@@ -63,6 +64,22 @@
android:id=
"@+id/btn_addLocationActivity_addLocation"
android:id=
"@+id/btn_addLocationActivity_addLocation"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Add Location"
/>
android:text=
"Add Location"
android:backgroundTint=
"#5D71C9"
/>
<Button
android:id=
"@+id/btn_MapVedioActivity_userGuide"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"User Guide"
android:backgroundTint=
"#5D71C9"
/>
<Button
android:id=
"@+id/btn_predictor"
android:layout_width=
"match_parent"
android:layout_height=
"65dp"
android:backgroundTint=
"#5D71C9"
android:text=
"Rewards Predictor"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_get_physical.xml
View file @
dbddd657
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".screens.getPhysical.GetPhysicalActivity"
>
tools:context=
".screens.getPhysical.GetPhysicalActivity"
android:background=
"@drawable/background"
>
<TextView
<TextView
android:id=
"@+id/textView7"
android:id=
"@+id/textView7"
...
...
app/src/main/res/layout/activity_locations_crud.xml
View file @
dbddd657
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".screens.locationsHandler.LocationsCrud"
>
tools:context=
".screens.locationsHandler.LocationsCrud"
android:background=
"@drawable/background"
>
<LinearLayout
<LinearLayout
android:layout_width=
"380dp"
android:layout_width=
"380dp"
...
@@ -43,6 +44,7 @@
...
@@ -43,6 +44,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Add Locations"
android:text=
"Add Locations"
app:icon=
"@drawable/ic_baseline_playlist_add_24"
/>
app:icon=
"@drawable/ic_baseline_playlist_add_24"
android:backgroundTint=
"#5D71C9"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_mapvedio.xml
0 → 100644
View file @
dbddd657
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".screens.locationsHandler.MapVedioActivity"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Embark on a Geospatial Odyssey 🌐🔍 Explore the Universe of Latitude, Longitude, and Elevation!"
android:textSize=
"20dp"
android:textAlignment=
"center"
android:layout_marginTop=
"10dp"
android:textStyle=
"bold"
android:textColor=
"@color/cardview_dark_background"
></TextView>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Check Latitude longitude on Google map"
android:textSize=
"18dp"
android:textAlignment=
"center"
android:layout_marginTop=
"120dp"
android:textStyle=
"bold"
android:textColor=
"@color/cardview_dark_background"
></TextView>
<WebView
android:layout_width=
"match_parent"
android:layout_height=
"250sp"
android:id=
"@+id/webView"
android:layout_marginTop=
"160dp"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Check elevation on Google map"
android:textSize=
"18dp"
android:textAlignment=
"center"
android:layout_marginTop=
"430dp"
android:textStyle=
"bold"
android:textColor=
"@color/cardview_dark_background"
></TextView>
<WebView
android:id=
"@+id/webView2"
android:layout_width=
"match_parent"
android:layout_height=
"250sp"
android:layout_marginTop=
"470dp"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/activity_rewarding_screen.xml
View file @
dbddd657
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".geospatial.RewardingScreenActivity"
>
tools:context=
".geospatial.RewardingScreenActivity"
android:background=
"@drawable/background"
>
<LinearLayout
<LinearLayout
android:layout_width=
"371dp"
android:layout_width=
"371dp"
...
@@ -45,6 +46,7 @@
...
@@ -45,6 +46,7 @@
android:id=
"@+id/btn_claim_reward"
android:id=
"@+id/btn_claim_reward"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_height=
"60dp"
android:text=
"Claim Reward"
/>
android:text=
"Claim Reward"
android:backgroundTint=
"#5D71C9"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_rewards.xml
View file @
dbddd657
...
@@ -4,7 +4,8 @@
...
@@ -4,7 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".screens.rewards.RewardsActivity"
>
tools:context=
".screens.rewards.RewardsActivity"
android:background=
"@drawable/background"
>
<LinearLayout
<LinearLayout
android:layout_width=
"367dp"
android:layout_width=
"367dp"
...
...
app/src/main/res/layout/predict_reward.xml
0 → 100644
View file @
dbddd657
<?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"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".PredictReward"
android:orientation=
"vertical"
android:background=
"@drawable/background"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Rewards Predictor"
android:textSize=
"24dp"
android:textAlignment=
"center"
android:layout_marginTop=
"10dp"
android:textStyle=
"bold"
android:textColor=
"@color/cardview_dark_background"
></TextView>
<EditText
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Latitude"
android:id=
"@+id/latitude"
android:textStyle=
"bold"
android:layout_marginTop=
"10dp"
></EditText>
<EditText
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Longitude"
android:id=
"@+id/longitude"
android:textStyle=
"bold"
android:layout_marginTop=
"10dp"
></EditText>
<EditText
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Elevation (0 – (177.3 to 179.9), 1 – (180 to 189.9), 2 - (190 to 200), 3 - (201 to 229.9), 4 - (230 to 290), 5 - (291 to 460.6)
)"
android:id=
"@+id/elevation"
android:textStyle=
"bold"
android:layout_marginTop=
"10dp"
></EditText>
<Button
android:layout_width=
"match_parent"
android:layout_height=
"65dp"
android:text=
"Click for Prediction"
android:layout_marginTop=
"20dp"
android:textStyle=
"bold"
android:id=
"@+id/predict"
android:backgroundTint=
"#5D71C9"
></Button>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
""
android:textSize=
"20dp"
android:textAlignment=
"center"
android:layout_marginTop=
"25dp"
android:textStyle=
"bold"
android:id=
"@+id/reward"
android:textColor=
"@color/cardview_dark_background"
></TextView>
</LinearLayout>
app/src/main/res/layout/reward_item.xml
View file @
dbddd657
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:background=
"@drawable/background"
>
<LinearLayout
<LinearLayout
android:layout_width=
"376dp"
android:layout_width=
"376dp"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment