Skip to content
Snippets Groups Projects
Commit 32c37d3c authored by Niharika K's avatar Niharika K
Browse files

user area

parent 4a5d61d1
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@ public class ProfileActivity extends AppCompatActivity {
public void save(View view)
{
EditText age = (EditText)findViewById(R.id.age);
/*EditText age = (EditText)findViewById(R.id.age);
RadioGroup gender =(RadioGroup)findViewById(R.id.gender);
EditText phone = (EditText)findViewById(R.id.phone);
RadioButton selectedRadioButton;
......@@ -53,7 +53,9 @@ public class ProfileActivity extends AppCompatActivity {
user = firebaseAuth.getCurrentUser();
databaseReference.child("Profile").child(user.getUid()).child("Age").setValue(a);
databaseReference.child("Profile").child(user.getUid()).child("Gender").setValue(g);
databaseReference.child("Profile").child(user.getUid()).child("Phone").setValue(p);
DatabaseReference databaseReference2=FirebaseDatabase.getInstance().getReference().child("Profile").child(user.getUid()).child("Gender");
databaseReference2.setValue(g);
DatabaseReference databaseReference3=FirebaseDatabase.getInstance().getReference().child("Profile").child(user.getUid()).child("Phone");
databaseReference3.setValue(p);*/
}
}
......@@ -30,7 +30,7 @@ public class RegisterActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
databaseReference= FirebaseDatabase.getInstance().getReference().child("Profile");
databaseReference= FirebaseDatabase.getInstance().getReference();
final EditText user = (EditText)findViewById(R.id.user);
......
......@@ -2,6 +2,7 @@ package com.example.chan24.smartplanner;
import android.app.Dialog;
import android.content.Intent;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
......@@ -16,9 +17,18 @@ import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class UserArea extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mToggle;
NavigationView navigationView;
......@@ -27,17 +37,14 @@ public class UserArea extends AppCompatActivity {
//TextView v;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_area);
if (googleServicesAvailable()){
//Toast.makeText(this,"Perfect",Toast.LENGTH_SHORT).show();
}
Intent i =getIntent();
s = i.getStringExtra("name");
// v =(TextView)findViewById(R.id.textView2);
//v.setText("Welcome "+s);
mDrawerLayout = (DrawerLayout)findViewById(R.id.activity_user_area);
mToggle = new ActionBarDrawerToggle(this,mDrawerLayout,R.string.open,R.string.close);
......@@ -46,6 +53,26 @@ public class UserArea extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
FirebaseAuth fa = FirebaseAuth.getInstance();
FirebaseUser fu = fa.getCurrentUser();
DatabaseReference dr =FirebaseDatabase.getInstance().getReference().child("Profile").child(fu.getUid()).child("Username");
dr.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
s=dataSnapshot.getValue().toString();
//Toast.makeText(getApplicationContext(),s,Toast.LENGTH_SHORT).show();
TextView t=(TextView)findViewById(R.id.textView2);
t.setText("Welcome "+s);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
navigationView = (NavigationView)findViewById(R.id.navigation_view);
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
......
......@@ -16,12 +16,25 @@
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="50dp" />
android:text=""
android:textColor="@color/wallet_holo_blue_light"
android:textSize="35dp"
android:textAlignment="center"
android:layout_height="80dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="35dp"
android:text="What do you want to do?"
android:textColor="@color/colorPrimaryDark"
android:textSize="25dp"
android:layout_marginTop="10dp"
/>
<CheckBox
android:id="@+id/shopping"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Shopping" />
<CheckBox
......@@ -36,10 +49,28 @@
android:layout_height="wrap_content"
android:text="Dining" />
<TextView
android:layout_width="match_parent"
android:layout_height="35dp"
android:text="How far can you go?"
android:textSize="25dp"
android:textColor="@color/colorPrimary"
android:layout_marginTop="30dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="20dp"
android:inputType="number"
android:hint="Distance in km"
/>
<Button
android:id="@+id/save"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="135dp"
android:layout_marginTop="70dp"
android:text="Save" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment