Files
EasyPlayerPro-Android/EasyPlayerPro/src/main/java/org/easydarwin/easyplayer/SettingsActivity.java
2025-12-10 23:03:26 +08:00

65 lines
2.1 KiB
Java

package org.easydarwin.easyplayer;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import org.easydarwin.easyplayer.databinding.ActivitySettingBinding;
import org.easydarwin.easyplayer.util.SPUtil;
/**
* 设置页
*/
public class SettingsActivity extends AppCompatActivity {
private ActivitySettingBinding mBinding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_setting);
setSupportActionBar(mBinding.toolbar);
mBinding.toolbarBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mBinding.udpSwitch.setChecked(SPUtil.getUDPMode(this));
mBinding.codecSwitch.setChecked(SPUtil.getMediaCodec(this));
mBinding.udpSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SPUtil.setUDPMode(SettingsActivity.this, isChecked);
}
});
mBinding.codecSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
SPUtil.setMediaCodec(SettingsActivity.this, isChecked);
}
});
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
}
}