// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_VPN_BYPASS_ADDRESS = "bypass_address";


import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.Map;
import java.util.regex.Pattern;
import static com.antest1.kcanotify.KcaConstants.PREF_VPN_BYPASS_ADDRESS;
        getPreferenceManager().setSharedPreferencesName("pref");
        int pref_key = getArguments().getInt(NESTED_TAG);
        Log.e("KCA", "PREF_KEY " + pref_key);
        switch (pref_key) {
            case FRAGMENT_ADV_NETWORK:
                setPreferencesFromResource(R.xml.advance_network_settings, rootKey);
                getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
                ((AppCompatActivity) getActivity()).getSupportActionBar()
                        .setTitle(getStringWithLocale(R.string.setting_menu_kand_title_adv_network));
                break;
            default:
                break;
        }
    }

    @Override
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
        Preference pref = findPreference(key);
        if (pref instanceof ListPreference) {
            ListPreference etp = (ListPreference) pref;
            pref.setSummary(etp.getEntry());
        } else if (pref instanceof EditTextPreference) {
            EditTextPreference etp = (EditTextPreference) pref;
            pref.setSummary(etp.getText());
        }
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        String key = preference.getKey();
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_VPN_BYPASS_ADDRESS = "bypass_address";


// Path: app/src/main/java/com/antest1/kcanotify/NestedPreferenceFragment.java
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.Map;
import java.util.regex.Pattern;
import static com.antest1.kcanotify.KcaConstants.PREF_VPN_BYPASS_ADDRESS;

        getPreferenceManager().setSharedPreferencesName("pref");
        int pref_key = getArguments().getInt(NESTED_TAG);
        Log.e("KCA", "PREF_KEY " + pref_key);
        switch (pref_key) {
            case FRAGMENT_ADV_NETWORK:
                setPreferencesFromResource(R.xml.advance_network_settings, rootKey);
                getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
                ((AppCompatActivity) getActivity()).getSupportActionBar()
                        .setTitle(getStringWithLocale(R.string.setting_menu_kand_title_adv_network));
                break;
            default:
                break;
        }
    }

    @Override
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
        Preference pref = findPreference(key);
        if (pref instanceof ListPreference) {
            ListPreference etp = (ListPreference) pref;
            pref.setSummary(etp.getEntry());
        } else if (pref instanceof EditTextPreference) {
            EditTextPreference etp = (EditTextPreference) pref;
            pref.setSummary(etp.getText());
        }
    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        String key = preference.getKey();
        if (PREF_VPN_BYPASS_ADDRESS.equals(key)) {