导航菜单

页面标题

页面副标题

六分钟步行测试管理软件 v1.1.0.2112120029 - LanguageSet.java 源代码

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 LanguageSet.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package cn.neoprint.padmonitor.ui;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.app.AppGlobal;
import cn.neoprint.padmonitor.utils.FontManager;
import java.util.Locale;

public class LanguageSet extends Activity implements View.OnClickListener {
    public TextView btnOK;
    private SharedPreferences gzj;
    private RadioGroup language_rgp;
    private RadioButton langugageCh;
    private RadioButton langugageEn;
    private RadioButton langugageFrance;
    private RadioButton langugageGe;
    private RadioButton langugageIt;
    AppGlobal myApp = null;
    private int nlanguage = 0;

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(1);
        AppGlobal appGlobal = (AppGlobal) getApplication();
        this.myApp = appGlobal;
        appGlobal.setSystemBarVisible(this, false);
        setContentView(R.layout.language_set);
        this.myApp.SetBackgroundLight(this, -255, 78, true);
        setFinishOnTouchOutside(false);
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf"));
        SharedPreferences sharedPreferences = getSharedPreferences("gzj", 0);
        this.gzj = sharedPreferences;
        this.nlanguage = sharedPreferences.getInt("language", 1);
        this.language_rgp = (RadioGroup) findViewById(R.id.languagetype);
        this.langugageCh = (RadioButton) findViewById(R.id.chinese);
        this.langugageEn = (RadioButton) findViewById(R.id.english);
        this.langugageIt = (RadioButton) findViewById(R.id.Romania);
        this.langugageGe = (RadioButton) findViewById(R.id.Spain);
        RadioButton radioButton = (RadioButton) findViewById(R.id.Franch);
        this.langugageFrance = radioButton;
        int i = this.nlanguage;
        if (i == 0) {
            this.langugageCh.setChecked(true);
        } else if (i == 1) {
            this.langugageEn.setChecked(true);
        } else if (i == 2) {
            this.langugageGe.setChecked(true);
        } else if (i == 3) {
            this.langugageIt.setChecked(true);
        } else if (i == 4) {
            radioButton.setChecked(true);
        }
        this.language_rgp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i2) {
                switch (i2) {
                    case R.id.Franch:
                        LanguageSet.this.nlanguage = 4;
                        break;
                    case R.id.Romania:
                        LanguageSet.this.nlanguage = 3;
                        break;
                    case R.id.Spain:
                        LanguageSet.this.nlanguage = 2;
                        break;
                    case R.id.chinese:
                        LanguageSet.this.nlanguage = 0;
                        break;
                    case R.id.english:
                        LanguageSet.this.nlanguage = 1;
                        break;
                }
            }
        });
        TextView textView = (TextView) findViewById(R.id.Btn_UpdateLanguage);
        this.btnOK = textView;
        textView.setOnClickListener(this);
        ((TextView) findViewById(R.id.Btn_back)).setOnClickListener(this);
    }

    public void SetLanguage() {
        SharedPreferences.Editor edit = this.gzj.edit();
        edit.putInt("language", this.nlanguage);
        edit.commit();
        Resources resources = getResources();
        DisplayMetrics displayMetrics = resources.getDisplayMetrics();
        Configuration configuration = resources.getConfiguration();
        int i = this.nlanguage;
        if (i == 0) {
            configuration.locale = Locale.CHINESE;
            resources.updateConfiguration(configuration, displayMetrics);
            return;
        }
        if (i == 1) {
            configuration.locale = Locale.ENGLISH;
            resources.updateConfiguration(configuration, displayMetrics);
            return;
        }
        if (i == 2) {
            configuration.locale = Locale.UK;
            resources.updateConfiguration(configuration, displayMetrics);
        } else if (i == 3) {
            configuration.locale = Locale.CANADA;
            resources.updateConfiguration(configuration, displayMetrics);
        } else {
            if (i != 4) {
                return;
            }
            configuration.locale = Locale.FRANCE;
            resources.updateConfiguration(configuration, displayMetrics);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.zoomout);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id != 2131361812) {
            if (id != 2131361814) {
                return;
            }
            finish();
            return;
        }
        SetLanguage();
        Bundle bundle = new Bundle();
        bundle.putBoolean("UpdateLanguage", true);
        Intent intent = new Intent();
        intent.putExtras(bundle);
        setResult(10, intent);
        finish();
    }
}