by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Martin Mauch
    @nightscape
    Hi Nick! Am I right to assume that findFrag will not work in onCreate? When I put it there, it doesn't find the Fragment, if I put it in onStart all works as expected.
    Nick
    @stanch
    @nightscape Yes, I think that’s correct. The fragment transaction only happens after onCreate.
    Yilin Wei
    @yilinwei
    Hi, new-ish android developer here. I think that macroid has been the only android project that uses the android plugin + scalatest as far as I can find . Do you mind adding a test to your macroid starter project? I would only I can't seem to get the configuration correct...
    Nick
    @stanch
    Hey @yilinwei, those tests may not be what you want, because they don’t run on the device, and they can’t really use the SDK either
    But if you do want the same configuration, here’s the important bit: https://github.com/macroid/macroid/blob/master/build.sbt#L39
    Yilin Wei
    @yilinwei
    @stanch That's fine - I'm mocking out OGL calls which means it's still of immense value. I thought that might be the correct part but it didn't do anything for me when I added it to my build.sbt...Must be doing something, really, really stupid [https://github.com/yilinwei/hedgehog]. I also asked the question in the sdk plugin room as well since when I cloned your git it would work.
    Yilin Wei
    @yilinwei
    Ah - pfn helped me solve the issue. The manifest.xml was in the wrong place... Knew it would be something stupid.
    bowerth
    @bowerth
    hello - I'm new to macroid and would use it to append to a simple text file in ledger format (date, description, [new line], account1, amount, [new line], account2, negative amount) - has anyone successfully set up a java.io.PrintWriter with macroid?
    Mauricio Güell Hernández
    @mauricioguell

    Good morning Gentlemen,
    I'm having problems trying to set an horizontal gravity to an ImageView in that way:

    w[ImageView] <~
            res(R.drawable.logo_app) <~
            gravity(Gravity.CENTER_HORIZONTAL) <~
    (...)

    The error message is: Don't know how to tweak macroid.Ui[android.widget.ImageView] with macroid.Loaf. Try importing an instance of CanTweak[macroid.Ui[android.widget.ImageView], macroid.Loaf, ...].

    Thank you a lot, I really appreciate your help :)

    Javi Pacheco
    @javipacheco
    Gravity isn't a tweak for ImageView... For that you should use Scale Type but I don't know if Macroid has this kind of tweak. Maybe you can try "macroid-extras" and you can use "ivScaleType" with CENTER_INSIDE. More info here https://developer.android.com/reference/android/widget/ImageView.ScaleType.html?hl=es
    Mauricio Güell Hernández
    @mauricioguell
    Working on it, thanks @javipacheco !
    Mauricio Güell Hernández
    @mauricioguell

    Hi!
    I have to set an EditText as a password input (in standard android you have only to write android:password="true" into the xml file). But I don't find how to do it in macroid, can you help me? :)

    Thank you for your help and for your amazing library.

    Javi Pacheco
    @javipacheco

    You can see the response here http://stackoverflow.com/questions/2586301/set-inputtype-for-an-edittext

    you can create a new tweak for that, for example,

    def edPassword = Tweak[EditText] (_.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD))

    I have not tried the code, but It should work fine

    BTW, we are using XML Layout in order to create our screens and later we are using macroid for transformations. You can see a example here https://github.com/47deg/scala-android/blob/master/src/main/scala/com/fortysevendeg/scala/android/ui/materiallist/Composers.scala

    You can use

    lazy val recycler = Option(findView(TR.recycler))
    
    ...
    
    (recycler  <~ rvAdapter(new ImageListAdapter())).run

    For example.... Here, you can use XML Layouts and Styles in Android, and later you can initialize your UI

    Mauricio Güell Hernández
    @mauricioguell
    Worked for me, thank you very much @javipacheco ! 47deg is love 47deg is live!!! :)
    I used
    def edPassword = Tweak[EditText] (_.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD))
    Javi Pacheco
    @javipacheco
    👍😀
    Javi Pacheco
    @javipacheco
    @mauricioguell if you create several methods for EditText widget maybe you can create a new PR to "macroid-extras" with the new tweaks 👍😀
    Mauricio Güell Hernández
    @mauricioguell
    Consider it done! I'm working in Android in Scala since your Meetup in Barcelona a few months ago. When I finish my project (professional, related to smart cities) and created some useful methods I will do the PR (at the moment I'm not prepared at all)!
    Javi Pacheco
    @javipacheco
    👍
    Carlos Gottberg
    @clinoge
    Hi :). I'm gettinga lot of warnings like Warning: com.fortysevendeg.macroid.extras.TR$layout$: can't find referenced field 'int design_navigation_item_separator' in program class com.fortysevendeg.macroid.extras.R$layout and then android:package crashes with an IOExcepion in ProGuard
    I'm using macroid-extras 0.3 and macroid M5. Scala version is 2.11.8 and sbt is 0.13.12. Android support v4 24.2.0 v7 24.2.0.
    I've tried googling, searching in the issues, sbt clean, sbt compile, read what the ProGuard guys have to say about it. But only found one StackOverflow answer which basically suggested to ignore these warnings... I don't know if that's the best idea...
    I'm sure I'm missing something totally stupid, but might be too tired to get it :c
    Niklas Klein
    @Taig
    @clinoge try to suppress the warnings in your ProGaurd config to get the app running. If that doesn't cause runtime errors you're fine
    Raúl Raja Martínez
    @raulraja
    @javipacheco are we seeing those in nine cards too? If so what is the way to fix them?
    Javi Pacheco
    @javipacheco
    We don't have this problem @clinoge Anyway, the TR (TypedResource) is a class for scala-android plugin. Maybe you can upgrade the plugin or ask in the GitHub of sbt-android project. Sorry, I can't help you about it
    Carlos Gottberg
    @clinoge

    No problem at all ^^. Today I hit another problem, but it might very well be my fault. When trying to tweak a Button

    w[Button] <~ lp[LinearLayout](64 dp, WRAP_CONTENT, 1)

    I'm getting java.lang.NoClassDefFoundError: Failed resolution of: Lscala/math/Numeric$IntIsIntegral$; at runtime :/.

    The only extra options I'm giving ProGuard are

    proguardOptions ++= Seq(
      "-dontwarn com.fortysevendeg.macroid.extras.*",
      "-dontwarn scala.async.internal.*",
      "-dontwarn scala.xml.parsing.*"
    )

    sbt android:run doesn't show any error at all. I don't think it's related to ProGuard... or maybe it is? I get the error from logcat :).

    GRBurst
    @GRBurst
    Hi folks,
    GRBurst
    @GRBurst
    Is there a way to use Futures with listables, e.g. to tweak my ListView with Future[List[something]]?
    val l: Future[List[Int]] = Future { List(2,3,4)}
    userListable.listAdapterTweak(l)
    GRBurst
    @GRBurst
    sry was not clear to me but this does the job
    l.map(li => userListable.listAdapterTweak(li))
    Raúl Raja Martínez
    @raulraja
    @GRBurst if you are not keeping the results of those tweaks you may want to use foreach instead of map to be explicit that you are performing side effects and it’s an impure operation.
    GRBurst
    @GRBurst
    @raulraja yes you are right, thanks for the hint :-)
    Raúl Raja Martínez
    @raulraja
    :thumbsup:
    Yilin Wei
    @yilinwei
    @raulraja are there any plans to make macroid compatible with iOS?
    Raúl Raja Martínez
    @raulraja
    @yilinwei I don’t know enough swift to determine if the lang would support a similar DSL. There is some Scala specific semantics that would need to be workaround or not provide parity of features. Do you have a use case?
    Yilin Wei
    @yilinwei
    @raulraja I don't quite currently (I have a similar compat issues so I was looking to see what you guys were doing) - but why do you want to use swift? There are several VM's which allow you to compile java code to obj-c
    We had a few PoC with RoboVM originally but that sadly died.
    And from working with swift you won't be able to do anything close to as rich - though it may have changed in the 1 year that I haven't used it.
    Raúl Raja Martínez
    @raulraja
    @yilinwei I thought you implied swift as nobody today uses Scala on iOS AFAIK. Hopefully Scala native would open some doors there, but still to early.
    Yilin Wei
    @yilinwei
    Like I said there are a few JVM's which run on iOS (Unity iirc uses a .NET based one, libGDX uses Xamarin atm). I don't expect the performance of scala on iOS to be particularly much worse than android.
    Raúl Raja Martínez
    @raulraja
    @yilinwei Are there any bindings to access UI stuff from Scala in iOS land in any of those platforms?
    Yilin Wei
    @yilinwei
    @raulraja Originally RoboVM has access to the API stuff (touch gesture etc...); Intel's JVM (which is what the libgdx) should also have bindings. We're probably going to do a deep dive on the JVM stuff in ~ 3 - 6m so we could sync up at that point to see whether it's feasible (since we'll have to perf test etc...).
    Raúl Raja Martínez
    @raulraja
    sounds good, looking forward to learn more about it.
    Yuriy Yarosh
    @yuriy-yarosh
    o/
    I wish there was a comparison chart of macroid with anko.
    The Almikey
    @TheAlmikey_twitter
    hey came across some dead link on the macroid page, like this one http://47deg.github.io/macroid/docs/api/core/macroid/Tweaks$.html , the pages have been moved to a new url maybe?
    Raúl Raja Martínez
    @raulraja
    @javipacheco do you know if the scaladocs are getting published somewhere ^^^?
    Raúl Raja Martínez
    @raulraja
    @TheAlmikey_twitter scaladocs are no longer getting published. I created 47deg/macroid#106 which will be adressed in the next sprint to fix those links and point to the actual Github sources.