Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
Research-Project
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
Jayakody J.A.D.K.A - IT19114040
Research-Project
Commits
df0dd89f
Commit
df0dd89f
authored
Apr 19, 2022
by
Anuththara18
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sustained Attention Modifications
parent
b240f4a0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
166 additions
and
42 deletions
+166
-42
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+5
-2
app/src/main/java/com/anuththara18/attentionassessment/sustained/SustainedAttentionGame1.java
...ttentionassessment/sustained/SustainedAttentionGame1.java
+61
-16
app/src/main/java/com/anuththara18/attentionassessment/videos/IntroductoryVideoPortraitActivity.java
...nassessment/videos/IntroductoryVideoPortraitActivity.java
+96
-20
app/src/main/res/layout/activity_introductory_video.xml
app/src/main/res/layout/activity_introductory_video.xml
+2
-2
app/src/main/res/values-si/strings(si).xml
app/src/main/res/values-si/strings(si).xml
+1
-1
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
df0dd89f
...
@@ -74,7 +74,9 @@
...
@@ -74,7 +74,9 @@
<activity
<activity
android:name=
".sustained.BirdChoosingActivity"
android:name=
".sustained.BirdChoosingActivity"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.AppCompat.NoActionBar"
/>
android:theme=
"@style/Theme.AppCompat.NoActionBar"
>
</activity>
<activity
<activity
android:name=
".focused.AnimalChoosingActivity"
android:name=
".focused.AnimalChoosingActivity"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
...
@@ -122,7 +124,8 @@
...
@@ -122,7 +124,8 @@
<activity
<activity
android:name=
".sustained.SustainedAttentionGame1"
android:name=
".sustained.SustainedAttentionGame1"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:theme=
"@style/Theme.AppCompat.NoActionBar"
/>
android:theme=
"@style/Theme.AppCompat.NoActionBar"
>
</activity>
<activity
<activity
android:name=
".focused.FocusedAttentionGame2"
android:name=
".focused.FocusedAttentionGame2"
android:screenOrientation=
"landscape"
android:screenOrientation=
"landscape"
...
...
app/src/main/java/com/anuththara18/attentionassessment/sustained/SustainedAttentionGame1.java
View file @
df0dd89f
...
@@ -51,9 +51,9 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -51,9 +51,9 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
/*Integer[] isi = { 10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
/*Integer[] isi = { 10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 45000, 25000, 50000, 20000, 35000, 60000, 15000, 30000, 55000, 40000,
10000, 15000, 10000, 15000 };*/
10000, 15000, 10000, 15000 };*/
Integer
[]
isi
=
{
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
Integer
[]
isi
=
{
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
1000
,
1500
,
1000
,
1500
};
1000
,
4500
,
2500
,
5000
,
2000
,
3500
,
6000
,
1500
,
3000
,
5500
,
4000
,
};
Integer
[]
image
=
{
R
.
drawable
.
red_bird_gif
,
Integer
[]
image
=
{
R
.
drawable
.
red_bird_gif
,
R
.
drawable
.
blue_bird_gif
,
R
.
drawable
.
blue_bird_gif
,
...
@@ -79,6 +79,8 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -79,6 +79,8 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
long
totalReactionTime
=
0
;
long
totalReactionTime
=
0
;
int
meanReactionTime
=
0
;
int
meanReactionTime
=
0
;
long
seconds
;
MediaPlayer
mp
,
mp2
;
MediaPlayer
mp
,
mp2
;
@Override
@Override
...
@@ -118,14 +120,21 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -118,14 +120,21 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(
i
<=
51
)
{
// tot duration - 14.5 mins = 870000
// ms -> s /1000
//385000 , 770000, (50000)
// s -> m /60
if
(
i
<=
269
)
{
// tot duration - 14.534 mins = 872000
//if (duration <= 870000) {
//385000 , 770000, (50000) = 1 205 000
// 38500, 77000
// 75000
if
(
i
%
2
!=
0
||
totalCorrectResponses
>
25
)
{
if
(
i
%
2
!=
0
)
{
randomImage
=
random
.
nextInt
(
6
);
randomImage
=
random
.
nextInt
(
6
);
bird
.
setVisibility
(
View
.
INVISIBLE
);
bird
.
setVisibility
(
View
.
INVISIBLE
);
gifImageView
.
setVisibility
(
View
.
VISIBLE
);
gifImageView
.
setVisibility
(
View
.
VISIBLE
);
red_btn
.
setEnabled
(
true
);
bird
.
setEnabled
(
true
);
gifImageView
.
setImageResource
(
image
[
randomImage
]);
gifImageView
.
setImageResource
(
image
[
randomImage
]);
clickedImage
=
image
[
randomImage
];
clickedImage
=
image
[
randomImage
];
updateInterval
=
isi
[
j
];
updateInterval
=
isi
[
j
];
...
@@ -136,10 +145,11 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -136,10 +145,11 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
j
++;
j
++;
}
}
// appearance - 0.5s * 25 times
// appearance - 0.5s * 25 times
else
if
(
totalCorrectResponses
<=
25
)
{
else
{
Log
.
d
(
"radomTimer"
,
String
.
valueOf
(
i
+
" 3000"
));
Log
.
d
(
"radomTimer"
,
String
.
valueOf
(
i
+
" 3000"
));
Log
.
d
(
"******************************"
,
"start 1"
);
Log
.
d
(
"******************************"
,
"start 1"
);
bird
.
setVisibility
(
View
.
VISIBLE
);
if
(
BirdChoosingActivity
.
birdSelected
==
1
)
{
if
(
BirdChoosingActivity
.
birdSelected
==
1
)
{
bird
.
setImageResource
(
R
.
drawable
.
blue_bird
);
bird
.
setImageResource
(
R
.
drawable
.
blue_bird
);
clickedImage
=
R
.
drawable
.
blue_bird
;
clickedImage
=
R
.
drawable
.
blue_bird
;
...
@@ -159,7 +169,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -159,7 +169,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
}
}
bird
.
setVisibility
(
View
.
VISIBLE
);
bird
.
setVisibility
(
View
.
VISIBLE
);
red_btn
.
setEnabled
(
true
);
bird
.
setEnabled
(
true
);
gifImageView
.
setVisibility
(
View
.
INVISIBLE
);
gifImageView
.
setVisibility
(
View
.
INVISIBLE
);
startTime
=
System
.
currentTimeMillis
();
startTime
=
System
.
currentTimeMillis
();
gifImageView
.
postDelayed
(
this
,
3000
);
gifImageView
.
postDelayed
(
this
,
3000
);
...
@@ -171,17 +181,22 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -171,17 +181,22 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
}
}
else
{
else
{
long
gameEnd
=
System
.
currentTimeMillis
();
long
gameEnd
=
System
.
currentTimeMillis
();
long
seconds
=
(
gameEnd
-
gameStart
)
/
1000
;
seconds
=
(
gameEnd
-
gameStart
);
if
(
noOfCorrectResponses
==
0
)
{
meanReactionTime
=
0
;
}
else
{
meanReactionTime
=
(
int
)
Math
.
ceil
(
totalReactionTime
/
noOfCorrectResponses
);
// ms
meanReactionTime
=
(
int
)
Math
.
ceil
(
totalReactionTime
/
noOfCorrectResponses
);
// ms
}
Log
.
d
(
"****************************************************"
,
"****************************************************"
);
Log
.
d
(
"****************************************************"
,
"****************************************************"
);
Log
.
d
(
"Game Time"
,
String
.
valueOf
(
seconds
));
Log
.
d
(
"Game Time"
,
String
.
valueOf
(
duration
));
Log
.
d
(
"total"
,
String
.
valueOf
(
totalCorrectResponses
));
Log
.
d
(
"total"
,
String
.
valueOf
(
totalCorrectResponses
));
Log
.
d
(
"correctResponses"
,
String
.
valueOf
(
noOfCorrectResponses
));
Log
.
d
(
"correctResponses"
,
String
.
valueOf
(
noOfCorrectResponses
));
noOfOmmissionErrors
=
totalCorrectResponses
-
noOfCorrectResponses
;
noOfOmmissionErrors
=
totalCorrectResponses
-
noOfCorrectResponses
;
Log
.
d
(
"omissionErrors"
,
String
.
valueOf
(
totalCorrectResponses
-
noOfCorrectResponses
));
Log
.
d
(
"omissionErrors"
,
String
.
valueOf
(
totalCorrectResponses
-
noOfCorrectResponses
));
Log
.
d
(
"commissionErrors"
,
String
.
valueOf
(
noOfCommissionErrors
));
Log
.
d
(
"commissionErrors"
,
String
.
valueOf
(
noOfCommissionErrors
));
Log
.
d
(
"meanReactionTime"
,
String
.
valueOf
(
meanReactionTime
));
Log
.
d
(
"meanReactionTime"
,
String
.
valueOf
(
meanReactionTime
));
Log
.
d
(
"duration"
,
String
.
valueOf
(
duration
));
Log
.
d
(
"duration"
,
String
.
valueOf
(
seconds
));
saveDataToOnlineDB
();
saveDataToOnlineDB
();
createTable
();
createTable
();
saveDataToLocalDB
();
saveDataToLocalDB
();
...
@@ -208,6 +223,36 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -208,6 +223,36 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
}
}
red_btn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
red_btn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
long
gameEnd
=
System
.
currentTimeMillis
();
seconds
=
(
gameEnd
-
gameStart
);
if
(
noOfCorrectResponses
==
0
)
{
meanReactionTime
=
0
;
}
else
{
meanReactionTime
=
(
int
)
Math
.
ceil
(
totalReactionTime
/
noOfCorrectResponses
);
// ms
}
Log
.
d
(
"****************************************************"
,
"****************************************************"
);
Log
.
d
(
"Game Time"
,
String
.
valueOf
(
seconds
));
Log
.
d
(
"total"
,
String
.
valueOf
(
totalCorrectResponses
));
Log
.
d
(
"correctResponses"
,
String
.
valueOf
(
noOfCorrectResponses
));
noOfOmmissionErrors
=
totalCorrectResponses
-
noOfCorrectResponses
;
Log
.
d
(
"omissionErrors"
,
String
.
valueOf
(
totalCorrectResponses
-
noOfCorrectResponses
));
Log
.
d
(
"commissionErrors"
,
String
.
valueOf
(
noOfCommissionErrors
));
Log
.
d
(
"meanReactionTime"
,
String
.
valueOf
(
meanReactionTime
));
Log
.
d
(
"duration"
,
String
.
valueOf
(
seconds
));
saveDataToOnlineDB
();
createTable
();
saveDataToLocalDB
();
Intent
intent
=
new
Intent
(
getApplicationContext
(),
SA1CompleteScreen
.
class
);
finish
();
mp
.
pause
();
startActivity
(
intent
);
}
});
bird
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
clickedTime
=
System
.
currentTimeMillis
();
clickedTime
=
System
.
currentTimeMillis
();
...
@@ -218,7 +263,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -218,7 +263,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
totalReactionTime
=
(
long
)
(
totalReactionTime
+
reactionTime
);
totalReactionTime
=
(
long
)
(
totalReactionTime
+
reactionTime
);
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
Log
.
d
(
"correct "
,
startTime
+
" "
+
clickedTime
+
" "
+
reactionTime
);
noOfCorrectResponses
++;
noOfCorrectResponses
++;
red_btn
.
setEnabled
(
false
);
bird
.
setEnabled
(
false
);
}
}
else
{
else
{
noOfCommissionErrors
++;
noOfCommissionErrors
++;
...
@@ -297,7 +342,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -297,7 +342,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
int
no_of_ommission_errors
=
noOfOmmissionErrors
;
int
no_of_ommission_errors
=
noOfOmmissionErrors
;
int
no_of_commission_errors
=
noOfCommissionErrors
;
int
no_of_commission_errors
=
noOfCommissionErrors
;
int
mean_reaction_time
=
(
int
)
meanReactionTime
;
int
mean_reaction_time
=
(
int
)
meanReactionTime
;
int
total_duration
=
duration
;
int
total_duration
=
(
int
)
seconds
;
HashMap
<
String
,
Integer
>
params
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
params
=
new
HashMap
<>();
params
.
put
(
"childID"
,
child_ID
);
params
.
put
(
"childID"
,
child_ID
);
...
@@ -399,7 +444,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
...
@@ -399,7 +444,7 @@ public class SustainedAttentionGame1 extends AppCompatActivity {
int
no_of_ommission_errors
=
noOfOmmissionErrors
;
int
no_of_ommission_errors
=
noOfOmmissionErrors
;
int
no_of_commission_errors
=
noOfCommissionErrors
;
int
no_of_commission_errors
=
noOfCommissionErrors
;
int
mean_reaction_time
=
(
int
)
meanReactionTime
;
int
mean_reaction_time
=
(
int
)
meanReactionTime
;
int
total_duration
=
duration
;
int
total_duration
=
(
int
)
seconds
;
String
insertSQL
=
"INSERT INTO sustainedAttention \n"
+
String
insertSQL
=
"INSERT INTO sustainedAttention \n"
+
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\n"
+
"(childID, totalCorrectResponses, noOfCorrectResponses, noOfCommissionErrors, noOfOmmissionErrors, meanReactionTime, totalDuration)\n"
+
...
...
app/src/main/java/com/anuththara18/attentionassessment/videos/IntroductoryVideoPortraitActivity.java
View file @
df0dd89f
package
com.anuththara18.attentionassessment.videos
;
package
com.anuththara18.attentionassessment.videos
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.app.DownloadManager
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.media.MediaPlayer
;
import
android.media.MediaPlayer
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.webkit.DownloadListener
;
import
android.webkit.WebSettings
;
import
android.webkit.WebView
;
import
android.webkit.WebViewClient
;
import
android.widget.MediaController
;
import
android.widget.MediaController
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
android.widget.VideoView
;
import
android.widget.VideoView
;
...
@@ -24,14 +32,14 @@ public class IntroductoryVideoPortraitActivity extends AppCompatActivity {
...
@@ -24,14 +32,14 @@ public class IntroductoryVideoPortraitActivity extends AppCompatActivity {
//String videoUrl;
//String videoUrl;
String
videoUrl
=
"https://1drv.ms/v/s!AvtsEIqJweWzmFqPURb36VGZZJpp"
;
String
videoUrl
=
"https://1drv.ms/v/s!AvtsEIqJweWzmFqPURb36VGZZJpp"
;
//String videoUrl = "https://drive.google.com/file/d/1Qt8C8Ucf0icgnLYdBSfhThm1nQbatGDa/view?usp=sharing";
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_introductory_video
);
setContentView
(
R
.
layout
.
activity_introductory_video
);
// finding videoview by its id
/*
VideoView
videoView
=
findViewById
(
R
.
id
.
videoView
);
if (MainFragment.game.equals("focused")) {
if (MainFragment.game.equals("focused")) {
videoUrl = "https://media.geeksforgeeks.org/wp-content/uploads/20201217192146/Screenrecorder-2020-12-17-19-17-36-828.mp4?_=1";
videoUrl = "https://media.geeksforgeeks.org/wp-content/uploads/20201217192146/Screenrecorder-2020-12-17-19-17-36-828.mp4?_=1";
}
}
...
@@ -45,31 +53,50 @@ public class IntroductoryVideoPortraitActivity extends AppCompatActivity {
...
@@ -45,31 +53,50 @@ public class IntroductoryVideoPortraitActivity extends AppCompatActivity {
videoUrl = "";
videoUrl = "";
}
}
// Uri object to refer the
*/
// resource from the videoUrl
Uri
uri
=
Uri
.
parse
(
videoUrl
);
// sets the resource from the
// videoUrl to the videoView
videoView
.
setVideoURI
(
uri
);
// creating object of
// initialising the web view
// media controller class
WebView
wv
=
(
WebView
)
findViewById
(
R
.
id
.
videoView
);
MediaController
mediaController
=
new
MediaController
(
this
);
// sets the anchor view
// add your link here
// anchor view for the videoView
wv
.
loadUrl
(
"https://drive.google.com/file/d/1Qt8C8Ucf0icgnLYdBSfhThm1nQbatGDa/view?usp=sharing"
);
mediaController
.
setAnchorView
(
videoView
);
//wv.loadUrl("https://1drv.ms/v/s!AvtsEIqJweWzmFqPURb36VGZZJpp");
wv
.
setWebViewClient
(
new
Client
());
WebSettings
ws
=
wv
.
getSettings
();
// sets the media player to the videoView
// Enabling javascript
mediaController
.
setMediaPlayer
(
videoView
);
ws
.
setJavaScriptEnabled
(
true
);
wv
.
getSettings
().
setJavaScriptCanOpenWindowsAutomatically
(
true
);
wv
.
clearCache
(
true
);
wv
.
clearHistory
();
// sets the media controller to the videoView
// download manager is a service that can be used to handle downloads
videoView
.
setMediaController
(
mediaController
);
wv
.
setDownloadListener
(
new
DownloadListener
()
{
@Override
public
void
onDownloadStart
(
String
url
,
String
s1
,
String
s2
,
String
s3
,
long
l
)
{
DownloadManager
.
Request
req
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
url
));
req
.
setNotificationVisibility
(
DownloadManager
.
Request
.
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
);
DownloadManager
dm
=
(
DownloadManager
)
getSystemService
(
DOWNLOAD_SERVICE
);
dm
.
enqueue
(
req
);
Toast
.
makeText
(
IntroductoryVideoPortraitActivity
.
this
,
"Downloading...."
,
Toast
.
LENGTH_SHORT
).
show
();
}
});
/*
// starts the video
VideoView videoView = findViewById(R.id.videoView);
Uri uri = Uri.parse(videoUrl);
videoView.setVideoURI(uri);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
mediaController.setMediaPlayer(videoView);
videoView.setMediaController(mediaController);
videoView.start();
videoView.start();
*/
/*
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
@Override
public void onCompletion(MediaPlayer mp) {
public void onCompletion(MediaPlayer mp) {
...
@@ -93,8 +120,57 @@ public class IntroductoryVideoPortraitActivity extends AppCompatActivity {
...
@@ -93,8 +120,57 @@ public class IntroductoryVideoPortraitActivity extends AppCompatActivity {
}
}
}
}
});
});
*/
}
private
class
Client
extends
WebViewClient
{
// on page started load start loading the url
@Override
public
void
onPageStarted
(
WebView
view
,
String
url
,
Bitmap
favicon
)
{
super
.
onPageStarted
(
view
,
url
,
favicon
);
}
// load the url of our drive
@Override
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
view
.
loadUrl
(
url
);
return
true
;
}
@Override
public
void
onPageFinished
(
WebView
view
,
String
url
)
{
super
.
onPageFinished
(
view
,
url
);
}
public
void
onReceivedError
(
WebView
webView
,
int
errorCode
,
String
description
,
String
failingUrl
)
{
// if stop loading
try
{
webView
.
stopLoading
();
}
catch
(
Exception
e
)
{
}
if
(
webView
.
canGoBack
())
{
webView
.
goBack
();
}
// if loaded blank then show error
// to check internet connection using
// alert dialog
webView
.
loadUrl
(
"about:blank"
);
AlertDialog
alertDialog
=
new
AlertDialog
.
Builder
(
IntroductoryVideoPortraitActivity
.
this
).
create
();
alertDialog
.
setTitle
(
"Error"
);
alertDialog
.
setMessage
(
"Check your internet connection and Try again."
);
alertDialog
.
setButton
(
DialogInterface
.
BUTTON_POSITIVE
,
"Try Again"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
finish
();
startActivity
(
getIntent
());
}
});
alertDialog
.
show
();
super
.
onReceivedError
(
webView
,
errorCode
,
description
,
failingUrl
);
}
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/activity_introductory_video.xml
View file @
df0dd89f
...
@@ -7,11 +7,11 @@
...
@@ -7,11 +7,11 @@
android:orientation=
"vertical"
android:orientation=
"vertical"
tools:context=
".videos.IntroductoryVideoPortraitActivity"
>
tools:context=
".videos.IntroductoryVideoPortraitActivity"
>
<
Video
View
android:id=
"@+id/videoView"
<
Web
View
android:id=
"@+id/videoView"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_centerVertical=
"true"
android:layout_centerVertical=
"true"
android:layout_centerHorizontal=
"true"
>
android:layout_centerHorizontal=
"true"
>
</
Video
View>
</
Web
View>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values-si/strings(si).xml
View file @
df0dd89f
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
<string
name=
"optional"
>
* විකල්ප
</string>
<string
name=
"optional"
>
* විකල්ප
</string>
<string
name=
"req"
>
* අවශ්යයි
</string>
<string
name=
"req"
>
* අවශ්යයි
</string>
<string
name=
"send"
>
දත්ත යවන්න
</string>
<string
name=
"send"
>
දත්ත යවන්න
</string>
<string
name=
"diagnosis"
>
ඔබේ දරුවා අවධානය යොමු කිර
ීමේ දුර්වලතාවයකින් පෙළෙනවා
ද?
</string>
<string
name=
"diagnosis"
>
ඔබේ දරුවා අවධානය යොමු කිර
ිමේදී යම් දුර්වලතාවයක් පෙන්නුම් කරන්නේ
ද?
</string>
<string
name=
"select"
>
තෝරන්න
</string>
<string
name=
"select"
>
තෝරන්න
</string>
<string
name=
"birdselect"
>
ඔබ වඩාත්ම කැමති චරිතය තෝරන්න
</string>
<string
name=
"birdselect"
>
ඔබ වඩාත්ම කැමති චරිතය තෝරන්න
</string>
...
...
app/src/main/res/values/strings.xml
View file @
df0dd89f
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<string
name=
"optional"
>
* Optional
</string>
<string
name=
"optional"
>
* Optional
</string>
<string
name=
"req"
>
* Required
</string>
<string
name=
"req"
>
* Required
</string>
<string
name=
"send"
>
Send Data
</string>
<string
name=
"send"
>
Send Data
</string>
<string
name=
"diagnosis"
>
Is your child suffering from any
attention impairements?
</string>
<string
name=
"diagnosis"
>
Does your child show any symptoms of
attention impairements?
</string>
<string
name=
"select"
>
Select the
</string>
<string
name=
"select"
>
Select the
</string>
<string
name=
"birdselect"
>
Pick your favourite character
</string>
<string
name=
"birdselect"
>
Pick your favourite character
</string>
...
...
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