-
Notifications
You must be signed in to change notification settings - Fork 1.9k
db sample cleanup #545
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
Merged
samtstern
merged 5 commits into
firebase:version-1.2.0-dev
from
SUPERCILEX:sample-cleanup
Jan 31, 2017
Merged
db sample cleanup #545
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
37a57e9
Sample cleanup
SUPERCILEX 1aa27d3
Remove confusing field
SUPERCILEX 7f23522
Cleanup
SUPERCILEX a2e10e7
Merge remote-tracking branch 'firebase/version-1.2.0-dev' into sample…
SUPERCILEX 30aaf80
Merge remote-tracking branch 'firebase/version-1.2.0-dev' into sample…
SUPERCILEX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.firebase.uidemo.database; | ||
|
||
public class Chat { | ||
private String mName; | ||
private String mMessage; | ||
private String mUid; | ||
|
||
public Chat() { | ||
// Needed for Firebase | ||
} | ||
|
||
public Chat(String name, String message, String uid) { | ||
mName = name; | ||
mMessage = message; | ||
mUid = uid; | ||
} | ||
|
||
public String getName() { | ||
return mName; | ||
} | ||
|
||
public void setName(String name) { | ||
mName = name; | ||
} | ||
|
||
public String getMessage() { | ||
return mMessage; | ||
} | ||
|
||
public void setMessage(String message) { | ||
mMessage = message; | ||
} | ||
|
||
public String getUid() { | ||
return mUid; | ||
} | ||
|
||
public void setUid(String uid) { | ||
mUid = uid; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
app/src/main/java/com/firebase/uidemo/database/ChatHolder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.firebase.uidemo.database; | ||
|
||
import android.graphics.PorterDuff; | ||
import android.graphics.drawable.GradientDrawable; | ||
import android.graphics.drawable.RotateDrawable; | ||
import android.support.v4.content.ContextCompat; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.Gravity; | ||
import android.view.View; | ||
import android.widget.FrameLayout; | ||
import android.widget.LinearLayout; | ||
import android.widget.RelativeLayout; | ||
import android.widget.TextView; | ||
|
||
import com.firebase.uidemo.R; | ||
|
||
public class ChatHolder extends RecyclerView.ViewHolder { | ||
private final TextView mNameField; | ||
private final TextView mTextField; | ||
private final FrameLayout mLeftArrow; | ||
private final FrameLayout mRightArrow; | ||
private final RelativeLayout mMessageContainer; | ||
private final LinearLayout mMessage; | ||
private final int mGreen300; | ||
private final int mGray300; | ||
|
||
public ChatHolder(View itemView) { | ||
super(itemView); | ||
mNameField = (TextView) itemView.findViewById(R.id.name_text); | ||
mTextField = (TextView) itemView.findViewById(R.id.message_text); | ||
mLeftArrow = (FrameLayout) itemView.findViewById(R.id.left_arrow); | ||
mRightArrow = (FrameLayout) itemView.findViewById(R.id.right_arrow); | ||
mMessageContainer = (RelativeLayout) itemView.findViewById(R.id.message_container); | ||
mMessage = (LinearLayout) itemView.findViewById(R.id.message); | ||
mGreen300 = ContextCompat.getColor(itemView.getContext(), R.color.material_green_300); | ||
mGray300 = ContextCompat.getColor(itemView.getContext(), R.color.material_gray_300); | ||
} | ||
|
||
public void setIsSender(boolean isSender) { | ||
final int color; | ||
if (isSender) { | ||
color = mGreen300; | ||
mLeftArrow.setVisibility(View.GONE); | ||
mRightArrow.setVisibility(View.VISIBLE); | ||
mMessageContainer.setGravity(Gravity.END); | ||
} else { | ||
color = mGray300; | ||
mLeftArrow.setVisibility(View.VISIBLE); | ||
mRightArrow.setVisibility(View.GONE); | ||
mMessageContainer.setGravity(Gravity.START); | ||
} | ||
|
||
((GradientDrawable) mMessage.getBackground()).setColor(color); | ||
((RotateDrawable) mLeftArrow.getBackground()).getDrawable() | ||
.setColorFilter(color, PorterDuff.Mode.SRC); | ||
((RotateDrawable) mRightArrow.getBackground()).getDrawable() | ||
.setColorFilter(color, PorterDuff.Mode.SRC); | ||
} | ||
|
||
public void setName(String name) { | ||
mNameField.setText(name); | ||
} | ||
|
||
public void setText(String text) { | ||
mTextField.setText(text); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confusing name: empty listView or emptyList view.