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

Allow to override background, icon and divider colors #295

Merged
merged 10 commits into from
Sep 25, 2018

Conversation

RashidianPeyman
Copy link
Contributor

@RashidianPeyman RashidianPeyman commented Jul 29, 2018

Hello, dear Niklas Baudy (Vacation) first of all, I apologize for my English and thank u for your useful third- party. I use your Emoji third-party in my app but I needed to change background, divider and icon colors programmatically based on my themes. so I fork the Emoji and changed it on demand. now I can use three methods to change background, divider and icon colors in setUpEmojiPopup so we have
this Three :
.setBackgroundColor(Color.parseColor("#BDBDBD"))
.setDividerColor(Color.parseColor("#42A5F5"))
.setIconColor(Color.parseColor("#f0f0f0"))

Although if u don't use them. default values will call and there is no problem

With respect
Peyman Rashidian

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

Can you revert all of the formatting changes?

@@ -83,24 +87,29 @@
}
};

EmojiPopup(@NonNull final View rootView, @NonNull final EmojiEditTextInterface editInterface,
@Nullable final RecentEmoji recent, @Nullable final VariantEmoji variant) {
public EmojiPopup(@NonNull final View rootView, @NonNull final EmojiEditTextInterface editInterface,
Copy link
Owner

Choose a reason for hiding this comment

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

Why public?

Copy link
Contributor Author

@RashidianPeyman RashidianPeyman Aug 10, 2018

Choose a reason for hiding this comment

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

it added for a test, but I forget to remove it, now its ok

@@ -29,7 +31,8 @@
static final int MIN_KEYBOARD_HEIGHT = 100;

final View rootView;
final Activity context;
private Activity context;
private int backgroundColor, iconColor, dividerColor;
Copy link
Owner

Choose a reason for hiding this comment

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

Please put each on it's own line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return this;
}

@CheckResult public Builder setDividerColor(final int dividerColor) {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add @ColorInt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I will add them

@RashidianPeyman
Copy link
Contributor Author

RashidianPeyman commented Aug 10, 2018

all revert formatting changes did and revisions have done

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

There are still some formatting errors.

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
import android.widget.PopupWindow;

Copy link
Owner

Choose a reason for hiding this comment

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

revert this one please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -50,7 +56,8 @@
@Nullable OnEmojiPopupDismissListener onEmojiPopupDismissListener;

final ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override public void onGlobalLayout() {
@Override
Copy link
Owner

Choose a reason for hiding this comment

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

should be on the same line just as it was previosly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


popupWindow = new PopupWindow(context);

final OnEmojiLongClickListener longClickListener = new OnEmojiLongClickListener() {
@Override public void onEmojiLongClick(@NonNull final EmojiImageView view, @NonNull final Emoji emoji) {
@Override
Copy link
Owner

Choose a reason for hiding this comment

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

same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

EmojiPopup(@NonNull final View rootView, @NonNull final EmojiEditTextInterface editInterface,
@Nullable final RecentEmoji recent, @Nullable final VariantEmoji variant) {
EmojiPopup(@NonNull final View rootView, @NonNull final EmojiEditTextInterface editInterface,
@Nullable final RecentEmoji recent, @Nullable final VariantEmoji variant, int backgroundColor, int iconColor, int dividerColor) {
Copy link
Owner

Choose a reason for hiding this comment

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

same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

variantPopup.show(view, emoji);
}
};

final OnEmojiClickListener clickListener = new OnEmojiClickListener() {
@Override public void onEmojiClick(@NonNull final EmojiImageView imageView, @NonNull final Emoji emoji) {
@Override
Copy link
Owner

Choose a reason for hiding this comment

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

same

Copy link
Contributor Author

@RashidianPeyman RashidianPeyman Aug 11, 2018

Choose a reason for hiding this comment

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

I tried to fix them in the new commit 😉

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

Formatting still need some tweaks. Eventually I can also get around it

this.context = Utils.asActivity(rootView.getContext());
this.rootView = rootView.getRootView();
this.editInterface = editInterface;
this.editInterface = editInterface ;
Copy link
Owner

Choose a reason for hiding this comment

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

Revert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -149,7 +157,7 @@ public void toggle() {
if (isKeyboardOpen) {
// If the keyboard is visible, simply show the emoji popup.
showAtBottom();
} else if (editInterface instanceof View) {
} else if (editInterface instanceof View) {
Copy link
Owner

Choose a reason for hiding this comment

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

Revert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

final View emojiDivider = findViewById(R.id.emoji_divider);
if (dividerColor != 0)
emojiDivider.setBackgroundColor(dividerColor);
else
Copy link
Owner

Choose a reason for hiding this comment

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

Braces are missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it important to have braces?
You mean that?
if (dividerColor != 0){
emojiDivider.setBackgroundColor(dividerColor);
} else{
emojiDivider.setBackgroundColor(getResources().getColor(R.color.emoji_divider));
}

@RashidianPeyman
Copy link
Contributor Author

RashidianPeyman commented Aug 11, 2018

thank you Niklas Your hand is open to making the changes

@vanniktech vanniktech changed the title change background ,icon and divider colors programmatically Allow to override background ,icon and divider colors Aug 12, 2018
@vanniktech vanniktech changed the title Allow to override background ,icon and divider colors Allow to override background, icon and divider colors Aug 12, 2018
@RashidianPeyman
Copy link
Contributor Author

thank you Niklas 👍👍👍

@vanniktech
Copy link
Owner

There are some findbugs warnings, you want to take a look at it? Otherwise I'll eventually get to it.

@vanniktech
Copy link
Owner

Findbugs is still complaining, I think. Eventually I'll get to it.

Copy link
Owner

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

This should be good to go now. (I think)

@codecov
Copy link

codecov bot commented Sep 25, 2018

Codecov Report

Merging #295 into master will decrease coverage by 0.39%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #295     +/-   ##
=========================================
- Coverage   26.01%   25.62%   -0.4%     
=========================================
  Files          24       25      +1     
  Lines         911      925     +14     
  Branches       99      102      +3     
=========================================
  Hits          237      237             
- Misses        655      669     +14     
  Partials       19       19
Impacted Files Coverage Δ
...src/main/java/com/vanniktech/emoji/EmojiPopup.java 0% <0%> (ø) ⬆️
.../src/main/java/com/vanniktech/emoji/EmojiView.java 0% <0%> (ø) ⬆️
...main/java/com/vanniktech/emoji/emoji/CacheKey.java 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3c52dc...8a02df3. Read the comment docs.

@vanniktech vanniktech merged commit ed266e1 into vanniktech:master Sep 25, 2018
@RashidianPeyman
Copy link
Contributor Author

Thank you, Niklas , it's working very well 👍👍

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