package com.gs.apidemo;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.gs.core.light.GsLightsManager;

public class LedActivity extends BaseActivity implements View.OnClickListener {
    private static final String TAG = "TalkingActivity";
    private TextView mStatusTv;
    private Button mRedLedBtn, mGreenLedBtn, mBlueLedBtn, mCloseLedBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_led);
        mStatusTv = (TextView) findViewById(R.id.tv_line_status);

        mRedLedBtn = (Button) findViewById(R.id.btn_red_led);
        mRedLedBtn.setOnClickListener(this);
        mGreenLedBtn = (Button) findViewById(R.id.btn_green_led);
        mGreenLedBtn.setOnClickListener(this);
        mBlueLedBtn = (Button) findViewById(R.id.btn_blue_led);
        mBlueLedBtn.setOnClickListener(this);
        mCloseLedBtn = (Button) findViewById(R.id.btn_close_led);
        mCloseLedBtn.setOnClickListener(this);
    }

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

    @Override
    public void onClick(View v) {
        int shineType = GsLightsManager.KEEPING_SHOW;
        if (R.id.btn_red_led == v.getId()) {
            GsLightsManager.instance().closeCustom();
            GsLightsManager.instance().openCustom(GsLightsManager.COLOR_RED, shineType);
        } else if (R.id.btn_green_led == v.getId()) {
            GsLightsManager.instance().closeCustom();
            GsLightsManager.instance().openCustom(GsLightsManager.COLOR_GREEN, shineType);
        } else if (R.id.btn_blue_led == v.getId()) {
            GsLightsManager.instance().closeCustom();
            GsLightsManager.instance().openCustom(GsLightsManager.COLOR_BLUE, shineType);
        } else if (R.id.btn_close_led == v.getId()) {
            GsLightsManager.instance().closeCustom();
        }
    }
}
