package com.x1unix.avi;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Point;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Display;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * An example full-screen activity that shows and hides the system UI (i.e.
 * status bar and navigation/system bar) with user interaction.
 */
public class MoviePlayerActivity extends AppCompatActivity {

    private WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_movie_player);

        webView = (WebView) findViewById(R.id.webplayer);

        Intent receivedIntent = getIntent();

        // Load player with intent data
        if (receivedIntent != null) {
            loadPlayer(receivedIntent.getStringExtra("movieId"),
                    receivedIntent.getStringExtra("movieTitle"));
        }
    }

    private void loadPlayer(String kpId, String title) {
        setTitle(title);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return true;

            }
        });

        Point size = getDisplaySize();

        webView.loadUrl("http://sandbx.ml/?kpid=" + kpId + "&h=" + size.y + "&w="+ size.x);
    }

    private Point getDisplaySize() {
        Display display = getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        return size;
    }
}

@@ -22,48 +22,8 @@
 i;%0A%0A
-import android.annotation.SuppressLint;%0A
 impo
@@ -196,16 +196,41 @@
 Bundle;%0A
+import android.util.Log;%0A
 import a
@@ -557,16 +557,61 @@
 webView;
+%0A    private String LSECTION = %22MoviePlayer%22;
 %0A%0A    @O
@@ -1244,24 +1244,25 @@
 bled(true);%0A
+%0A
         webV
@@ -1426,178 +1426,277 @@
     
-return true;%0A%0A            %7D%0A        %7D);%0A%0A        Point size = getDisplaySize();%0A%0A        webView.loadUrl(%22http://sandbx.ml/?kpid=%22 + kpId + %22&h=%22 + size.y + %22&w=%22+ size.x
+Log.w(LSECTION, %22Client has tried to redirect to '%22 + url + %22'%22);%0A                return false;%0A%0A            %7D%0A        %7D);%0A%0A        String movieUrl = %22http://sandbx.ml/?kpid=%22 + kpId;%0A        Log.i(LSECTION, %22Loading url: %22 + movieUrl);%0A        webView.loadUrl(movieUrl
 );%0A 
@@ -1693,32 +1693,33 @@
 vieUrl);%0A    %7D%0A%0A
+%0A
     private Poin

Move viewport sizing logic to backend