Giter VIP home page Giter VIP logo

Comments (21)

nasko700 avatar nasko700 commented on May 29, 2024 4

Here is how I fixed the problem with adding icon on the menu button:
I created a FloatingActionButton on the menu button(this way it's hidden) and every color transparent in menu button. Then I'm listening if the added button is pressed:
myButton.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
if(floatMenu.isExpanded()){
floatMenu.collapse();
} else{
floatMenu.expand();
}
}
});

Hope it helps.

from android-floating-action-button.

jemshit avatar jemshit commented on May 29, 2024 1

@nasko700 lol, good trick 💃

from android-floating-action-button.

chalup avatar chalup commented on May 29, 2024

Already answered in #41:

The problem with this request is that the icon is currently strictly connected with the animation: plus rotates 135 degrees and turns into "X", which closes the menu. So customizing icon would not be enough: you'd also have to customize the animation. I'll consider this for further releases, but it's not an area of focus right now.

Right now == forseeable future, unless someone comes up with a great, generic solution and implements it.

from android-floating-action-button.

str4d avatar str4d commented on May 29, 2024

Here's an idea: If the FAM icon is set to anything (ie. not the default plus), then as the action menu expands out, that icon rotates about an axis in the plane of the screen (instead of perpendicular, like the current animation), revealing an "X". The reverse animation happens on collapse.

This is hard to convey in words, but imagine you are looking down at a roller which is moving a piece of paper. As the paper slides out, the roller turns, revealing a different side.

The direction that the icon rolls would depend on:

  • The orientation of the FAM (the icon would roll in opposite direction for down vs. up, and would roll horizontally for a horizontal FAM).
  • Whether the FABs in the FAM should be considered to be "under" or "over" the FAM's button. Returning to the roller analogy, this corresponds to whether the roller is beneath or above the paper; the different rollers turn in opposite directions to make the paper move in the same direction.

If this sounds like a great, generic solution then I can have a stab at implementing it :)

from android-floating-action-button.

chalup avatar chalup commented on May 29, 2024

It is generic indeed, but I wouldn't call it great.

I'm leaning towards the Inbox approach, i.e. changing icon and replacing close action with custom action.

from android-floating-action-button.

DineshAnandan avatar DineshAnandan commented on May 29, 2024

👍 for the option to replace + icon. Really most wanted feature too

from android-floating-action-button.

chap126 avatar chap126 commented on May 29, 2024

The ability to achieve what Inbox does with the FAM would be excellent.

from android-floating-action-button.

ch3m1c avatar ch3m1c commented on May 29, 2024

Please add it, because + isn't just enough to describe what that FOA is going to do.. Inbox solution is great! ;)

Maybe you can start with just static icon (no animation at all, when user defined an icon)

from android-floating-action-button.

k0shk0sh avatar k0shk0sh commented on May 29, 2024

well i have made some changes in code to be able to change icon inside of the floatingMenu. instead of adding AddFloatingButton i add FloatingButton plus i have made changes and added new attr to make the drawable works. i'll be requesting pull request.

from android-floating-action-button.

tamiof avatar tamiof commented on May 29, 2024

Joining the request
btw I noticed the animation doesn't work after using proguard with a signed apk. any solutions for this problem?

from android-floating-action-button.

chalup avatar chalup commented on May 29, 2024

@tamiof The proguard issue was fixed in 1.2.0. I just checked the output of gradle proguardRelease task in sample project and everything looks fine. Maybe you have some other conflicting proguard rules? Can you share your config?

from android-floating-action-button.

tamiof avatar tamiof commented on May 29, 2024

This is my proguard config. It's an old project that was handed to me so things might be out of date or conflicted
Do you see any conflicts here I missed?

-optimizationpasses 5

#When not preverifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jars, you should then use:
-dontusemixedcaseclassnames

#Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting
-dontskipnonpubliclibraryclasses

#Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
-dontpreverify

#Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
-verbose

#The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive overloading (of static fields).
#To understand or change this check http://proguard.sourceforge.net/index.html#/manual/optimizations.html
-optimizations !code/simplification/arithmetic,!field/,!class/merging/

#To repackage classes on a single package
#-repackageclasses ''

#Uncomment if using annotations to keep them.
#-keepattributes Annotation

-printmapping proguard.map
-renamesourcefileattribute ProGuard
-keepattributes SourceFile,LineNumberTable

m libraries

#-libraryjars /libs/android-query-full.0.26.7.jar
-dontwarn com.androidquery.auth.**
-dontwarn com.jfeinstein.jazzyviewpager.**

-keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock {
(android.app.Activity, int);
}

#Keep classes that are referenced on the AndroidManifest
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
}

#To avoid changing names of methods invoked on layout's onClick.
#Uncomment and add specific method names if using onClick on layouts
#-keepclassmembers class * {
#public void onClickButton(android.view.View);
#}

#Maintain java native methods
-keepclasseswithmembernames class * {
native ;
}

#To maintain custom components names that are used on layouts XML.
#Uncomment if having any problem with the approach below
#-keep public class custom.components.package.and.name.**

#To maintain custom components names that are used on layouts XML:
-keep public class * extends android.view.View {
public (android.content.Context);
public (android.content.Context, android.util.AttributeSet);
public (android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}

-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public (android.content.Context, android.util.AttributeSet, int);
}

#Maintain enums
-keepclassmembers enum * {
public static *[] values();
public static *
valueOf(java.lang.String);
}

#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

#Keep the R
-keepclassmembers class *.R$ {
public static ;
}

ADDITIONAL OPTIONS NOT USED NORMALLY

#To keep callback calls. Uncomment if using any
#http://proguard.sourceforge.net/index.html#/manual/examples.html#callback
#-keep class mypackage.MyCallbackClass {
#void myCallbackMethod(java.lang.String);
#}

#Uncomment if using Serializable
-keepclassmembers class * implements java.io.Serializable {
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}

-keepclassmembers class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
;
;
}

##---------------Begin: proguard configuration for Gson ----------
#Gson uses generic type information stored in a class file when working with fields. Proguard
#removes such information by default, so configure it to keep all of it.
-keepattributes Signature

#For using GSON @expose annotation
-keepattributes Annotation

#Gson specific classes
-keep class sun.misc.Unsafe { ; }
#-keep class com.google.gson.stream.
* { *; }

#Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

##---------------End: proguard configuration for Gson ----------

from android-floating-action-button.

chalup avatar chalup commented on May 29, 2024

@tamiof Please create a gist with this config, it got completely mangled by github markdown. And one more obvious question, just to confirm - are you using gradle to build your projects?

from android-floating-action-button.

tamiof avatar tamiof commented on May 29, 2024

@chalup this particular project does not use gradle build. Any chance switching to gradle might fix this issue? I've been postponing it for a while so this might be a good time to switch to gradle
https://gist.github.com/tamiof/8aa534ece3b64cb8bbb8

from android-floating-action-button.

chalup avatar chalup commented on May 29, 2024

@tamiof no need to switch to gradle, you just have to add this proguard rules: https://github.com/futuresimple/android-floating-action-button/blob/master/library/consumer-proguard-rules.pro

Were you using gradle, the build system would apply these rules to your build automatically.

from android-floating-action-button.

rubdottocom avatar rubdottocom commented on May 29, 2024

Is it possible to change AddFloatingActionButton background color for the FloatingActionsMenu programatically?
I can change color of child buttons but seems that the parent button color must be set only on XML

from android-floating-action-button.

chalup avatar chalup commented on May 29, 2024

@rubdottocom this issue is tracked in #49

from android-floating-action-button.

rubdottocom avatar rubdottocom commented on May 29, 2024

Ooops! Sorry, thank you :-)

from android-floating-action-button.

tamiof avatar tamiof commented on May 29, 2024

@chalup guess I somehow missed on those particular rules. 10x!

from android-floating-action-button.

Poeschl avatar Poeschl commented on May 29, 2024

Any new progress for this issue? If approved, I would like to solve it like here: http://eichefam.net/2014/10/27/inbox-fab/

from android-floating-action-button.

deshmukhrohit11 avatar deshmukhrohit11 commented on May 29, 2024

@nasko700 : Thank you. You rock

from android-floating-action-button.

Related Issues (20)

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.