Skip to content
This repository has been archived by the owner on Apr 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8 from nbd9/unstable
Browse files Browse the repository at this point in the history
Unstable
  • Loading branch information
nickthegroot authored Mar 31, 2017
2 parents 2b49f2b + 831e1e1 commit 8126ed8
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .idea/libraries/easypermissions_0_2_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/espresso_core_2_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/espresso_idling_resource_2_2_2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/exposed_instrumentation_api_publish_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/fabric_1_3_14.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/rules_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/runner_0_5.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/tweet_composer_2_3_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/tweet_ui_2_3_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/twitter_2_3_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/libraries/twitter_core_2_3_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "v0.5.0"
versionName "v0.5.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true

Expand Down
10 changes: 9 additions & 1 deletion app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@
},
"oauth_client": [
{
"client_id": "1084759978628-qrur4ekn6orqvsnfj0l7aigdcts1lg7s.apps.googleusercontent.com",
"client_id": "1084759978628-qu0fcoads4anhekqgvqkifo8sd368j9g.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.nbdeg.unityplanner",
"certificate_hash": "277f623468bfd04cf46a455fa4f6350f58a2a471"
}
},
{
"client_id": "1084759978628-eniqmdpr4a7ud6vdgdq8m2d3p5hm6nc1.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.nbdeg.unityplanner",
"certificate_hash": "f48ae2ad54a85455f04b8af3d9bef4d1f2c86cd6"
}
},
{
"client_id": "1084759978628-je98io85qo41ca7a1isl0829keu8b914.apps.googleusercontent.com",
"client_type": 3
Expand Down
64 changes: 23 additions & 41 deletions app/src/main/java/com/nbdeg/unityplanner/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
Expand All @@ -30,7 +29,7 @@
import com.squareup.picasso.Picasso;

@SuppressWarnings({"CanBeFinal", "MismatchedQueryAndUpdateOfCollection"})
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, classFragment.OnFragmentInteractionListener, homeScreen.OnFragmentInteractionListener{
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {

private Database db = new Database();

Expand Down Expand Up @@ -90,10 +89,6 @@ public void onError() {
});

if (findViewById(R.id.fragment_container) != null) {

// However, if we're being restored from a previous state,
// then we don't need to do anything and should return or else
// we could end up with overlapping fragments.
if (savedInstanceState != null) {
return;
}
Expand Down Expand Up @@ -124,7 +119,10 @@ public void onBackPressed() {
}
}

@SuppressWarnings("StatementWithEmptyBody")
/**
* Changes fragment based on user selected choice from Navigation Bar.
* @param item ID of selected item
*/
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
Expand All @@ -134,34 +132,22 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
assignmentFragment newFragment = new assignmentFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack so the user can navigate back
transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(null);

// Commit the transaction
transaction.commit();
} else if (id == R.id.nav_classes) {
classFragment newFragment = new classFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack so the user can navigate back
transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(null);

// Commit the transaction
transaction.commit();
} else if (id == R.id.nav_home) {
homeScreen newFragment = new homeScreen();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack so the user can navigate back
transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(null);

// Commit the transaction
transaction.commit();
}

Expand All @@ -170,33 +156,29 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
return true;
}

/**
* Adds functions to three dot menu on Main Screens
* @param item ID of the selected item
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

switch (id) {
case R.id.action_settings:
return true;
case R.id.action_logout:
AuthUI.getInstance()
.signOut(this)
.addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(@NonNull Task<Void> task) {
// user is now signed out
startActivity(new Intent(MainActivity.this, loginActivity.class));
finish();
}
});
case R.id.action_tutorial:
startActivity(new Intent(MainActivity.this, IntroActivity.class));
if (id == R.id.action_logout) {
AuthUI.getInstance()
.signOut(this)
.addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(@NonNull Task<Void> task) {
// user is now signed out
startActivity(new Intent(MainActivity.this, loginActivity.class));
finish();
}
});
} else if (id == R.id.action_settings) {
return true;
} else if (id == R.id.action_tutorial) {
startActivity(new Intent(MainActivity.this, IntroActivity.class));
}
return super.onOptionsItemSelected(item);
}

@Override
public void onFragmentInteraction(Uri uri) {
}
}
15 changes: 1 addition & 14 deletions app/src/main/java/com/nbdeg/unityplanner/classFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
Expand All @@ -19,7 +18,6 @@

public class classFragment extends Fragment {

private OnFragmentInteractionListener mListener;
private FirebaseRecyclerAdapter mAdapter;

public classFragment() {
Expand All @@ -39,7 +37,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,

// Gets Firebase Information
Database db = new Database();
DatabaseReference classDb = db.classDb;
DatabaseReference classDb = Database.classDb;

// Displaying Data
RecyclerView classesView = (RecyclerView) view.findViewById(R.id.class_list);
Expand Down Expand Up @@ -67,22 +65,11 @@ public void onClick(View view) {
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}

@Override
public void onDetach() {
super.onDetach();
mAdapter.cleanup();
mListener = null;
}

public interface OnFragmentInteractionListener {
void onFragmentInteraction(Uri uri);
}
}
21 changes: 0 additions & 21 deletions app/src/main/java/com/nbdeg/unityplanner/homeScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
Expand All @@ -18,7 +17,6 @@
import com.nbdeg.unityplanner.utils.Database;

public class homeScreen extends Fragment {
private OnFragmentInteractionListener mListener;
private FirebaseRecyclerAdapter mAdapter;

TextView haveAssignmentsDueView;
Expand Down Expand Up @@ -70,33 +68,14 @@ public void onClick(View view) {
return view;
}

// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}

@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}

@Override
public void onDetach() {
super.onDetach();
mAdapter.cleanup();
mListener = null;
}

public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
Loading

0 comments on commit 8126ed8

Please sign in to comment.