Commit aeb5d7b0 authored by Hansi rathnayaka's avatar Hansi rathnayaka

medical serach

parent 9b1fa957
......@@ -5,7 +5,10 @@
<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.25" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/activity_duty_calling.xml" value="0.19166666666666668" />
<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_sing_in.xml" value="0.3596014492753623" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/activity_singup.xml" value="0.20572916666666666" />
<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_chat.xml" value="0.12771739130434784" />
......@@ -13,6 +16,9 @@
<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/showdeasislayout.xml" value="0.25" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/showdoctors.xml" value="0.21354166666666666" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/layout/textview_border.xml" value="0.20572916666666666" />
<entry key="..\:/Users/wishwa/StudioProjects/Skidndiseaseapp/app/src/main/res/menu/doctormenu.xml" value="0.21354166666666666" />
<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" />
</map>
......
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
......@@ -32,11 +33,12 @@ dependencies {
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'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-database:20.0.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
......
{
"project_info": {
"project_number": "894858391967",
"project_id": "skidn-disease-app",
"storage_bucket": "skidn-disease-app.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:894858391967:android:35951e5084b2d48bbf0daa",
"android_client_info": {
"package_name": "com.project.skidn_disease_app"
}
},
"oauth_client": [
{
"client_id": "894858391967-7bmjm6spevdh6s4ehlasdd4ve5oa5n1l.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCa1DdzI_I0yTRZcTI1gSqj-mBiww9x_gM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "894858391967-7bmjm6spevdh6s4ehlasdd4ve5oa5n1l.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
......@@ -11,6 +11,12 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Skidndiseaseapp">
<activity
android:name=".DutyCalling"
android:exported="true" />
<activity
android:name=".Singup"
android:exported="true" />
<activity
android:name=".SingIn"
android:exported="true" />
......
package com.project.skidn_disease_app;
public class Doctor {
public String name,email;
public Doctor(String name, String email) {
this.name = name;
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
package com.project.skidn_disease_app;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.project.skidn_disease_app.R;
import com.project.skidn_disease_app.ShowDoctorViewHolder;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Random;
public class DoctorListAdapter extends RecyclerView.Adapter<ShowDoctorViewHolder> {
private ArrayList<JSONObject> dataList;
Context context;
public DoctorListAdapter(Context context,ArrayList<JSONObject> dataList) {
this.dataList = dataList;
this.context =context;
System.out.println("Ccccccccc");
System.out.println(dataList);
System.out.println("Ccccccccc");
}
@Override
public int getItemViewType(final int position) {
return R.layout.showdoctors;
}
@NonNull
@Override
public ShowDoctorViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.showdoctors,parent,false);
// View view = LayoutInflater.from(parent.getContext()).inflate(viewType, parent, false);
// View view = LayoutInflater.from(parent.getContext()).inflate(viewType, parent, false);
return new ShowDoctorViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ShowDoctorViewHolder holder, int position) {
System.out.println("Ccccccccc");
System.out.println(position);
System.out.println("Ccccccccc");
JSONObject jsonobject = dataList.get(position);
System.out.println(jsonobject.toString());
try {
String name = jsonobject.getString("name");
String title= jsonobject.getString("title");
String phone = jsonobject.getString("phone");
String email = jsonobject.getString("email");
holder.getName_show_doctors().setText(String.valueOf("Name: "+title));
holder.getEmail_show_doctors().setText(String.valueOf("Title: "+name));
holder.getPhone_show_doctors().setText(String.valueOf("Email: "+email));
holder.getTitle_show_doctors().setText(String.valueOf("Phone: "+phone));
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public int getItemCount() {
return dataList.size();
}
}
\ No newline at end of file
package com.project.skidn_disease_app;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
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.JsonArrayRequest;
import com.android.volley.toolbox.Volley;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
* Use the {@link MedcFragment#newInstance} factory method to
......@@ -17,8 +43,13 @@ public class MedcFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private SharedPreferences sharedPref;
FirebaseAuth auth = FirebaseAuth.getInstance();
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private RecyclerView recyclerView;
View view;
ArrayList<JSONObject> dataArrayList = new ArrayList<>();
// TODO: Rename and change types of parameters
private String mParam1;
......@@ -46,6 +77,62 @@ public class MedcFragment extends Fragment {
return fragment;
}
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
inflater.inflate(R.menu.doctormenu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
public void setHasOptionsMenu(boolean hasMenu) {
super.setHasOptionsMenu(hasMenu);
}
@Override
public void onPrepareOptionsMenu(@NonNull Menu menu) {
super.onPrepareOptionsMenu(menu);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this.getContext());
String UserId = settings.getString("userid", "");
MenuItem item= menu.findItem(R.id.action_Onboarding_medec);
if (UserId != null && !UserId.equals("")) {
item.setTitle("LogOut");
}
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int itemThatWasClickedId = item.getItemId();
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this.getContext());
String UserId = settings.getString("userid", "");
System.out.println(UserId);
if(UserId!=null && !UserId.equals("")) {
if(item.getTitle().equals("LogOut")){
SharedPreferences.Editor editor = settings.edit();
editor.putString("userid", "");
editor.commit();
item.setTitle("Onboarding");
}
if(item.getTitle().equals("Duty Calling")){
Intent i = new Intent(this.getContext(), DutyCalling.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}
}else{
System.out.println("UserId");
System.out.println(UserId);
System.out.println("UserId");
if (itemThatWasClickedId == R.id.action_Duty_medec) {
Intent intent = new Intent(getContext(),SingIn.class);
startActivity(intent);
}
if (itemThatWasClickedId == R.id.action_Onboarding_medec) {
Intent intent = new Intent(getContext(),Singup.class);
startActivity(intent);
}
}
return super.onOptionsItemSelected(item);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -53,13 +140,68 @@ public class MedcFragment extends Fragment {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
setHasOptionsMenu(true);
dataArrayList=getDoctors(new VolleyCallBack() {
@Override
public void onSuccess() {
System.out.println("hello"+dataArrayList);
recyclerView = view.findViewById(R.id.medecrecyele_view);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
DoctorListAdapter medecAdapter = new DoctorListAdapter(view.getContext(),dataArrayList);
recyclerView.setAdapter(medecAdapter);
}});
getActivity().setTitle("Medical Channling");
}
public ArrayList<JSONObject> getDoctors(final VolleyCallBack callBack){
String url = "https://i0qh9h.deta.dev/api/doctors";
List<String> jsonResponses = new ArrayList<>();
RequestQueue requestQueue = Volley.newRequestQueue(this.getContext());
JsonArrayRequest jsonObjectRequest = new JsonArrayRequest(Request.Method.GET, url, null, response -> {
System.out.println(response.getClass());
for(int i=0; i < response.length(); i++) {
JSONObject jsonobject = null;
try {
jsonobject = response.getJSONObject(i);
System.out.println("xxx");
System.out.println(jsonobject);
System.out.println("xxx");
callBack.onSuccess();
dataArrayList.add(jsonobject);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, error -> error.printStackTrace());
requestQueue.add(jsonObjectRequest);
return dataArrayList;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_medc, container, false);
view = inflater.inflate(R.layout.fragment_medc, container, false);
// recyclerView = (RecyclerView) view.findViewById(R.id.medecrecyele_view);
recyclerView = view.findViewById(R.id.medecrecyele_view);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
DoctorListAdapter medecAdapter = new DoctorListAdapter(this.getContext(),dataArrayList);
recyclerView.setAdapter(medecAdapter);
return view;
}
}
\ 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;
public class MedecAdapter extends RecyclerView.Adapter<MedecAdapter.ViewHolder>{
ArrayList<JSONObject> dataArrayList = new ArrayList<>();
Context context;
public MedecAdapter(ArrayList<JSONObject> dataArrayList, Context context) {
this.dataArrayList = dataArrayList;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.showdoctors,parent,false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
System.out.println(dataArrayList.size());
System.out.println(position);
System.out.println("here"+dataArrayList);
String name,title,phone,email = "";
JSONObject jsonobject = dataArrayList.get(position);
try {
name = jsonobject.getString("name");
title= jsonobject.getString("title");
phone = jsonobject.getString("phone");
email = jsonobject.getString("email");
System.out.println(name);
System.out.println(title);
holder.title_show_doctors.setText("Name: "+title);
holder.name_show_doctors.setText("Title: "+name);
holder.email_show_doctors.setText("Email: "+email);
holder.phone_show_doctors.setText("Phone: "+phone);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public int getItemCount() {
return dataArrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder{
TextView name_show_doctors,title_show_doctors,phone_show_doctors,email_show_doctors;
public ViewHolder(@NonNull View itemView) {
super(itemView);
name_show_doctors = itemView.findViewById(R.id.title_show_doctors);
title_show_doctors = itemView.findViewById(R.id.title_show_doctors);
phone_show_doctors = itemView.findViewById(R.id.phone_show_doctors);
email_show_doctors = itemView.findViewById(R.id.email_show_doctors);
}
}
}
package com.project.skidn_disease_app;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class ShowDoctorViewHolder extends RecyclerView.ViewHolder {
private TextView name_show_doctors,title_show_doctors,phone_show_doctors,email_show_doctors;
public ShowDoctorViewHolder(@NonNull View itemView) {
super(itemView);
name_show_doctors = itemView.findViewById(R.id.title_show_doctors);
title_show_doctors = itemView.findViewById(R.id.title_show_doctors);
phone_show_doctors = itemView.findViewById(R.id.phone_show_doctors);
email_show_doctors = itemView.findViewById(R.id.email_show_doctors);
}
public TextView getTitle_show_doctors() {
return title_show_doctors;
}
public TextView getPhone_show_doctors() {
return phone_show_doctors;
}
public TextView getEmail_show_doctors() {
return email_show_doctors;
}
public TextView getName_show_doctors(){
return name_show_doctors;
}
}
\ No newline at end of file
package com.project.skidn_disease_app;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Patterns;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class SingIn extends AppCompatActivity {
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
public class SingIn extends AppCompatActivity {
EditText email,password;
TextView forget,signin;
SharedPreferences settings;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAuth = FirebaseAuth.getInstance();
settings = PreferenceManager.getDefaultSharedPreferences(this);
setContentView(R.layout.activity_sing_in);
this.setTitle("Duty Calling");
email = findViewById(R.id.email_singin_et);
password = findViewById(R.id.pw_singin_et);
forget = findViewById(R.id.forgot_password_singin);
signin = findViewById(R.id.Wanna_join_click_singin_et);
Toast.makeText(this,"Hi",Toast.LENGTH_LONG).show();
}
public void singUp_signin(View view) {
Intent intent = new Intent(this,Singup.class);
startActivity(intent);
}
public void forget_sigin(View view) {
Intent intent = new Intent(this,Singup.class);
startActivity(intent);
}
public void siginActivity(View view) {
String email_text = email.getText().toString().trim();
String password_text =password.getText().toString().trim();
if(password_text.isEmpty()){
password.setError("Password Can't be empthy");
password.requestFocus();
return;
}
if(email_text.isEmpty()){
email.setError("Email Address needed");
email.requestFocus();
return;
}
if(!Patterns.EMAIL_ADDRESS.matcher(email_text).matches()){
email.setError("Please Provide Vaild Email");
email.requestFocus();
return;
}
System.out.println("---------");
System.out.println(email_text);
System.out.println(password_text);
System.out.println(FirebaseAuth.getInstance().getCurrentUser().getUid());
String userId = FirebaseAuth.getInstance().getCurrentUser().getUid();
System.out.println("-----------");
mAuth.signInWithEmailAndPassword(email_text,password_text).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(SingIn.this,"Sign in Successful",Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = settings.edit();
editor.putString("userid", FirebaseAuth.getInstance().getCurrentUser().getUid().toString());
System.out.println(FirebaseAuth.getInstance().getCurrentUser().getUid().toString());
editor.commit();
System.out.println("singed innnnnnnnnnnn");
Intent i = new Intent(SingIn.this, DutyCalling.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}else{
Toast.makeText(SingIn.this,"Sign in Unsuccessful",Toast.LENGTH_LONG).show();
}
}
});
}
}
\ No newline at end of file
package com.project.skidn_disease_app;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Patterns;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
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.Volley;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.FirebaseDatabase;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Singup extends AppCompatActivity {
private FirebaseAuth mAuth;
EditText email,password,cpassword,name;
public static final String MyPREFERENCES = "MyPrefs" ;
SharedPreferences settings;
TextView forget,signin;
private SharedPreferences sharedPref;
// FirebaseAuth auth = FirebaseAuth.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
settings = PreferenceManager.getDefaultSharedPreferences(this);
setContentView(R.layout.activity_singup);
this.setTitle("Onboarding");
email = findViewById(R.id.Email_singup_et);
password = findViewById(R.id.pw_sign_up);
cpassword = findViewById(R.id.cpw_sign_up);
name = findViewById(R.id.name_singup);
forget = findViewById(R.id.forgot_password_signup);
signin = findViewById(R.id.Have_an_account_click);
mAuth = FirebaseAuth.getInstance();
Toast.makeText(this,"Hi",Toast.LENGTH_LONG).show();
}
@Override
protected void onStart() {
super.onStart();
// Check if user is signed in (non-null) and update UI accordingly.
// FirebaseUser currentUser = mAuth.getCurrentUser();
}
public void singUp_singin(View view) {
Intent intent = new Intent(this,SingIn.class);
startActivity(intent);
}
public void forget_singup(View view) {
Intent intent = new Intent(this,SingIn.class);
startActivity(intent);
}
public void justafunction(String id,String name,String email,String permitNo,String phone,String address,int Data[],final VolleyCallBack callBack) throws JSONException {
// String url ="https://projects.vishnusivadas.com/testing/write.php";
final String url = "https://i0qh9h.deta.dev/api/doctor";
JSONArray jsonArray = new JSONArray();
Map<String, Object> postParam= new HashMap<>();
postParam.put("id", "getList");
postParam.put("title", "10.0086575");
postParam.put("name", "getList");
postParam.put("phone", "getList");
postParam.put("email", "getList");
postParam.put("permitNo", "getList");
postParam.put("address", "getList");
postParam.put("availability",jsonArray.toString() );
String quary = "{\n \"id\": \""+id+"\",\n \"title\": \""+"Dr "+"\",\n \"name\": \""+name+"\",\n \"phone\": \"\",\n \"email\": \""+email+"\",\n \"permitNo\": \"\",\n \"address\": \"\",\n \"availability\": [\n]\n}";
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));
callBack.onSuccess();
} 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);
queue.add(req);
}
public void singup_click(View view) {
String email_text = email.getText().toString().trim();
String name_text = name.getText().toString().trim();
String password_text = password.getText().toString().trim();
String cpassword_text = cpassword.getText().toString().trim();
String emaill_text = email.getText().toString().trim();
System.out.println(email_text);
if(emaill_text.isEmpty()){
email.setError("Email Address needed");
email.requestFocus();
return;
}
if(name_text.isEmpty()){
name.setError("Vaild Name needed");
name.requestFocus();
return;
}
if(password_text.isEmpty()){
password.setError("Password Can't be empthy");
password.requestFocus();
return;
}
if(cpassword_text.isEmpty()){
cpassword.setError("Password Can't be empthy");
cpassword.requestFocus();
return;
}else{
if(!cpassword_text.equals(password_text)){
cpassword.setError("Password Should Match");
password.setError("Password Should Match");
cpassword.requestFocus();
return;
}
}
if(!Patterns.EMAIL_ADDRESS.matcher(email_text).matches()){
email.setError("Please Provide Vaild Email");
email.requestFocus();
return;
}
mAuth.createUserWithEmailAndPassword(email_text,password_text).addOnCompleteListener(task -> {
if(task.isSuccessful()){
Doctor doctor = new Doctor(name_text,email_text);
FirebaseDatabase.getInstance().getReference("Doctors")
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.setValue(doctor).addOnCompleteListener(task1 -> {
if(task1.isSuccessful()){
SharedPreferences.Editor editor = settings.edit();
editor.putString("userid", FirebaseAuth.getInstance().getCurrentUser().getUid());
editor.commit();
System.out.println(FirebaseAuth.getInstance().getCurrentUser().getUid());
int data[] = new int[0];
try {
justafunction(FirebaseAuth.getInstance().getCurrentUser().getUid().toString(),name_text,email_text,"","","",data, () -> {
Toast.makeText(Singup.this,"Doctor is Registered!",Toast.LENGTH_SHORT).show();
Intent i = new Intent(Singup.this, DutyCalling.class);
startActivity(i);
// this is where you will call the geofire, here you have the response from the volley.
});
} catch (JSONException e) {
e.printStackTrace();
}
}else{
Toast.makeText(Singup.this,"Doctor is Not 1Registered!",Toast.LENGTH_SHORT).show();
}
});
}else{
Toast.makeText(Singup.this,"Doctor is Not Registered!",Toast.LENGTH_SHORT).show();
}
});
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@android:color/white" />
<stroke android:width="1dip" android:color="#000000"/>
<padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".DutyCalling">
<TextView
android:id="@+id/onDuty_name_tv"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Name" />
<EditText
android:id="@+id/onDuty_name_et"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="Name"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
<TextView
android:id="@+id/onDuty_address_tv"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Address" />
<EditText
android:id="@+id/onDuty_address_et"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="Address"
android:background="@drawable/textview_border"
android:inputType="textPostalAddress"
android:minHeight="48dp" />
<TextView
android:id="@+id/onDuty_ph_tv"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Phone Number" />
<EditText
android:id="@+id/onDuty_ph_et"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="Phone Number"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textPhonetic"
android:minHeight="48dp" />
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="30dp"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/monday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Monday" />
<TextView
android:id="@+id/tuesday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Tuesday" />
<TextView
android:id="@+id/wensday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Wensday" />
<TextView
android:id="@+id/thursday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Thursday" />
<TextView
android:id="@+id/Friday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Friday" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/monday_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:hint="Availablity"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
<EditText
android:id="@+id/tuesday_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="Availablity"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
<EditText
android:id="@+id/wensday_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="Availablity"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
<EditText
android:id="@+id/thursday_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="Availablity"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
<EditText
android:id="@+id/friday_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:hint="Availablity"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/button5"
android:layout_marginTop="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:onClick="ondutyUpdatenew"
android:text="Update" />
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
android:orientation="vertical"
tools:context=".SingIn">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<TextView
android:id="@+id/Email_signin_tv"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Email" />
<EditText
android:id="@+id/email_singin_et"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textEmailAddress"
android:minHeight="48dp" />
<TextView
android:id="@+id/pw_singin_tv"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="Password"
android:paddingTop="15dp"
android:paddingBottom="5dp" />
<EditText
android:id="@+id/pw_singin_et"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textPassword"
android:minHeight="48dp"
android:paddingLeft="25dp"
android:paddingRight="25dp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="siginActivity"
android:layout_marginTop="40dp"
android:text="Sign In" />
<TextView
android:id="@+id/forgot_password_singin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="20dp"
android:onClick="forget_sigin"
android:text="Forgot password?" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/Wanna_join_singin_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="20dp"
android:text="Wanna join?" />
<TextView
android:id="@+id/Wanna_join_click_singin_et"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#F9CC9F"
android:layout_gravity="center"
android:onClick="singUp_signin"
android:paddingTop="20dp"
android:text=" Sign Up" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?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"
android:orientation="vertical"
tools:context=".Singup">
<TextView
android:id="@+id/textView"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:text="Name" />
<EditText
android:id="@+id/name_singup"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textPersonName"
android:minHeight="48dp" />
<TextView
android:id="@+id/android_id_tv_ph"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="Email"
android:paddingTop="15dp"
android:paddingBottom="5dp" />
<EditText
android:id="@+id/Email_singup_et"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textEmailAddress"
android:minHeight="48dp"
android:paddingLeft="25dp"
android:paddingRight="25dp" />
<TextView
android:id="@+id/android_id_tv_pw"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="Password"
android:paddingTop="15dp"
android:paddingBottom="5dp" />
<EditText
android:id="@+id/pw_sign_up"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textPassword"
android:minHeight="48dp"
android:paddingLeft="25dp"
android:paddingRight="25dp" />
<TextView
android:id="@+id/android_id_tv_cpw"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="Confirm Password"
android:paddingTop="15dp"
android:paddingBottom="5dp" />
<EditText
android:id="@+id/cpw_sign_up"
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/textview_border"
android:inputType="textPassword"
android:minHeight="48dp"
android:paddingLeft="25dp"
android:paddingRight="25dp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="singup_click"
android:layout_marginTop="20dp"
android:text="Sign Up" />
<TextView
android:id="@+id/forgot_password_signup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="20dp"
android:onClick="forget_singup"
android:text="Forgot password?" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/Have_an_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="20dp"
android:text="Have an account?" />
<TextView
android:id="@+id/Have_an_account_click"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#F9CC9F"
android:layout_gravity="center"
android:onClick="singUp_singin"
android:paddingTop="20dp"
android:text=" Sign in" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -4,12 +4,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"
android:background="@drawable/background"
android:background="#FCFCFC"
tools:context=".MedcFragment">
<!-- TODO: Update blank fragment layout -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/medec_recyele_view"
android:id="@+id/medecrecyele_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="1dp"
......
<?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="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
app:cardBackgroundColor="#FFF2E6"
android:paddingBottom="5dp"
android:layout_marginBottom="10dp"
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_show_doctors"
android:textSize="14dp"
android:layout_margin="4dp"
android:textAlignment="textStart"
android:textColor="#000000"
android:layout_height="wrap_content"
android:text="some text"/>
<TextView
android:layout_width="match_parent"
android:id="@+id/name_show_doctors"
android:layout_margin="4dp"
android:textSize="14dp"
android:textAlignment="textStart"
android:textColor="#000000"
android:layout_height="wrap_content"
android:text="some text"/>
<TextView
android:layout_width="match_parent"
android:id="@+id/phone_show_doctors"
android:layout_margin="4dp"
android:textSize="14dp"
android:textAlignment="textStart"
android:textColor="#000000"
android:layout_height="wrap_content"
android:text="some text"/>
<TextView
android:layout_width="match_parent"
android:id="@+id/email_show_doctors"
android:layout_margin="4dp"
android:textSize="14dp"
android:textAlignment="textStart"
android:textColor="#000000"
android:layout_height="wrap_content"
android:text="some text"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_title_medec"
android:title="Are you a doctor?"/>
<item
android:id="@+id/action_Duty_medec"
android:title="Duty Calling"/>
<item
android:id="@+id/action_Onboarding_medec"
android:title="Onboarding"/>
</menu>
\ No newline at end of file
......@@ -6,12 +6,9 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.3.10'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
\ 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