Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

SlidingMenu binding error: missing class error was raised while reflecting setBehindCanvasTransforme

$
0
0

Hi,

I am trying to create bindings for the SlidingMenu java lib but I am running into a problem porting the CustomAnimation class from the sample because the generated binding is missing a method called 'SetBehindCanvasTransformer'.

I am getting a bunch of missing class errors (SlidingMenu has 4 interfaces defined within its class and these are all missing)

Warning 6   missing class error was raised while reflecting setBehindCanvasTransformer [public void com.slidingmenu.lib.SlidingMenu.setBehindCanvasTransformer(com.slidingmenu.lib.SlidingMenu$CanvasTransformer)] : com/slidingmenu/lib/R  C:\Users\Jake\Documents\GitHub\SlidingMenuMonodroid\SlidingMenuBinding\JARTOXML SlidingMenuBinding

These are the missing classes (well they are actually interfaces)

  • com.slidingmenu.lib.SlidingMenu$OnCloseListener
  • com.slidingmenu.lib.SlidingMenu$OnClosedListener
  • com.slidingmenu.lib.SlidingMenu$OnOpenListener
  • com.slidingmenu.lib.SlidingMenu$OnOpenedListener
  • com.slidingmenu.lib.SlidingMenu$CanvasTransformer

I have attached a screenshot of the errors that are showing up when I build the binding. I have a feeling it is because the $ sign in the com.slidingmenu.lib.SlidingMenu$CanvasTransformer class. In the docs it mentions that "classes and interfaces whose name only consists of lower case letters, numbers, or the $ as obfuscated. The obfuscated types will be filtered out by the by the binding generator and not included in the Java Binding library."

So I have tried adding to the metadata.xml file (I think the xpaths are correct because I am not seeing the BINDINGSGENERATOR : no nodes matching...). But this still doesn't fix the errors. So not sure if it has anthing to do with that!

  <attr path="/api/package[@name='com.slidingmenu.lib']/interface[@name='SlidingMenu.CanvasTransformer']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.slidingmenu.lib']/interface[@name='SlidingMenu.OnOpenListener']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.slidingmenu.lib']/interface[@name='SlidingMenu.OnOpenedListener']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.slidingmenu.lib']/interface[@name='SlidingMenu.OnCloseListener']" name="obfuscated">false</attr>
  <attr path="/api/package[@name='com.slidingmenu.lib']/interface[@name='SlidingMenu.OnClosedListener']" name="obfuscated">false</attr>

I the dll that gets generated I can actually see the SlidingMenu.ICanvasTransformer (using dotpeek to decompile because Object Browser in visual studio borks on my dll). So I have no idea why the SetBehindCanvasTransformer method of SlidingMenu is not there :-(

In com.slidingMenu.lib.SlidingMenu CanvasTransformer is just an interface like this (and it is declared withing the SlidingMenu class)

/**
 * The Interface CanvasTransformer.
 */
public interface CanvasTransformer {

    /**
     * Transform canvas.
     *
     * @param canvas the canvas
     * @param percentOpen the percent open
     */
    public void transformCanvas(Canvas canvas, float percentOpen);
}

I have put the code on Github so that if anyone is able to help me out that would be much appreciated! https://github.com/superlogical/SlidingMenuMonodroid

Here is the code in my project that needs the SetBehindCanvasTransformer method:

using Android.OS;
using SlidingMenuBinding.Lib;
using SlidingMenuBinding.Lib.App;
using SlidingMenuDemo.Fragments;

namespace SlidingMenuDemo.Animation
{
  public abstract class CustomAnimation : BaseActivity
  {
    private SlidingMenu.ICanvasTransformer transformer;

    protected CustomAnimation(int titleRes, SlidingMenu.ICanvasTransformer transformer) : base(titleRes)
    {
      this.transformer = transformer;
    }

    public override void OnCreate(Bundle savedInstanceState)
    {
      base.OnCreate(savedInstanceState);

      // set the above view
      SetContentView(Resource.Layout.content_frame);
      SupportFragmentManager.BeginTransaction()
        .Replace(Resource.Id.content_frame, new SampleListFragment())
        .Commit();

      SlidingMenu sm = SlidingMenu;
      SetSlidingActionBarEnabled(true);
      sm.BehindScrollScale = 0.0f;
      sm.SetBehindCanvasTransformer(this.transformer); // This doesn't work as it is missing from the binding
    }
  }
}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>