Git Product home page Git Product logo

rmswitch's People

Contributors

riccardomoro 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

rmswitch's Issues

On adapter.notifyDataSetChanged all switches are animated

I have a RecyclerView, each item have a RMTristateSwitch, when update all data, I call to adapter.notifyDataSetChanged() and all RMTristateSwitch do an animation and it's very ugly.
¿How can I disabled this animation on reload?

[request] custom background

It will be great to have a possibility to add custom background to the switch. Or have material switch background with possibility to add drawable to left and right.

Weird behavior when using with ViewPager

When using the RMSwitch with a ViewPager and a RecyclerView, the switches on the adjacent screen are showing incorrectly. The drawables are rendered incorrectly and clicking it does not move to the other side. See the attached picture,
screenshot

The workaround is to reload the entire recyclerview by calling notifyDataSetChanged() but I prefer not to do that since it has a visible flash in the data.

Cannot use checked image

It is working fine when I am not using image for checked state but when I use is it is giving error.
I am using it in Toolbar the code is following
<com.rm.rmswitch.RMSwitch
android:id="@+id/btnAvailability"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/margin_8dp"
app:checked="true"
app:switchBkgCheckedColor="@color/colorWhite"
app:switchBkgNotCheckedColor="@color/colorWhite"
app:switchToggleCheckedColor="@color/colorGreen"
app:switchToggleCheckedImage="@drawable/confirm"
app:switchToggleNotCheckedImage="@drawable/cancel"
app:switchToggleNotCheckedColor="@color/colorPrimary" />

Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class com.rm.rmswitch.RMSwitch
at android.view.LayoutInflater.createView(LayoutInflater.java:649)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:768)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:975)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable/confirm.png"
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parse(Integer.java:410)
at java.lang.Integer.parseInt(Integer.java:367)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:133)
at android.content.res.TypedArray.getInt(TypedArray.java:357)
at com.rm.rmswitch.RMAbstractSwitch.(RMAbstractSwitch.java:119)
at com.rm.rmswitch.RMSwitch.(RMSwitch.java:87)
at com.rm.rmswitch.RMSwitch.(RMSwitch.java:83)

Bug: in sample, crash when pressing home button

This is the log:

11-21 10:10:47.451 4055-4055/com.rm.switchsample E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 1160672)
11-21 10:10:47.453 4055-4055/com.rm.switchsample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rm.switchsample, PID: 4055
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1160672 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3755)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6088)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.os.TransactionTooLargeException: data parcel size 1160672 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3628)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3747)
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6088) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

Memory leak caused by static variables

Hi, thanks for the library. However it has a potential problem causing memory leaks.
Here is a Leak Canary dump showing how the memory leak occured.

Could you fix it please ?
screen shot 2017-10-22 at 3 09 21 pm

Ability to setChecked without animation

When I call setChecked inside a RecyclerView, the animation triggers when I don't want it to. Can you please make a method such as setChecked(boolean checked, boolean animate)?

Crashes on start

Title says it all

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rm.switchsample/com.rm.switchsample.ActivityMain}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.rm.rmswitch.RMSwitch
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.rm.rmswitch.RMSwitch
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.rm.rmswitch.RMSwitch
Caused by: java.lang.reflect.InvocationTargetException

strange loop if in relative layout

....android E/RMSwitch: Paddings
....android E/RMSwitch: Margins
....android E/RMSwitch: Paddings
....android E/RMSwitch: Margins
....android E/RMSwitch: Paddings
....android E/RMSwitch: Margins
....android E/RMSwitch: Paddings
....android E/RMSwitch: Margins
....android E/RMSwitch: Paddings
....android E/RMSwitch: Margins

jCenter

For the record, you can get this library from jitpack using com.github.RiccardoMoro:RMSwitch:1.2.3

switch button looping

android switch loop does a iteration in 3... if you are calling an api it will call it 3 times, toasting 3 times. after the second time the toggle goes from on - off - on again.

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.