Slider Component [MIT AI2]

As you may have noticed when you use the Slider Component between 0 and 100 it works properly, each step increases or decreases by one, but if you increase the MaxValue above 100 you get numbers with commas, e.g.

  • MaxValue 101 you get 1.01 for each step
  • MaxValue 255 you get 2.55 for each step

and this is because of setMax() value which is programmatically set at 100.

I have changed this setMax() value to 255 and by doing that I get increased or decreased steps by one…


Use any decompiling method that support smali

Designer properties

Blocks


Decompiled Apk

Go to your folder/path (in my case RGBColors)


..RGBColors\smali\com\google\appinventor\components\runtime

find and open Slider.smali file for editing, I recommend Notepad++ for this

find const/16 v1, 0x64 or just 0x64


    const/16 v1, 0x64

    invoke-virtual {v0, v1}, Landroid/widget/SeekBar;->setMax(I)V

edit 0x64 to 0xff


    const/16 v1, 0xff

    invoke-virtual {v0, v1}, Landroid/widget/SeekBar;->setMax(I)V

find (twice x2) 0x42c80000


    mul-float/2addr v0, v1

    const/high16 v1, 0x42c80000    # 100.0f

    div-float/2addr v0, v1

edit (twice x2) 0x42c80000 to 0x437f0000


    mul-float/2addr v0, v1

    const/high16 v1, 0x437f0000    # 255.0f

    div-float/2addr v0, v1

Done, build your Apk, install and try your new modified App.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.