Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dependencies {
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.4'

implementation 'com.google.api-client:google-api-client:1.23.0'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
implementation 'com.google.apis:google-api-services-calendar:v3-rev305-1.23.0'

}
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeActivity"></activity>
<activity android:name=".HomeActivity" />
<activity android:name=".TestingPage" />
<activity android:name=".TrainingPage"></activity>
</application>

</manifest>
33 changes: 33 additions & 0 deletions app/src/main/java/coveros/com/trainingapp/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.UserProfileChangeRequest;

public class HomeActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
private TextView welcomeText;
private Button trainingButton;
private Button testingButton;


@Override
Expand All @@ -23,15 +28,43 @@ protected void onCreate(Bundle savedInstanceState) {

Toolbar myToolbar = findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);

trainingButton = findViewById(R.id.trainingButton);
testingButton = findViewById(R.id.testingButton);

mAuth = FirebaseAuth.getInstance();
welcomeText = findViewById(R.id.welcome_text);
FirebaseUser user = mAuth.getCurrentUser();
if(user != null){
String welcome = user.getEmail().toString();
welcomeText.setText("Welcome "+welcome);

//TODO updates display name to provided string if you want to add name fields
// UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
// .setDisplayName("Arya").build();
//
// user.updateProfile(profileUpdates);
// String welcome = user.getDisplayName();
}


trainingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Go to training page
Intent test = new Intent(HomeActivity.this, TrainingPage.class);
startActivity(test);
}
});

testingButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Go to testing page
Intent train = new Intent(HomeActivity.this, TestingPage.class);
startActivity(train);
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.UserProfileChangeRequest;

public class MainActivity extends AppCompatActivity {

Expand Down Expand Up @@ -133,7 +134,6 @@ public void onStart() {

private void updateUI(FirebaseUser currentUser) {
if(currentUser != null){
//TODO
Intent homePage = new Intent(this,HomeActivity.class);
startActivity(homePage);
}
Expand Down
52 changes: 52 additions & 0 deletions app/src/main/java/coveros/com/trainingapp/TestingPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package coveros.com.trainingapp;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.google.firebase.auth.FirebaseAuth;

public class TestingPage extends AppCompatActivity {

private FirebaseAuth mAuth;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_testing_page);

Toolbar myToolbar = findViewById(R.id.my_toolbar2);
setSupportActionBar(myToolbar);

mAuth = FirebaseAuth.getInstance();


}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.signOut:
// User chose the "Settings" item, show the app settings UI...
mAuth.signOut();
Intent signIn = new Intent(this, MainActivity.class);
startActivity(signIn);
finish();
return true;

default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);

}
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.action_items, menu);
return true;
}
}
12 changes: 12 additions & 0 deletions app/src/main/java/coveros/com/trainingapp/TrainingClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package coveros.com.trainingapp;

public class TrainingClass {
private String description;
private String name;
private String location;
private String date; //String or Date object?

public TrainingClass(){

}
}
13 changes: 13 additions & 0 deletions app/src/main/java/coveros/com/trainingapp/TrainingPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package coveros.com.trainingapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class TrainingPage extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_training_page);
}
}
1 change: 1 addition & 0 deletions app/src/main/res/credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"installed":{"client_id":"318510870027-58v56uv4c82c0lmnl88drtj8mo1j9vdr.apps.googleusercontent.com","project_id":"trainingapp-3af3f","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://www.googleapis.com/oauth2/v3/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"o3Gzmfw2MxjfaDaIuUkMbiix","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
4 changes: 4 additions & 0 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="Training"
android:textAllCaps="false"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a way to define all of these properties as a default set, so you don't need to redefine these each time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msaperst i think maybe in the style/themes you can set a style that can be used by all buttons or something if thats what you mean

android:background="@color/coverosPrimary"
app:layout_constraintBottom_toTopOf="@+id/testingButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -60,6 +62,8 @@
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="Testing"
android:textAllCaps="false"
android:background="@color/coverosPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
13 changes: 7 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimaryDark"
android:background="@color/coverosPrimary"
android:hint="@string/hint_account"
android:inputType="textEmailAddress"
android:padding="10dp"
android:singleLine="true"
android:textColor="@color/white"
android:textColorHint="#ffff25e6"
android:textColorHint="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
Expand All @@ -41,13 +41,13 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimaryDark"
android:background="@color/coverosPrimary"
android:hint="@string/hint_password"
android:inputType="textPassword"
android:padding="10dp"
android:singleLine="true"
android:textColor="@color/white"
android:textColorHint="#ffff25e6"
android:textColorHint="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
Expand All @@ -66,8 +66,9 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimaryDark"
android:background="@color/coverosPrimary"
android:text="@string/btn_login"
android:textAllCaps="false"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -87,7 +88,7 @@
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimaryDark"
android:background="@color/coverosPrimary"
android:text="@string/btn_link_to_register"
android:textAllCaps="false"
android:textColor="@color/white"
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/layout/activity_testing_page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:background="@color/white"
tools:context=".TestingPage">

<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar2"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

</android.support.constraint.ConstraintLayout>
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_training_page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".TrainingPage">

</android.support.constraint.ConstraintLayout>
3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
<color name="colorPrimaryDark">#2e0057</color>
<color name="colorAccent">#D81B60</color>
<color name="white">#ffffffff</color>
<color name="coverosPrimary">#276bcf</color>
<color name="hintColorPink">#ffff25e6</color>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong, why 8 chars, not 6?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk, the color showed up, i just used the color scale thing and picked the color which gave me the output.

<color name="grey">#837f82</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<string name="app_name">TrainingApp</string>
<string name="hint_password">Enter Password</string>
<string name="hint_account">Enter Email</string>
<string name="btn_login">Submit</string>
<string name="btn_login">Login</string>
<string name="btn_link_to_register">Register</string>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorPrimary">@color/grey</item>
<item name="colorPrimaryDark">@color/coverosPrimary</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

Expand Down