package com.xplora.xpsettings.Activity;

import android.os.Bundle;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.Toast;

import com.xplora.xpsettings.Data.DatabaseHelper;
import com.xplora.xpsettings.R;

public class AddWatchFaceActivity extends BaseActionActivity {
    EditText password;
    FrameLayout check;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wifi_login);
        password = findViewById(R.id.password);
        check = findViewById(R.id.check);
        check.setOnClickListener(view -> {
            addWatchFace(password.getText().toString());
        });
        password.requestFocus();
    }

    public void addWatchFace(String name) {
        int value = DatabaseHelper.addWatchFace(this, name);
        if (value <= 0) {
            Toast toast = Toast.makeText(this, "Failed!", Toast.LENGTH_SHORT);
            toast.show();
        } else {
            Toast toast = Toast.makeText(this, "Success!", Toast.LENGTH_SHORT);
            toast.show();
            finish();
        }
    }
}