package epson.maintain.activity;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import epson.common.Utils;
import epson.print.CommonDefine;
import epson.print.CustomLayoutDialogFragment;
import epson.print.R;

public class PrinterNotFoundDialogCreator {
    public static CustomLayoutDialogFragment getPrinterNotFoundDialog(Context context, boolean z, int i) {
        String str;
        if (z) {
            str = context.getString(R.string.EPS_PRNERR_COMM1_NOWIFI);
        } else if (Utils.getPrefBoolean(context, "PrintSetting", CommonDefine.RE_SEARCH)) {
            String ssid = Utils.getSSID(context);
            if (!Utils.isConnectedWifi(context) || ssid == null) {
                return CustomLayoutDialogFragment.newInstance(i, context.getString(R.string.EPS_PRNERR_COMM4), R.string.EPS_ERR_PRINTER_NOT_FOUND_TITLE, 0, R.string.str_btn_close);
            }
            str = context.getString(R.string.EPS_ERR_PRINTER_NOT_FOUND_RESEARCH2, new Object[]{ssid});
        } else {
            str = context.getString(R.string.EPS_PRNERR_COMM1);
        }
        return CustomLayoutDialogFragment.newInstance(i, str + "\n\n" + context.getString(R.string.confirm_browse_wlan_setup_info), R.string.EPS_ERR_PRINTER_NOT_FOUND_TITLE, R.string.browse_site, R.string.str_btn_close);
    }

    public static Intent getStartIntent(Context context) {
        return new Intent("android.intent.action.VIEW", Uri.parse(context.getString(R.string.printer_not_found_guidance_url)));
    }
}
