// Path: playerSDK/src/main/java/com/kaltura/playersdk/casting/KCastDevice.java
// public class KCastDevice {
//     private String routerName;
//     private String modelName;
//     private String deviceVersion;
//     private String routerId;
// 
//     public KCastDevice(MediaRouter.RouteInfo info) {
//         routerName = info.getName();
//         routerId = info.getId();
//     }
// 
//     public KCastDevice(CastDevice castDevice) {
//         routerName = castDevice.getFriendlyName();
//         modelName = castDevice.getModelName();
//         deviceVersion = castDevice.getDeviceVersion();
//         routerId = castDevice.getDeviceId();
//     }
// 
//     public String getRouterName() {
//         return routerName;
//     }
// 
//     public void setRouterName(String routerName) {
//         this.routerName = routerName;
//     }
// 
//     public String getRouterId() {
//         return routerId;
//     }
// 
//     public void setRouterId(String routerId) {
//         this.routerId = routerId;
//     }
// 
//     public String getModelName() {
//         return modelName;
//     }
// 
//     public void setModelName(String modelName) {
//         this.modelName = modelName;
//     }
// 
//     public String getDeviceVersion() {
//         return deviceVersion;
//     }
// 
//     public void setDeviceVersion(String deviceVersion) {
//         this.deviceVersion = deviceVersion;
//     }
// 
//     @Override
//     public String toString() {
//         return routerName;
//     }
// }


import android.app.Dialog;
import android.content.Context;
import android.text.Html;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.kaltura.playersdk.casting.KCastDevice;
import java.util.ArrayList;
package com.kaltura.kalturaplayertoolkit;




/**
 * Created by nissimpardo on 10/11/15.
 */
public class CastDetectedDevicesDialog extends Dialog {
    private ArrayList<KCastDevice> mRouteNames;
    private ArrayAdapter<KCastDevice> mAdapter;

    public interface CastDetectedDevicesDialogListener {
        public void disconnect();
        public void routeSelected(String castDeviceId);
    }

    public CastDetectedDevicesDialog(Context context, final CastDetectedDevicesDialogListener listener) {
        super(context);
        setContentView(R.layout.media_routers);
        setTitle(Html.fromHtml("<font color='#0db6d1'>Connect to Device</font>"));
        mRouteNames = new ArrayList<KCastDevice>();
        final ListView routeListView = (ListView)findViewById(R.id.listview);
        mAdapter = new ArrayAdapter<KCastDevice>(context, android.R.layout.simple_list_item_1, mRouteNames);
        routeListView.setAdapter(mAdapter);
        routeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (mAdapter.getItem(position).getRouterName().equals("Disconnect")) {
                    listener.disconnect();
// Path: playerSDK/src/main/java/com/kaltura/playersdk/casting/KCastDevice.java
// public class KCastDevice {
//     private String routerName;
//     private String modelName;
//     private String deviceVersion;
//     private String routerId;
// 
//     public KCastDevice(MediaRouter.RouteInfo info) {
//         routerName = info.getName();
//         routerId = info.getId();
//     }
// 
//     public KCastDevice(CastDevice castDevice) {
//         routerName = castDevice.getFriendlyName();
//         modelName = castDevice.getModelName();
//         deviceVersion = castDevice.getDeviceVersion();
//         routerId = castDevice.getDeviceId();
//     }
// 
//     public String getRouterName() {
//         return routerName;
//     }
// 
//     public void setRouterName(String routerName) {
//         this.routerName = routerName;
//     }
// 
//     public String getRouterId() {
//         return routerId;
//     }
// 
//     public void setRouterId(String routerId) {
//         this.routerId = routerId;
//     }
// 
//     public String getModelName() {
//         return modelName;
//     }
// 
//     public void setModelName(String modelName) {
//         this.modelName = modelName;
//     }
// 
//     public String getDeviceVersion() {
//         return deviceVersion;
//     }
// 
//     public void setDeviceVersion(String deviceVersion) {
//         this.deviceVersion = deviceVersion;
//     }
// 
//     @Override
//     public String toString() {
//         return routerName;
//     }
// }


// Path: kalturaPlay/src/main/java/com/kaltura/kalturaplayertoolkit/CastDetectedDevicesDialog.java
import android.app.Dialog;
import android.content.Context;
import android.text.Html;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.kaltura.playersdk.casting.KCastDevice;
import java.util.ArrayList;

package com.kaltura.kalturaplayertoolkit;




/**
 * Created by nissimpardo on 10/11/15.
 */
public class CastDetectedDevicesDialog extends Dialog {
    private ArrayList<KCastDevice> mRouteNames;
    private ArrayAdapter<KCastDevice> mAdapter;

    public interface CastDetectedDevicesDialogListener {
        public void disconnect();
        public void routeSelected(String castDeviceId);
    }

    public CastDetectedDevicesDialog(Context context, final CastDetectedDevicesDialogListener listener) {
        super(context);
        setContentView(R.layout.media_routers);
        setTitle(Html.fromHtml("<font color='#0db6d1'>Connect to Device</font>"));
        mRouteNames = new ArrayList<KCastDevice>();
        final ListView routeListView = (ListView)findViewById(R.id.listview);
        mAdapter = new ArrayAdapter<KCastDevice>(context, android.R.layout.simple_list_item_1, mRouteNames);
        routeListView.setAdapter(mAdapter);
        routeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (mAdapter.getItem(position).getRouterName().equals("Disconnect")) {
                    listener.disconnect();
                } else {