From c3649a9c80b70dd7406a557ed7433d815ab34852 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 29 Jan 2020 08:46:21 -0500 Subject: [PATCH] formatting touchups --- src/Android/Accessibility/AccessibilityHelpers.cs | 8 ++++---- src/Android/Accessibility/AccessibilityService.cs | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Android/Accessibility/AccessibilityHelpers.cs b/src/Android/Accessibility/AccessibilityHelpers.cs index 955342225..c442da555 100644 --- a/src/Android/Accessibility/AccessibilityHelpers.cs +++ b/src/Android/Accessibility/AccessibilityHelpers.cs @@ -370,7 +370,7 @@ namespace Bit.Droid.Accessibility var anchorViewRectTop = anchorViewRect.Top; anchorViewRect.Dispose(); - int calculatedTop = rootRectHeight - anchorViewRectTop; + var calculatedTop = rootRectHeight - anchorViewRectTop; if((int)Build.VERSION.SdkInt >= 24) { calculatedTop -= GetNavigationBarHeight(); @@ -385,7 +385,8 @@ namespace Bit.Droid.Accessibility Point point = null; if(anchorNode != null) { - anchorNode.Refresh(); // update node's info since this is still a reference from an older event + // Update node's info since this is still a reference from an older event + anchorNode.Refresh(); if(!anchorNode.VisibleToUser) { return new Point(-1, -1); @@ -406,7 +407,7 @@ namespace Bit.Droid.Accessibility { return new Point(-1, -1); } - Rect inputWindowRect = GetInputMethodWindowRect(windows); + var inputWindowRect = GetInputMethodWindowRect(windows); if(inputWindowRect != null) { limitLowY += inputWindowRect.Height(); @@ -419,7 +420,6 @@ namespace Bit.Droid.Accessibility } point = GetOverlayAnchorPosition(root, anchorNode, rootNodeHeight); - if(point.Y < limitLowY || point.Y > limitHighY) { point.X = -1; diff --git a/src/Android/Accessibility/AccessibilityService.cs b/src/Android/Accessibility/AccessibilityService.cs index dda364403..6996d4f04 100644 --- a/src/Android/Accessibility/AccessibilityService.cs +++ b/src/Android/Accessibility/AccessibilityService.cs @@ -29,7 +29,8 @@ namespace Bit.Droid.Accessibility private const string BitwardenWebsite = "vault.bitwarden.com"; private AccessibilityNodeInfo _anchorNode = null; - private int _lastAnchorX, _lastAnchorY = 0; + private int _lastAnchorX = 0; + private int _lastAnchorY = 0; private static bool _overlayAnchorObserverRunning = false; private IWindowManager _windowManager = null; private LinearLayout _overlayView = null; @@ -64,7 +65,7 @@ namespace Bit.Droid.Accessibility return; } - // AccessibilityHelpers.PrintTestData(root, e); + // AccessibilityHelpers.PrintTestData(RootInActiveWindow, e); AccessibilityNodeInfo root = null; @@ -83,6 +84,7 @@ namespace Bit.Droid.Accessibility { break; } + var isKnownBroswer = AccessibilityHelpers.SupportedBrowsers.ContainsKey(root.PackageName); if(e.EventType == EventTypes.ViewClicked && isKnownBroswer) { @@ -255,8 +257,8 @@ namespace Bit.Droid.Accessibility { return; } - _overlayAnchorObserverRunning = true; + _overlayAnchorObserverRunning = true; _overlayAnchorObserverRunnable = new Java.Lang.Runnable(() => { if(_overlayAnchorObserverRunning) @@ -283,8 +285,8 @@ namespace Bit.Droid.Accessibility { windows = Windows; } - var anchorPosition = AccessibilityHelpers.GetOverlayAnchorPosition(_anchorNode, root, windows); + var anchorPosition = AccessibilityHelpers.GetOverlayAnchorPosition(_anchorNode, root, windows); if(anchorPosition == null) { CancelOverlayPrompt();