package epson.print.copy;

import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;

import epson.common.Utils;
import epson.print.MyPrinter;
import epson.print.R;
import epson.print.Util.EPLog;
import epson.print.copy.Component.ecopycomponent.ECopyComponent;
import epson.print.copy.Component.ecopycomponent.ECopyOptionContext;
import epson.print.copy.Component.ecopycomponent.ECopyOptionItem;
import epson.print.copy.Component.eremoteoperation.ERemoteDevice;
import epson.print.copy.Component.eremoteoperation.ERemoteOperation;
import epson.print.widgets.LongTapRepeatAdapter;

public class CopyActivity extends ActivityBase implements View.OnClickListener {
    private static final int CONNECTION_TIMEOUT = 30000;
    private static final int EPS_COMM_BID = 2;
    private static final int REQUEST_CODE_REPEAT_COPY = 12;
    private final int COMM_ERROR = 1;
    private final int PROBE_PRINTER = 0;
    private String TAG = "CopyActivty";
    private final int UPDATE_SETTING = 2;
    boolean bProbedPrinter = false;
    private int clearindex = 0;
    CopyProcess copyProcess;
    private boolean doClear = false;
    private ActivityBase.errorDialog errordialog;
    private String ipAdress;
    private RadioGroup mCopyTypeGroup;
    Handler mHandler = new Handler(new Handler.Callback() {
        public boolean handleMessage(Message message) {
            EPLog.i(TAG, "HandlerCallback");
            switch (message.what) {
                case 0:
                    EPLog.i(TAG, "PROBE_PRINTER");
                    CopyActivity copyActivity = CopyActivity.this;
                    ProbePrinter unused = copyActivity.task = new ProbePrinter();
                    task.execute(new Void[0]);
                    return true;
                case 1:
                    EPLog.i(TAG, "COMM_ERROR");
                    CopyActivity copyActivity2 = CopyActivity.this;
                    ActivityBase.errorDialog unused2 = copyActivity2.errordialog = new ActivityBase.errorDialog(copyActivity2);
                    errordialog.showErrorDialog(getString(R.string.EPS_PRNERR_COMM_TITLE), getString(R.string.EPS_PRNERR_COMM5), ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
                        public void onClose(ActivityBase.ClickButton clickButton) {
                            finish();
                        }
                    });
                    return true;
                case 2:
                    EPLog.i(TAG, "UPDATE_SETTING");
                    if (optionContext == null) {
                        fetchCopyOptionContext();
                        return true;
                    }
                    CopyActivity copyActivity3 = CopyActivity.this;
                    copyActivity3.optionContext = copyActivity3.copyComponent.getBindedCopyOptionContext();
                    copyComponent.bindCopyOptionContext(optionContext, optionListener);
                    CopyActivity copyActivity4 = CopyActivity.this;
                    copyActivity4.buildCopyOptions(copyActivity4.copyComponent.getCopyOptionItems());
                    return true;
                default:
                    return true;
            }
        }
    });
    private ViewGroup mLayout;
    private RadioButton mNormalCopyButton;
    private MaintainPrinter2 mPrinter;
    private RadioButton mRepeatCopyButton;
    ECopyComponent.ICopyOptionListener optionListener;
    ActivityBase.OptionItemChangedListener optionValueChangedListener;
    private ActivityBase.settingPreference presettings = new ActivityBase.settingPreference();
    private int printerLocation;
    ECopyComponent.ICopySystemSettings systemSettings;
    private ProbePrinter task;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        copyComponent.getRemoteOperationUUID(this);
        optionContext = null;
        mLayout = (ViewGroup) getLayoutInflater().inflate(R.layout.copy, (ViewGroup) null);
        setContentView((View) mLayout);
        setupUi();
        setActionBar((int) R.string.FunctionName_iPrint_Copy, true);
        if (mPrinter == null) {
            mPrinter = MaintainPrinter2.getInstance();
        }
        optionValueChangedListener = new ActivityBase.OptionItemChangedListener() {
            public void onOptionItemChanged(ECopyOptionItem eCopyOptionItem) {
                copyComponent.setCopyOptionItem(eCopyOptionItem);
            }
        };
        optionListener = new ECopyComponent.ICopyOptionListener() {
            public void onCopyOptionChanged(ECopyOptionItem eCopyOptionItem, ArrayList<ECopyOptionItem> arrayList, ECopyComponent.ICopyOptionListener.CopyOptionChangedError copyOptionChangedError) {
                if (copyOptionChangedError != null) {
                    loading.dismiss();
                    CopyActivity copyActivity = CopyActivity.this;
                    ActivityBase.errorDialog errordialog = new ActivityBase.errorDialog(copyActivity);
                    String[] reasonText = errordialog.getReasonText(copyOptionChangedError);
                    errordialog.showErrorDialog(reasonText[0], reasonText[1]);
                    return;
                }
                ArrayList arrayList2 = new ArrayList();
                if (doClear) {
                    if (clearindex != copyComponent.getCopyOptionItems().size()) {
                        allClear();
                        return;
                    }
                    boolean unused = doClear = false;
                    int unused2 = clearindex = 0;
                    arrayList2.addAll(copyComponent.getCopyOptionItems());
                }
                arrayList2.add(eCopyOptionItem);
                if (arrayList != null) {
                    arrayList2.addAll(arrayList);
                }
                buildCopyOptions(arrayList2);
            }
        };
    }

    public void onResume() {
        EPLog.v(TAG, "onResume()");
        super.onResume();
        isKeepSimpleAPConnection = false;
        getPrinterInfo();
        CopyProcess copyProcess2 = copyProcess;
        if (copyProcess2 == null || !copyProcess2.isProccessing()) {
            if (!WiFiDirectManager.isNeedConnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER)) {
                isTryConnectSimpleAp = false;
            } else if (!isTryConnectSimpleAp) {
                isTryConnectSimpleAp = true;
                if (WiFiDirectManager.reconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, -1)) {
                    isKeepSimpleAPConnection = true;
                    bProbedPrinter = false;
                    return;
                }
            }
            loading.show();
            if (!bProbedPrinter) {
                mHandler.sendEmptyMessage(0);
            } else {
                mHandler.sendEmptyMessage(2);
            }
        } else {
            copyProcess.setDisconnectWifi(false);
        }
    }

    public void onPause() {
        EPLog.v(TAG, "onPause()");
        super.onPause();
        int i = printerLocation;
        if (i == 1 || i == 3) {
            ProbePrinter probePrinter = task;
            if (probePrinter != null) {
                probePrinter.cancel(true);
            }
            CopyProcess copyProcess2 = copyProcess;
            if (copyProcess2 != null && copyProcess2.isProccessing()) {
                copyProcess.setDisconnectWifi(true);
            } else if (!isKeepSimpleAPConnection) {
                WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
            }
        }
        if (isFinishing()) {
            deleteLongTapMessage();
        }
    }

    protected void onDestroy() {
        super.onDestroy();
    }

    protected void onActivityResult(int i, int i2, Intent intent) {
        if (i == 12) {
            if (i2 == -1) {
                finish();
            } else {
                mNormalCopyButton.setChecked(true);
            }
        }
    }

    private void setupUi() {
        findViewById(R.id.color).setOnClickListener(this);
        findViewById(R.id.scale).setOnClickListener(this);
        findViewById(R.id.paper_size).setOnClickListener(this);
        findViewById(R.id.paper_type).setOnClickListener(this);
        findViewById(R.id.paper_source).setOnClickListener(this);
        findViewById(R.id.document_type).setOnClickListener(this);
        findViewById(R.id.quality).setOnClickListener(this);
        findViewById(R.id.copy_setting_clear_all).setOnClickListener(this);
        findViewById(R.id.copy_button).setOnClickListener(this);
        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountUp));
        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountDown));
        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountUp));
        LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountDown));
        mCopyTypeGroup = (RadioGroup) findViewById(R.id.copy_type_group);
        mNormalCopyButton = (RadioButton) findViewById(R.id.normal_copy_tab);
        mNormalCopyButton.setChecked(true);
        mNormalCopyButton.setEnabled(false);
        mNormalCopyButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            }
        });
        mRepeatCopyButton = (RadioButton) findViewById(R.id.repeat_copy_tab);
        mRepeatCopyButton.setChecked(false);
        mNormalCopyButton.setEnabled(false);
        mRepeatCopyButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                if (z) {
                    switchToRepeatCopy();
                }
            }
        });
    }

    private void switchToRepeatCopy() {
        isKeepSimpleAPConnection = true;
        startActivityForResult(new Intent(this, epson.print.rpcopy.CopyActivity.class), 12);
    }

    public void onClick(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.color /*2131230930*/:
                intent.setClass(getBaseContext(), CopySettingActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.ColorEffectsType.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            case R.id.copy_button /*2131230948*/:
                String str = TAG;
                EPLog.i(str, "NOW_PRINTER:" + printerId);
                presettings.saveCopyOptions(copyComponent.getCopyOptionItems());
                copyProcess = new CopyProcess(this);
                copyProcess.startCopy(getApplicationContext());
                return;
            case R.id.copy_setting_clear_all /*2131230967*/:
                allClear();
                return;
            case R.id.document_type /*2131231000*/:
                intent.setClass(getBaseContext(), CopySettingActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.ScanContentType.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            case R.id.paper_size /*2131231306*/:
                intent.setClass(getBaseContext(), CopySettingActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            case R.id.paper_source /*2131231311*/:
                intent.setClass(getBaseContext(), CopySettingActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            case R.id.paper_type /*2131231314*/:
                intent.setClass(getBaseContext(), CopySettingActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaType.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            case R.id.quality /*2131231392*/:
                intent.setClass(getBaseContext(), CopySettingActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintQuality.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            case R.id.scale /*2131231441*/:
                intent.setClass(getBaseContext(), CopyScaleActivity.class);
                intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XScale.name());
                startActivityAndKeepSimpleAp(intent);
                return;
            default:
                return;
        }
    }

    private void startActivityAndKeepSimpleAp(Intent intent) {
        isKeepSimpleAPConnection = true;
        startActivity(intent);
    }

    private void allClear() {
        doClear = true;
        loading.show();
        ArrayList<ECopyOptionItem> copyOptionItems = copyComponent.getCopyOptionItems();
        int i = clearindex;
        clearindex = i + 1;
        ECopyOptionItem eCopyOptionItem = copyOptionItems.get(i);
        switch (eCopyOptionItem.getKey()) {
            case ColorEffectsType:
                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_Color);
                break;
            case ScanContentType:
                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ScanContentType_Mixed);
                break;
            case PrintMediaType:
                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_Stationery);
                break;
            case PrintMediaSize:
                if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.US.getLanguage()) && eCopyOptionItem.getSelectableChoices().contains(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter)) {
                    eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter);
                    break;
                } else {
                    eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_A4);
                    break;
                }
                break;
            case PrintMediaSource:
                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSource_Bottom);
                break;
            case PrintQuality:
                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintQuality_Normal);
                break;
            case XScale:
                eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit);
                break;
            case XDensity:
            case CopyMagnification:
            case Copies:
                eCopyOptionItem.selectValue(eCopyOptionItem.getDefaultValue());
                break;
        }
        copyComponent.setCopyOptionItem(eCopyOptionItem);
    }

    private void fetchCopyOptionContext() {
        copyComponent.createCopyOptionContext(copyType, new ECopyComponent.ICopyOptionContextListener() {
            public void onCopyOptionContextCreated(ECopyComponent.ECopyType eCopyType, ECopyOptionContext eCopyOptionContext, ECopyComponent.ICopyOptionContextListener.ContextCreationError contextCreationError) {
                CopyActivity copyActivity = CopyActivity.this;
                copyActivity.optionContext = eCopyOptionContext;
                if (contextCreationError == null) {
                    copyActivity.copyComponent.bindCopyOptionContext(optionContext, optionListener);
                    ArrayList<ECopyOptionItem> copyOptionItems = copyComponent.getCopyOptionItems();
                    if (ActivityBase.printerId.equalsIgnoreCase(presettings.loadPrePrinter())) {
                        presettings.setCopyOptions(copyOptionItems);
                    } else {
                        buildCopyOptions(copyOptionItems);
                    }
                } else {
                    ActivityBase.errorDialog unused = copyActivity.errordialog = new ActivityBase.errorDialog(copyActivity);
                    String[] reasonText = errordialog.getReasonText(contextCreationError);
                    errordialog.showErrorDialog(reasonText[0], reasonText[1], ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
                        public void onClose(ActivityBase.ClickButton clickButton) {
                            finish();
                        }
                    });
                }
            }
        });
    }

    private void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
        Iterator<ECopyOptionItem> it = arrayList.iterator();
        while (it.hasNext()) {
            ECopyOptionItem next = it.next();
            ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
            switch (key) {
                case ColorEffectsType:
                    String str = TAG;
                    EPLog.i(str, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_color_info, next);
                    break;
                case ScanContentType:
                    String str2 = TAG;
                    EPLog.i(str2, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_document_type_info, next);
                    break;
                case PrintMediaType:
                    String str3 = TAG;
                    EPLog.i(str3, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_paper_type_info, next);
                    break;
                case PrintMediaSize:
                    String str4 = TAG;
                    EPLog.i(str4, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_paper_size_info, next);
                    break;
                case PrintMediaSource:
                    String str5 = TAG;
                    EPLog.i(str5, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_paper_source_info, next);
                    break;
                case PrintQuality:
                    String str6 = TAG;
                    EPLog.i(str6, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_quality_info, next);
                    break;
                case XScale:
                    String str7 = TAG;
                    EPLog.i(str7, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
                    updateSetting(R.id.copy_scale_info, next);
                    break;
                case XDensity:
                    optionValueMap.put(key, new XDensityValue(next));
                    break;
                case CopyMagnification:
                    optionValueMap.put(key, new ActivityBase.CopyMagnificationValue(next));
                    break;
                case Copies:
                    optionValueMap.put(key, new CopiesValue(next));
                    break;
            }
            loading.dismiss();
        }
    }

    private void updateSetting(int i, ECopyOptionItem eCopyOptionItem) {
        TextView textView = (TextView) mLayout.findViewById(i);
        if (eCopyOptionItem.getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom) {
            textView.setText(getString(R.string.XScale_CustomSetting) + String.valueOf(((ActivityBase.NumberOptionValue) optionValueMap.get(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification)).value) + " %");
            return;
        }
        textView.setText(string(eCopyOptionItem.getSelectedChoice().name()));
    }

    class CopiesValue extends ActivityBase.NumberOptionValue {
        public CopiesValue(ECopyOptionItem eCopyOptionItem) {
            super();
            bindOption(R.id.SettingEditCopies, eCopyOptionItem);
            bindCountUp(R.id.SettingButonCopiesCountUp);
            bindCountDown(R.id.SettingButonCopiesCountDown);
            setOptionValueChangedListener(optionValueChangedListener);
        }
    }

    class XDensityValue extends ActivityBase.NumberOptionValue {
        ImageView image;
        TypedArray images = getResources().obtainTypedArray(R.array.density_images);

        public XDensityValue(ECopyOptionItem eCopyOptionItem) {
            super();
            bindOption(R.id.density_image, eCopyOptionItem);
            bindCountUp(R.id.SettingButonXDensityCountUp);
            bindCountDown(R.id.SettingButonXDensityCountDown);
            setOptionValueChangedListener(optionValueChangedListener);
        }

        private void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
            optionItem = eCopyOptionItem;
            value = eCopyOptionItem.getSelectedValue();
            image = (ImageView) findViewById(i);
            image.setImageDrawable(images.getDrawable(value + 4));
            image.setEnabled(eCopyOptionItem.isEnabled());
        }

        private void bindCountUp(int i) {
            countUp = (Button) findViewById(i);
            countUp.setOnClickListener(new CounterImage(1));
            if (value == optionItem.getMaximumValue()) {
                countUp.setEnabled(false);
            } else {
                countUp.setEnabled(true);
            }
        }

        private void bindCountDown(int i) {
            countDown = (Button) findViewById(i);
            countDown.setOnClickListener(new CounterImage(-1));
            if (value == optionItem.getMinimumValue()) {
                countDown.setEnabled(false);
            } else {
                countDown.setEnabled(true);
            }
        }

        class CounterImage extends ActivityBase.NumberOptionValue.Counter implements View.OnClickListener {
            public CounterImage(int i) {
                super(i);
            }

            private void updateImage(int i) {
                XDensityValue.value += i;
                XDensityValue.optionItem.selectValue(XDensityValue.value);
                if (XDensityValue.changedListener != null) {
                    XDensityValue.changedListener.onOptionItemChanged(XDensityValue.optionItem);
                }
            }

            public void onClick(View view) {
                updateImage(amount);
            }
        }
    }

    private void getPrinterInfo() {
        MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
        printerId = curPrinter.getPrinterId();
        printerIp = curPrinter.getIp();
        printerLocation = curPrinter.getLocation();
    }

    private class ProbePrinter extends AsyncTask<Void, Void, Boolean> {
        private volatile boolean mRepeatCopyAvailable;

        protected void onPreExecute() {
        }

        private ProbePrinter() {
        }

        protected Boolean doInBackground(Void... voidArr) {
            EPLog.i(TAG, "ProbePrinter doInBackground");
            mRepeatCopyAvailable = false;
            if ((printerLocation != 1 && printerLocation != 3) || ActivityBase.printerId == null) {
                return false;
            }
            mPrinter.doInitDriver(CopyActivity.this, 2);
            if (mPrinter.doProbePrinter(60, ActivityBase.printerId, ActivityBase.printerIp, printerLocation) != 0) {
                return false;
            }
            int doSetPrinter = mPrinter.doSetPrinter();
            String access$200 = TAG;
            EPLog.i(access$200, "Set Printer result: " + doSetPrinter);
            if (doSetPrinter != 0) {
                return false;
            }
            CopyActivity copyActivity = CopyActivity.this;
            String unused = copyActivity.ipAdress = copyActivity.mPrinter.doGetIp();
            String access$2002 = TAG;
            EPLog.i(access$2002, "IPAdress : " + ipAdress);
            CopyActivity copyActivity2 = CopyActivity.this;
            copyActivity2.bProbedPrinter = true;
            copyActivity2.systemSettings = new ECopyComponent.ICopySystemSettings() {
                public int getThickPaper() {
                    return 0;
                }

                public String getPrinterIPAddress() {
                    String access$200 = TAG;
                    EPLog.i(access$200, "getPrinterIPAddress : " + ipAdress);
                    return ipAdress;
                }
            };
            ECopyComponent sharedComponent = ECopyComponent.sharedComponent();
            sharedComponent.setSystemSettings(systemSettings);
            sharedComponent.setProperty(ECopyComponent.Property.RequestConnectionTimeout, CopyActivity.CONNECTION_TIMEOUT);
            mRepeatCopyAvailable = checkRepeatCopyFunction();
            return true;
        }

        protected void onCancelled() {
            EPLog.i(TAG, "ProbePrinter onCancelled");
            super.onCancelled();
            mPrinter.doCancelFindPrinter();
        }

        protected void onPostExecute(Boolean bool) {
            EPLog.i(TAG, "ProbePrinter onPostExecute");
            changeRepeatCopyButtonState(mRepeatCopyAvailable);
            if (bool.booleanValue()) {
                mHandler.sendEmptyMessage(2);
            } else {
                mHandler.sendEmptyMessage(1);
            }
        }
    }

    private boolean checkRepeatCopyFunction() {
        ERemoteDevice eRemoteDevice = new ERemoteDevice();
        eRemoteDevice.setHostIP(ipAdress);
        eRemoteDevice.setRequestConnectionTimeout(CONNECTION_TIMEOUT);
        ERemoteDevice.ERemoteDeviceFunctionsResult executeGetFunctionsCommand = eRemoteDevice.executeGetFunctionsCommand(Utils.getRemoteOperationUUID(getApplicationContext()));
        return executeGetFunctionsCommand.success() && executeGetFunctionsCommand.functions().contains(ERemoteOperation.ERemoteParam.repeat_copy);
    }

    private void changeRepeatCopyButtonState(boolean z) {
        int i;
        boolean z2 = false;
        if (z) {
            i = 0;
            z2 = true;
        } else {
            i = 8;
        }
        mCopyTypeGroup.setVisibility(i);
        mRepeatCopyButton.setEnabled(z2);
    }

    protected void deleteLongTapMessage() {
        MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
        findViewById(R.id.SettingButonCopiesCountUp).dispatchTouchEvent(obtain);
        findViewById(R.id.SettingButonCopiesCountDown).dispatchTouchEvent(obtain);
        findViewById(R.id.SettingButonXDensityCountUp).dispatchTouchEvent(obtain);
        findViewById(R.id.SettingButonXDensityCountDown).dispatchTouchEvent(obtain);
    }

    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        deleteLongTapMessage();
    }
}
