private void init() {
    m2GCheckBoxPreference = (CheckBoxPreference) mFragment.findPreference(KEY_NETWORK_TYPE_2G);
    m3GCheckBoxPreference = (CheckBoxPreference) mFragment.findPreference(KEY_NETWORK_TYPE_3G);
    m4GCheckBoxPreference = (CheckBoxPreference) mFragment.findPreference(KEY_NETWORK_TYPE_4G);

    if (m2GCheckBoxPreference != null) {
      m2GCheckBoxPreference.setOnPreferenceChangeListener(
          (Preference.OnPreferenceChangeListener) mFragment);
    }
    if (m3GCheckBoxPreference != null) {
      m3GCheckBoxPreference.setOnPreferenceChangeListener(
          (Preference.OnPreferenceChangeListener) mFragment);
    }
    if (m4GCheckBoxPreference != null) {
      m4GCheckBoxPreference.setOnPreferenceChangeListener(
          (Preference.OnPreferenceChangeListener) mFragment);
    }

    Intent intent = getIntent();
    mSlotId = intent.getIntExtra(NetworkEditor.PLMN_SLOT, -1);
    mAct = intent.getIntExtra(NetworkEditor.PLMN_SERVICE, 0);

    PhoneLog.d(TAG, "init(): mSlotId = " + mSlotId + ", mAct = " + mAct);
    convertAct2Selections(mAct);

    if (!is4GSimCard(mSlotId)) {
      PhoneLog.d(
          TAG, "init(): the baseband of the sim card do not contain 4G. remove 4G CheckBox item.");
      PreferenceScreen prefSet = mFragment.getPreferenceScreen();
      prefSet.removePreference(m4GCheckBoxPreference);
    }
  }
Пример #2
0
 public static void clickPreference(PreferenceFragment fragment, Preference preference) {
   try {
     Method performClick =
         Preference.class.getDeclaredMethod("performClick", PreferenceScreen.class);
     performClick.invoke(preference, fragment.getPreferenceScreen());
   } catch (IllegalAccessException e) {
     throw new RuntimeException(e);
   } catch (IllegalArgumentException e) {
     throw new RuntimeException(e);
   } catch (NoSuchMethodException e) {
     throw new RuntimeException(e);
   } catch (InvocationTargetException e) {
     throw new RuntimeException(e);
   }
 }
Пример #3
0
 public void showInitialSummary(PreferenceFragment preferenceFragment) {
   for (int i = 0; i < preferenceFragment.getPreferenceScreen().getPreferenceCount(); i++) {
     initSummary(preferenceFragment.getPreferenceScreen().getPreference(i));
   }
   onPreferenceCreate(preferenceFragment);
 }