package kr.co.icontrols.iotplatform;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import kr.co.icontrols.iotplatform.DataClass.UserInfo;
import kr.co.icontrols.iotplatform.utils.SharedPrefUtil;

import static kr.co.icontrols.iotplatform.utils.Constants.RESULT_INIT_APP_CONFIRM;

public class SettingActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
    }

    @Override
    protected void onResume() {
        super.onResume();
        if(UserInfo.pushAccess/*SharedPrefUtil.getBoolean(SharedPrefUtil.NOTI_ALL,SharedPrefUtil.DEFAULT_NOTI_ALL)*/) {
            ((TextView)findViewById(R.id.txtAlarmOnOff)).setText(getString(R.string.on));
        } else {
            ((TextView)findViewById(R.id.txtAlarmOnOff)).setText(getString(R.string.off));
        }
    }

    @Override
    public void onClick(View v) {
        /*
        final View fv = v;
        fv.setEnabled(false);
        Timer buttonTimer = new Timer();
        buttonTimer.schedule(new TimerTask() {
            @Override
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            fv.setEnabled(true);
                        } catch (Exception e) {
                            e.printStackTrace();
                        } finally {

                        }
                    }
                });
            }
        }, 500);
        */

        switch (v.getId()) {
            case R.id.btnAlarmSetting:
                startActivity(new Intent(this, AlarmSettingActivity.class));
                break;
            case R.id.btnAppInfo:
                startActivity(new Intent(this, AppInfoActivity.class));
                break;
            case R.id.btnBack:
                onBackPressed();
                break;
        }
    }
}