@Override protected void onFinishInflate() { // TODO Auto-generated method stub super.onFinishInflate(); itemText.setText(R.string.time_select); mPrefs = Prefs.read(mContext); mPrefs.registerOnSharedPreferenceChangeListener(this); mTickerTime = mPrefs.getInt(Prefs.TICKER_TIME_PREF, Prefs.TICKER_TIME_DEFAULT); if (mTickerTime != 5 && mTickerTime != 10 && mTickerTime != 15) { mTickerTime = 5; } mTimeTmp = mTickerTime / 5 - 1; dotView.setString("...", mTimeTmp); WGUtil.LogD(TAG, "---------mTickerTime = " + mTickerTime); switch (mTickerTime) { case TIME_5: optionText.setText(R.string.ticker_time_5); mTimeTmp = 0; break; case TIME_10: optionText.setText(R.string.ticker_time_10); mTimeTmp = 1; break; case TIME_15: optionText.setText(R.string.ticker_time_15); mTimeTmp = 2; break; default: break; } }
@Override public void onSharedPreferenceChanged(SharedPreferences arg0, String arg1) { // TODO Auto-generated method stub final int val = arg0.getInt(Prefs.TICKER_TIME_PREF, Prefs.TICKER_TIME_DEFAULT); if (val != mTickerTime) { mTickerTime = val; } WGUtil.LogD(TAG, "---------ret=" + val); Settings.Secure.putInt(mContext.getContentResolver(), Prefs.TICKER_TIME_PREF, val); }