本文整理汇总了Java中android.text.TextUtils.SimpleStringSplitter方法的典型用法代码示例。如果您正苦于以下问题:Java TextUtils.SimpleStringSplitter方法的具体用法?Java TextUtils.SimpleStringSplitter怎么用?Java TextUtils.SimpleStringSplitter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextUtils
的用法示例。
在下文中一共展示了TextUtils.SimpleStringSplitter方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAccessibilityServiceEnabled
import android.text.TextUtils; //导入方法依赖的package包/类
public static boolean isAccessibilityServiceEnabled(Context context, Class<? extends AccessibilityService> accessibilityService) {
ComponentName expectedComponentName = new ComponentName(context, accessibilityService);
String enabledServicesSetting = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (enabledServicesSetting == null)
return false;
TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
colonSplitter.setString(enabledServicesSetting);
while (colonSplitter.hasNext()) {
String componentNameString = colonSplitter.next();
ComponentName enabledService = ComponentName.unflattenFromString(componentNameString);
if (enabledService != null && enabledService.equals(expectedComponentName))
return true;
}
return false;
}
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:21,代码来源:AccessibilityServiceUtils.java
示例2: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
public static boolean isAccessibilitySettingsOn(Context context, String serviceName) {
int accessibilityEnabled = 0;
boolean accessibilityFound = false;
try {
accessibilityEnabled = Settings.Secure.getInt(context.getApplicationContext().getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED);
} catch (SettingNotFoundException e) {
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
String settingValue = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
splitter.setString(settingValue);
while (splitter.hasNext()) {
String accessabilityService = splitter.next();
if (accessabilityService.equalsIgnoreCase(serviceName)) {
return true;
}
}
}
} else {
// Log.v(TAG, "***ACCESSIBILIY IS DISABLED***");
}
return accessibilityFound;
}
示例3: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn() {
int accessibilityEnabled = 0;
final String service = getPackageName() + "/" + NotificationService.class.getName();
boolean accessibilityFound = false;
try {
accessibilityEnabled = Settings.Secure.getInt(getApplicationContext().getContentResolver(), android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
} catch (Settings.SettingNotFoundException e) {
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
String settingValue = Settings.Secure.getString(getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
splitter.setString(settingValue);
while (splitter.hasNext()) {
String accessabilityService = splitter.next();
if (accessabilityService.equalsIgnoreCase(service)) {
return true;
}
}
}
} else {
}
return accessibilityFound;
}
示例4: checkAccessibilityEnabled
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* 检测当前辅助服务是否开启
*/
public static boolean checkAccessibilityEnabled(Context context,Class<? extends AccessibilityService> clazz) {
int accessibilityEnabled = 0;
final String service = context.getPackageName() + "/" + clazz.getCanonicalName();
try {
accessibilityEnabled = Settings.Secure.getInt(context.getApplicationContext().getContentResolver(),Settings.Secure.ACCESSIBILITY_ENABLED);
} catch (Settings.SettingNotFoundException ignored) {
// ignored
}
TextUtils.SimpleStringSplitter stringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
String settingValue = Settings.Secure.getString(context.getApplicationContext().getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
stringColonSplitter.setString(settingValue);
while (stringColonSplitter.hasNext()) {
String accessibilityService = stringColonSplitter.next();
if (accessibilityService.equalsIgnoreCase(service)) {
return true;
}
}
}
}
return false;
}
示例5: getAccessibilityStatus
import android.text.TextUtils; //导入方法依赖的package包/类
public static void getAccessibilityStatus(Context context) {
long start = System.currentTimeMillis();
try {
Set<ComponentName> enabledServices = new HashSet<>();
final String enabledServicesSetting = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
final TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
colonSplitter.setString(enabledServicesSetting);
while (colonSplitter.hasNext()) {
final String componentNameString = colonSplitter.next();
final ComponentName enabledService = ComponentName.unflattenFromString(componentNameString);
BaseAccessibility.logPrint("getAccessibilityStatus= " + componentNameString + " enabledService=" + (enabledService == null ? false : true));
if (enabledService != null) {
enabledServices.add(enabledService);
}
}
ComponentName appstoreComponent = new ComponentName(context, MyAccessibility.class);
BaseAccessibility.isEnable.set(enabledServices.contains(appstoreComponent));
BaseAccessibility.logPrint("getAccessibilityStatus status:" + BaseAccessibility.isEnable.get() + " enabledServicesSetting=" + enabledServicesSetting);
} catch (Throwable e) {
BaseAccessibility.logPrint(e.getMessage());
e.printStackTrace();
}
BaseAccessibility.logPrint("getAccessibilityStatus= " + "getAccessibilityStatus cost:" + (System.currentTimeMillis() - start) + ",status:" + BaseAccessibility.isEnable.get());
}
示例6: parseSelectedAccounts
import android.text.TextUtils; //导入方法依赖的package包/类
private void parseSelectedAccounts(String selectedIds) {
try {
TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
splitter.setString(selectedIds);
for (String s : splitter) {
long id = Long.parseLong(s);
for (Account account : accounts) {
if (account.id == id) {
account.setChecked(true);
break;
}
}
}
} catch (Exception ex) {
// ignore
}
}
示例7: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn(Context mContext) {
int accessibilityEnabled = 0;
final String service = getPackageName() + "/" + JumpService.class.getCanonicalName();
try {
accessibilityEnabled = Settings.Secure.getInt(
mContext.getApplicationContext().getContentResolver(),
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
log.v( "accessibilityEnabled = " + accessibilityEnabled);
} catch (Settings.SettingNotFoundException e) {
log.d( "Error finding setting, default accessibility to not found: "
+ e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
log.v( "***ACCESSIBILITY IS ENABLED*** -----------------");
String settingValue = Settings.Secure.getString(
mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
mStringColonSplitter.setString(settingValue);
while (mStringColonSplitter.hasNext()) {
String accessibilityService = mStringColonSplitter.next();
log.v( "-------------- > accessibilityService :: " + accessibilityService + " " + service);
if (accessibilityService.equalsIgnoreCase(service)) {
log.v( "We've found the correct setting - accessibility is switched on!");
return true;
}
}
}
} else {
log.v( "***ACCESSIBILITY IS DISABLED***");
}
return false;
}
示例8: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn(Context mContext) {
int accessibilityEnabled = 0;
final String service = getPackageName() + "/" + HelpService.class.getCanonicalName();
try {
accessibilityEnabled = Settings.Secure.getInt(
mContext.getApplicationContext().getContentResolver(),
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
Log.v(TAG, "accessibilityEnabled = " + accessibilityEnabled);
} catch (Settings.SettingNotFoundException e) {
Log.e(TAG, "Error finding setting, default accessibility to not found: "
+ e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
Log.v(TAG, "***ACCESSIBILITY IS ENABLED*** -----------------");
String settingValue = Settings.Secure.getString(
mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
mStringColonSplitter.setString(settingValue);
while (mStringColonSplitter.hasNext()) {
String accessibilityService = mStringColonSplitter.next();
Log.v(TAG, "-------------- > accessibilityService :: " + accessibilityService + " " + service);
if (accessibilityService.equalsIgnoreCase(service)) {
Log.v(TAG, "We've found the correct setting - accessibility is switched on!");
return true;
}
}
}
} else {
Log.v(TAG, "***ACCESSIBILITY IS DISABLED***");
}
return false;
}
示例9: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Checks if the Forge Auto fill accessibility service is enabled
*
* @param context application context
* @return true = service enabled, false = service disabled
*/
public static boolean isAccessibilitySettingsOn(Context context) {
int accessibilityEnabled = 0;
final String service = context.getPackageName() + "/" + AccessibilityAutofillService.class.getCanonicalName();
try {
accessibilityEnabled = Settings.Secure.getInt(
context.getApplicationContext().getContentResolver(),
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
} catch (Settings.SettingNotFoundException e) {
// If there is an error, log it
Log.e(Forge.ERROR_LOG, e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
String settingValue = Settings.Secure.getString(
context.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
mStringColonSplitter.setString(settingValue);
while (mStringColonSplitter.hasNext()) {
String accessibilityService = mStringColonSplitter.next();
if (accessibilityService.equalsIgnoreCase(service)) {
return true;
}
}
}
}
return false;
}
示例10: isAccessibilityServiceEnabled
import android.text.TextUtils; //导入方法依赖的package包/类
public static boolean isAccessibilityServiceEnabled(Context context, Class<? extends AccessibilityService> accessibilityService) {
String enabledServicesSetting = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (enabledServicesSetting == null) return false;
TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
colonSplitter.setString(enabledServicesSetting);
while (colonSplitter.hasNext()) {
ComponentName enabledService = ComponentName.unflattenFromString(colonSplitter.next());
if (enabledService != null && enabledService.equals(new ComponentName(context, accessibilityService)))
return true;
}
return false;
}
示例11: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
public static boolean isAccessibilitySettingsOn(Context mContext) {
int accessibilityEnabled = 0;
final String service = BigBangApp.getInstance().getPackageName() + "/" + BigBangMonitorService.class.getCanonicalName();
try {
accessibilityEnabled = Settings.Secure.getInt(
mContext.getApplicationContext().getContentResolver(),
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
LogUtil.v(TAG, "accessibilityEnabled = " + accessibilityEnabled);
} catch (Settings.SettingNotFoundException e) {
LogUtil.d(TAG, "Error finding setting, default accessibility to not found: "
+ e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
LogUtil.v(TAG, "***ACCESSIBILITY IS ENABLED*** -----------------");
String settingValue = Settings.Secure.getString(
mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
mStringColonSplitter.setString(settingValue);
while (mStringColonSplitter.hasNext()) {
String accessibilityService = mStringColonSplitter.next();
LogUtil.v(TAG, "-------------- > accessibilityService :: " + accessibilityService + " " + service);
if (accessibilityService.equalsIgnoreCase(service)) {
LogUtil.v(TAG, "We've found the correct setting - accessibility is switched on!");
return true;
}
}
}
} else {
LogUtil.v(TAG, "***ACCESSIBILITY IS DISABLED***");
}
return false;
}
示例12: isAccessibilitySettingsOn
import android.text.TextUtils; //导入方法依赖的package包/类
private boolean isAccessibilitySettingsOn(Context mContext) {
int accessibilityEnabled = 0;
final String service = getPackageName() + "/" + getPackageName() + ".MyService";
boolean accessibilityFound = false;
try {
accessibilityEnabled = Settings.Secure.getInt(
mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ACCESSIBILITY_ENABLED);
Log.v("MainActivity","accessibilityEnabled = " + accessibilityEnabled);
} catch (Settings.SettingNotFoundException e) {
Log.e("MainActivity","Error finding setting, default accessibility to not found: "
+ e.getMessage());
}
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
if (accessibilityEnabled == 1) {
Log.v("MainActivity","***ACCESSIBILIY IS ENABLED*** -----------------");
String settingValue = Settings.Secure.getString(
mContext.getApplicationContext().getContentResolver(),
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
if (settingValue != null) {
TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
splitter.setString(settingValue);
while (splitter.hasNext()) {
String accessabilityService = splitter.next();
Log.v("MainActivity","-------------- > accessabilityService :: " + accessabilityService);
if (accessabilityService.equalsIgnoreCase(service)) {
Log.v("MainActivity","We've found the correct setting - accessibility is switched on!");
return true;
}
}
}
} else {
Log.v("MainActivity","***ACCESSIBILIY IS DISABLED***");
}
return accessibilityFound;
}