Skip to content

Commit

Permalink
* removed get classes test
Browse files Browse the repository at this point in the history
* commented out google sign in test

* added/fixed title bar for AddClasses, CreateGroup, and ProfileActivity

* added mUser check for getClasses() in CreateGroup

* made add classes button function in navigation menu

* removed references to old 'classes' field on ProfileActivity. Current doesn't display/update anything related to classes

* added empty school, major, and year values in SetUpAccount. Now you can actually view your profile and update it after you create it.
  • Loading branch information
Amuff1n committed Mar 28, 2018
1 parent 7b79700 commit 49630da
Show file tree
Hide file tree
Showing 9 changed files with 924 additions and 535 deletions.
1,419 changes: 899 additions & 520 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Expand Up @@ -57,9 +57,4 @@ public void run() {
}
});
}

@Test
public void testGetClasses() throws Exception {
}

}
Expand Up @@ -69,6 +69,8 @@ public void run() {
mAuth.signOut();
}

//Should we still have google sign-in?
/*
@Test
public void testOnClickSignInGoogle() throws Exception {
mSignInGoogle.performClick();
Expand All @@ -78,5 +80,5 @@ public void testOnClickSignInGoogle() throws Exception {
assertNotNull(mAuth.getCurrentUser());
mAuth.signOut();
}

*/
}
7 changes: 3 additions & 4 deletions app/src/main/AndroidManifest.xml
Expand Up @@ -30,13 +30,12 @@
<activity
android:name=".ProfileActivity"
android:label="@string/title_activity_profile"
android:theme="@style/AppTheme.NoActionBar"
android:theme="@style/AppTheme"
android:parentActivityName=".Home" />
<activity android:name=".CreateGroup"
android:theme="@style/AppTheme.NoActionBar"/>
android:theme="@style/AppTheme"/>
<activity android:name=".AddClasses"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".EditClasses"></activity>
android:theme="@style/AppTheme" />
</application>

</manifest>
3 changes: 3 additions & 0 deletions app/src/main/java/com/studybuddy/studybuddy/AddClasses.java
Expand Up @@ -40,6 +40,9 @@ public class AddClasses extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_classes);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

mUser = FirebaseAuth.getInstance().getCurrentUser();
mFireStore = FirebaseFirestore.getInstance();
done = (Button) findViewById(R.id.classesAdded);
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/com/studybuddy/studybuddy/CreateGroup.java
Expand Up @@ -13,6 +13,7 @@
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.Toolbar;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
Expand Down Expand Up @@ -47,6 +48,9 @@ public class CreateGroup extends AppCompatActivity implements AdapterView.OnItem
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_group);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

mAuth = FirebaseAuth.getInstance();
mUser = FirebaseAuth.getInstance().getCurrentUser();
mFirestore = FirebaseFirestore.getInstance();
Expand All @@ -59,8 +63,9 @@ protected void onCreate(Bundle savedInstanceState) {
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.locations_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Drop down list for classes
//TODO this messes up CreateGroupTest, mUser null
//getClasses();
if (mUser != null) {
getClasses();
}

mLocation.setAdapter(adapter);
mLocation.setOnItemSelectedListener(this);
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/studybuddy/studybuddy/Home.java
Expand Up @@ -91,6 +91,11 @@ else if (id == R.id.nav_account) {
return true;
}

else if (id == R.id.nav_add_classe) {
startActivity(new Intent(getApplicationContext(), AddClasses.class));
return true;
}

DrawerLayout drawer = findViewById(R.id.drawerLayout);
drawer.closeDrawer(GravityCompat.START);
return true;
Expand Down
Expand Up @@ -46,6 +46,7 @@ public class ProfileActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);


Expand Down Expand Up @@ -112,8 +113,6 @@ public void onComplete(@NonNull Task<QuerySnapshot> task) {

String year = document.get("year").toString();
mYearTextView.setText(year);

mClassesTextView.setText(document.get("classes").toString());
}
} else {
mNameTextView.setText(R.string.profile_error_databaseread);
Expand All @@ -133,7 +132,6 @@ private void saveProfile() {
user.put("major", mMajorTextView.getText().toString());
user.put("year", mYearTextView.getText().toString());
user.put("school", mSchoolTextView.getText().toString());
user.put("classes", mClassesTextView.getText().toString());

} catch (IllegalArgumentException iae) {
Log.w(TAG, "updateProfileWithEmptyFields", iae);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/studybuddy/studybuddy/SetUpAccount.java
Expand Up @@ -58,6 +58,9 @@ public void onClick(View v) {
userMap.put("firstName", FirstName);
userMap.put("lastName", LastName);
userMap.put("uid", mId.getUid());
userMap.put("", "school");
userMap.put("", "major");
userMap.put("", "year");
mFirestore.collection("users").document(mUser.getUid()).update(userMap).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Expand Down

0 comments on commit 49630da

Please sign in to comment.