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

iCommit #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

iCommit #1

wants to merge 1 commit into from

Conversation

adhi124
Copy link

@adhi124 adhi124 commented Mar 3, 2017

pls


public void onClick(View v)
{
switch(v.getId())
Copy link
Contributor

@aneeshj4 aneeshj4 Mar 15, 2017

Choose a reason for hiding this comment

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

For each case in the switch statement, instead of having long blocks of code, you could put functions instead. For example, you could have createNewEventClicked(), imageClicked(), etc. This makes the switch easier to read and modularizes the code. Try to do this in all cases where there are switch statements.

String desc = newDescText.getText().toString();
String host = mAuth.getCurrentUser().getEmail();

FirebaseUtils.writeEventToDB(mDatabase, riversRef, eventimageuri, key, name, date, desc, host, mAuth);
Copy link
Contributor

@aneeshj4 aneeshj4 Mar 15, 2017

Choose a reason for hiding this comment

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

Good use of utils

dialog.dismiss();
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, 1); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing startActivityForResult(intent, 1), put 1 in a public static final variable. For example, you could do:
public static final int CHOOSE_PHOTO_REQUEST = 1. That way, in onActivityResult in the bottom, when you check whether requestCode == 1, you know what it is actually checking for (instead you would check requestCode == CHOOSE_PHOTO_REQUEST).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants