// Path: app/src/main/java/wseemann/media/romote/utils/CommandHelper.java
// public class CommandHelper {
// 
//     private CommandHelper() {
// 
//     }
// 
//     public static String getDeviceURL(Context context) {
//         String url = "";
// 
//         try {
//             Device device = PreferenceUtils.getConnectedDevice(context);
// 
//             url = device.getHost();
//         } catch (Exception ex) {
//         }
// 
//         return url;
//     }
// 
//     public static String getIconURL(Context context, String channelId) {
//         String url = "";
// 
//         try {
//             Device device = PreferenceUtils.getConnectedDevice(context);
// 
//             url = device.getHost() + "/query/icon/" + channelId;
//         } catch (Exception ex) {
//         }
// 
//         return url;
//     }
// 
//     public static String getDeviceInfoURL(Context context, String host) {
//         String url = host;
// 
//         return url;
//     }
// 
//     public static String getConnectedDeviceInfoURL(Context context, String host) {
//         String url = "";
// 
//         try {
//             Device device = PreferenceUtils.getConnectedDevice(context);
// 
//             url = device.getHost();
//         } catch (Exception ex) {
//         }
// 
//         return url;
//     }
// }


import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
import wseemann.media.romote.R;
import wseemann.media.romote.utils.CommandHelper;
package wseemann.media.romote.fragment;




/**
 * Created by wseemann on 6/20/16.
 */
public class InstallChannelDialog extends DialogFragment {

    private String mChannelCode;

    private static InstallChannelListener mListener;

    public static InstallChannelDialog getInstance(Activity activity, String channelCode) {
        try {
            // Instantiate the InstallChannelListener so we can send events with it
            mListener = (InstallChannelListener) activity;
        } catch (ClassCastException e) {
            // The activity doesn't implement the interface, throw exception
            throw new ClassCastException(activity.toString()
                    + " must implement InstallChannelListener");
        }

        InstallChannelDialog fragment = new InstallChannelDialog();

        Bundle args = new Bundle();
        args.putString("channel_code", channelCode);
        fragment.setArguments(args);

        return fragment;
    }

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

        setCancelable(false);

        mChannelCode = getArguments().getString("channel_code");
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.fragment_install_channel, null);
        ImageView imageView = (ImageView) view.findViewById(android.R.id.icon);

        Picasso.with(getActivity())
// Path: app/src/main/java/wseemann/media/romote/utils/CommandHelper.java
// public class CommandHelper {
// 
//     private CommandHelper() {
// 
//     }
// 
//     public static String getDeviceURL(Context context) {
//         String url = "";
// 
//         try {
//             Device device = PreferenceUtils.getConnectedDevice(context);
// 
//             url = device.getHost();
//         } catch (Exception ex) {
//         }
// 
//         return url;
//     }
// 
//     public static String getIconURL(Context context, String channelId) {
//         String url = "";
// 
//         try {
//             Device device = PreferenceUtils.getConnectedDevice(context);
// 
//             url = device.getHost() + "/query/icon/" + channelId;
//         } catch (Exception ex) {
//         }
// 
//         return url;
//     }
// 
//     public static String getDeviceInfoURL(Context context, String host) {
//         String url = host;
// 
//         return url;
//     }
// 
//     public static String getConnectedDeviceInfoURL(Context context, String host) {
//         String url = "";
// 
//         try {
//             Device device = PreferenceUtils.getConnectedDevice(context);
// 
//             url = device.getHost();
//         } catch (Exception ex) {
//         }
// 
//         return url;
//     }
// }


// Path: app/src/main/java/wseemann/media/romote/fragment/InstallChannelDialog.java
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
import wseemann.media.romote.R;
import wseemann.media.romote.utils.CommandHelper;

package wseemann.media.romote.fragment;




/**
 * Created by wseemann on 6/20/16.
 */
public class InstallChannelDialog extends DialogFragment {

    private String mChannelCode;

    private static InstallChannelListener mListener;

    public static InstallChannelDialog getInstance(Activity activity, String channelCode) {
        try {
            // Instantiate the InstallChannelListener so we can send events with it
            mListener = (InstallChannelListener) activity;
        } catch (ClassCastException e) {
            // The activity doesn't implement the interface, throw exception
            throw new ClassCastException(activity.toString()
                    + " must implement InstallChannelListener");
        }

        InstallChannelDialog fragment = new InstallChannelDialog();

        Bundle args = new Bundle();
        args.putString("channel_code", channelCode);
        fragment.setArguments(args);

        return fragment;
    }

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

        setCancelable(false);

        mChannelCode = getArguments().getString("channel_code");
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.fragment_install_channel, null);
        ImageView imageView = (ImageView) view.findViewById(android.R.id.icon);

        Picasso.with(getActivity())
                .load(CommandHelper.getIconURL(getActivity(), mChannelCode))