Scalified / fab

Floating Action Button Library for Android
Apache License 2.0
849 stars 164 forks source link

FAB sides are not perfectly round #29

Closed wingoku closed 9 years ago

wingoku commented 9 years ago

I have used the default implementation of your library's FAB, however the FAB is not perfectly round. The left & top side of the FAB is cut off - not round. Any work arounds to resolve this.

 <com.software.shell.fab.ActionButton
        android:id="@+id/action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="-"
        android:textColor="#fff"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true"
        android:elevation="7dp"
        android:layout_margin="@dimen/fab_margins"
        fab:type="DEFAULT" />```
vbaidak commented 9 years ago

Hi wingoku,

Please specify the emulator / device details where you have faced with this issue This feature has been tested on API 15, 19, 21 emulators and no issues were found

Also,

  1. android:text and android:textColor attributes will have no effect, because ActionButton doesn't have any logic to work with text (indeed it is not a text view). It is recommended to remove these attributes so far as they may lead to unexpected behavior
  2. android:elevation attribute will work only on Lollipop devices and higher. On other devices the default shadow will be shown
wingoku commented 9 years ago

Nexus 5 Android 5.1.1

I have tried by removing the text properties as well but same issue. Also the ScaleUp animation isn't smooth either as shown in the Gif in ReadMe.

vbaidak commented 9 years ago

wingoku,

I couldn't reproduce the issue neither on the _HAX x86x64 nor on the amerabi-v7 emulator with API 22

There are no any cut offs nor not smooth animation.

Please provide the full layout XML configuration and the initialization code for this layout. Also, please answer these questions:

  1. Are you using device or emulator? If emulator -> provide the full API image name and resolution
  2. Have you tried to check it on another device / emulator?
wingoku commented 9 years ago
  1. I am using real Nexus 5.
  2. Yes. This issue is occuring on another Nexus 5 with 5.1
        actionButton.setState(ActionButton.State.NORMAL);
        actionButton.setButtonColor(getResources().getColor(R.color.main_color_light));
        actionButton.setButtonColorPressed(getResources().getColor(R.color.main_color_dark));

        actionButton.setShadowResponsiveEffectEnabled(false);
        actionButton.setRippleEffectEnabled(false);
        actionButton.setButtonColorRipple(getResources().getColor(R.color.ripple_color));

        Animation showAnim = AnimationUtils.loadAnimation(this, R.anim.scale_up_anim);
        actionButton.setShowAnimation(showAnim);
        actionButton.show();

        actionButton.playShowAnimation();

Scale_up_anim.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:duration="500"
        android:fromXScale="0.0"
        android:toXScale="1.0"
        android:fromYScale="0.0"
        android:toYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:interpolator="@android:anim/overshoot_interpolator"
        />
</set>```
vbaidak commented 9 years ago

Please provide the full XML layout

wingoku commented 9 years ago

I can but there is no point in providing a RelativeLayout enclosing this FAB only.

vbaidak commented 9 years ago

The code you are using contains no issues, I checked it on emulator with API 22 and no issues were found

I can't test it on device, but I suppose the behavior would be the same. It wasn't reproduced on my API 21 physical device, so I think on API 22, which is only a minor update of API 21 everything should also work well.

My assumption is that the issue is somewhere within your layout / margins configuration. As a recommendation, you may clone the project, build and deploy the sample application and check it on your device - in this case you can check whether everything is configured properly.

Without having the issue detected It can't be proved as an issue and thus it can't be fixed.

marcochin commented 9 years ago

Before I've used this library I used another FAB library and the issue of a not round button would occur if I used a color with transparency. If I switch back to a solid color it would look round again. Could that be the problem?

vbaidak commented 9 years ago

I'm not sure

wingoku, I can build the sample project demo and send you an .apk file. Would you have an ability to check it?

wingoku commented 9 years ago

yeah sure.

vbaidak commented 9 years ago

wingoku,

I've built the sample application for you.

Please, provide you e-mail address or e-mail me

wingoku commented 9 years ago

umer.farooq@ingrain.io

wingoku commented 9 years ago

Plus the animations on Lollipop aren't smooth. The animation on the FAB doesn't seem to play.

vbaidak commented 9 years ago

I've sent you the demo sample apk

As for animations on Lollipop - I have a Lollipop device and I do not have any problems with them. It would be nice if you could record a video / take screenshot.

The animation on the FAB doesn't seem to play - please provide the steps to reproduce

wingoku commented 9 years ago

@shell-software Sorry for the late reply. The sample apk seems to be working fine. I don't why is it behaving like this. I have copied the xml code from your repo's readme. I'll do further testing and will let you know about the progress.

wingoku commented 9 years ago

@shell-software I need help regarding packaging the dependencies inside the .aar file. I have a library project "A" which depends on Shell-Software FAB library. When I use my library project "A" inside my app, currenly I have to add the FAB library in dependency section of the app. How can I package the FAB library in my library project "A" so that when I add my library "A" in the app, I don't have to add the dependency "Shell-Software FAB" in the app.

vbaidak commented 9 years ago

Hi wingoku,

Seems that the problem is within your layout or smth like that. If you need my support let me know.

As for dependencies the situation is not clear for me, because I also faced with this problem recenlty and currently didn't find any solution.

As far as I know you can set the transitive=true when you build your app project like it was suggested here

When I faced with it, in my case project A was a module of the entire application and had a transitive libraries. In my main application I used this code:

dependencies {
    compile project(':fab')
}

And when I faced with the problem of transitive dependencies in fab library, I couldn't resolve it. I searched it and it seemed that there is no such possibility. So I had to add it directly as a local library

wingoku commented 9 years ago

Yep I already tried with transitive = true, but that messed up the class path for the class and I couldn't reference any class from .aar. It seems like I have to set the proper hiearchy of the dependencies for it to work. The only solution is to learn Gradle properly and then figure out a way to create a fat artifact file.

vbaidak commented 9 years ago

The problem is that android gradle plugin does not have a runtime scope for dependencies like java gradle plugin has. So, as a result they are not included into aar file

In your case, however you can create a multimodule project in this way:

-- root ---- build.gradle ---- settings.gradle ---- library_module_A -------- build.gradle ---- project_module -------- build.gradle

in build.gradle file for library module A specify the dependency on ActionButton library:

dependencies {
    compile 'com.github.shell-software:fab:1.1.0'
}

in build.gradle file for application project specify the dependency on project A:

dependencies {
    compile project(':library_module_A')
}

in settings.gradle file: include ':library_module_A', ':project_module'

Please check this and let me know

vbaidak commented 9 years ago

Any updates upon this?

wingoku commented 9 years ago

@shell-software Thank you very much :) Though I have dropped the transitive dependency thing for the moment. I'll catch up with you soon on other things :)

vbaidak commented 9 years ago

Great. Sure, feel free to ask.

Best wishes, Shell Software Inc. On 15 Jun 2015 11:45, "Umer Farooq" notifications@github.com wrote:

@shell-software https://github.com/shell-software Thank you very much :) Though I have dropped the transitive dependency thing for the moment. I'll catch up with you soon on other things :)

— Reply to this email directly or view it on GitHub https://github.com/shell-software/fab/issues/29#issuecomment-111981211.