sakebook/Reachability

set content view in Reachability

Opened this issue · 3 comments

is it possible to set layout inside the Reachability. Meansi need to set layout instead of "R.drawable.tiles".is it possible?

Reachability can have ImageView. You can set ImageView layout and resource to Reachability.
You can use the setHoverView To set the ImageView.

// Create ImageView to use for Reachability
ImageView view = new ImageView(this);
view.setBackgroundResource(R.drawable.custom_button_selector); // for change state
view.setScaleType(ImageView.ScaleType.CENTER);

Reachability reachability = new Reachability(this);
reachability.setHoverView(view, R.drawable.back_pull, R.drawable.back_push); // for change image 
reachability.makeHoverView(Reachability.Position.CENTER);

Sample code. This has been used in the demo apk.
https://github.com/sakebook/Reachability/blob/master/demo/src/main/java/com/sakebook/android/sample/reachabilitysample/CustomAnimationActivity.java

is it possible to add activity_my.xml as reachability HoverView?

No, HoverView attached RootView. Can not support xml as HoverView.

But you can call switchBack.
switchBack as same as HoverView click.
You can use the Reachability anywhere.

        findViewById(R.id.some_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mReachability.switchBack();
            }
        });