Java Code Examples for android.provider.Settings#ACTION_ACCESSIBILITY_SETTINGS

The following examples show how to use android.provider.Settings#ACTION_ACCESSIBILITY_SETTINGS . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: SoloPi   File: EventService.java    License: Apache License 2.0 6 votes vote down vote up
public void startTrackAccessibilityEvent() {
    Context context = contextRef.get();
    if (context == null) {
        return;
    }

    // 检查Accessibility
    if (!PermissionUtil.isAccessibilitySettingsOn(context)) {
        showEnableAccessibilityServiceHint();
        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        context.startActivity(intent);
        // 当AccessibilityService已启动,修改运行模式
    } else {
        if (accessibilityTracker == null) {
            accessibilityTracker = new AccessibilityEventTracker();
        }

        accessibilityTracker.setAccessibilityListener(proxy);
        accessibilityTracker.startTrackEvent();
    }
}
 
Example 2
public void openAcsSettings(final Context ctx, boolean forceShowOnboarding) {
    mPrevAccessibilitySettingsOn = AndroidIntegration
            .isAccessibilitySettingsOnAndServiceRunning(ctx);

    Intent intent = new Intent(
            Settings.ACTION_ACCESSIBILITY_SETTINGS);

    PackageManager packageManager = getActivity().getPackageManager();
    if (intent.resolveActivity(packageManager) != null) {
        startActivityForResult(
                intent,
                0);
        if (!GotItPreferences.Companion.getPreferences(ctx).isTooltipConfirmed(getString(R.string.tooltipid_onboarding))
                || forceShowOnboarding) {
            vgBoss.postDelayed(new Runnable() {
                @Override
                public void run() {
                    OnboardingActivity.show(ctx);
                }
            }, 500);
        }
    } else {
        Ln.w("No Intent available to handle ACTION_ACCESSIBILITY_SETTINGS");
        ActionAccessibilitySettingsNotResolvableActivity.show(ctx);
    }
}
 
Example 3
Source Project: MiHomePlus   File: MainActivity.java    License: MIT License 6 votes vote down vote up
public void onClick(View v) {
    Intent intent = new Intent();
    switch (v.getId()) {
        case R.id.Accessibility:
            Context context = getApplicationContext();
            CharSequence text = "請激活 MiHomePlus 無障礙設定";
            int duration = Toast.LENGTH_SHORT;
            Toast.makeText(context, text, duration).show();

            //打开系统无障碍设置界面
            Intent accessibleIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
            startActivity(accessibleIntent);
            break;
        case R.id.AppSetting:
            intent.setClass(MainActivity.this, AppSetting.class);
            startActivity(intent);
            break;
        case R.id.Help:
            intent.setClass(MainActivity.this, Help.class);
            startActivity(intent);
            break;
        default:
            break;
    }
}
 
Example 4
@Override
public void onClick(View v) {
    if (v == btnRoot) {
        rootInstall();
    }
    if (v == btnAccess) {
        accessInstall();
    }
    if (v == btnSelectApk) {
        selectApk();
    }
    if (v == btnOpenAccess) {
        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        startActivity(intent);
    }
}
 
Example 5
@Override
public void onReceive(Context context, Intent intent) {
    SharedPreferences mSp = PreferenceManager.getDefaultSharedPreferences(context);
    if (intent.getAction().equals(Config.REMOTE_CONTROL_ACTION)) {
        boolean displayToast = intent.getBooleanExtra("RESPOND", true);
        if (BaseMethod.isAccessibilitySettingsOn(context)) {
            BaseMethod.KeyLockBroadcast(context, true, true);
        } else if (mSp.getBoolean(Config.ROOT_OPEN_SERVICE, false) && mSp.getBoolean(Config.ROOT_FUNCTION, false)) {
            BaseMethod.controlAccessibilityServiceWithRoot(true, false);
        } else {
            if (displayToast) {
                Toast.makeText(context, R.string.start_service_first, Toast.LENGTH_SHORT).show();
                Intent access_intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
                context.startActivity(access_intent);
            }
        }
    }
}
 
Example 6
public static void RunAccessibilityService(Context context) {
    SharedPreferences mSp = PreferenceManager.getDefaultSharedPreferences(context);
    if (mSp.getBoolean(Config.ROOT_OPEN_SERVICE, false) && mSp.getBoolean(Config.ROOT_FUNCTION, false)) {
        controlAccessibilityServiceWithRoot(true, false);
    } else {
        Toast.makeText(context, R.string.start_service_first, Toast.LENGTH_SHORT).show();
        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}
 
Example 7
Source Project: FileManager   File: AccessibilityUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static void gotoAccessibilityPage(Context context) {
    try {
        Intent accessibilityItent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        context.startActivity(accessibilityItent);
    } catch (Exception e) {
        Loger.w("AccessibilityUtil", e.toString());
        e.printStackTrace();
    }
}
 
Example 8
@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();
    if (ACTION_TEMP_HIDE.equals(action)) {
        Core.getInstance(this).doTemporaryHide(intent.getStringExtra(EXTRA_PACKAGE_NAME), Boolean.TRUE);
        Core.getInstance(this).closeNotificationDrawer();

    } else if (ACTION_TEMP_SHOW.equals(action)) {
        Core.getInstance(this).doTemporaryHide(intent.getStringExtra(EXTRA_PACKAGE_NAME), Boolean.FALSE);
        Core.getInstance(this).closeNotificationDrawer();

    } else if (ACTION_SHOW_CONFIG.equals(action)) {
        AppConfigActivity.show(this, intent.getStringExtra(EXTRA_PACKAGE_NAME), null);
    } else if (ACTION_STOPBOSS.equals(action)) {
        Core.getInstance(this).panic();

    } else if (ACTION_SHOW_ACCESSIBILITY_SETTINGS.equals(action)) {

        Intent i = new Intent(
                Settings.ACTION_ACCESSIBILITY_SETTINGS);
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        PackageManager packageManager = getPackageManager();
        if (intent.resolveActivity(packageManager) != null) {
            startActivity(i);
        } else {
            Ln.w("No Intent available to handle ACTION_ACCESSIBILITY_SETTINGS");
            ActionAccessibilitySettingsNotResolvableActivity.showFromService(this);
            ;
        }


    } else if (ACTION_INFO_ON.equals(action)) {
        Core.getInstance(this).toggleInfoMode(true);
        Core.getInstance(this).closeNotificationDrawer();
    } else if (ACTION_INFO_OFF.equals(action)) {
        Core.getInstance(this).toggleInfoMode(false);
        Core.getInstance(this).closeNotificationDrawer();
    }
}
 
Example 9
private void enableExtender() {
        if (getActivity() == null)
            return;

        boolean ok = false;
        if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_ACCESSIBILITY_SETTINGS, getActivity())) {
            try {
                Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
                startActivityForResult(intent, RESULT_ACCESSIBILITY_SETTINGS);
                ok = true;
            } catch (Exception e) {
                PPApplication.recordException(e);
            }
        }
        if (!ok) {
            if (getActivity() != null) {
                AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
                dialogBuilder.setMessage(R.string.setting_screen_not_found_alert);
                //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert);
                dialogBuilder.setPositiveButton(android.R.string.ok, null);
                AlertDialog dialog = dialogBuilder.create();

//                dialog.setOnShowListener(new DialogInterface.OnShowListener() {
//                    @Override
//                    public void onShow(DialogInterface dialog) {
//                        Button positive = ((AlertDialog)dialog).getButton(DialogInterface.BUTTON_POSITIVE);
//                        if (positive != null) positive.setAllCaps(false);
//                        Button negative = ((AlertDialog)dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
//                        if (negative != null) negative.setAllCaps(false);
//                    }
//                });

                if (!getActivity().isFinishing())
                    dialog.show();
            }
        }
    }
 
Example 10
public static void RestartAccessibilityService(Context context) {
    if (isAccessibilitySettingsOn(context)) {
        SharedPreferences mSp = PreferenceManager.getDefaultSharedPreferences(context);
        if (mSp.getBoolean(Config.ROOT_OPEN_SERVICE, false) && mSp.getBoolean(Config.ROOT_FUNCTION, false)) {
            controlAccessibilityServiceWithRoot(false, true);
        } else {
            Toast.makeText(context, R.string.restart_service, Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
            context.startActivity(intent);
        }
    }
}
 
Example 11
Source Project: Noyze   File: ConfigurationActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void openAccessibility() {
    Intent accessibility = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    try {
        startActivity(accessibility);
    } catch (ActivityNotFoundException e) {
        LOGE(TAG, "Error opening Accessibility.", e);
        Crouton.showText(getActivity(), R.string.accessibility_error, Style.ALERT);
    }
}
 
Example 12
public void openAccessibility() {
    try {
        Intent accessibleIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
        accessibleIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (accessibleIntent == null) {
        } else {
            startActivity(accessibleIntent);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
Example 13
public void showObtainingPermissionAccessibility() {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    startActivity(intent);
}
 
Example 14
Source Project: styT   File: buff_ext.java    License: Apache License 2.0 4 votes vote down vote up
public void onForwardToAccessibility(View view) {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    startActivity(intent);
}
 
Example 15
Source Project: stynico   File: buff_ext.java    License: MIT License 4 votes vote down vote up
public void onForwardToAccessibility(View view)
{
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    startActivity(intent);
}
 
Example 16
Source Project: FireFiles   File: PackageManagerUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static void startAccessibilitySettings(Context context) {
	Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
	intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	context.startActivity(intent);
}
 
Example 17
Source Project: FireFiles   File: PackageManagerUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static void startAccessibilitySettings(Context context) {
	Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
	intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	context.startActivity(intent);
}
 
Example 18
/**
 * {@inheritDoc}
 */
@NonNull
@Override
public Intent getIntentSettings() {
    return new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
}
 
Example 19
@Override
public void guideToEnable(Context context) {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}
 
Example 20
private void jumpToAccessSetting() {
    Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}