diff options
author | nchalko <nchalko@google.com> | 2018-02-22 10:09:14 -0800 |
---|---|---|
committer | Nick Chalko <nchalko@google.com> | 2018-02-26 15:41:02 -0800 |
commit | b74e2b82c01c2ceaf381ca4078930b81faa5731f (patch) | |
tree | e49da88fb217f57c74516db20c13cfd76b05f17e /src/com/android/tv/guide/ProgramGuide.java | |
parent | f8010160ab81af8d5c375c2232908b0ffae802d0 (diff) | |
download | TV-b74e2b82c01c2ceaf381ca4078930b81faa5731f.tar.gz |
FIX: Leave controls displayed when accessibility is turned on.
PiperOrigin-RevId: 186633960
Change-Id: If81f40a26e7636663da32f46d8b69c33e662e3d0
Diffstat (limited to 'src/com/android/tv/guide/ProgramGuide.java')
-rw-r--r-- | src/com/android/tv/guide/ProgramGuide.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/com/android/tv/guide/ProgramGuide.java b/src/com/android/tv/guide/ProgramGuide.java index 33ab9ad7..5b53f904 100644 --- a/src/com/android/tv/guide/ProgramGuide.java +++ b/src/com/android/tv/guide/ProgramGuide.java @@ -43,6 +43,7 @@ import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener; import com.android.tv.ChannelTuner; import com.android.tv.MainActivity; import com.android.tv.R; @@ -57,6 +58,7 @@ import com.android.tv.dvr.DvrDataManager; import com.android.tv.dvr.DvrScheduleManager; import com.android.tv.ui.HardwareLayerAnimatorListenerAdapter; import com.android.tv.ui.ViewUtils; +import com.android.tv.ui.hideable.AutoHideScheduler; import com.android.tv.util.TvInputManagerHelper; import com.android.tv.util.Utils; import java.util.ArrayList; @@ -64,7 +66,8 @@ import java.util.List; import java.util.concurrent.TimeUnit; /** The program guide. */ -public class ProgramGuide implements ProgramGrid.ChildFocusListener { +public class ProgramGuide + implements ProgramGrid.ChildFocusListener, AccessibilityStateChangeListener { private static final String TAG = "ProgramGuide"; private static final boolean DEBUG = false; @@ -141,13 +144,7 @@ public class ProgramGuide implements ProgramGrid.ChildFocusListener { private final Handler mHandler = new ProgramGuideHandler(this); private boolean mActive; - private final Runnable mHideRunnable = - new Runnable() { - @Override - public void run() { - hide(); - } - }; + private final AutoHideScheduler mAutoHideScheduler; private final long mShowDurationMillis; private ViewTreeObserver.OnGlobalLayoutListener mOnLayoutListenerForShow; @@ -415,6 +412,7 @@ public class ProgramGuide implements ProgramGrid.ChildFocusListener { mShowGuidePartial = mAccessibilityManager.isEnabled() || mSharedPreference.getBoolean(KEY_SHOW_GUIDE_PARTIAL, true); + mAutoHideScheduler = new AutoHideScheduler(activity, this::hide); } @Override @@ -569,13 +567,12 @@ public class ProgramGuide implements ProgramGrid.ChildFocusListener { /** Schedules hiding the program guide. */ public void scheduleHide() { - cancelHide(); - mHandler.postDelayed(mHideRunnable, mShowDurationMillis); + mAutoHideScheduler.schedule(mShowDurationMillis); } /** Cancels hiding the program guide. */ public void cancelHide() { - mHandler.removeCallbacks(mHideRunnable); + mAutoHideScheduler.cancel(); } /** Process the {@code KEYCODE_BACK} key event. */ @@ -928,6 +925,11 @@ public class ProgramGuide implements ProgramGrid.ChildFocusListener { } } + @Override + public void onAccessibilityStateChanged(boolean enabled) { + mAutoHideScheduler.onAccessibilityStateChanged(enabled); + } + private class GlobalFocusChangeListener implements ViewTreeObserver.OnGlobalFocusChangeListener { private static final int UNKNOWN = 0; |