@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 protected void onSwitchCheckChanged(boolean bChecked) { // TODO Auto-generated method stub super.onSwitchCheckChanged(bChecked); // final boolean value = !bChecked; int value1 = 0; if (tap == true) { mTickerTime += 5; --mTimeTmp; value1 = mTickerTime; if (value1 >= 20) { value1 = 5; mTickerTime = 5; mTimeTmp = 0; } } else if (tap == false) { mTickerTime -= 5; ++mTimeTmp; value1 = mTickerTime; if (value1 <= 0) { value1 = 15; mTickerTime = 15; mTimeTmp = 2; } } // // if(value1!=mTickerTime) // { SharedPreferences.Editor editor = Prefs.edit(mContext); editor.putInt(Prefs.TICKER_TIME_PREF, value1); editor.apply(); // } switch (value1) { case TIME_5: optionText.setText(R.string.ticker_time_5); break; case TIME_10: optionText.setText(R.string.ticker_time_10); break; case TIME_15: optionText.setText(R.string.ticker_time_15); break; default: break; } optionText.invalidate(); }