diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index b0f39b09a..45f36621f 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -141,6 +141,10 @@ + { + LoaderManager.LoaderCallbacks, SensorEventListener { public static final int REQUEST_CODE_ATTACH_IMAGE = 100; public static final int REQUEST_CODE_TAKE_PICTURE = 101; public static final int REQUEST_CODE_ATTACH_VIDEO = 102; @@ -1948,7 +1948,7 @@ protected void onCreate(Bundle savedInstanceState) { } } - //Pick-Up-To-Call + //Pick-Up-To-Call @Override public void onSensorChanged(SensorEvent event) { @@ -1962,20 +1962,11 @@ public void onSensorChanged(SensorEvent event) { break; case Sensor.TYPE_PROXIMITY: - int currentProx = (int) event.values[0]; - if (initProx) { - SensorProximity = currentProx; - initProx = false; - } else { - if( SensorProximity > 0 && currentProx == 0){ - proxChanged = true; - } - } - SensorProximity = currentProx; + SensorProximity = (int) event.values[0]; break; } - if (rightOrientation(SensorOrientationY) && proxChanged ) { + if (rightOrientation(SensorOrientationY) && SensorProximity == 0 ) { if (getRecipients().isEmpty() == false) { //unregister Listener to don't let the onSesorChanged run the whole time @@ -1988,7 +1979,6 @@ public void onSensorChanged(SensorEvent event) { String number = getRecipients().get(0).getNumber(); Intent dialIntent = new Intent(Intent.ACTION_CALL); dialIntent.setData(Uri.fromParts("tel", number, null)); - //dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(dialIntent); } } @@ -2347,17 +2337,17 @@ public void run() { if(motionCallEnabled){ SensorOrientationY = 0; - SensorProximity = 0; + SensorProximity = 1; proxChanged = false; initProx = true; mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), - SensorManager.SENSOR_DELAY_UI); + SensorManager.SENSOR_DELAY_NORMAL); mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY), - SensorManager.SENSOR_DELAY_UI); + SensorManager.SENSOR_DELAY_NORMAL); } } diff --git a/src/com/android/mms/ui/MessagingPreferenceActivity.java b/src/com/android/mms/ui/MessagingPreferenceActivity.java index 1dbd17da6..54bb7f396 100755 --- a/src/com/android/mms/ui/MessagingPreferenceActivity.java +++ b/src/com/android/mms/ui/MessagingPreferenceActivity.java @@ -76,6 +76,7 @@ public class MessagingPreferenceActivity extends PreferenceActivity public static final String ENABLE_EMOJIS = "pref_key_enable_emojis"; public static final String FULL_TIMESTAMP = "pref_key_mms_full_timestamp"; public static final String SENT_TIMESTAMP = "pref_key_mms_use_sent_timestamp"; + public static final String MOTION_CALL_RECIPIENT = "pref_key_motion_call_recipient"; public static final String NOTIFICATION_VIBRATE_PATTERN = "pref_key_mms_notification_vibrate_pattern"; public static final String NOTIFICATION_VIBRATE_PATTERN_CUSTOM = "pref_key_mms_notification_vibrate_pattern_custom"; public static final String NOTIFICATION_VIBRATE_CALL ="pre_key_mms_notification_vibrate_call"; @@ -96,6 +97,7 @@ public class MessagingPreferenceActivity extends PreferenceActivity private Preference mSmsToMmsTextThreshold; private ListPreference mVibrateWhenPref; private CheckBoxPreference mEnableNotificationsPref; + private CheckBoxPreference mMotionCallRecipientPref; private Recycler mSmsRecycler; private Recycler mMmsRecycler; private Preference mManageTemplate; @@ -118,6 +120,7 @@ protected void onCreate(Bundle icicle) { mMmsLimitPref = findPreference("pref_key_mms_delete_limit"); mClearHistoryPref = findPreference("pref_key_mms_clear_history"); mEnableNotificationsPref = (CheckBoxPreference) findPreference(NOTIFICATION_ENABLED); + mMotionCallRecipientPref = (CheckBoxPreference) findPreference(MOTION_CALL_RECIPIENT); mVibrateWhenPref = (ListPreference) findPreference(NOTIFICATION_VIBRATE_WHEN); mManageTemplate = findPreference(MANAGE_TEMPLATES); mGestureSensitivity = (ListPreference) findPreference(GESTURE_SENSITIVITY);