Oxidizer doesn't seem to import correctly

I’m trying to convert this little bit of code:

mWebView.setWebChromeClient(new WebChromeClient()
        {   public void onProgressChanged(WebView wView, int progress)
            {   myActivity.setProgress(progress * 1000);
            }
        }

where mWebView is a member variable of the class

mWebView: android.webkit.WebView;

and MyActivity is also member variable of the class, but an Activity.

Oxidizer imports this as:

  mWebView.setWebChromeClient(new WebChromeClient(new class (onProgressChanged := method  begin
    myActivity.setProgress(progress * 1000);
  end)));

When I try to compile (latest beta), I get:

Error (E63) Type mismatch

I’ve tried a myriad of other ways to try and accomplish this.

Also a related question. Are there sample Android apps in Oxygene that exercise these sorts of Android features? I’ve tried, but my google-fu has failed me.

Update. I’ve also tried some things like this:

method ActivityHelp.onProgressChangedMine(view: WebView; newProgress: Integer);
begin
	myActivity.setProgress(newProgress * 1000);
end;

…snip…

method ActivityHelp.LoadWebPage();
var myWebChromeClient: WebChromeClient;
begin

…snip…
myWebChromeClient := new WebChromeClient();
myWebChromeClient.onProgressChanged += @(onProgressChangedMine(mWebView, mProgress));
mWebView.setWebChromeClient(myWebChromeClient);

and various variations on trying to assign the onProgressChangedMine function to .onProgressChanged… Depending on the variation, I get No matching overload, or variable expected, etc.

I don’t mind doing this the ‘hard way’ (rather than anonymous methods), but I want to move this code over. I built this shell code in Android Studio (tested, debugged there) and I’m just trying to replicate the code here in Oxygene.

If I try moving in larger chunks of Java using Oxidizer, I get “Error converting Java to Oxygene: Value cannot be null. Parameter name: statement”.

Hi, my colleague will reply to the oxidizer parts but:

Isn’t valid. The original java code is really a subclass of WebChromeClient. Something like:

mWebView.WebChromeClient := new class WebChromeClient(onProgressChanged := method(wv: WebView; process: Integer)  begin
    myActivity.setProgress(progress * 1000);
  end)));

Should work better.

Thanks, logged as bugs://75291

Hello! Could you, please, send this code where you get NRE.

Thanks in advance!

bugs://75291 got closed with status fixed.

That worked great, though I didn’t need but one closing paren:

mWebView.WebChromeClient := new class WebChromeClient(onProgressChanged := method(wv: WebView; progress: Integer)  begin
    myActivity.setProgress(progress * 1000);
  end);

Thank you.

I get that different ways. I have this as whole file I’m trying to import from java to Oxygene.

package com.accordancebible.framework;

import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.internal.view.menu.ActionMenuItemView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;

import java.util.ArrayList;

public class ColorizeTheToolBar
{
    static public void colorizeToolBarItem(AppCompatActivity myActivity, final String description, boolean bIsBlue)
    {   int theColor;
        if (bIsBlue)
            theColor = myActivity.getResources().getColor(R.color.colorAccent);
        else
            theColor = myActivity.getResources().getColor(R.color.colorGreyToolbarIcons);
        final ViewGroup decorView = (ViewGroup) myActivity.getWindow().getDecorView();
        final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
        final String myOverflowDescription = myActivity.getString(R.string.overflow_image);
        final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(theColor, PorterDuff.Mode.SRC_ATOP);
        viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
        {   @Override
            public void onGlobalLayout()
            {   final ArrayList<View> outViews = new ArrayList<>();
                decorView.findViewsWithText(outViews, description, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
                if (outViews.isEmpty())
                    return;
                if (description == myOverflowDescription)
                {   ImageView overflow = (ImageView) outViews.get(0);
                    overflow.setColorFilter(colorFilter);
                }
                else
                {   ActionMenuItemView overflow = (ActionMenuItemView) outViews.get(0);
                    overflow.getCompoundDrawables()[0].setColorFilter(colorFilter);
                }
                removeOnGlobalLayoutListener(decorView, this);
            }
        });
    }

    private static void removeOnGlobalLayoutListener(View myView, ViewTreeObserver.OnGlobalLayoutListener myListener)
    {   if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
            myView.getViewTreeObserver().removeGlobalOnLayoutListener(myListener);
        else
            myView.getViewTreeObserver().removeOnGlobalLayoutListener(myListener);
    }

}

I get: Value cannot be null. Parameter name: value

Or, if I try to paste in these three functions from a different file (my original question):

 @Override
    protected void onCreate(Bundle savedInstanceState)
    {   getWindow().requestFeature(Window.FEATURE_PROGRESS);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_activity_help);
        mWebView = (WebView) findViewById(R.id.helpWebView);
        LoadWebPage();
    }

    public void LoadWebPage()
    {   mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setBuiltInZoomControls(true);
        mWebView.getSettings().setDisplayZoomControls(false);
        final Activity myActivity = this;
        mWebView.setWebChromeClient(new WebChromeClient()
        {   public void onProgressChanged(WebView wView, int progress)
            {   myActivity.setProgress(progress * 1000);
            }
        }
        );
        mWebView.setWebViewClient(new WebViewClient()
        {   public void onReceivedError(WebView wView, int errorCode, String description, String failingUrl)
            {   Toast.makeText(myActivity, description, Toast.LENGTH_LONG).show();
            }
        }
        );
        mWebView.loadUrl("http://accordancefiles2.com/helpfiles/Mobile2/Advanced/Default.htm");
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {   if (event.getAction() == KeyEvent.ACTION_DOWN)
        {   switch (keyCode)
            {   case KeyEvent.KEYCODE_BACK:
                    if (mWebView.canGoBack())
                        mWebView.goBack();
                    else
                        finish();
                    return true;
            }
        }
        return super.onKeyDown(keyCode, event);
    }

I get: Error converting Java to Oxygene: Value cannot be null. Parameter name: statement

If you want more sample code to try and import, I emailed ck a dropbox link to the Android Studio project I’m trying to move over into Oxygene. Honestly, I’d rather the java to Oxygene file import work, rather than use Oxidizer on a cut and paste basis.

In addition, I’m having trouble getting my imported layouts to be recognized. I’ve tried adding as existing item, as well as creating a new layout and pasting in the code. I’m getting ‘No such static member’ on both of:

ContentView := com.accordancebible.accordance.R.layout.activity_activity_help; 
mWebView = android.webkit.WebView(findViewById(com.accordancebible.accordance.R.id.helpWebView));

and Intellisense doesn’t pick up the new file under R.layout.

And the file is named (although I’ve tried variations) activity_activity_help.layout-xml.

I tried cleaning the solution, and deleting R.java and R.pas, rebuilding solution, etc., with no improvement.

It must be something I’m just not seeing.

I think I hit something like this months ago and got around it, but I can’t remember why.

Thanks, logged as bugs://75311

Just for my planning, are all those bugs? The failed file import, the failed paste AND the No such static member on the R class?

If I’m doing something wrong (particularly on the R class issue), I’d like to get that fixed and move forward on that end.

we’re investigating now (got your mail too, will reply later when I know more)

Thanks, logged as bugs://75343

bugs://75343 got closed with status fixed.

bugs://75311 got closed with status fixed.

Will these fixes be on the next beta–and if so, when will that be available?

The fix will be available in the next build today evening.

OK, Good.

I’m not seeing a new beta as of this morning.

I see “RemObjects Elements - 8.3.94.2001.exe [Branch: beta] — Fri, May 27, 2016”. is your subscription still active?

It should be active. I can go here:

https://secure.remobjects.com/portal/downloads/

but all I see is:

Elements (Oxygene, C# and Silver for all three platforms)
RemObjects Elements - 8.3.93.1987.exe [May 2016 Update Release] — Tue, May 3, 2016

and my Everwood screens says:

‘Up to date’ in green, and Oxygene for Java says 8.3.93.1987

I hit ‘Refresh’ with no change.

If I go to the License manager, I see (among other things) Oxygene Java Type=Full Beta=True, Subscription End Date 2016-09-21.

Anything else I should check?