本文整理汇总了Java中android.view.accessibility.AccessibilityManager.addAccessibilityStateChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityManager.addAccessibilityStateChangeListener方法的具体用法?Java AccessibilityManager.addAccessibilityStateChangeListener怎么用?Java AccessibilityManager.addAccessibilityStateChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityManager
的用法示例。
在下文中一共展示了AccessibilityManager.addAccessibilityStateChangeListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//CrashReport.initCrashReport(getApplicationContext(), "900019352", false);
Bugly.init(getApplicationContext(), "900019352", false);
setContentView(R.layout.activity_main);
pluginStatusText = (TextView) findViewById(R.id.layout_control_accessibility_text);
pluginStatusIcon = (ImageView) findViewById(R.id.layout_control_accessibility_icon);
handleMaterialStatusBar();
explicitlyLoadPreferences();
//监听AccessibilityService 变化
accessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);
accessibilityManager.addAccessibilityStateChangeListener(this);
updateServiceStatus();
}
示例2: checkAndStartService
import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
private void checkAndStartService() {
accessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
@Override
public void onAccessibilityStateChanged(boolean b) {
Log.d(TAG,"onAccessibilityStateChanged b = "+b);
if(b){
goWecaht();
}else{
openService();
}
}
});
name = sendName.getText().toString();
content = sendContent.getText().toString();
if(TextUtils.isEmpty(name)){
Toast.makeText(this,"联系人不能为空",Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(content)) {
Toast.makeText(this,"内容不能为空",Toast.LENGTH_SHORT).show();
return;
}
SharedPreferencesUtils.init(this, Contant.CONTACT).putString("friend",name);
SharedPreferencesUtils.init(this, Contant.CONTACT).putString("content",content);
if(!accessibilityManager.isEnabled()){
openService();
}else{
goWecaht();
}
}
示例3: checkAndStartService
import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
private void checkAndStartService() {
accessibilityManager = (AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE);
accessibilityManager.addAccessibilityStateChangeListener(new AccessibilityManager.AccessibilityStateChangeListener() {
@Override
public void onAccessibilityStateChanged(boolean b) {
Log.d(TAG,"onAccessibilityStateChanged b = "+b);
if(b){
goWecaht();
}else{
openService();
}
}
});
name = sendName.getText().toString();
content = sendContent.getText().toString();
if(TextUtils.isEmpty(name)){
Toast.makeText(this,"联系人不能为空",Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(content)) {
Toast.makeText(this,"内容不能为空",Toast.LENGTH_SHORT).show();
return;
}
if(!accessibilityManager.isEnabled()){
openService();
}else{
goWecaht();
}
}
示例4: onCreate
import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
accessibilityManager = (AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE);
accessibilityManager.addAccessibilityStateChangeListener(this);
motionClickIntent = new Intent(this, MotionClickService.class);
screenRecodeIntent = new Intent(this, ScreenRecodeService.class);
startAllService();
}
示例5: postInflationStartup
import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Override
public void postInflationStartup() {
super.postInflationStartup();
mSnackbarManager = new SnackbarManager(this);
mDataUseSnackbarController = new DataUseSnackbarController(this, getSnackbarManager());
mAssistStatusHandler = createAssistStatusHandler();
if (mAssistStatusHandler != null) {
if (mTabModelSelector != null) {
mAssistStatusHandler.setTabModelSelector(mTabModelSelector);
}
mAssistStatusHandler.updateAssistState();
}
// If a user had ALLOW_LOW_END_DEVICE_UI explicitly set to false then we manually override
// SysUtils.isLowEndDevice() with a switch so that they continue to see the normal UI. This
// is only the case for grandfathered-in svelte users. We no longer do so for newer users.
if (!ChromePreferenceManager.getInstance(this).getAllowLowEndDeviceUi()) {
CommandLine.getInstance().appendSwitch(
BaseSwitches.DISABLE_LOW_END_DEVICE_MODE);
}
AccessibilityManager manager = (AccessibilityManager)
getBaseContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
manager.addAccessibilityStateChangeListener(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mTouchExplorationStateChangeListener = new TouchExplorationStateChangeListener() {
@Override
public void onTouchExplorationStateChanged(boolean enabled) {
checkAccessibility();
}
};
manager.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
}
// Make the activity listen to policy change events
CombinedPolicyProvider.get().addPolicyChangeListener(this);
// Set up the animation placeholder to be the SurfaceView. This disables the
// SurfaceView's 'hole' clipping during animations that are notified to the window.
mWindowAndroid.setAnimationPlaceholderView(mCompositorViewHolder.getSurfaceView());
// Inform the WindowAndroid of the keyboard accessory view.
mWindowAndroid.setKeyboardAccessoryView((ViewGroup) findViewById(R.id.keyboard_accessory));
initializeToolbar();
initializeTabModels();
if (!isFinishing() && getFullscreenManager() != null) {
getFullscreenManager().initialize(
(ControlContainer) findViewById(R.id.control_container),
getTabModelSelector(),
getControlContainerHeightResource());
}
}
示例6: addAccessibilityStateChangeListener
import android.view.accessibility.AccessibilityManager; //导入方法依赖的package包/类
public static boolean addAccessibilityStateChangeListener(AccessibilityManager manager, Object listener) {
return manager.addAccessibilityStateChangeListener((AccessibilityStateChangeListener) listener);
}