Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-232
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
T.H.C. Heshan
2023-232
Commits
fd75cd1a
Commit
fd75cd1a
authored
Nov 04, 2023
by
DESKTOP-ERETTBS\Chathuka Heshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
landing page created
parent
b6bad3a5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
276 additions
and
0 deletions
+276
-0
Mobile App/app/src/main/java/com/sliit/blindvision/Locate.java
...e App/app/src/main/java/com/sliit/blindvision/Locate.java
+184
-0
Mobile App/app/src/main/java/com/sliit/blindvision/MainActivity.java
...app/src/main/java/com/sliit/blindvision/MainActivity.java
+14
-0
Mobile App/app/src/main/res/layout/activity_landing.xml
Mobile App/app/src/main/res/layout/activity_landing.xml
+22
-0
Mobile App/app/src/main/res/layout/activity_main.xml
Mobile App/app/src/main/res/layout/activity_main.xml
+56
-0
No files found.
Mobile App/app/src/main/java/com/sliit/blindvision/Locate.java
0 → 100644
View file @
fd75cd1a
package
com.sliit.blindvision
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.ArrayAdapter
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
java.util.ArrayList
;
public
class
Locate
extends
Activity
{
ArrayList
<
String
>
buildings
;
DatabaseHelper
db
;
ArrayAdapter
<
String
>
arrayAdapter
;
ArrayList
<
PositionData
>
positionsData
;
String
building
;
TextView
result
;
Button
locate
;
public
void
onCreate
(
Bundle
saveInstanceState
)
{
super
.
onCreate
(
saveInstanceState
);
setContentView
(
R
.
layout
.
locate
);
db
=
new
DatabaseHelper
(
this
);
buildings
=
db
.
getBuildings
();
locate
=
(
Button
)
findViewById
(
R
.
id
.
locate
);
result
=
(
TextView
)
findViewById
(
R
.
id
.
result
);
arrayAdapter
=
new
ArrayAdapter
<
String
>(
this
,
android
.
R
.
layout
.
simple_spinner_item
,
buildings
);
locate
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
arg0
)
{
// TODO Auto-generated method stub
Intent
intent
=
new
Intent
(
getApplicationContext
(),
Scan
.
class
);
intent
.
putExtra
(
"isLearning"
,
false
);
startActivityForResult
(
intent
,
0
);
}
});
arrayAdapter
=
new
ArrayAdapter
<
String
>(
this
,
android
.
R
.
layout
.
simple_list_item_1
,
buildings
);
// Set The Adapter
if
(
buildings
.
size
()==
0
)
{
Toast
.
makeText
(
this
,
"No building data available."
,
Toast
.
LENGTH_LONG
).
show
();
locate
.
setEnabled
(
false
);
}
else
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setCancelable
(
false
);
builder
.
setTitle
(
"Choose building"
);
builder
.
setAdapter
(
arrayAdapter
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
// the user clicked on colors[which]
building
=
buildings
.
get
(
which
);
}
});
builder
.
show
();
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
intent
)
{
// TODO Auto-generated method stub
if
(
resultCode
==
RESULT_OK
){
PositionData
positionData
=
(
PositionData
)
intent
.
getSerializableExtra
(
"PositionData"
);
positionsData
=
db
.
getReadings
(
building
);
String
closestPosition
=
null
;
ArrayList
<
Router
>
wifis
=
db
.
getFriendlyWifis
(
building
);
int
min_distance
=
positionData
.
uDistance
(
positionsData
.
get
(
0
),
wifis
);
int
j
=
0
;
closestPosition
=
positionsData
.
get
(
0
).
getName
();
String
res
=
""
;
res
+=
closestPosition
+
"\n"
+
min_distance
;
res
+=
"\n"
+
positionsData
.
get
(
0
).
toString
();
for
(
int
i
=
1
;
i
<
positionsData
.
size
();
i
++)
{
int
distance
=
positionData
.
uDistance
(
positionsData
.
get
(
i
),
wifis
);
res
+=
"\n"
+
positionsData
.
get
(
i
).
getName
()
+
"\n"
+
distance
;
res
+=
"\n"
+
positionsData
.
get
(
i
).
toString
();
if
(
distance
<
min_distance
)
{
min_distance
=
distance
;
j
=
i
;
closestPosition
=
positionsData
.
get
(
i
).
getName
();
}
}
if
(
min_distance
==
PositionData
.
MAX_DISTANCE
){
closestPosition
=
"OUT OF RANGE"
;
Toast
.
makeText
(
this
,
"You are out of range of the selected building"
,
Toast
.
LENGTH_LONG
).
show
();
}
result
.
setText
(
"Nearest point : "
+
closestPosition
);
//////////////////////////////////////////////////
min_distance
=
positionData
.
uDistance
(
positionsData
.
get
(
0
),
wifis
);
String
closestPosition2
=
null
;
closestPosition2
=
positionsData
.
get
(
0
).
getName
();
res
=
""
;
res
+=
closestPosition2
+
"\n"
+
min_distance
;
res
+=
"\n"
+
positionsData
.
get
(
0
).
toString
();
for
(
int
i
=
1
;
i
<
positionsData
.
size
();
i
++)
{
if
(
i
!=
j
)
{
int
distance
=
positionData
.
uDistance
(
positionsData
.
get
(
i
),
wifis
);
res
+=
"\n"
+
positionsData
.
get
(
i
).
getName
()
+
"\n"
+
distance
;
res
+=
"\n"
+
positionsData
.
get
(
i
).
toString
();
closestPosition2
=
positionsData
.
get
(
i
).
getName
();
//////////////////////////
if
(
closestPosition2
.
equals
(
closestPosition
))
continue
;
if
(
distance
<
min_distance
)
{
min_distance
=
distance
;
closestPosition2
=
positionsData
.
get
(
i
).
getName
();
}
}
}
if
(
min_distance
==
PositionData
.
MAX_DISTANCE
){
closestPosition2
=
"OUT OF RANGE"
;
Toast
.
makeText
(
this
,
"You are out of range of the selected building"
,
Toast
.
LENGTH_LONG
).
show
();
}
res
+=
"\nCurrent:\n"
+
positionData
.
toString
();
Log
.
v
(
"Result"
,
res
);
super
.
onActivityResult
(
requestCode
,
resultCode
,
intent
);
}
}
public
class
CustomOnItemSelectedListener
implements
AdapterView
.
OnItemSelectedListener
{
public
void
onItemSelected
(
AdapterView
<?>
parent
,
View
view
,
int
pos
,
long
id
)
{
building
=
parent
.
getItemAtPosition
(
pos
).
toString
();
locate
.
setEnabled
(
true
);
}
@Override
public
void
onNothingSelected
(
AdapterView
<?>
arg0
)
{
// TODO Auto-generated method stub
locate
.
setEnabled
(
false
);
}
}
}
Mobile App/app/src/main/java/com/sliit/blindvision/MainActivity.java
0 → 100644
View file @
fd75cd1a
package
com.sliit.blindvision
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
public
class
MainActivity
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
}
}
\ No newline at end of file
Mobile App/app/src/main/res/layout/activity_landing.xml
0 → 100644
View file @
fd75cd1a
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<Button
android:id=
"@+id/btn_wifi_calibration"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"16dp"
android:text=
"Open WiFi Calibration"
/>
<Button
android:id=
"@+id/btn_route_finder"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Open Route Finder"
/>
</LinearLayout>
Mobile App/app/src/main/res/layout/activity_main.xml
0 → 100644
View file @
fd75cd1a
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/LinearLayout1"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:paddingBottom=
"@dimen/activity_vertical_margin"
android:paddingLeft=
"@dimen/activity_horizontal_margin"
android:paddingRight=
"@dimen/activity_horizontal_margin"
android:paddingTop=
"@dimen/activity_vertical_margin"
>
<TextView
android:id=
"@+id/textHeading"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
<EditText
android:id=
"@+id/placename"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
>
<requestFocus
/>
</EditText>
<Button
android:id=
"@+id/button1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:text=
"Calibrate"
/>
<TextView
android:id=
"@+id/TextView1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
/>
<TextView
android:id=
"@+id/TextView2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:textColor=
"#ff0000"
android:textSize=
"30dp"
/>
<ScrollView
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
>
<TextView
android:id=
"@+id/TextView3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</ScrollView>
</LinearLayout>
\ No newline at end of file
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