Loading res/values/config.xml +1 −3 Original line number Diff line number Diff line Loading @@ -35,14 +35,12 @@ <bool name="config_allow_export_to_sdcard">true</bool> <!-- If true, enable vibration (haptic feedback) for dialer key presses. The pattern is set on a per-platform basis using config_virtualKeyVibePattern. TODO: If enough users are annoyed by this, we might eventually need to make it a user preference rather than a per-platform resource. --> <bool name="config_enable_dialer_key_vibration">true</bool> <!-- How long to vibrate (in msec), if dialer key vibration is enabled. --> <integer name="config_dialer_key_vibrate_duration">40</integer> <!-- The type of vcard for improt. If the vcard importer cannot guess the exact type of a vCard type, the improter uses this type. --> <string name="config_import_vcard_type" translatable="false">default</string> Loading src/com/android/contacts/TwelveKeyDialer.java +35 −5 Original line number Diff line number Diff line Loading @@ -82,6 +82,9 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, /** The DTMF tone volume relative to other sounds in the stream */ private static final int TONE_RELATIVE_VOLUME = 50; /** Play the vibrate pattern only once. */ private static final int VIBRATE_NO_REPEAT = -1; private EditText mDigits; private View mDelete; private MenuItem mAddToContactMenuItem; Loading @@ -108,7 +111,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, // Vibration (haptic feedback) for dialer key presses. private Vibrator mVibrator; private boolean mVibrateOn; private long mVibrateDuration; private long[] mVibratePattern; /** Identifier for the "Add Call" intent extra. */ Loading Loading @@ -218,12 +221,10 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, super.onRestoreInstanceState(icicle); } // Initialize vibration parameters. // TODO: We might eventually need to make mVibrateOn come from a // user preference rather than a per-platform resource, in which // case we would need to update it in onResume() rather than here. mVibrateOn = r.getBoolean(R.bool.config_enable_dialer_key_vibration); mVibrateDuration = (long) r.getInteger(R.integer.config_dialer_key_vibrate_duration); initVibrationPattern(r); } @Override Loading Loading @@ -984,7 +985,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, if (mVibrator == null) { mVibrator = new Vibrator(); } mVibrator.vibrate(mVibrateDuration); mVibrator.vibrate(mVibratePattern, VIBRATE_NO_REPEAT); } /** Loading Loading @@ -1066,6 +1067,35 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, } } /** * Initialize the vibration parameters. * @param r The Resources with the vibration parameters. */ private void initVibrationPattern(Resources r) { int[] pattern = null; try { mVibrateOn = r.getBoolean(R.bool.config_enable_dialer_key_vibration); pattern = r.getIntArray(com.android.internal.R.array.config_virtualKeyVibePattern); if (null == pattern) { Log.e(TAG, "Vibrate pattern is null."); mVibrateOn = false; } } catch (Resources.NotFoundException nfe) { Log.e(TAG, "Vibrate control bool or pattern missing.", nfe); mVibrateOn = false; } if (!mVibrateOn) { return; } // int[] to long[] conversion. mVibratePattern = new long[pattern.length]; for (int i = 0; i < pattern.length; i++) { mVibratePattern[i] = pattern[i]; } } /** * This function return true if Wait menu item can be shown * otherwise returns false. Assumes the passed string is non-empty Loading Loading
res/values/config.xml +1 −3 Original line number Diff line number Diff line Loading @@ -35,14 +35,12 @@ <bool name="config_allow_export_to_sdcard">true</bool> <!-- If true, enable vibration (haptic feedback) for dialer key presses. The pattern is set on a per-platform basis using config_virtualKeyVibePattern. TODO: If enough users are annoyed by this, we might eventually need to make it a user preference rather than a per-platform resource. --> <bool name="config_enable_dialer_key_vibration">true</bool> <!-- How long to vibrate (in msec), if dialer key vibration is enabled. --> <integer name="config_dialer_key_vibrate_duration">40</integer> <!-- The type of vcard for improt. If the vcard importer cannot guess the exact type of a vCard type, the improter uses this type. --> <string name="config_import_vcard_type" translatable="false">default</string> Loading
src/com/android/contacts/TwelveKeyDialer.java +35 −5 Original line number Diff line number Diff line Loading @@ -82,6 +82,9 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, /** The DTMF tone volume relative to other sounds in the stream */ private static final int TONE_RELATIVE_VOLUME = 50; /** Play the vibrate pattern only once. */ private static final int VIBRATE_NO_REPEAT = -1; private EditText mDigits; private View mDelete; private MenuItem mAddToContactMenuItem; Loading @@ -108,7 +111,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, // Vibration (haptic feedback) for dialer key presses. private Vibrator mVibrator; private boolean mVibrateOn; private long mVibrateDuration; private long[] mVibratePattern; /** Identifier for the "Add Call" intent extra. */ Loading Loading @@ -218,12 +221,10 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, super.onRestoreInstanceState(icicle); } // Initialize vibration parameters. // TODO: We might eventually need to make mVibrateOn come from a // user preference rather than a per-platform resource, in which // case we would need to update it in onResume() rather than here. mVibrateOn = r.getBoolean(R.bool.config_enable_dialer_key_vibration); mVibrateDuration = (long) r.getInteger(R.integer.config_dialer_key_vibrate_duration); initVibrationPattern(r); } @Override Loading Loading @@ -984,7 +985,7 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, if (mVibrator == null) { mVibrator = new Vibrator(); } mVibrator.vibrate(mVibrateDuration); mVibrator.vibrate(mVibratePattern, VIBRATE_NO_REPEAT); } /** Loading Loading @@ -1066,6 +1067,35 @@ public class TwelveKeyDialer extends Activity implements View.OnClickListener, } } /** * Initialize the vibration parameters. * @param r The Resources with the vibration parameters. */ private void initVibrationPattern(Resources r) { int[] pattern = null; try { mVibrateOn = r.getBoolean(R.bool.config_enable_dialer_key_vibration); pattern = r.getIntArray(com.android.internal.R.array.config_virtualKeyVibePattern); if (null == pattern) { Log.e(TAG, "Vibrate pattern is null."); mVibrateOn = false; } } catch (Resources.NotFoundException nfe) { Log.e(TAG, "Vibrate control bool or pattern missing.", nfe); mVibrateOn = false; } if (!mVibrateOn) { return; } // int[] to long[] conversion. mVibratePattern = new long[pattern.length]; for (int i = 0; i < pattern.length; i++) { mVibratePattern[i] = pattern[i]; } } /** * This function return true if Wait menu item can be shown * otherwise returns false. Assumes the passed string is non-empty Loading