List of usage examples for android.view.accessibility AccessibilityManager isEnabled
public boolean isEnabled()
From source file:ti.modules.titanium.app.AppModule.java
@Kroll.method @Kroll.getProperty/*w ww . j a v a 2s.com*/ public boolean getAccessibilityEnabled() { AccessibilityManager manager = TiApplication.getInstance().getAccessibilityManager(); boolean enabled = manager.isEnabled(); if (!enabled && Build.VERSION.SDK_INT < TiC.API_LEVEL_HONEYCOMB) { // Prior to Honeycomb, AccessibilityManager.isEnabled() would sometimes // return false erroneously the because manager service would asynchronously set the // enabled property in the manager client. So when checking the value, it // might not have been set yet. In studying the changes they made for // Honeycomb, we can see that they do the following in order to determine // if accessibility really is enabled or not: enabled = Settings.Secure.getInt(TiApplication.getInstance().getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1; } return enabled; }
From source file:android.support.v7.widget.TooltipCompatHandler.java
@Override public boolean onHover(View v, MotionEvent event) { if (mPopup != null && mFromTouch) { return false; }//from w w w .j a va 2s . 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:g7.bluesky.launcher3.AppsCustomizeTabHost.java
@Override public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) { mPagedView.onLauncherTransitionEnd(l, animated, toWorkspace); mInTransition = false;/*from w w w. j ava 2 s . c o m*/ if (!toWorkspace) { // Make sure adjacent pages are loaded (we wait until after the transition to // prevent slowing down the animation) mPagedView.loadAssociatedPages(mPagedView.getCurrentPage()); // Opening apps, need to announce what page we are on. AccessibilityManager am = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { // Notify the user when the page changes announceForAccessibility(mPagedView.getCurrentPageDescription()); } // Going from Workspace -> All Apps // NOTE: We should do this at the end since we check visibility state in some of the // cling initialization/dismiss code above. setVisibilityOfSiblingsWithLowerZOrder(INVISIBLE); } }
From source file:rikka.materialpreference.SwitchPreference.java
private void syncViewIfAccessibilityEnabled(View view) { AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!accessibilityManager.isEnabled()) { return;// w w w .j av a 2s. c om } View switchView = view.findViewById(R.id.switchWidget); syncSwitchView(switchView); View summaryView = view.findViewById(android.R.id.summary); syncSummaryView(summaryView); }
From source file:android.support.v7.preference.SwitchPreferenceCompat.java
private void syncViewIfAccessibilityEnabled(View view) { AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!accessibilityManager.isEnabled()) { return;//w ww .j av a2s.com } View switchView = view.findViewById(R.id.switchWidget); syncSwitchView(switchView); View summaryView = view.findViewById(android.R.id.summary); syncSummaryView(summaryView); }
From source file:android.support.v14.preference.SwitchPreference.java
private void syncViewIfAccessibilityEnabled(View view) { AccessibilityManager accessibilityManager = (AccessibilityManager) getContext() .getSystemService(Context.ACCESSIBILITY_SERVICE); if (!accessibilityManager.isEnabled()) { return;/*from w w w . j a v a 2 s . c o m*/ } View switchView = view.findViewById(AndroidResources.ANDROID_R_SWITCH_WIDGET); syncSwitchView(switchView); View summaryView = view.findViewById(android.R.id.summary); syncSummaryView(summaryView); }
From source file:gov.wa.wsdot.android.wsdot.ui.home.HomeActivity.java
/** * Attempts to check if there is a new version of the notification list. * Alerts users with a tap target view if there is. *///w w w. ja v a 2 s .c o m private void tryDisplayNotificationTipView() { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); int topicVersion = settings.getInt(getString(R.string.firebase_notification_topics_version), 0); int newTopicVersion = settings.getInt(getString(R.string.new_firebase_notification_topics_version), 0); String title = settings.getString(getString(R.string.firebase_notification_title), "New Notifications Available"); String description = settings.getString(getString(R.string.firebase_notification_description), ""); AccessibilityManager am = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE); Boolean accessibilityEnabled = false; if (am != null) { accessibilityEnabled = am.isEnabled(); } if ((topicVersion < newTopicVersion) && !accessibilityEnabled) { try { TapTargetView.showFor(this, TapTarget.forToolbarMenuItem(mToolbar, R.id.menu_notifications, title, description) // All options below are optional .outerCircleColor(R.color.primary_default) // Specify a color for the outer circle .titleTextSize(20) // Specify the size (in sp) of the title text .titleTextColor(R.color.white) // Specify the color of the title text .descriptionTextSize(15) // Specify the size (in sp) of the description text .textColor(R.color.white) // Specify a color for both the title and description text .textTypeface(Typeface.SANS_SERIF) // Specify a typeface for the text .dimColor(R.color.black) // If set, will dim behind the view with 30% opacity of the given color .drawShadow(true) // Whether to draw a drop shadow or not .cancelable(true) // Whether tapping outside the outer circle dismisses the view .tintTarget(true) // Whether to tint the target view's color .transparentTarget(true) // Specify whether the target is transparent (displays the content underneath) .targetRadius(40), // Specify the target radius (in dp) new TapTargetView.Listener() { // The listener can listen for regular clicks, long clicks or cancels @Override public void onTargetClick(TapTargetView view) { super.onTargetClick(view); startActivity(new Intent(HomeActivity.this, NotificationsActivity.class)); } }); } catch (NullPointerException | IllegalArgumentException e) { Log.e(TAG, "Exception while trying to show tip view"); Log.e(TAG, e.getMessage()); } } settings.edit().putInt(getString(R.string.firebase_notification_topics_version), newTopicVersion).apply(); }
From source file:com.silentcircle.contacts.activities.ScContactDetailActivity.java
/** * Setup the activity title and subtitle with contact name and company. */// w ww .j av a2s.co m private void setupTitle() { CharSequence displayName = ContactDetailDisplayUtils.getDisplayName(this, mContactData); String company = ContactDetailDisplayUtils.getCompany(this, mContactData); ActionBar actionBar = this.getSupportActionBar(); actionBar.setTitle(displayName); actionBar.setSubtitle(company); if (!TextUtils.isEmpty(displayName)) { AccessibilityManager accessibilityManager = (AccessibilityManager) this .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isEnabled()) { View decorView = getWindow().getDecorView(); decorView.setContentDescription(displayName); decorView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } } }
From source file:com.facebook.litho.LayoutState.java
private static boolean isAccessibilityEnabled(AccessibilityManager accessibilityManager) { return accessibilityManager.isEnabled() && AccessibilityManagerCompat.isTouchExplorationEnabled(accessibilityManager); }
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 . j ava 2 s.c o 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); } }