Commit 55badf2c authored by Kavindu Randika's avatar Kavindu Randika

commit final

parent 6796aa41
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<option name="filePathToZoomLevelMap"> <option name="filePathToZoomLevelMap">
<map> <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/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_deasis_show.xml" value="0.25" />
<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/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/deasisecheck.xml" value="0.22" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_camera.xml" value="0.1" /> <entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_camera.xml" value="0.1" />
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_medc.xml" value="0.12771739130434784" /> <entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_medc.xml" value="0.12771739130434784" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_search.xml" value="0.2199546485260771" /> <entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/fragment_search.xml" value="0.2199546485260771" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/frame_textview.xml" value="0.22" /> <entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/frame_textview.xml" value="0.22" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/showdeasislayout.xml" value="0.25" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/menu/menu.xml" value="0.20416666666666666" /> <entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/menu/menu.xml" value="0.20416666666666666" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/menu/search_menu.xml" value="0.22" /> <entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/menu/search_menu.xml" value="0.22" />
</map> </map>
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Skidndiseaseapp"> android:theme="@style/Theme.Skidndiseaseapp">
<activity
android:name=".SingIn"
android:exported="true" />
<activity <activity
android:name=".DeasisShow" android:name=".DeasisShow"
android:exported="true" /> android:exported="true" />
......
package com.project.skidn_disease_app; package com.project.skidn_disease_app;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle; import android.os.Bundle;
public class DeasisShow extends AppCompatActivity { import java.io.Reader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class DeasisShow extends AppCompatActivity {
ArrayList<String> dataList;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deasis_show); setContentView(R.layout.activity_deasis_show);
Bundle extras = getIntent().getExtras();
String userName;
if (extras != null) {
// dataList.removeAll(dataList);
// dataList.clear();
if (dataList!=null){
dataList.clear();
for(String text:dataList){
System.out.println(" inside \n"+text);
}
}
dataList = (ArrayList) extras.get("deasis");
for(String text:dataList){
System.out.println(text);
}
Set<String> set = new HashSet<>(dataList);
dataList.clear();
dataList.addAll(set);
System.out.println("data");
System.out.println(dataList);
System.out.println(dataList.getClass());
System.out.println("data");
initRecyleView(dataList);
// and get whatever type user account id is
}
}
public void initRecyleView(ArrayList<String> dataList){
RecyclerView recyclerView = findViewById(R.id.show_recyele_view);
DeasisShowAdapter deasisShowAdapter = new DeasisShowAdapter(dataList,this);
recyclerView.setAdapter(deasisShowAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
} }
} }
\ No newline at end of file
package com.project.skidn_disease_app;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class DeasisShowAdapter extends RecyclerView.Adapter<DeasisShowAdapter.ViewHolder>{
private ArrayList<String> arrayList = new ArrayList<>();
Context context;
public DeasisShowAdapter(ArrayList<String> arrayList, Context context) {
this.arrayList = arrayList;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.showdeasislayout,parent,false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
System.out.println(arrayList.size());
System.out.println(position);
System.out.println("here"+arrayList);
JSONObject obj = null;
String name="";
String description = "";
try {
for (Object data: (arrayList)) {
System.out.println("here"+data);
obj = new JSONObject(data.toString());
List<String> list = new ArrayList<String>();
name = (String) obj.get("name");
description = (String) obj.get("description");
System.out.println("name "+name);
System.out.println("description "+description);
}
holder.titleText.setText(name);
holder.description.setText(description);
System.out.println(name);
System.out.println(description);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
TextView titleText,description;
public ViewHolder(@NonNull View itemView) {
super(itemView);
titleText = itemView.findViewById(R.id.title_deasis);
description = itemView.findViewById(R.id.title_deasis_description);
}
}
}
...@@ -27,6 +27,7 @@ import com.android.volley.VolleyError; ...@@ -27,6 +27,7 @@ import com.android.volley.VolleyError;
import com.android.volley.VolleyLog; import com.android.volley.VolleyLog;
import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.JsonRequest; import com.android.volley.toolbox.JsonRequest;
import com.android.volley.toolbox.RequestFuture;
import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley; import com.android.volley.toolbox.Volley;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
...@@ -41,6 +42,7 @@ import org.json.JSONObject; ...@@ -41,6 +42,7 @@ import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import retrofit2.Call; import retrofit2.Call;
...@@ -60,6 +62,7 @@ public class SearchFragment extends Fragment implements QuantityListner{ ...@@ -60,6 +62,7 @@ public class SearchFragment extends Fragment implements QuantityListner{
private static final String ARG_PARAM2 = "param2"; private static final String ARG_PARAM2 = "param2";
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
private RecyclerView recyclerView; private RecyclerView recyclerView;
ArrayList<Object> data_ = new ArrayList<>();
private ArrayList<String> responce_data; private ArrayList<String> responce_data;
private ArrayList<String> values; private ArrayList<String> values;
...@@ -205,12 +208,20 @@ public class SearchFragment extends Fragment implements QuantityListner{ ...@@ -205,12 +208,20 @@ public class SearchFragment extends Fragment implements QuantityListner{
String point = this.map.get(data); String point = this.map.get(data);
output.add(Integer.parseInt(point)); output.add(Integer.parseInt(point));
} }
System.out.println("printing---");
System.out.println(output.toString()); System.out.println(output.toString());
ArrayList<String> data_ = justafunction(output.toString()); justafunction(output.toString(),new VolleyCallBack() {
Intent intent = new Intent(this.getContext(),DeasisShow.class);
intent.putExtra("deasis",data_); @Override
startActivity(intent); public void onSuccess() {
System.out.println("hello"+data_);
Intent intent = new Intent(getContext(),DeasisShow.class);
intent.putExtra("deasis",data_);
startActivity(intent);
// this is where you will call the geofire, here you have the response from the volley.
}});
}else{ }else{
showAlert("Please Checkout Some symptoms","Warining"); showAlert("Please Checkout Some symptoms","Warining");
} }
...@@ -243,10 +254,10 @@ public class SearchFragment extends Fragment implements QuantityListner{ ...@@ -243,10 +254,10 @@ public class SearchFragment extends Fragment implements QuantityListner{
AlertDialog alert11 = builder1.create(); AlertDialog alert11 = builder1.create();
alert11.show(); alert11.show();
} }
public ArrayList<String> justafunction(String data) throws JSONException { public void justafunction(String data,final VolleyCallBack callBack) throws JSONException {
// String url ="https://projects.vishnusivadas.com/testing/write.php"; // String url ="https://projects.vishnusivadas.com/testing/write.php";
final String url = "https://nnau7c.deta.dev/api/predictions/symptoms"; final String url = "https://i0qh9h.deta.dev/api/predictions/symptoms";
final ArrayList<String>[] data_ = new ArrayList[]{new ArrayList<>()};
String quary = "{\"symptoms\": "+data+"}"; String quary = "{\"symptoms\": "+data+"}";
final JSONObject jsonBody = new JSONObject(quary); final JSONObject jsonBody = new JSONObject(quary);
JsonObjectRequest req = new JsonObjectRequest(url, jsonBody, JsonObjectRequest req = new JsonObjectRequest(url, jsonBody,
...@@ -255,20 +266,32 @@ public class SearchFragment extends Fragment implements QuantityListner{ ...@@ -255,20 +266,32 @@ public class SearchFragment extends Fragment implements QuantityListner{
public void onResponse(JSONObject response) { public void onResponse(JSONObject response) {
try { try {
VolleyLog.v("Response:%n %s", response.toString(4)); VolleyLog.v("Response:%n %s", response.toString(4));
System.out.println(response);
ArrayList<String> listdata = new ArrayList<String>(); ArrayList<String> listdata = new ArrayList<String>();
ArrayList<String> data_in = new ArrayList<String>(); ArrayList<String> data_in = new ArrayList<String>();
JSONArray jsonArray = (JSONArray)response.get("result"); JSONArray jsonArray = (JSONArray)response.get("result");
if (jsonArray != null) { if (jsonArray != null) {
int len = jsonArray.length(); int len = jsonArray.length();
if(data_!=null && data_.size()!=0){
data_.clear();
}
for (int i=0;i<len;i++){ for (int i=0;i<len;i++){
data_in.add(jsonArray.get(i).toString()); data_in.add(jsonArray.get(i).toString());
data_.add(jsonArray.get(i).toString());
} }
} }
for (String data: (data_in)) { for (Object data: (data_)) {
System.out.println(data); System.out.println("here"+data);
JSONObject obj = new JSONObject(data.toString());
List<String> list = new ArrayList<String>();
String name = (String) obj.get("name");
String description = (String) obj.get("description");
System.out.println("name "+name);
System.out.println("description "+description);
} }
data_[0] = data_in; callBack.onSuccess();
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -278,13 +301,12 @@ public class SearchFragment extends Fragment implements QuantityListner{ ...@@ -278,13 +301,12 @@ public class SearchFragment extends Fragment implements QuantityListner{
public void onErrorResponse(VolleyError error) { public void onErrorResponse(VolleyError error) {
VolleyLog.e("Error: ", error.getMessage()); VolleyLog.e("Error: ", error.getMessage());
} }
}); });
// add the request object to the queue to be executed // add the request object to the queue to be executed
RequestQueue queue = Volley.newRequestQueue(this.getContext()); RequestQueue queue = Volley.newRequestQueue(this.getContext());
queue.add(req); queue.add(req);
System.out.println(data_[0]);
return data_[0];
} }
public void getMap() { public void getMap() {
this.map.put("Crusting of skin bumps.","23"); this.map.put("Crusting of skin bumps.","23");
......
package com.project.skidn_disease_app;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class SingIn extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sing_in);
}
}
\ No newline at end of file
package com.project.skidn_disease_app;
public interface VolleyCallBack {
void onSuccess();
}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
tools:context=".DeasisShow"> tools:context=".DeasisShow">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_width="409dp" android:id="@+id/show_recyele_view"
android:layout_height="729dp" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="1dp" tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" /> tools:layout_editor_absoluteY="1dp" />
</FrameLayout> </RelativeLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".SingIn">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
...@@ -8,14 +8,11 @@ ...@@ -8,14 +8,11 @@
tools:context=".MedcFragment"> tools:context=".MedcFragment">
<!-- TODO: Update blank fragment layout --> <!-- TODO: Update blank fragment layout -->
<TextView <androidx.recyclerview.widget.RecyclerView
android:textSize="30dp" android:id="@+id/medec_recyele_view"
android:textColor="@color/white" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_centerInParent="true" tools:layout_editor_absoluteX="1dp"
android:textAlignment="center" tools:layout_editor_absoluteY="1dp" />
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Channel Now" />
</FrameLayout> </RelativeLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
app:cardBackgroundColor="#FEE3C8"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:id="@+id/title_deasis"
android:textSize="18dp"
android:textAlignment="center"
android:textColor="#000000"
android:layout_height="wrap_content"
android:text="some text"/>
<TextView
android:layout_width="match_parent"
android:id="@+id/title_deasis_description"
android:textSize="14dp"
android:textAlignment="center"
android:textColor="#000000"
android:layout_height="wrap_content"
android:text="some text"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment