package com.hdl.photovoltaic.ui.me;
|
|
|
import android.annotation.SuppressLint;
|
import android.os.Bundle;
|
import android.view.View;
|
|
import com.hdl.photovoltaic.R;
|
import com.hdl.photovoltaic.base.CustomBaseActivity;
|
import com.hdl.photovoltaic.config.UserConfigManage;
|
import com.hdl.photovoltaic.databinding.ActivityWebBinding;
|
import com.hdl.photovoltaic.utils.LocalManageUtil;
|
|
/**
|
* 《服务协议》和《隐私协议》界面
|
*/
|
public class WebActivity extends CustomBaseActivity {
|
|
|
private ActivityWebBinding viewBinding;
|
|
public static final int ServiceAgreement = 0;
|
public static final int PrivacyAgreement = 1;
|
|
/**
|
* 0,表示服务协议
|
* 1,表示隐私协议
|
*/
|
private int typeIntValue;
|
|
@Override
|
public Object getContentView() {
|
viewBinding = ActivityWebBinding.inflate(getLayoutInflater());
|
return viewBinding.getRoot();
|
}
|
|
@Override
|
public void onBindView(Bundle savedInstanceState) {
|
setStatusBarTranslucent();
|
getWindow().setNavigationBarColor(getColor(R.color.text_FF000000));
|
this.typeIntValue = getIntent().getIntExtra("type", 0);
|
//初始化
|
initView();
|
//初始化界面监听器
|
initEvent();
|
}
|
|
private void initEvent() {
|
viewBinding.toolbarTopRl.topBackLl.setOnClickListener(new View.OnClickListener() {
|
@Override
|
public void onClick(View view) {
|
finish();
|
}
|
});
|
}
|
|
@SuppressLint("SetJavaScriptEnabled")
|
private void initView() {
|
viewBinding.contentView.getSettings().setJavaScriptEnabled(true);
|
//xml里面设置背景无效
|
viewBinding.contentView.setBackgroundColor(getColor(R.color.text_FF000000));
|
if (this.typeIntValue == 0) {
|
viewBinding.toolbarTopRl.topTitleTv.setText(R.string.app_service_agreement);
|
} else {
|
viewBinding.toolbarTopRl.topTitleTv.setText(R.string.app_privacy_policy);
|
}
|
viewBinding.toolbarTopRl.topBackLl.setVisibility(View.VISIBLE);
|
|
if (UserConfigManage.getInstance().getCurrentAppLanguage().equals(LocalManageUtil.zh)) {
|
//中文
|
if (this.typeIntValue == 0) {
|
//用户协议 https://nearest.hdlcontrol.com
|
viewBinding.contentView.loadUrl("https://common.hdlcontrol.com/common-h5/#/pages/greenEnergyAgreement/userAgreement");
|
} else {
|
//隐私协议
|
viewBinding.contentView.loadUrl("https://common.hdlcontrol.com/common-h5/#/pages/greenEnergyAgreement/privacyAgreement");
|
}
|
} else {
|
//英文
|
if (this.typeIntValue == 0) {
|
//用户协议
|
viewBinding.contentView.loadUrl("https://common.hdlcontrol.com/common-h5/#/pages/greenEnergyAgreement/userAgreementEn");
|
} else {
|
//隐私协议
|
viewBinding.contentView.loadUrl("https://common.hdlcontrol.com/common-h5/#/pages/greenEnergyAgreement/privacyAgreementEn");
|
}
|
}
|
|
}
|
}
|