Skip to content
Snippets Groups Projects
Commit f6928b2b authored by melvinabraham's avatar melvinabraham
Browse files

Reverted and added name field

parent e23282c2
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import android.support.annotation.IdRes;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
......@@ -28,7 +29,7 @@ public class MainActivity extends AppCompatActivity {
FragmentManager fragmentManager;
FragmentTransaction fragmentTransaction;
FirebaseAuth firebaseAuth;
EditText getname;
int flag = 0;
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference("message");
......@@ -50,6 +51,7 @@ public class MainActivity extends AppCompatActivity {
mDatabase.child(userId).setValue(user);
*/
getname = RegisterActivity.name;
mDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
......@@ -79,7 +81,7 @@ public class MainActivity extends AppCompatActivity {
if(flag == 0) {
userId = mDatabase.push().getKey();
User user = new User(data);
User user = new User(data,getname.getText().toString());
mDatabase.child(userId).setValue(user);
Log.e("E","new");
}
......
......@@ -20,6 +20,7 @@ import com.google.firebase.auth.FirebaseAuth;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{
static EditText name;
EditText email;
EditText password;
Button b;
......@@ -84,7 +85,7 @@ public class RegisterActivity extends AppCompatActivity implements View.OnClickL
progress.setMessage("Registering"); // Progress Bar
progress.show();
name = (EditText) findViewById(R.id.etName);
try {
firebaseAuth.createUserWithEmailAndPassword(mail, pass) // Create New Entry
......
......@@ -6,7 +6,7 @@ package com.mapps.seproject;
public class User {
public String name;
public String email;
......@@ -16,9 +16,10 @@ public class User {
}
public User(String email) {
public User(String email,String name) {
this.email = email;
this.name = name;
}
......
......@@ -37,8 +37,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bRegister"
android:layout_marginTop="28dp"
android:layout_below="@+id/etRegPassword"
android:layout_marginTop="53dp"
android:layout_below="@+id/etName"
android:layout_alignParentStart="true" />
<TextView
......@@ -46,9 +46,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvHaveAccountReg"
android:layout_marginTop="32dp"
android:layout_below="@+id/bRegister"
android:layout_centerHorizontal="true"
android:layout_marginTop="51dp" />
android:layout_centerHorizontal="true" />
<TextView
android:text="Sign In"
......@@ -61,5 +61,17 @@
android:layout_alignTop="@+id/tvHaveAccountReg"
android:layout_centerHorizontal="true" />
<EditText
android:id="@+id/etName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/etRegPassword"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName" />
</RelativeLayout>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment