package com.lc.myapplication.security.mysoundstwo.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.lc.myapplication.security.mysoundstwo.R;

public class SettingActivity extends AppCompatActivity {
    private RelativeLayout set_pravicy;
    private RelativeLayout main_setting;
    private RelativeLayout set_share;
    private RelativeLayout set_grade;
    private RelativeLayout set_version;
    private ImageView image_back;
    private TextView set_title;
    private WebView webView;
    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        main_setting = findViewById(R.id.main_setting);
        setbackground();
        set_title = findViewById(R.id.set_title);
        set_title.setTypeface(Typeface.createFromAsset(getAssets(),"myfront1.ttf"));
        set_pravicy = findViewById(R.id.set_privacy);
        set_share = findViewById(R.id.set_share);
        set_grade = findViewById(R.id.set_grade);
        set_version = findViewById(R.id.set_version);
        image_back = findViewById(R.id.image_back);
        image_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        set_pravicy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SettingActivity.this,PracyActivity.class);
                startActivity(intent);
            }
        });
        set_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareAPP();
            }
        });
        set_version.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(SettingActivity.this,getString(R.string.app_version)+"V1.0.0",Toast.LENGTH_LONG).show();
            }
        });
        set_grade.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String url = getString(R.string.share_app);
                Intent intent2 = new Intent(Intent.ACTION_VIEW);
                intent2.setData(Uri.parse(url));
                startActivity(intent2);
            }
        });
    }
    private void setbackground() {
        Window window = getWindow();
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        main_setting.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }
    public void shareAPP() {
        Intent sharedIntent = new Intent();
        sharedIntent.setAction(Intent.ACTION_SEND);
        sharedIntent.setType("text/*");
        sharedIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_app));    //设置要分享的内容
        startActivity(Intent.createChooser(sharedIntent, "Share"));
    }
}