Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed proxChanged check and included lost motion call preference #9

Open
wants to merge 1 commit into
base: ics
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
</PreferenceCategory>

<PreferenceCategory android:title="@string/pref_extra_settings">
<CheckBoxPreference android:key="pref_key_motion_call_recipient"
android:title="@string/pref_title_motion_call_recipient"
android:summary="@string/pref_summary_motion_call_recipient"
android:defaultValue="false" />
<CheckBoxPreference android:key="pref_key_strip_unicode"
android:title="@string/pref_title_strip_unicode"
android:summary="@string/pref_summary_strip_unicode"
Expand Down
24 changes: 7 additions & 17 deletions src/com/android/mms/ui/ComposeMessageActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
public class ComposeMessageActivity extends Activity
implements View.OnClickListener, TextView.OnEditorActionListener,
MessageStatusListener, Contact.UpdateListener, OnGesturePerformedListener,
LoaderManager.LoaderCallbacks<Cursor> {
LoaderManager.LoaderCallbacks<Cursor>, 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;
Expand Down Expand Up @@ -1948,7 +1948,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

//Pick-Up-To-Call
//Pick-Up-To-Call
@Override
public void onSensorChanged(SensorEvent event) {

Expand All @@ -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
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/com/android/mms/ui/MessagingPreferenceActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand All @@ -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);
Expand Down