package com.example.rxappvisibility;

import android.app.Application;
import android.widget.Toast;

import com.gramboid.rxappvisibility.AppVisibilityProvider;

import rx.functions.Action1;

public class App extends Application {

    private AppVisibilityProvider visibilityProvider;

    AppVisibilityProvider getVisibilityProvider() {
        return visibilityProvider;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        visibilityProvider = new AppVisibilityProvider(this);
        visibilityProvider
                .getAppVisibility()
                .subscribe(new Action1<Boolean>() {
                    @Override
                    public void call(Boolean visible) {
                        Toast.makeText(App.this, visible ? "App visible" : "App hidden", Toast.LENGTH_SHORT).show();
                    }
                });
    }
}

@@ -282,102 +282,8 @@
 r;%0A%0A
-    AppVisibilityProvider getVisibilityProvider() %7B%0A        return visibilityProvider;%0A    %7D%0A%0A
     

Tidy up