diff --git a/app/src/main/java/com/example/nimal/help/Help.java b/app/src/main/java/com/example/nimal/help/Help.java index 29e0105549e215c94e4db5d5ce63b89ee3986331..c24e97c04fa12768af0af4c871e4dff8178053a4 100644 --- a/app/src/main/java/com/example/nimal/help/Help.java +++ b/app/src/main/java/com/example/nimal/help/Help.java @@ -4,7 +4,9 @@ import android.app.ProgressDialog; import android.content.Intent; import android.media.Rating; import android.net.Uri; +import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -40,6 +42,10 @@ public class Help extends AppCompatActivity { DatabaseReference databaseReference; + Snackbar s; + + CoordinatorLayout coordinatorLayout1; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -49,6 +55,7 @@ public class Help extends AppCompatActivity { area = (EditText)findViewById(R.id.Area); show = (TextView)findViewById(R.id.ShowSugg); + coordinatorLayout1 = (CoordinatorLayout)findViewById(R.id.coordinatorLayout); sb = new StringBuffer(); sb1 = new StringBuffer(); @@ -89,7 +96,16 @@ public class Help extends AppCompatActivity { latitude = gps.getLatitude(); longitude = gps.getLongitude(); - Toast.makeText(this, latitude+" , "+longitude, Toast.LENGTH_SHORT).show(); + s = Snackbar.make(coordinatorLayout1,"Latitude : "+latitude+"\nLongitude : "+longitude,Snackbar.LENGTH_LONG) + .setAction("HIDE", new View.OnClickListener() { + @Override + public void onClick(View v) { + s.dismiss(); + } + }); + //Toast.makeText(this, latitude+" , "+longitude, Toast.LENGTH_SHORT).show(); + s.show(); + } else { diff --git a/app/src/main/java/com/example/nimal/help/Login1.java b/app/src/main/java/com/example/nimal/help/Login1.java index ef7bf09d3454130fcd0cec9512e764522ff52d24..64f39fff3299370b43042752c0860512f7a92056 100644 --- a/app/src/main/java/com/example/nimal/help/Login1.java +++ b/app/src/main/java/com/example/nimal/help/Login1.java @@ -1,8 +1,10 @@ package com.example.nimal.help; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.DisplayMetrics; @@ -25,6 +27,9 @@ public class Login1 extends AppCompatActivity { SharedPreferences sharedPreferences; + TextView contact,add,remove,view,update,location; + ImageView contact1,add1,remove1,view1,update1,location1; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -43,6 +48,22 @@ public class Login1 extends AppCompatActivity { TextView txt = (TextView) findViewById(R.id.TextView1); txt.setText("Welcome "+sharedPreferences.getString("Email",null).toString()+" !!!"); + + + contact = (TextView)findViewById(R.id.textView); + add = (TextView)findViewById(R.id.textView1); + remove = (TextView)findViewById(R.id.textView2); + view = (TextView)findViewById(R.id.textView3); + update = (TextView)findViewById(R.id.textView4); + location = (TextView)findViewById(R.id.textView5); + + contact1 = (ImageView)findViewById(R.id.imageView); + add1 = (ImageView)findViewById(R.id.imageView2); + remove1 = (ImageView)findViewById(R.id.imageView3); + view1 = (ImageView)findViewById(R.id.imageView4); + update1 = (ImageView)findViewById(R.id.imageView5); + location1 = (ImageView)findViewById(R.id.imageView6); + /* GridView gridView = (GridView) findViewById(R.id.GridView2); gridView.setAdapter(new Login1.ImageAdapter(this)); @@ -126,4 +147,96 @@ public class Login1 extends AppCompatActivity { R.drawable.images8 };*/ } +/* + @Override + public void onClick(View v) { + + if (v == contact||v == contact1) + { + Intent j = new Intent(Login1.this, AddUser.class); + startActivity(j); + } + else if(v == add || v== add1) + { + Intent j = new Intent(Login1.this, Add_Hosp.class); + startActivity(j); + } + else if(v == remove || v== remove1) + { + Intent j = new Intent(Login1.this, Remove_Hosp.class); + startActivity(j); + } + else if(v == view || v== view1) + { + Intent j = new Intent(Login1.this, View_Hosp.class); + startActivity(j); + } + else if(v == update || v== update) + { + Intent j = new Intent(Login1.this, Edit_Hosp.class); + startActivity(j); + } + else if(v == location || v== location1) + { + Intent j = new Intent(Login1.this, Location.class); + startActivity(j); + } + else + { + Toast.makeText(this, "Please click either on the image or button", Toast.LENGTH_SHORT).show(); + } + + } + */ + + public void addc(View view) + { + Intent j = new Intent(Login1.this, AddUser.class); + startActivity(j); + } + public void addh(View view) + { + Intent j = new Intent(Login1.this, Add_Hosp.class); + startActivity(j); + } + public void removeh(View view) + { + Intent j = new Intent(Login1.this, Remove_Hosp.class); + startActivity(j); + } + public void viewh(View view) + { + Intent j = new Intent(Login1.this, View_Hosp.class); + startActivity(j); + } + public void edith(View view) + { + Intent j = new Intent(Login1.this, Edit_Hosp.class); + startActivity(j); + } + public void locationh(View view) + { + Intent j = new Intent(Login1.this, Location.class); + startActivity(j); + } + public void signout(View view) + { + AlertDialog.Builder ab = new AlertDialog.Builder(this); + ab.setMessage("Willing to log out?"); + ab.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + firebaseAuth.signOut(); + Intent i = new Intent(Login1.this,MainActivity.class); + startActivity(i); + } + }); + ab.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //do nothing + } + }); + ab.show(); + } } diff --git a/app/src/main/res/layout/activity_help.xml b/app/src/main/res/layout/activity_help.xml index e7f75513eccba31dfc0fd48fb81c96cddf00bc36..55ddafafeb206264ac6e83e1d43bc2ff076263af 100644 --- a/app/src/main/res/layout/activity_help.xml +++ b/app/src/main/res/layout/activity_help.xml @@ -44,6 +44,7 @@ </LinearLayout> + <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> @@ -51,8 +52,10 @@ <ScrollView android:id="@+id/scrollView2" android:layout_width="300dp" - android:layout_height="350dp" + android:layout_height="325dp" + android:layout_above="@+id/floatingActionButton" android:layout_alignParentStart="true" + android:layout_alignParentTop="true" android:layout_toStartOf="@+id/floatingActionButton"> <TextView @@ -69,8 +72,8 @@ android:id="@+id/floatingActionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_alignParentBottom="true" android:layout_alignParentEnd="true" - android:layout_below="@+id/scrollView2" android:layout_gravity="end" android:clickable="true" android:onClick="newing" @@ -84,9 +87,9 @@ android:layout_alignParentEnd="true" android:layout_marginBottom="15dp" android:clickable="true" - app:fabSize="mini" android:onClick="call" android:visibility="invisible" + app:fabSize="mini" app:srcCompat="@android:drawable/stat_sys_phone_call_forward" /> <android.support.design.widget.FloatingActionButton @@ -96,13 +99,25 @@ android:layout_above="@+id/floatingActionButton2" android:layout_alignStart="@+id/floatingActionButton2" android:layout_marginBottom="12dp" - android:onClick="messaging" android:clickable="true" - app:fabSize="mini" + android:onClick="messaging" android:visibility="invisible" + app:fabSize="mini" app:srcCompat="@android:drawable/stat_notify_chat" /> + <android.support.design.widget.CoordinatorLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_alignParentStart="true" + android:id="@+id/coordinatorLayout" + android:layout_toStartOf="@+id/floatingActionButton" + android:layout_alignParentTop="true"> + + </android.support.design.widget.CoordinatorLayout> + </RelativeLayout> + + </LinearLayout> diff --git a/app/src/main/res/layout/activity_login1.xml b/app/src/main/res/layout/activity_login1.xml index ff022c18ab1e487c06bbd6ca3e9cc01fcf04b1dc..10d1d3475b0a409fc97cecf0e7bc671edbfe75a6 100644 --- a/app/src/main/res/layout/activity_login1.xml +++ b/app/src/main/res/layout/activity_login1.xml @@ -9,41 +9,51 @@ tools:context="com.example.nimal.help.Login1"> <TextView - android:layout_width="match_parent" - android:layout_height="25dp" - android:textSize="20dp" android:id="@+id/TextView1" + android:layout_width="match_parent" + android:layout_height="30dp" android:gravity="right" - android:textStyle="bold"/> + android:textSize="20dp" + android:textStyle="bold" /> <ImageView android:layout_width="50dp" android:layout_height="30dp" - android:layout_marginTop="50dp" + android:layout_marginTop="29dp" android:src="@drawable/images4" android:layout_marginLeft="70dp" - android:id="@+id/imageView" /> + android:id="@+id/imageView" + android:clickable="true" + android:onClick="edith" + android:layout_marginStart="66dp" + android:layout_below="@+id/TextView1" + android:layout_alignParentStart="true" /> <TextView android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="25dp" android:text="Add User" + android:onClick="addc" android:textSize="25dp" android:textStyle="bold" - android:layout_marginTop="3dp" - android:layout_alignTop="@+id/imageView" - android:layout_toEndOf="@+id/imageView" /> + android:clickable="true" + android:layout_alignParentEnd="true" + android:layout_toEndOf="@+id/imageView" + android:layout_alignBottom="@+id/imageView" + android:layout_alignTop="@+id/imageView" /> <ImageView android:layout_width="50dp" android:layout_height="40dp" android:layout_marginLeft="55dp" - android:src="@drawable/images5" + android:src="@drawable/images7" android:id="@+id/imageView2" - android:layout_alignTop="@+id/textView1" - android:layout_toStartOf="@+id/textView1" /> + android:onClick="viewh" + android:clickable="true" + android:layout_alignBottom="@+id/textView3" + android:layout_toStartOf="@+id/textView3" /> <TextView android:id="@+id/textView1" @@ -51,37 +61,47 @@ android:layout_height="wrap_content" android:textSize="25dp" android:text="Add Hospital" - android:layout_marginTop="60dp" + android:layout_marginTop="45dp" android:textStyle="bold" - android:layout_alignTop="@+id/imageView" + android:onClick="addh" + android:clickable="true" + android:layout_below="@+id/textView" + android:layout_alignParentEnd="true" android:layout_toEndOf="@+id/imageView" /> <ImageView android:layout_width="50dp" android:layout_height="40dp" android:layout_marginLeft="40dp" - android:src="@drawable/image6" + android:src="@drawable/images5" android:id="@+id/imageView5" - android:layout_alignTop="@+id/textView2" - android:layout_toStartOf="@+id/textView2" /> + android:clickable="true" + android:onClick="addh" + android:layout_above="@+id/textView2" + android:layout_toStartOf="@+id/textView1" /> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="25dp" + android:onClick="removeh" android:text="Remove Hospital" - android:layout_marginTop="110dp" + android:layout_marginTop="35dp" android:textStyle="bold" - android:layout_alignTop="@+id/imageView" - android:layout_toEndOf="@+id/imageView" /> + android:clickable="true" + android:layout_below="@+id/textView1" + android:layout_alignParentEnd="true" + android:layout_toEndOf="@+id/imageView2" /> <ImageView android:layout_width="50dp" android:layout_height="40dp" - android:src="@drawable/images7" + android:src="@drawable/image6" android:id="@+id/imageView4" - android:layout_alignTop="@+id/textView3" - android:layout_alignStart="@+id/imageView2" /> + android:clickable="true" + android:onClick="removeh" + android:layout_alignBottom="@+id/textView2" + android:layout_toStartOf="@+id/textView2" /> <TextView android:id="@+id/textView3" @@ -89,18 +109,24 @@ android:layout_height="wrap_content" android:textSize="25dp" android:text="View Hospital" - android:layout_marginTop="158dp" + android:layout_marginTop="32dp" android:textStyle="bold" - android:layout_alignTop="@+id/imageView" - android:layout_toEndOf="@+id/imageView" /> + android:onClick="viewh" + android:clickable="true" + android:layout_below="@+id/textView2" + android:layout_alignParentEnd="true" + android:layout_toEndOf="@+id/imageView5" /> <ImageView android:layout_width="50dp" android:layout_height="40dp" android:src="@drawable/images9" android:id="@+id/imageView3" - android:layout_alignTop="@+id/textView4" - android:layout_alignStart="@+id/imageView6" /> + android:clickable="true" + android:onClick="edith" + android:layout_below="@+id/imageView2" + android:layout_alignStart="@+id/imageView2" + android:layout_marginTop="28dp" /> <TextView android:id="@+id/textView4" @@ -108,31 +134,47 @@ android:layout_height="wrap_content" android:textSize="25dp" android:text="Update Hospital" - android:layout_marginTop="205dp" + android:clickable="true" android:textStyle="bold" - android:layout_alignTop="@+id/imageView" - android:layout_toEndOf="@+id/imageView" /> + android:onClick="edith" + android:layout_alignBottom="@+id/imageView3" + android:layout_alignParentEnd="true" + android:layout_toEndOf="@+id/imageView3" /> <ImageView android:layout_width="50dp" android:layout_height="40dp" android:src="@drawable/images8" android:id="@+id/imageView6" - android:layout_alignTop="@+id/textView5" - android:layout_alignStart="@+id/imageView2" /> + android:clickable="true" + android:onClick="locationh" + android:layout_alignBottom="@+id/textView5" + android:layout_toStartOf="@+id/textView5" /> <TextView android:id="@+id/textView5" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="25dp" - android:layout_marginTop="250dp" android:text="Location" + android:clickable="true" + android:onClick="locationh" android:textStyle="bold" - android:layout_alignTop="@+id/imageView" - android:layout_toEndOf="@+id/imageView" /> - - + android:layout_below="@+id/textView4" + android:layout_alignParentEnd="true" + android:layout_marginTop="34dp" + android:layout_toEndOf="@+id/imageView3" /> + <TextView + android:id="@+id/textView6" + android:layout_width="150dp" + android:layout_height="30dp" + android:text="Sign Out" + android:textStyle="bold" + android:gravity="center" + android:clickable="true" + android:onClick="signout" + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" /> </RelativeLayout>