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);
    }
  }
    private void setServerPreferenceSummary(PreferenceFragment f, String s) {
      f.findPreference("connectionScreen")
          .setSummary(modesReadable[Preferences.getModeId()] + ": " + s);

      ((BaseAdapter) ((PreferenceScreen) f.findPreference("root")).getRootAdapter())
          .notifyDataSetChanged(); // Have to redraw the list to reflect summary change
    }
 public void test() throws InterruptedException {
   PreferenceFragment fragment =
       (PreferenceFragment)
           mActivity
               .getFragmentManager()
               .findFragmentByTag(MySettingsFragment.class.getSimpleName());
   CheckBoxPreference mUseExternalStorage =
       (CheckBoxPreference) fragment.findPreference(MyPreferences.KEY_USE_EXTERNAL_STORAGE_NEW);
   assertTrue(mUseExternalStorage != null);
   Thread.sleep(500);
   assertFalse("MyService is not available", MyServiceManager.isServiceAvailable());
 }
 @Override
 protected void onClick() {
   // Launch the ringtone picker
   Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
   onPrepareRingtonePickerIntent(intent);
   PreferenceFragment owningFragment = getPreferenceManager().getFragment();
   if (owningFragment != null) {
     owningFragment.startActivityForResult(intent, mRequestCode);
   } else {
     getPreferenceManager().getActivity().startActivityForResult(intent, mRequestCode);
   }
 }
Beispiel #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.preferences);
  }
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      RutgersCTApp.getObjectGraph(getParentActivity()).inject(this);

      addPreferencesFromResource(R.xml.settings);
    }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    PreferenceScreen ps = getPreferenceManager().createPreferenceScreen(getActivity());
    ps.setTitle(R.string.quick_response_settings_title);

    mResponses = Utils.getQuickResponses(getActivity());

    if (mResponses != null) {
      mEditTextPrefs = new EditTextPreference[mResponses.length];

      Arrays.sort(mResponses);
      int i = 0;
      for (String response : mResponses) {
        EditTextPreference et = new EditTextPreference(getActivity());
        et.setDialogTitle(R.string.quick_response_settings_edit_title);
        et.setTitle(response); // Display Text
        et.setText(response); // Value to edit
        et.setOnPreferenceChangeListener(this);
        mEditTextPrefs[i++] = et;
        ps.addPreference(et);
      }
    } else {
      Log.wtf(TAG, "No responses found");
    }
    setPreferenceScreen(ps);
    /// M:Toast to alarm @{
    mToast = Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT);
    /// @}
  }
 @Override
 public void onPause() {
   super.onPause();
   if (mEnabledSwitch != null) {
     mEnabledSwitch.pause();
   }
 }
Beispiel #9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);
  }
Beispiel #10
0
 @Override
 public void onPause() {
   super.onPause();
   // Unregister the listener whenever a key changes
   PreferenceManager.getDefaultSharedPreferences(mActivity)
       .unregisterOnSharedPreferenceChangeListener(this);
 }
Beispiel #11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.prefs_route);

    mPrefEnabled = (TwoStatePreference) findPreference(getString(R.string.pref_tts_enabled));
    mPrefLanguages = (ListPreference) findPreference(getString(R.string.pref_tts_language));

    final Framework.Params3dMode _3d = new Framework.Params3dMode();
    Framework.nativeGet3dMode(_3d);

    final TwoStatePreference pref3d =
        (TwoStatePreference) findPreference(getString(R.string.pref_3d));
    pref3d.setChecked(_3d.enabled);

    pref3d.setOnPreferenceChangeListener(
        new Preference.OnPreferenceChangeListener() {
          @Override
          public boolean onPreferenceChange(Preference preference, Object newValue) {
            Framework.nativeSet3dMode((Boolean) newValue, _3d.buildings);
            return true;
          }
        });

    update();
  }
    @Override
    public void onResume() {
      super.onResume();
      final Activity activity = this.getActivity();

      // Load the camera sizes.
      loadSizes();

      // Make sure to hide settings for cameras that don't exist on this
      // device.
      setVisibilities();

      // Put in the summaries for the currently set values.
      final PreferenceScreen resolutionScreen =
          (PreferenceScreen) findPreference(PREF_CATEGORY_RESOLUTION);
      fillEntriesAndSummaries(resolutionScreen);
      setPreferenceScreenIntent(resolutionScreen);

      final PreferenceScreen advancedScreen =
          (PreferenceScreen) findPreference(PREF_CATEGORY_ADVANCED);
      setPreferenceScreenIntent(advancedScreen);

      Preference helpPref = findPreference(PREF_LAUNCH_HELP);
      helpPref.setOnPreferenceClickListener(
          new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
              GoogleHelpHelper.launchGoogleHelp(activity);
              return true;
            }
          });
      getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.preferences_list);

      final String keyList[] = getResources().getStringArray(R.array.pref_key_list);
      Preference preference;
      String value = "";
      for (String pref_key : keyList) {
        preference = findPreference(pref_key);
        if (preference != null) {
          if (preference instanceof ListPreference) {
            value = ((ListPreference) preference).getValue();
          } else if (preference instanceof SwitchPreference) {
            getSummaryForSwitchPreference((SwitchPreference) preference);
          } else if (preference instanceof RingtonePreference) {
            value = ((RingtonePreference) preference).getShowSilent() ? "Enabled" : "Silent";
          } else if (pref_key.equalsIgnoreCase(getString(R.string.pref_key_export_bookmarks))) {
            value = getString(R.string.pref_key_export_bookmarks_summary);
          } else if (pref_key.equalsIgnoreCase(getString(R.string.pref_key_changelog))) {
            value = getString(R.string.pref_key_changelog_summary);
          } else {
            value = "";
          }
          preference.setSummary(value);
          preference.setOnPreferenceChangeListener(mListener);
          preference.setOnPreferenceClickListener(mListener);
        }
      }
    }
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
    findPreference("about").setOnPreferenceClickListener(this);

    Preference account = findPreference("account");
    account.setOnPreferenceClickListener(this);
    if (((MainActivity) getActivity()).getGC().isConnected()) {
      account.setSummary(
          getString(
              R.string.signed_in,
              ((MainActivity) getActivity()).getGC().getCurrentPlayer().getDisplayName()));
    }

    final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();

    Preference goal = findPreference("goal");
    goal.setOnPreferenceClickListener(this);
    goal.setSummary(getString(R.string.goal_summary, prefs.getInt("goal", DEFAULT_GOAL)));

    Preference stepsize = findPreference("stepsize");
    stepsize.setOnPreferenceClickListener(this);
    stepsize.setSummary(
        getString(
            R.string.step_size_summary,
            prefs.getFloat("stepsize_value", DEFAULT_STEP_SIZE),
            prefs.getString("stepsize_unit", DEFAULT_STEP_UNIT)));

    setHasOptionsMenu(true);
  }
Beispiel #15
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    abdAlatifPref =
        (SwitchPreference) findPreference(getString(R.string.abd_alatif_notificatin_pref_key));
    waliAlahidPref =
        (SwitchPreference) findPreference(getString(R.string.wali_notification_pref_key));
    khadimAlhrmPref =
        (SwitchPreference) findPreference(getString(R.string.khadim_notification_pref_key));
    firstClassPref =
        (SwitchPreference) findPreference(getString(R.string.first_notification_pref_key));

    boolean abdAlatifNotification =
        MyApplication.pref.getBoolean(getString(R.string.abd_alatif_notificatin_pref_key), false);
    boolean waliAlahidNotificatin =
        MyApplication.pref.getBoolean(getString(R.string.wali_notification_pref_key), false);
    boolean khadimAlhrmNotification =
        MyApplication.pref.getBoolean(getString(R.string.khadim_notification_pref_key), false);
    boolean firstClassNotification =
        MyApplication.pref.getBoolean(getString(R.string.first_notification_pref_key), false);

    abdAlatifPref.setChecked(abdAlatifNotification);
    waliAlahidPref.setChecked(waliAlahidNotificatin);
    khadimAlhrmPref.setChecked(khadimAlhrmNotification);
    firstClassPref.setChecked(firstClassNotification);
  }
Beispiel #16
0
  @Override
  public void onResume() {
    super.onResume();

    findPreference(MyApplication.AUTO_ACTIVATION_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.CHANGE_NOTIFICATION_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.CHANGE_RINGTONE_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.REPEATIN_DAYS_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.CHANGE_WIFI_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.CHOOSE_NOTIFICATION_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.CHOOSE_RINGTONE_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.PROFILE_NAME_KEY).setOnPreferenceChangeListener(this);
    findPreference(MyApplication.RING_MODE_KEY).setOnPreferenceChangeListener(this);

    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

    updatePrefences(findPreference(MyApplication.CHANGE_NOTIFICATION_KEY));
    updatePrefences(findPreference(MyApplication.CHANGE_RINGTONE_KEY));
    updatePrefences(findPreference(MyApplication.REPEATIN_DAYS_KEY));
    updatePrefences(findPreference(MyApplication.CHANGE_WIFI_KEY));
    updatePrefences(findPreference(MyApplication.CHOOSE_NOTIFICATION_KEY));
    updatePrefences(findPreference(MyApplication.CHOOSE_RINGTONE_KEY));
    updatePrefences(findPreference(MyApplication.PROFILE_NAME_KEY));
    updatePrefences(findPreference(MyApplication.RING_MODE_KEY));
  }
Beispiel #17
0
 @Override
 public void onResume() {
   super.onResume();
   // Set up a listener whenever a key changes
   PreferenceManager.getDefaultSharedPreferences(mActivity)
       .registerOnSharedPreferenceChangeListener(this);
 }
 @Override
 public void onStop() {
   super.onStop();
   if (mSyncType > 0) {
     SyncService.sync(getActivity(), mSyncType);
   }
 }
 @Override
 public void onStop() {
   super.onStop();
   getPreferenceManager()
       .getSharedPreferences()
       .unregisterOnSharedPreferenceChangeListener(this);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   addPreferencesFromResource(R.layout.preference);
   CheckBoxPreference checkBoxPreference =
       (CheckBoxPreference)
           findPreference(getResources().getString(R.string.setting_alarm_open_key));
   checkBoxPreference.setOnPreferenceChangeListener(
       new Preference.OnPreferenceChangeListener() {
         @Override
         public boolean onPreferenceChange(Preference preference, Object newValue) {
           AlarmSeting alarmSeting = new AlarmSeting(getActivity());
           if ((boolean) newValue == true) {
             List<int[]> planTime = null;
             boolean[] isMilk = null;
             FeedPlanHelper feedPlanHelper = null;
             feedPlanHelper = FeedPlanHelper.getInstance();
             List<BabyFeedItem> babyFeedItems = feedPlanHelper.getBabyFeedItemsFromAcache();
             if (babyFeedItems == null) return true;
             babyFeedItems = feedPlanHelper.sortBabyfeedItems(babyFeedItems);
             planTime = feedPlanHelper.getTime(babyFeedItems);
             isMilk = feedPlanHelper.getType(babyFeedItems);
             alarmSeting.start(planTime, isMilk);
           } else {
             alarmSeting.cancleAlarm();
           }
           return true;
         }
       });
 }
 @Override
 public void onStart() {
   super.onStart();
   final TinkerActivity activity = (TinkerActivity) getActivity();
   mEnabledSwitch =
       new BaseSystemSettingSwitchBar(activity, mSwitchBar, NAVIGATION_BAR_SHOW, true, this);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   addPreferencesFromResource(R.xml.preference_lock_pattern);
   lock_pattern_on = this.findPreference("lock_pattern_on");
   lock_pattern_on.setOnPreferenceChangeListener(this);
 }
 @Override
 public void onDestroyView() {
   super.onDestroyView();
   if (mEnabledSwitch != null) {
     mEnabledSwitch.teardownSwitchBar();
   }
 }
 @Override
 public void onResume() {
   super.onResume(); //
   if (adapter != null) {
     this.rootView.setAdapter(adapter);
   }
 }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.ui_settings);
    getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
    getActivity().getActionBar().setDisplayShowHomeEnabled(false);
    getActivity().getActionBar().setTitle(R.string.title_settings);

    createShortCut = findPreference("createShortCut");
    createShortCut.setOnPreferenceClickListener(this);
    pVersion = findPreference("pVersion");
    pVersion.setOnPreferenceClickListener(this);
    pVersionDetail = findPreference("pVersionDetail");
    pVersionDetail.setSummary("当前版本:" + AppUtil.getVersion(getActivity()));
    pVersionDetail.setOnPreferenceClickListener(this);

    pGithub = findPreference("pGithub");
    pGithub.setOnPreferenceClickListener(this);
    pGrade = findPreference("pGrade");
    pGrade.setOnPreferenceClickListener(this);
    pShare = findPreference("pShare");
    pShare.setOnPreferenceClickListener(this);
    pAbout = findPreference("pAbout");
    pAbout.setOnPreferenceClickListener(this);
    initData();
  }
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.pref_general);

      bindPreferenceSummaryToValue(findPreference("pref_key_letter_grades"));
    }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    final Context context = getActivity();
    mSubtypeLocaleAdapter = new SubtypeLocaleAdapter(context);
    mKeyboardLayoutSetAdapter = new KeyboardLayoutSetAdapter(context);

    final String prefSubtypes = SettingsValues.getPrefAdditionalSubtypes(mPrefs, getResources());
    setPrefSubtypes(prefSubtypes, context);

    mIsAddingNewSubtype =
        (savedInstanceState != null) && savedInstanceState.containsKey(KEY_IS_ADDING_NEW_SUBTYPE);
    if (mIsAddingNewSubtype) {
      getPreferenceScreen()
          .addPreference(SubtypePreference.newIncompleteSubtypePreference(context, mSubtypeProxy));
    }

    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState != null
        && savedInstanceState.containsKey(KEY_IS_SUBTYPE_ENABLER_NOTIFICATION_DIALOG_OPEN)) {
      mSubtypePreferenceKeyForSubtypeEnabler =
          savedInstanceState.getString(KEY_SUBTYPE_FOR_SUBTYPE_ENABLER);
      final SubtypePreference subtypePref =
          (SubtypePreference) findPreference(mSubtypePreferenceKeyForSubtypeEnabler);
      mSubtypeEnablerNotificationDialog = createDialog(subtypePref);
      mSubtypeEnablerNotificationDialog.show();
    }
  }
 @Override
 public void onDestroy() {
   super.onDestroy();
   getPreferenceScreen()
       .getSharedPreferences()
       .unregisterOnSharedPreferenceChangeListener(mSharePrefListener);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   addPreferencesFromResource(R.xml.pref_sensors);
   bindPreferenceSummaryToValue(findPreference("video_codec"));
   bindPreferenceSummaryToValue(findPreference("angel_address"));
 }
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      // Load the preferences
      addPreferencesFromResource(R.xml.preference_fragment);
    }