Back to project page callmeter.
The source code is released under:
GNU General Public License
If you think the Android project callmeter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.ub0r.android.callmeter.ui.prefs; /*from w w w. j av a2s.c o m*/ import android.content.Context; import android.preference.Preference; import android.view.View; import android.view.View.OnClickListener; import de.ub0r.android.callmeter.R; public class UpDownPreference extends Preference implements OnClickListener { static interface OnUpDownClickListener { void onUpDownClick(Preference preference, int direction); } private final OnUpDownClickListener mCallback; public UpDownPreference(final Context context, final OnUpDownClickListener callback) { super(context); setPersistent(false); mCallback = callback; if (callback != null) { setWidgetLayoutResource(R.layout.preference_widget_updown); } } @Override protected void onBindView(final View view) { super.onBindView(view); view.setOnClickListener(this); if (mCallback != null) { view.findViewById(R.id.button_up).setOnClickListener(this); view.findViewById(R.id.button_down).setOnClickListener(this); } } @Override public void onClick(final View v) { switch (v.getId()) { case R.id.button_up: mCallback.onUpDownClick(this, -1); return; case R.id.button_down: mCallback.onUpDownClick(this, 1); return; default: if (getOnPreferenceClickListener() != null) { getOnPreferenceClickListener().onPreferenceClick(this); } return; } } }