package com.ibm.mil.cafejava.sample;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.ibm.mil.cafejava.CafeJava;
import com.worklight.wlclient.api.WLResponse;

import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final ProgressDialog dialog = new ProgressDialog(this);
        dialog.show();

        new CafeJava()
                .createConnectionObservable(this)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<WLResponse>() {
                    @Override public void call(WLResponse wlResponse) {
                        dialog.cancel();
                        Toast.makeText(MainActivity.this, "Connected to Worklight", Toast.LENGTH_SHORT).show();
                    }
                }, new Action1<Throwable>() {
                    @Override public void call(Throwable throwable) {
                        dialog.cancel();
                        Toast.makeText(MainActivity.this, throwable.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

@@ -1,8 +1,114 @@
+/*%0A * Licensed Materials - Property of IBM%0A * %C2%A9 Copyright IBM Corporation 2015. All Rights Reserved.%0A */%0A%0A
 package 
@@ -476,17 +476,16 @@
 tion1;%0A%0A
-%0A
 public c

Add copyright header to sample source file