Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebff5255 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "This fixes the lockscreen haptic issue." into gingerbread

parents 6d85adbe c4544d3c
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -931,7 +931,8 @@ public class RotarySelector extends View {
            mVibrator = (android.os.Vibrator)
                    getContext().getSystemService(Context.VIBRATOR_SERVICE);
        }
        mVibrator.vibrate(Integer.parseInt((Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY)).split( ",\\s*" )[0]));
        long[] hapFeedback = stringToLongArray(Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY));
        mVibrator.vibrate(hapFeedback, -1);
    }

    /**
@@ -1081,6 +1082,22 @@ public class RotarySelector extends View {
        mTime12_24=time12_24;
    }

    private long[] stringToLongArray(String inpString) {
        if (inpString == null) {
            long[] returnLong = new long[1];
            returnLong[0] = 0;
            return returnLong;
        }
        String[] splitStr = inpString.split(",");
        int los = splitStr.length;
        long[] returnLong = new long[los];
        int i;
        for (i = 0; i < los; i++) {
            returnLong[i] = Long.parseLong(splitStr[i].trim());
        }
        return returnLong;
    }

    // Debugging / testing code

    private void log(String msg) {
+18 −1
Original line number Diff line number Diff line
@@ -809,7 +809,8 @@ public class SlidingTab extends ViewGroup {
            mVibrator = (android.os.Vibrator)
                    getContext().getSystemService(Context.VIBRATOR_SERVICE);
        }
        mVibrator.vibrate(Integer.parseInt((Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY)).split( ",\\s*" )[0]));
        long[] hapFeedback = stringToLongArray(Settings.System.getString(getContext().getContentResolver(),Settings.System.HAPTIC_DOWN_ARRAY));
        mVibrator.vibrate(hapFeedback, -1);
    }

    /**
@@ -845,6 +846,22 @@ public class SlidingTab extends ViewGroup {
        }
    }

     private long[] stringToLongArray(String inpString) {
        if (inpString == null) {
            long[] returnLong = new long[1];
            returnLong[0] = 0;
            return returnLong;
        }
        String[] splitStr = inpString.split(",");
        int los = splitStr.length;
        long[] returnLong = new long[los];
        int i;
        for (i = 0; i < los; i++) {
            returnLong[i] = Long.parseLong(splitStr[i].trim());
        }
        return returnLong;
    }

    private void log(String msg) {
        Log.d(LOG_TAG, msg);
    }