Coder Social home page Coder Social logo

shinebutton's Introduction

ShineButton

license platform Build Status Android Arsenal API

This is a UI lib for Android. Effects like shining.

preview

Usage

 shineButton = (ShineButton) findViewById(R.id.shine_button);
 shineButton.init(activity);

or

 ShineButton shineButtonJava = new ShineButton(this);
 shineButtonJava.setBtnColor(Color.GRAY);
 shineButtonJava.setBtnFillColor(Color.RED);
 shineButtonJava.setShapeResource(R.raw.heart);
 shineButtonJava.setAllowRandomColor(true);
 LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(100, 100);
 shineButtonJava.setLayoutParams(layoutParams);
 if (linearLayout != null) {
     linearLayout.addView(shineButtonJava);
 }

Simple Usage

Icon shape is made from png mask. Please see raw files.

app:siShape

Default button color.

app:btn_color

Fill button color.

app:btn_fill_color

If this property is true,the effects will become random color shine.

app:allow_random_color

preview

 <com.sackcentury.shinebuttonlib.ShineButton
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_centerInParent="true"
                android:src="@android:color/darker_gray"
                android:id="@+id/po_image2"
                app:btn_color="@android:color/darker_gray"
                app:btn_fill_color="@android:color/holo_green_dark"
                app:allow_random_color="false"
                app:siShape="@raw/smile"/>

Complex Usage

Property Java method Description
siShape void setShapeResource(int) Set raw resource (png)
btn_color void setBtnColor(int) Set origin color
btn_fill_color void setBtnFillColor(int) Set fill color after click
allow_random_color void setAllowRandomColor(boolean) Allow shine color random
shine_animation_duration void setAnimDuration(int) Set shine anim duration
big_shine_color void setBigShineColor(int) Set big shine color
click_animation_duration void setClickAnimDuration(int) Set click anim duration
enable_flashing void enableFlashing(boolean) Enable effect like flash
shine_count void setShineCount(int) Set shine count around button
shine_distance_multiple void setShineDistanceMultiple(float) Set multiple of distance to button
shine_turn_angle void setShineTurnAngle(float) Set turn angle of shine
shine_size void setShineSize(int) Set size of shine by pixel
small_shine_color void setSmallShineColor(int) Set small shine color
small_shine_offset_angle void setSmallShineOffAngle(float) Set angle offset of small shine to big shine
app:shine_turn_angle="20"
app:shine_count="15"
app:allow_random_color="true"
app:enable_flashing="true"

preview

<com.sackcentury.shinebuttonlib.ShineButton
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_centerInParent="true"
                android:src="@android:color/darker_gray"
                android:id="@+id/po_image1"
                app:btn_color="@android:color/darker_gray"
                app:btn_fill_color="#FF6666"
                app:allow_random_color="false"
                app:enable_flashing="false"
                app:big_shine_color="#FF6666"
                app:click_animation_duration="200"
                app:shine_animation_duration="1500"
                app:shine_turn_angle="10"
                app:small_shine_offset_angle="20"
                app:shine_distance_multiple="1.5f"
                app:small_shine_color="#CC9999"
                app:shine_count="8"
                app:siShape="@raw/like"/>

Support Dialog

When use button on a Dialog

shineButton.setFixDialog(dialog);

Easy to support.

Requirements

  • Android 4.0+

Code Reference

android-shape-imageview EasingInterpolator

Maven

<dependency>
  <groupId>com.sackcentury</groupId>
  <artifactId>shinebutton</artifactId>
  <version>1.0.0</version>
  <type>aar</type>
</dependency>

Gradle

buildscript {
    repositories {
        mavenCentral()
    }
}
dependencies {
    compile 'com.sackcentury:shinebutton:1.0.0'
}

Credits

iOS lib fave-button Android implement. FaveButton was inspired by Twitter’s Like Heart Animation;

Third Party Bindings

React Native

You may now use this library with React Native via the module here

License

The MIT License (MIT)

Copyright (c) 2016 Chad Song 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

shinebutton's People

Contributors

chadcsong avatar chenzhang22 avatar i-taozi avatar prscx avatar stefanmedack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shinebutton's Issues

Animation is in wrong place

Hi, after 1.3 commit, rendering problem disapppeared, but now animation is in random place on screen, not around button ;)

Animation Issues when using on Dialog Fragment

Hi, it's a great pleasure using this library!

However, I faced with a situation when the shinebutton is used in a dialog fragment. The button's particles animation seems to go out of place (ie, not in line with the button). Not sure what is the problem here?

[Feature Request] Configure size of shines

@ChadCSong Please mark this as a feature request, thank you!

Shines are sized proportionally to the size of the icon it is being applied to. This means that small icons will have shines that are barely visible and certainly not enough dramatic effect. Is there an option to resize the shines? For example, I have a 24dp icon but I would like the shines to be bigger so they show up better.

Thank you for all the great work and making this resource available to everyone!

Problem with RecyclerView

when i click on one of the shine button and scroll away from that position, on getting back to it, it will deselect itself automatically.
How can i fix this, i notice the same thing in the example you provided for the list view

Rendering problem

Button is working very well, but there is something wrong with rendering in android studio:

java.lang.NullPointerException
at com.sackcentury.shinebuttonlib.ShineButton.onDraw_Original(ShineButton.java:203)
at com.sackcentury.shinebuttonlib.ShineButton.onDraw(ShineButton.java)
at android.view.View.draw(View.java:16178)
at android.view.View.draw(View.java:16090)
at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3609)
at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16088)
at android.view.ViewGroup.drawChild_Original(ViewGroup.java:3609)
at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:61)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16181)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:455)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:428)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:654)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:596)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:591)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Animation when .setChecked is called

At the line 112 of ShineButton.java there is setChecked(bool), modify in this way:

public void setChecked(boolean checked, boolean anim) {
        isChecked = checked;
        if (checked) {
            setSrcColor(btnFillColor);
            isChecked = true;
            if (anim) showAnim();
        } else {
            setSrcColor(btnColor);
            isChecked = false;
            if (anim) setCancel();
        }
        onListenerUpdate(checked);
}
public void setChecked(boolean checked){
        setChecked(checked, false);
}

Draw bug?

The Android 4.3 API18 phone shows that the water ripple is square and should be circular?

Build with an error

FAILURE: Build failed with an exception.

* Where:
Build file '/Volumes/xs/CodeSpace/Products/LuoliLuoli-Corperation/lab/ShineButton/shinebuttonlib/build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':shinebuttonlib'.
> Could not read script '/Volumes/xs/CodeSpace/Products/LuoliLuoli-Corperation/lab/ShineButton/maven_push.gradle' as it does not exist.

setChecked

You can added a method, where setChecked don't called changeListener?? thanks. It's just paint button.

Shine is not working when removing the status bar

I'm trying to remove the status bar. The shine effect doesn't work after implementing the following code:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
val w: Window = window // in Activity's onCreate() for instance
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}

Please Use Tag Release

Hello,
thanks for your developments.

Only one thing I would suggest to you: you could use tag release for every new release commited.

This behaviour permit to us to find more quickly the new releases and even your GitHub page is more standard for GitHub specifications.

Really appreciate that.

Thanks in advance.

screenshot

ShineView didn't remove after shine finished.

Following change to fix this:

In ShineView lin 128
shineButton.removeView(ShineView.this);

replace with:
((ViewGroup) ShineView.this.getParent()).removeView(ShineView.this);

Or modify ShineButton.removeView function.

How to set this button to clicked?

I want to use it as a collect button, so if I judge the post was collected, i need to set this button to a clicked situation, how can i achieve that?

change color can't resolve this case, because the ShineButton has two situations.

In fragment don't work the explosion in the icon

Hi,

I'm trying to implement the library. The icon change the color and do the effect of the moviment, but is not working inside a fragment. If I copy the same code in an activity, it is working fine.

Have the library a problem working in a fragment?

Fragment code:
@OverRide
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

    shineButton = (ShineButton) getView().findViewById(R.id.po_image0);
    shineButton.init((HomeActivity)getActivity());

    shineButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
        }
    });

}

XML code:
<com.sackcentury.shinebuttonlib.ShineButton
android:id="@+id/po_image0"
android:layout_width="18dp"
android:layout_height="18dp"
app:btn_color="@color/colorGrey"
app:btn_fill_color="#f26d7d"
app:siShape="@raw/ico_social_like"
android:layout_marginTop="@dimen/margin_10"
android:layout_marginLeft="@dimen/margin_20"
android:layout_marginStart="@dimen/margin_20"
android:elevation="10dp"/>

Doesn't work when no listener are defined

Hi,

I have tried to use this button but it doesn't work when I just initialize button with :

shineButton.init(getActivity());

But when I had a listener like that, it works :

shineButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("Click","Click");
            }
        }); 

Ps : I have tried in a activity and in a fragment

Doesn't Show Icon in the Layout on Marshmallow

I have tried using this code for layout but the icon doesn't show! minSdkVersion is 17 and targetSdkVersion is 25

<com.sackcentury.shinebuttonlib.ShineButton
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_centerInParent="true"
                android:src="@android:color/darker_gray"
                android:id="@+id/po_image1"
                app:btn_color="@android:color/darker_gray"
                app:btn_fill_color="#FF6666"
                app:allow_random_color="false"
                app:enable_flashing="false"
                app:big_shine_color="#FF6666"
                app:click_animation_duration="200"
                app:shine_animation_duration="1500"
                app:shine_turn_angle="10"
                app:small_shine_offset_angle="20"
                app:shine_distance_multiple="1.5f"
                app:small_shine_color="#CC9999"
                app:shine_count="8"
                app:siShape="@raw/heart"/>

How can i checked state?!

How can i save checked state in SharedPreferences?
I want when click on button, and checked is true show turn on button for ever and for use this i want sharedPreferences! but i don't know how can i it?

Can you help me?

Animation at wrong location when using a Dialog

I gave the dialog a specific size approximately in the center of the screen and the shine animation happens on the top left corner of it and the scale+change image color happens normally where the button is located.

I think the fix would be inside showAnim.
rootView.addView(shineView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

Wrong animation position after fullscreen

Hi,

First of all - thanks for such a great lib!

I have a problem with animation position after entering and exiting activity fullscreen mode.

In landscape mode my app goes fullscreen hiding all system UI. When I resume to portrait and exit fullscreen shining animations starts in wrong place!

Please help.

Can't use ShineButton in a CardView

I want to use ShineButton into my cardview but when i introduce it into the cardview it doesn't show anything. Here is my xml code

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/card_game"
android:layout_width="match_parent"
xmlns:cardview="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
cardview:cardUseCompatPadding="true"
cardview:cardCornerRadius="2dp"
cardview:cardElevation="2dp">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/image_view"
        android:layout_width="375dp"
        android:layout_height="160dp"
        android:layout_gravity="center_horizontal"
        android:scaleType="centerCrop" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="51dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/title_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="pavel"
            android:layout_margin="8dp"
            android:maxLines="3" />

        <com.sackcentury.shinebuttonlib.ShineButton
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_centerInParent="true"
            android:id="@+id/po_image0"
            app:btn_color="#FF6666"
            app:btn_fill_color="#999933"
            app:siShape="@raw/heart"
            android:layout_gravity="right"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"/>

        <TextView
            android:id="@+id/movie_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="robin"
            android:layout_margin="8dp"
            android:layout_alignParentBottom="true"
            />

    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">


    </LinearLayout>


</LinearLayout>

</android.support.v7.widget.CardView>

small issue

How to configure button effect? when i click the button, the effect will show the problem is after i click the button and click it again the effect on the button doesnt show up. I want is when i click it multiple times the effect will show every single click.

not removing shining effect after click to shine

After click on shine button to shine after shine effect done shine effect will not go away and in recyclerview it happens same and when click multi shine items it effect app performance .
And as i scroll shine scroll with it.(see in picture)

Screenshot_20200820-113304

Different drawable when selected

I would like the ShineButton to have a different drawable when selected, e.g. heart outline and full heart, not only different color.
Is there a way to achieve this with xml (if not, can you add one? :3)
What is the recommended way to achieve this programmatically?

App crashes on ShineButton click, NoClassDefFoundError

 java.lang.NoClassDefFoundError: Failed resolution of: Landroid/animation/Animator$AnimatorListener$$CC;
                                                       at com.sackcentury.shinebuttonlib.ShineView$3.onAnimationStart(Unknown Source:0)
                                                       at android.animation.ValueAnimator.notifyStartListeners(ValueAnimator.java:990)
                                                       at android.animation.ValueAnimator.startAnimation(ValueAnimator.java:1239)
                                                       at android.animation.ValueAnimator.start(ValueAnimator.java:1041)
                                                       at android.animation.ValueAnimator.start(ValueAnimator.java:1065)
                                                       at com.sackcentury.shinebuttonlib.ShineAnimator.startAnim(ShineAnimator.java:38)
                                                       at com.sackcentury.shinebuttonlib.ShineView.showAnimation(ShineView.java:201)
                                                       at com.sackcentury.shinebuttonlib.ShineView.onDraw(ShineView.java:232)
                                                       at android.view.View.draw(View.java:18731)
                                                       at android.view.View.updateDisplayListIfDirty(View.java:17681)
                                                       at android.view.View.draw(View.java:18459)
                                                       at android.view.ViewGroup.drawChild(ViewGroup.java:4184)
                                                       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3970)
                                                       at android.view.View.updateDisplayListIfDirty(View.java:17672)
                                                       at android.view.View.draw(View.java:18459)
                                                       at android.view.ViewGroup.drawChild(ViewGroup.java:4184)
                                                       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3970)
                                                       at android.view.View.updateDisplayListIfDirty(View.java:17672)
                                                       at android.view.View.draw(View.java:18459)
                                                       at android.view.ViewGroup.drawChild(ViewGroup.java:4184)
                                                       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3970)
                                                       at android.view.View.updateDisplayListIfDirty(View.java:17672)
                                                       at android.view.View.draw(View.java:18459)
                                                       at android.view.ViewGroup.drawChild(ViewGroup.java:4184)
                                                       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3970)
                                                       at android.view.View.updateDisplayListIfDirty(View.java:17672)
                                                       at android.view.View.draw(View.java:18459)
                                                       at android.view.ViewGroup.drawChild(ViewGroup.java:4184)
                                                       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3970)
                                                       at android.view.View.draw(View.java:18734)
                                                       at com.android.internal.policy.DecorView.draw(DecorView.java:763)
                                                       at android.view.View.updateDisplayListIfDirty(View.java:17681)
                                                       at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:636)
                                                       at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:642)
                                                       at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:750)
                                                       at android.view.ViewRootImpl.draw(ViewRootImpl.java:2975)
                                                       at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2789)
                                                       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2356)
                                                       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1385)
                                                       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6729)
                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:886)
                                                       at android.view.Choreographer.doCallbacks(Choreographer.java:698)
                                                       at android.view.Choreographer.doFrame(Choreographer.java:633)
                                                       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:872)
                                                       at android.os.Handler.handleCallback(Handler.java:769)
                                                       at android.os.Handler.dispatchMessage(Handler.java:98)
                                                       at android.os.Looper.loop(Looper.java:164)
                                                       at android.app.ActivityThread.main(ActivityThread.java:6535)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at ```
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.animation.Animator$AnimatorListener$$CC" on path: DexPathList[[zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/base.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_dependencies_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_0_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_1_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_2_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_3_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_4_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_5_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_6_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_7_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_8_apk.apk", zip file "/data/app/...-YaVovrqzuZuLptV57qTLUQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app...-YaVovrqzuZuLptV57qTLUQ==/lib/x86, /system/lib, /system/vendor/lib]]
                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                       	... 51 more

This crash happens with all the latest updates, i. e. Android Studio 3.0 Canary 4, Java 8, Android O etc.
It might be due to Java 8 because it is the only thing I haven't tested, but can you please tell me how to fix this bug / fix it?
Great library btw.

Button not showing in API 26 and above

My app minimum API Level is 21 and max is 28. Button is not showing in API 26 and above. But button is working. when I click on the position where the button was placed, from then onwards the button is showing in API 26 and above.

the following is the xml code for my layout file.

`

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <android.support.v7.widget.AppCompatImageButton
            android:id="@+id/d_btn_close"
            android:layout_width="?attr/actionBarSize"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:tint="@color/colorAccent"
            app:srcCompat="@drawable/ic_close"/>

        <TextView
            android:id="@+id/d_tv_cardName_toolbar"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:text="@string/card_name"
            android:fontFamily="monospace"
            android:textStyle="bold"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
            android:textColor="@color/secondaryTextColor" />

        <android.support.v7.widget.AppCompatImageButton
            android:id="@+id/d_btn_edt"
            android:layout_width="?attr/actionBarSize"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:tint="@color/colorAccent"
            app:srcCompat="@drawable/ic_edit" />

        <android.support.v7.widget.AppCompatImageButton
            android:id="@+id/d_btn_dlt"
            android:layout_width="?attr/actionBarSize"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:tint="@color/colorAccent"
            app:srcCompat="@drawable/ic_delete" />

    </LinearLayout>

</android.support.design.widget.AppBarLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background_1">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/spacing_medium"/>

        <LinearLayout
            android:id="@+id/lay_card"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <android.support.v7.widget.CardView
                android:id="@+id/d_card_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/spacing_large"
                android:visibility="visible"
                app:cardBackgroundColor="@color/light_green_700"
                app:cardCornerRadius="8dp"
                app:cardElevation="5dp">

                <!--  My Code -->

            </android.support.v7.widget.CardView>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:padding="8dp"
            android:baselineAligned="false">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:orientation="horizontal"
                android:gravity="center_vertical"
                android:paddingStart="8dp"
                android:paddingEnd="@dimen/spacing_middle">

                <View
                    android:layout_width="@dimen/spacing_middle"
                    android:layout_height="0dp" />

                <android.support.v7.widget.AppCompatImageView
                    android:id="@+id/d_img_remState"
                    android:layout_width="35dp"
                    android:layout_height="35dp"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:src="@drawable/ic_notifications_none"
                    android:tint="@color/colorAccent"
                    android:clickable="false"/>

                <View
                    android:layout_width="@dimen/spacing_middle"
                    android:layout_height="0dp" />

                <com.sackcentury.shinebuttonlib.ShineButton
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:id="@+id/d_btn_fav"
                    app:btn_fill_color="@color/colorAccent"
                    app:siShape="@raw/heart"
                    android:contentDescription="@string/favorite_button"
                    app:small_shine_color="@color/colorAccent"
                    app:big_shine_color="@color/colorPrimary"
                    android:elevation="10dp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:gravity="center_vertical|end"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="3dp"
                    android:text="@string/show_btn" />

                <View
                    android:layout_width="@dimen/spacing_medium"
                    android:layout_height="0dp"/>

                <android.support.v7.widget.AppCompatImageButton
                    android:id="@+id/d_btn_showw"
                    android:layout_width="35dp"
                    android:layout_height="35dp"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:scaleType="fitXY"
                    android:src="@drawable/asl_eye"
                    android:tint="@color/colorAccent" />
                <View
                    android:layout_width="@dimen/spacing_large"
                    android:layout_height="0dp"/>

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

    <com.google.android.gms.ads.AdView
        android:id="@+id/banner_adView_credit_open"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_add_unit_id"/>

</RelativeLayout>

`

click quickly will load error button color

such like this. I click quickly.

The last check callback is false. So the text color is right. But the btn color is error. It look like it the shakeAnimator's problem. Because shakeAnimator onAnimationStart will call setSrcColor(color) . I think set Animation Listener like this.

shakeAnimator.addListener(new Animator.AnimatorListener() {
    @Override
    public void onAnimationStart(Animator animator) {
        if (isChecked()) {
            setSrcColor(btnFillColor);
        }
    }

    @Override
    public void onAnimationEnd(Animator animator) {
        onListenerUpdate(isChecked());
    }

    @Override
    public void onAnimationCancel(Animator animator) {
        onListenerUpdate(isChecked());
    }

    @Override
    public void onAnimationRepeat(Animator animator) {

    }
});

and do some work in the onCheck callback.

mPariseImg.setOnCheckStateChangeListener(new ShineButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(View view, boolean isCheck) {
        if (!isCheck) {
            mPariseImg.setSrcColor(getResources().getColor(R.color.doctor_push_dis_vote));
        }
    }
});

It can do well. I think it can add to readme.

It is not working with SVG?

Is it not working with SVG? I've tried to use SVG but unfortunately, the borders of SVG has not shown clearly.

Manifest merger failed, spent many hours in it. How to fix this.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:27:9-35
    is also present at AndroidManifest.xml:27:9-35 value=(true).
    Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:20:5-23:76 to override.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

How can use this library for Favorite

Hi, thanks for this awesome library ❤️
But i have a problem, how can i use this in favorite feature?!
I want when click this button and added into favorite list, turn on button for ever for this post. and when delete post from favorite list turn off this button !

How can i it? can you send me code?

无法更换点击后的图片

大佬 你好 我发现这个库有个缺陷 就是只能通过填充颜色去改变点击后的效果 没办法设置图片的吗 因为有些图片不是单色的 所以我只好放弃使用了 唉 还是说这个库有设置图片的属性我没找到吗

Two Different SRC

I want to use 2 different src, like and unlike, but I couldn't. Could you help me?

App crashes

When you set android:layout_width="25dp" and android:layout_height="25dp", and continuously tap on star button, application is crashing. It is working fine for 20dp, 30dp, 50dp etc....

status

Can the initial state be the selection state?

Animation doesn't work when FLAG_LAYOUT_NO_LIMITS is enabled

When I enable FLAG_LAYOUT_NO_LIMITS the animation stops but when I disable it works.

Code to enable FLAG_LAYOUT_NO_LIMITS :-
Window window = getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Code to disable FLAG_LAYOUT_NO_LIMITS :-
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Need help

I try fix

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
...while parsing com/sackcentury/shinebuttonlib/BuildConfig.class

by
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
but failure :((

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.