Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Skidn disease App
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
Skin disease
Skidn disease App
Commits
6796aa41
Commit
6796aa41
authored
Sep 28, 2021
by
Kavindu Randika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search function 2
parent
4409af39
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
271 additions
and
3 deletions
+271
-3
.idea/misc.xml
.idea/misc.xml
+1
-0
app/build.gradle
app/build.gradle
+4
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+5
-0
app/src/main/java/com/project/skidn_disease_app/DeasisShow.java
...c/main/java/com/project/skidn_disease_app/DeasisShow.java
+15
-0
app/src/main/java/com/project/skidn_disease_app/SearchFragment.java
...in/java/com/project/skidn_disease_app/SearchFragment.java
+118
-3
app/src/main/java/com/project/skidn_disease_app/model/DeasisModal.java
...java/com/project/skidn_disease_app/model/DeasisModal.java
+27
-0
app/src/main/java/com/project/skidn_disease_app/network/ApiInterFace.java
...a/com/project/skidn_disease_app/network/ApiInterFace.java
+21
-0
app/src/main/java/com/project/skidn_disease_app/network/ArrayListVals.java
.../com/project/skidn_disease_app/network/ArrayListVals.java
+13
-0
app/src/main/java/com/project/skidn_disease_app/network/Request.java
...n/java/com/project/skidn_disease_app/network/Request.java
+34
-0
app/src/main/java/com/project/skidn_disease_app/network/RetrofitClientInstance.java
...ect/skidn_disease_app/network/RetrofitClientInstance.java
+19
-0
app/src/main/res/layout/activity_deasis_show.xml
app/src/main/res/layout/activity_deasis_show.xml
+14
-0
No files found.
.idea/misc.xml
View file @
6796aa41
...
...
@@ -4,6 +4,7 @@
<option
name=
"filePathToZoomLevelMap"
>
<map>
<entry
key=
"..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/drawable/tab_color.xml"
value=
"0.1125"
/>
<entry
key=
"..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/activity_deasis_show.xml"
value=
"0.1"
/>
<entry
key=
"..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/activity_main.xml"
value=
"0.19270833333333334"
/>
<entry
key=
"..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/deasisecheck.xml"
value=
"0.22"
/>
<entry
key=
"..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_camera.xml"
value=
"0.1"
/>
...
...
app/build.gradle
View file @
6796aa41
...
...
@@ -28,6 +28,10 @@ android {
}
dependencies
{
implementation
'com.android.volley:volley:1.2.1'
implementation
'com.loopj.android:android-async-http:1.4.9'
implementation
'com.squareup.retrofit2:retrofit:2.9.0'
implementation
'com.squareup.retrofit2:converter-gson:2.9.0'
implementation
'com.google.code.gson:gson:2.8.5'
implementation
'androidx.appcompat:appcompat:1.3.1'
implementation
'com.google.android.material:material:1.4.0'
...
...
app/src/main/AndroidManifest.xml
View file @
6796aa41
...
...
@@ -2,6 +2,8 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.project.skidn_disease_app"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
...
...
@@ -9,6 +11,9 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.Skidndiseaseapp"
>
<activity
android:name=
".DeasisShow"
android:exported=
"true"
/>
<activity
android:name=
".MainActivity"
android:exported=
"true"
>
...
...
app/src/main/java/com/project/skidn_disease_app/DeasisShow.java
0 → 100644
View file @
6796aa41
package
com.project.skidn_disease_app
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
public
class
DeasisShow
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_deasis_show
);
}
}
\ No newline at end of file
app/src/main/java/com/project/skidn_disease_app/SearchFragment.java
View file @
6796aa41
package
com.project.skidn_disease_app
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
...
...
@@ -7,6 +10,7 @@ import androidx.fragment.app.Fragment;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.Menu
;
import
android.view.MenuInflater
;
...
...
@@ -15,8 +19,33 @@ import android.view.View;
import
android.view.ViewGroup
;
import
android.widget.Toast
;
import
com.android.volley.NetworkResponse
;
import
com.android.volley.Request
;
import
com.android.volley.RequestQueue
;
import
com.android.volley.Response
;
import
com.android.volley.VolleyError
;
import
com.android.volley.VolleyLog
;
import
com.android.volley.toolbox.JsonObjectRequest
;
import
com.android.volley.toolbox.JsonRequest
;
import
com.android.volley.toolbox.StringRequest
;
import
com.android.volley.toolbox.Volley
;
import
com.google.gson.JsonObject
;
import
com.project.skidn_disease_app.model.DeasisModal
;
import
com.project.skidn_disease_app.network.ApiInterFace
;
import
com.project.skidn_disease_app.network.ArrayListVals
;
import
com.project.skidn_disease_app.network.RetrofitClientInstance
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Retrofit
;
/**
* A simple {@link Fragment} subclass.
...
...
@@ -29,9 +58,9 @@ public class SearchFragment extends Fragment implements QuantityListner{
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private
static
final
String
ARG_PARAM1
=
"param1"
;
private
static
final
String
ARG_PARAM2
=
"param2"
;
private
HashMap
<
String
,
Object
>
map
;
HashMap
<
String
,
String
>
map
=
new
HashMap
<>()
;
private
RecyclerView
recyclerView
;
private
ArrayList
<
String
>
responce_data
;
private
ArrayList
<
String
>
values
;
// TODO: Rename and change types of parameters
...
...
@@ -166,12 +195,97 @@ public class SearchFragment extends Fragment implements QuantityListner{
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
)
{
int
itemThatWasClickedId
=
item
.
getItemId
();
if
(
itemThatWasClickedId
==
R
.
id
.
action_search
)
{
Toast
.
makeText
(
this
.
getContext
(),
"hello"
,
Toast
.
LENGTH_LONG
).
show
();
try
{
getMap
();
if
(
this
.
responce_data
!=
null
){
if
(!
this
.
responce_data
.
isEmpty
()){
ArrayList
<
Integer
>
output
=
new
ArrayList
<>();
for
(
String
data:
this
.
responce_data
)
{
String
point
=
this
.
map
.
get
(
data
);
output
.
add
(
Integer
.
parseInt
(
point
));
}
System
.
out
.
println
(
"printing---"
);
System
.
out
.
println
(
output
.
toString
());
ArrayList
<
String
>
data_
=
justafunction
(
output
.
toString
());
Intent
intent
=
new
Intent
(
this
.
getContext
(),
DeasisShow
.
class
);
intent
.
putExtra
(
"deasis"
,
data_
);
startActivity
(
intent
);
}
else
{
showAlert
(
"Please Checkout Some symptoms"
,
"Warining"
);
}
}
else
{
showAlert
(
"Please Checkout Some symptoms"
,
"Warining"
);
Toast
.
makeText
(
this
.
getContext
(),
"Please Checkout Some symptoms"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
public
void
showAlert
(
String
msg
,
String
title
){
AlertDialog
.
Builder
builder1
=
new
AlertDialog
.
Builder
(
this
.
getContext
());
builder1
.
setMessage
(
msg
);
builder1
.
setTitle
(
title
);
builder1
.
setCancelable
(
true
);
builder1
.
setPositiveButton
(
"Ok"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
dialog
.
cancel
();
}
});
AlertDialog
alert11
=
builder1
.
create
();
alert11
.
show
();
}
public
ArrayList
<
String
>
justafunction
(
String
data
)
throws
JSONException
{
// String url ="https://projects.vishnusivadas.com/testing/write.php";
final
String
url
=
"https://nnau7c.deta.dev/api/predictions/symptoms"
;
final
ArrayList
<
String
>[]
data_
=
new
ArrayList
[]{
new
ArrayList
<>()};
String
quary
=
"{\"symptoms\": "
+
data
+
"}"
;
final
JSONObject
jsonBody
=
new
JSONObject
(
quary
);
JsonObjectRequest
req
=
new
JsonObjectRequest
(
url
,
jsonBody
,
new
Response
.
Listener
<
JSONObject
>()
{
@Override
public
void
onResponse
(
JSONObject
response
)
{
try
{
VolleyLog
.
v
(
"Response:%n %s"
,
response
.
toString
(
4
));
System
.
out
.
println
(
response
);
ArrayList
<
String
>
listdata
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
data_in
=
new
ArrayList
<
String
>();
JSONArray
jsonArray
=
(
JSONArray
)
response
.
get
(
"result"
);
if
(
jsonArray
!=
null
)
{
int
len
=
jsonArray
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++){
data_in
.
add
(
jsonArray
.
get
(
i
).
toString
());
}
}
for
(
String
data:
(
data_in
))
{
System
.
out
.
println
(
data
);
}
data_
[
0
]
=
data_in
;
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
},
new
Response
.
ErrorListener
()
{
@Override
public
void
onErrorResponse
(
VolleyError
error
)
{
VolleyLog
.
e
(
"Error: "
,
error
.
getMessage
());
}
});
// add the request object to the queue to be executed
RequestQueue
queue
=
Volley
.
newRequestQueue
(
this
.
getContext
());
queue
.
add
(
req
);
System
.
out
.
println
(
data_
[
0
]);
return
data_
[
0
];
}
public
void
getMap
()
{
this
.
map
.
put
(
"Crusting of skin bumps."
,
"23"
);
this
.
map
.
put
(
" Cysts."
,
"2"
);
...
...
@@ -288,6 +402,7 @@ public class SearchFragment extends Fragment implements QuantityListner{
@Override
public
void
onQunatiyChange
(
ArrayList
<
String
>
arrayList
)
{
this
.
responce_data
=
arrayList
;
Toast
.
makeText
(
this
.
getContext
(),
arrayList
.
toString
(),
Toast
.
LENGTH_LONG
).
show
();
}
}
\ No newline at end of file
app/src/main/java/com/project/skidn_disease_app/model/DeasisModal.java
0 → 100644
View file @
6796aa41
package
com.project.skidn_disease_app.model
;
public
class
DeasisModal
{
private
String
success
;
private
String
[]
result
;
public
DeasisModal
(
String
success
,
String
[]
result
)
{
this
.
success
=
success
;
this
.
result
=
result
;
}
public
String
getSuccess
()
{
return
success
;
}
public
void
setSuccess
(
String
success
)
{
this
.
success
=
success
;
}
public
String
[]
getResult
()
{
return
result
;
}
public
void
setResult
(
String
[]
result
)
{
this
.
result
=
result
;
}
}
app/src/main/java/com/project/skidn_disease_app/network/ApiInterFace.java
0 → 100644
View file @
6796aa41
package
com.project.skidn_disease_app.network
;
import
com.google.gson.JsonObject
;
import
com.project.skidn_disease_app.model.DeasisModal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
retrofit2.Call
;
import
retrofit2.http.Body
;
import
retrofit2.http.Field
;
import
retrofit2.http.FormUrlEncoded
;
import
retrofit2.http.Headers
;
import
retrofit2.http.POST
;
public
interface
ApiInterFace
{
// @FormUrlEncoded
@Headers
(
"Content-Type: application/json"
)
@POST
(
"symptoms"
)
Call
<
DeasisModal
>
postData
(
@Body
String
body
);
}
app/src/main/java/com/project/skidn_disease_app/network/ArrayListVals.java
0 → 100644
View file @
6796aa41
package
com.project.skidn_disease_app.network
;
import
java.util.ArrayList
;
public
class
ArrayListVals
{
final
ArrayList
<
String
>
symptoms
;
// final String bar;
public
ArrayListVals
(
ArrayList
<
String
>
symptoms
)
{
this
.
symptoms
=
symptoms
;
}
}
app/src/main/java/com/project/skidn_disease_app/network/Request.java
0 → 100644
View file @
6796aa41
package
com.project.skidn_disease_app.network
;
import
com.loopj.android.http.AsyncHttpClient
;
import
com.loopj.android.http.AsyncHttpResponseHandler
;
import
cz.msebera.android.httpclient.Header
;
public
class
Request
{
public
void
funcion
(){
AsyncHttpClient
client
=
new
AsyncHttpClient
();
client
.
post
(
"https://www.google.com"
,
new
AsyncHttpResponseHandler
()
{
@Override
public
void
onStart
()
{
// called before request is started
}
@Override
public
void
onSuccess
(
int
statusCode
,
Header
[]
headers
,
byte
[]
response
)
{
// called when response HTTP status is "200 OK"
}
@Override
public
void
onFailure
(
int
statusCode
,
Header
[]
headers
,
byte
[]
errorResponse
,
Throwable
e
)
{
// called when response HTTP status is "4XX" (eg. 401, 403, 404)
}
@Override
public
void
onRetry
(
int
retryNo
)
{
// called when request is retried
}
});}
}
app/src/main/java/com/project/skidn_disease_app/network/RetrofitClientInstance.java
0 → 100644
View file @
6796aa41
package
com.project.skidn_disease_app.network
;
import
retrofit2.Retrofit
;
import
retrofit2.converter.gson.GsonConverterFactory
;
public
class
RetrofitClientInstance
{
private
static
Retrofit
retrofit
;
private
static
final
String
BASE_URL
=
"https://nnau7c.deta.dev/api/predictions/"
;
public
static
Retrofit
getRetrofitInstance
()
{
if
(
retrofit
==
null
)
{
retrofit
=
new
retrofit2
.
Retrofit
.
Builder
()
.
baseUrl
(
BASE_URL
)
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
build
();
}
return
retrofit
;
}
}
app/src/main/res/layout/activity_deasis_show.xml
0 → 100644
View file @
6796aa41
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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=
".DeasisShow"
>
<androidx.recyclerview.widget.RecyclerView
android:layout_width=
"409dp"
android:layout_height=
"729dp"
tools:layout_editor_absoluteX=
"1dp"
tools:layout_editor_absoluteY=
"1dp"
/>
</FrameLayout>
\ 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