2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-05 00:25:09 +00:00

Use foreach

This commit is contained in:
Nicolas Fella
2018-09-29 20:36:17 +02:00
parent b513717c75
commit 1a17455992
2 changed files with 9 additions and 9 deletions

View File

@@ -70,14 +70,14 @@ public class PointerAccelerationProfileFactory {
// Breaks if a touchEventHistory entry is too "stale". // Breaks if a touchEventHistory entry is too "stale".
float distanceMoved = 0.0f; float distanceMoved = 0.0f;
long deltaT = 0; long deltaT = 0;
for (int i = 0; i < touchEventHistory.length; i++) { for (TouchDeltaEvent aTouchEventHistory : touchEventHistory) {
if (touchEventHistory[i] == null) break; if (aTouchEventHistory == null) break;
if (eventTime - touchEventHistory[i].time > freshThreshold) break; if (eventTime - aTouchEventHistory.time > freshThreshold) break;
distanceMoved += (float) Math.sqrt( distanceMoved += (float) Math.sqrt(
touchEventHistory[i].x * touchEventHistory[i].x aTouchEventHistory.x * aTouchEventHistory.x
+ touchEventHistory[i].y * touchEventHistory[i].y); + aTouchEventHistory.y * aTouchEventHistory.y);
deltaT = eventTime - touchEventHistory[i].time; deltaT = eventTime - aTouchEventHistory.time;
} }

View File

@@ -283,10 +283,10 @@ public class RemoteKeyboardPlugin extends Plugin {
int[] actions = {EditorInfo.IME_ACTION_GO, EditorInfo.IME_ACTION_NEXT, int[] actions = {EditorInfo.IME_ACTION_GO, EditorInfo.IME_ACTION_NEXT,
EditorInfo.IME_ACTION_SEND, EditorInfo.IME_ACTION_SEARCH, EditorInfo.IME_ACTION_SEND, EditorInfo.IME_ACTION_SEARCH,
EditorInfo.IME_ACTION_DONE}; // note: DONE should be last or we might hide the ime instead of "go" EditorInfo.IME_ACTION_DONE}; // note: DONE should be last or we might hide the ime instead of "go"
for (int i = 0; i < actions.length; i++) { for (int action : actions) {
if ((editorInfo.imeOptions & actions[i]) == actions[i]) { if ((editorInfo.imeOptions & action) == action) {
// Log.d("RemoteKeyboardPlugin", "Enter-action: " + actions[i]); // Log.d("RemoteKeyboardPlugin", "Enter-action: " + actions[i]);
inputConn.performEditorAction(actions[i]); inputConn.performEditorAction(action);
return true; return true;
} }
} }