CryptoMessage v1.3.2版本的 MD5 值为:66c611ce56a11450659dc23697562928

以下内容为反编译后的 SettingsFragment.java 源代码,内容仅作参考


package kz.gamma.VTalk.fragments.settings;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kz.gamma.VTalk.R$id;
import kz.gamma.VTalk.activities.BaseActivity;
import kz.gamma.VTalk.activities.MainActivity;
import kz.gamma.VTalk.activities.ui.main.MainActivity2;
import kz.gamma.VTalk.api.PreferencesHelper;
import kz.gamma.testsip.R;
import kz.gamma.tumarcsp.CertificateFieldsResolver;
import org.jivesoftware.smack.contacts.ContactManager;
import org.jivesoftware.smack.csp.CryptApi;
import org.jivesoftware.smack.db.entities.AccountEntity;
import org.jivesoftware.smack.db.entities.ContactItem;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smackx.iqregister.AccountManager;

public final class SettingsFragment extends Fragment {
    public static final Companion Companion = new Companion(null);
    private static final String TAG = SettingsFragment.class.getName();
    private PreferencesHelper prefsHelper;
    public Map<Integer, View> _$_findViewCache = new LinkedHashMap();
    private final String TAG$1 = SettingsFragment.class.getName();

    public void _$_clearFindViewByIdCache() {
        this._$_findViewCache.clear();
    }

    public View _$_findCachedViewById(int i) {
        View findViewById;
        Map<Integer, View> map = this._$_findViewCache;
        View view = map.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null || (findViewById = view2.findViewById(i)) == null) {
            return null;
        }
        map.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        _$_clearFindViewByIdCache();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
        Intrinsics.checkNotNullParameter(inflater, "inflater");
        return inflater.inflate(R.layout.fragment_settings, viewGroup, false);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intrinsics.checkNotNullParameter(item, "item");
        if (item.getItemId() == 16908332) {
            FragmentActivity requireActivity = requireActivity();
            Intrinsics.checkNotNull(requireActivity, "null cannot be cast to non-null type kz.gamma.VTalk.activities.BaseActivity");
            ((BaseActivity) requireActivity).hideKeyboard();
            requireActivity().onBackPressed();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        Intrinsics.checkNotNullParameter(view, "view");
        super.onViewCreated(view, bundle);
    }

    @Override
    public void onStart() {
        super.onStart();
        try {
            MainActivity2.s sVar = MainActivity2.s;
            this.prefsHelper = sVar.getPrefsHelper();
            XMPPTCPConnection connection = sVar.getConnection();
            AccountEntity defaultAccount = AccountManager.getInstance(connection).getDefaultAccount();
            ((TextView) _$_findCachedViewById(R$id.xmpp_setting)).setText("m.mfa.kz:5222");
            ((TextView) _$_findCachedViewById(R$id.ca_setting)).setText("m.mfa.kz:62222");
            ((TextView) _$_findCachedViewById(R$id.cmp_setting)).setText("http://m.mfa.kz:62306");
            ((TextView) _$_findCachedViewById(R$id.crl_setting)).setText("http://m.mfa.kz:62280/cgi/RevListGOST.crl");
            ((TextView) _$_findCachedViewById(R$id.dn_setting)).setText("C=KZ;O=Ministry of Foreign Affairs_FILE_GOST;CN=" + defaultAccount.getUsername() + ';');
            ContactManager instanceFor = ContactManager.getInstanceFor(connection);
            CertificateFieldsResolver certificateFieldsResolver = new CertificateFieldsResolver();
            ContactItem loadContactItem = instanceFor.loadContactItem();
            if (loadContactItem != null && loadContactItem.getCertificate() != null) {
                TextView textView = (TextView) _$_findCachedViewById(R$id.sertificat_number);
                Object serialNumber = certificateFieldsResolver.getSerialNumber(CryptApi.parseCertificate(loadContactItem.getCertificate()), 0);
                Intrinsics.checkNotNull(serialNumber, "null cannot be cast to non-null type kotlin.String");
                textView.setText((String) serialNumber);
            }
            if (requireActivity() instanceof MainActivity) {
                FragmentActivity requireActivity = requireActivity();
                Intrinsics.checkNotNull(requireActivity, "null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity");
                ActionBar supportActionBar = ((AppCompatActivity) requireActivity).getSupportActionBar();
                if (supportActionBar != null) {
                    supportActionBar.setHomeAsUpIndicator(R.drawable.ic_back);
                }
                setHasOptionsMenu(false);
            } else {
                if (requireActivity() instanceof AppCompatActivity) {
                    FragmentActivity requireActivity2 = requireActivity();
                    Intrinsics.checkNotNull(requireActivity2, "null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity");
                    ActionBar supportActionBar2 = ((AppCompatActivity) requireActivity2).getSupportActionBar();
                    if (supportActionBar2 != null) {
                        supportActionBar2.setHomeAsUpIndicator(R.drawable.ic_back);
                    }
                    FragmentActivity requireActivity3 = requireActivity();
                    Intrinsics.checkNotNull(requireActivity3, "null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity");
                    ActionBar supportActionBar3 = ((AppCompatActivity) requireActivity3).getSupportActionBar();
                    if (supportActionBar3 != null) {
                        supportActionBar3.setDisplayHomeAsUpEnabled(true);
                    }
                }
                setHasOptionsMenu(true);
                requireActivity().setTitle(R.string.network_settings);
            }
            SwitchCompat switchCompat = (SwitchCompat) _$_findCachedViewById(R$id.clearHackHistory);
            PreferencesHelper preferencesHelper = this.prefsHelper;
            Intrinsics.checkNotNull(preferencesHelper);
            switchCompat.setChecked(preferencesHelper.isClearHackHistory());
            switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                    SettingsFragment.m402onStart$lambda1$lambda0(SettingsFragment.this, compoundButton, z);
                }
            });
        } catch (Exception e) {
            Log.e(this.TAG$1, e.getMessage(), e);
        }
    }

    public static final void m402onStart$lambda1$lambda0(SettingsFragment this$0, CompoundButton compoundButton, boolean z) {
        Intrinsics.checkNotNullParameter(this$0, "this$0");
        PreferencesHelper preferencesHelper = this$0.prefsHelper;
        Intrinsics.checkNotNull(preferencesHelper);
        preferencesHelper.setClearHackHistory(z);
    }

    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final String getTAG() {
            return SettingsFragment.TAG;
        }
    }
}