List of usage examples for android.view.accessibility AccessibilityManager isTouchExplorationEnabled
public boolean isTouchExplorationEnabled()
From source file:Main.java
public static boolean isTouchExplorationEnabled(AccessibilityManager accessibilityManager) { if (Build.VERSION.SDK_INT >= 14) { return accessibilityManager.isTouchExplorationEnabled(); } else {//w w w.j av a 2s .c o m return false; } }
From source file:Main.java
public static boolean isTouchExplorationEnabled(Context context) { AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); return am.isTouchExplorationEnabled(); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static boolean isTouchExplorationEnabled(Context context) { AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); return am.isTouchExplorationEnabled(); }
From source file:Main.java
public static boolean isAccessibilityEnabled(Context context) { AccessibilityManager accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); return accessibilityManager.isTouchExplorationEnabled(); }
From source file:Main.java
/** * Return true if the accessibility service or touch exploration are enabled. *///from ww w.j a v a2s.c o m public static boolean isTouchAccessiblityEnabled(Context context) { AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); boolean isAccessibilityEnabled = am.isEnabled(); boolean isTouchExplorationEnabled = am.isTouchExplorationEnabled(); return isAccessibilityEnabled || isTouchExplorationEnabled; }
From source file:com.android.messaging.util.AccessibilityUtil.java
public static boolean isTouchExplorationEnabled(final Context context) { final AccessibilityManager accessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); return accessibilityManager.isTouchExplorationEnabled(); }
From source file:android.support.v7.widget.TooltipCompatHandler.java
@Override public boolean onHover(View v, MotionEvent event) { if (mPopup != null && mFromTouch) { return false; }/* www .j a va2s . c om*/ AccessibilityManager manager = (AccessibilityManager) mAnchor.getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (manager.isEnabled() && manager.isTouchExplorationEnabled()) { return false; } switch (event.getAction()) { case MotionEvent.ACTION_HOVER_MOVE: if (mAnchor.isEnabled() && mPopup == null) { mAnchorX = (int) event.getX(); mAnchorY = (int) event.getY(); setPendingHandler(this); } break; case MotionEvent.ACTION_HOVER_EXIT: hide(); break; } return false; }
From source file:com.android.messaging.ui.conversationlist.ConversationListFragment.java
@Override public void onPrepareOptionsMenu(final Menu menu) { super.onPrepareOptionsMenu(menu); final MenuItem startNewConversationMenuItem = menu.findItem(R.id.action_start_new_conversation); if (startNewConversationMenuItem != null) { // It is recommended for the Floating Action button functionality to be duplicated as a // menu/*from w ww . j a v a2 s .c om*/ AccessibilityManager accessibilityManager = (AccessibilityManager) getActivity() .getSystemService(Context.ACCESSIBILITY_SERVICE); startNewConversationMenuItem.setVisible(accessibilityManager.isTouchExplorationEnabled()); } final MenuItem archive = menu.findItem(R.id.action_show_archived); if (archive != null) { archive.setVisible(true); } }
From source file:gov.wa.wsdot.android.wsdot.ui.ferries.departures.FerriesRouteSchedulesDayDeparturesActivity.java
@Override public void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); if (savedInstanceState != null) { initLoad = savedInstanceState.getBoolean("initLoad", true); mDayIndex = savedInstanceState.getInt("dayIndex", 0); mTerminalIndex = savedInstanceState.getInt("terminalIndex", 0); }//from w ww . jav a 2 s. co m AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); if (am != null) { isAccessibilityEnabled = am.isEnabled(); isExploreByTouchEnabled = am.isTouchExplorationEnabled(); } Bundle args = getIntent().getExtras(); String title = args.getString("title"); mScheduleId = args.getInt("scheduleId"); mIsStarred = args.getInt("isStarred") != 0; setContentView(R.layout.activity_ferry_sailings); mViewPager = findViewById(R.id.pager); mAppBar = findViewById(R.id.appbar); mToolbar = findViewById(R.id.toolbar); mToolbar.setTitle(title); setSupportActionBar(mToolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } // set up the sailings spinner mSailingSpinner = this.findViewById(R.id.sailing_spinner); mSailingSpinner.setOnItemSelectedListener(this); mSailingSpinner.setId(SAILING_SPINNER_ID); mSailingsArrayAdapter = new ArrayAdapter<>(this, R.layout.simple_spinner_dropdown_item_white); mSailingsArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSailingSpinner.setAdapter(mSailingsArrayAdapter); // set up the day spinner mDaySpinner = this.findViewById(R.id.day_spinner); mDaySpinner.setOnItemSelectedListener(this); mDaySpinner.setId(DAY_SPINNER_ID); mDayOfWeekArrayAdapter = new ArrayAdapter<>(this, R.layout.simple_spinner_dropdown_item_white); mDayOfWeekArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mDaySpinner.setAdapter(mDayOfWeekArrayAdapter); // set up tab layout mTabLayout = findViewById(R.id.tab_layout); mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL); // Add tab titles and their corresponding fragments to the fragment list. tabFragments.add(mTabLayout.getTabCount(), FerriesRouteSchedulesDayDeparturesFragment.class); mTabLayout.addTab(mTabLayout.newTab().setText("Times")); tabFragments.add(mTabLayout.getTabCount(), FerriesTerminalCameraFragment.class); mTabLayout.addTab(mTabLayout.newTab().setText("Cameras")); tabFragments.add(mTabLayout.getTabCount(), VesselWatchFragment.class); mTabLayout.addTab(mTabLayout.newTab().setText("Vessel Watch")); mTabsAdapter = new TabsAdapter(this, tabFragments, getSupportFragmentManager(), mTabLayout.getTabCount()); mViewPager.setAdapter(mTabsAdapter); mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout)); mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { mViewPager.setCurrentItem(tab.getPosition()); if (tab.getText().equals("Cameras")) { mTracker = ((WsdotApplication) getApplication()).getDefaultTracker(); mTracker.setScreenName("/Ferries/Departures/" + tab.getText()); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); MyLogger.crashlyticsLog("Ferries", "Tap", "FerriesRouteSchedulesDayDeparturesActivity " + tab.getText(), 1); } if (tab.getText().equals("Vessel Watch")) { mTracker = ((WsdotApplication) getApplication()).getDefaultTracker(); mTracker.setScreenName("/Ferries/Departures/" + tab.getText()); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); MyLogger.crashlyticsLog("Ferries", "Tap", "FerriesRouteSchedulesDayDeparturesActivity " + tab.getText(), 1); mAppBar.setExpanded(true, true); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) mToolbar.getLayoutParams(); params.setScrollFlags(0); } else { if (!isAccessibilityEnabled && !isExploreByTouchEnabled) { mAppBar.setExpanded(true); // set expanded true so scroll flags take effect. Not sure why this works. AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) mToolbar.getLayoutParams(); params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED); } } } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); terminalViewModel = ViewModelProviders.of(this, viewModelFactory).get(FerryTerminalViewModel.class); terminalCameraViewModel = ViewModelProviders.of(this, viewModelFactory) .get(FerryTerminalCameraViewModel.class); scheduleViewModel = ViewModelProviders.of(this, viewModelFactory).get(FerrySchedulesViewModel.class); scheduleViewModel.init(mScheduleId); scheduleViewModel.getResourceStatus().observe(this, resourceStatus -> { if (resourceStatus != null) { switch (resourceStatus.status) { case LOADING: break; case SUCCESS: break; case ERROR: break; } } }); scheduleViewModel.getDatesWithSailings().observe(this, dates -> { if (dates != null) { mScheduleDateItems = new ArrayList<>(dates); // only request location on init load if (initLoad) { requestLocation(); } else { setViewContent(); } } }); MyLogger.crashlyticsLog("Ferries", "Screen View", "FerriesRouteSchedulesDayDeparturesActivity " + title, 1); enableAds(getString(R.string.ferries_ad_target)); // Accessibility if (isAccessibilityEnabled || isExploreByTouchEnabled) { mAppBar.setExpanded(true, true); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) mToolbar.getLayoutParams(); params.setScrollFlags(0); } }
From source file:com.joulespersecond.seattlebusbot.ArrivalsListFragment.java
@Override public void onStart() { super.onStart(); ObaAnalytics.reportFragmentStart(this); if (Build.VERSION.SDK_INT >= 14) { AccessibilityManager am = (AccessibilityManager) getActivity() .getSystemService(getActivity().ACCESSIBILITY_SERVICE); Boolean isTalkBackEnabled = am.isTouchExplorationEnabled(); if (isTalkBackEnabled) ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.ACCESSIBILITY.toString(), getString(R.string.analytics_action_touch_exploration), getString(R.string.analytics_label_talkback) + getClass().getSimpleName() + " using TalkBack"); }/*from w w w. j a v a 2 s . c om*/ }