package com.example.beijing_daxing;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

import com.example.beijing_daxing.databinding.ActivitySetingPowerBinding;
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
import com.example.beijing_daxing.vm.PowerData;

public class SetingPowerActivity extends AppCompatActivity {
    private PowerData powerData;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivitySetingPowerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_seting_power);
        powerData = new PowerData();
        powerData.setPowerIn( SharedPreferencesUtils.getInt("powerIn",0));
        powerData.setPowerOut( SharedPreferencesUtils.getInt("powerOut",0));
        powerData.setPowerStockCheck( SharedPreferencesUtils.getInt("powerStoreCheck",0));
        powerData.setPowerCheck( SharedPreferencesUtils.getInt("powerCheck",0));
        powerData.setPowerScrap( SharedPreferencesUtils.getInt("powerScrap",0));
        powerData.setPowerScrapIn( SharedPreferencesUtils.getInt("powerScrapIn",0));
        powerData.setPowerScrapOut( SharedPreferencesUtils.getInt("powerScrapOut",0));

        binding.setVm(powerData);

    }

    public void settingSeva(View view) {
        SharedPreferencesUtils.putInt("powerIn", powerData.getPowerIn());
        SharedPreferencesUtils.putInt("powerOut", powerData.getPowerOut());
        SharedPreferencesUtils.putInt("powerStoreCheck", powerData.getPowerStockCheck());
        SharedPreferencesUtils.putInt("powerCheck", powerData.getPowerCheck());
        SharedPreferencesUtils.putInt("powerScrap", powerData.getPowerScrap());
        SharedPreferencesUtils.putInt("powerScrapIn", powerData.getPowerScrapIn());
        SharedPreferencesUtils.putInt("powerScrapOut", powerData.getPowerScrapOut());

        finish();

    }
}