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

Add outlineColor attribute, so it can be user defined #41

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

ParkerK
Copy link

@ParkerK ParkerK commented Jul 14, 2017

In response to #17

This adds a 'outlineColor' attribute that will override the black/white border that the library sets. If user does not define 'outlineColor' then nothing changes, but if they do, the outline will always have that color (assuming that width is set)

outline_in_omnichan_app

Copy link
Member

@nwalters512 nwalters512 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks great overall, just a few things that need addressing before I merge.

If you could also add a demo to both dialogs and preferences that shows off this feature, that would be awesome!

@@ -39,6 +40,7 @@
private boolean mShouldDismissOnColorSelected = true;
private OnColorSelectedListener mListener;
private int mOutlineWidth = 0;
private @ColorInt int mOutlineColor;
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to default this to -1.

@@ -75,6 +76,7 @@ public SpectrumPreferenceCompat(Context context, AttributeSet attrs) {
}
mCloseOnSelected = a.getBoolean(R.styleable.SpectrumPreference_spectrum_closeOnSelected, true);
mOutlineWidth = a.getDimensionPixelSize(R.styleable.SpectrumPalette_spectrum_outlineWidth, 0);
mOutlineWidth = a.getColor(R.styleable.SpectrumPalette_spectrum_outlineColor, -1);
Copy link
Member

Choose a reason for hiding this comment

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

This should be mOutlineColor.

@@ -13,6 +13,7 @@
private final Paint mPaint;
private int mRadius = 0;
private int mOutlineWidth = 0;
private @ColorInt int mOutlineColor = -1;
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this isn't necessary.

Copy link
Author

Choose a reason for hiding this comment

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

Whoops, forgot to remove that, that was before I realized there was already a setOutlineColor method in that class

if (mOutlineColor != -1) {
mask.setStroke(mOutlineWidth, mOutlineColor);
}
else {
Copy link
Member

Choose a reason for hiding this comment

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

Keep your else on the same line as the preceding curly brace to match our coding style :)

Copy link
Author

Choose a reason for hiding this comment

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

Man that hurts to look at - this is the last time I make changes with the Github online editor :)


/**
* Force an outline color instead of setting
* to black or white (default behavior)
Copy link
Member

Choose a reason for hiding this comment

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

This description should be able to fit on one line.

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

Changes made

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

Changes made

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

Fixed outline color, open to other colors. Picked purple so it was noticeable

build.gradle Outdated
@@ -2,17 +2,19 @@

buildscript {
repositories {
google()
Copy link
Member

Choose a reason for hiding this comment

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

This line produces the following error in Studio 2.3.3:
Gradle DSL method not found: 'google()'
Are you running the 3.0 beta, or do I have to check my Gradle config?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, yeah that's Studio 3

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer not to use features from 3.0 until it hits stable, let's revert this for now.

Copy link
Author

Choose a reason for hiding this comment

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

It's a shortcut for google's maven - I just wasn't able to download the support libraries from gradle without it - so just ignore it and do what works for you on Studio 2

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

google() repo removed

@nwalters512
Copy link
Member

Looks like we still need to following for support lib 25.4.0, per https://developer.android.com/topic/libraries/support-library/setup.html:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

@@ -20,6 +20,16 @@
app:spectrum_colors="@array/demo_colors_expanded" />

<com.thebluealliance.spectrum.SpectrumPreferenceCompat
android:defaultValue="@color/md_indigo_500"
android:key="demo_preference_6"
android:summary="You can make all the colors have the same color border or your choosing"
Copy link
Member

Choose a reason for hiding this comment

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

Typo, should be "of your choosing". Also, can you stick with one title/summary for both the dialog and preference demos?

android:defaultValue="@color/md_indigo_500"
android:key="demo_preference_6"
android:summary="You can make all the colors have the same color border or your choosing"
android:title="Color preference with purple outlines"
Copy link
Member

Choose a reason for hiding this comment

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

Let's go with something more generic like "Color preference with custom outline color"

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

Text changed

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

Dialog and pref now have same description

Copy link
Author

@ParkerK ParkerK left a comment

Choose a reason for hiding this comment

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

Let me know if there's any other changes you'd like!

@ParkerK
Copy link
Author

ParkerK commented Dec 22, 2017

Think I got all the changes in, let me know if there's anything else

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