Example usage for android.text TextUtils equals

List of usage examples for android.text TextUtils equals

Introduction

In this page you can find the example usage for android.text TextUtils equals.

Prototype

public static boolean equals(CharSequence a, CharSequence b) 

Source Link

Document

Returns true if a and b are equal, including if they are both null.

Usage

From source file:Main.java

public static boolean isEnable(Context context) {
    AccessibilityManager manager = (AccessibilityManager) context
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    List<AccessibilityServiceInfo> services = manager
            .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
    boolean flag = false;
    for (AccessibilityServiceInfo info : services) {
        ResolveInfo i = info.getResolveInfo();
        if (TextUtils.equals(context.getPackageName(), i.serviceInfo.packageName)) {
            flag = true;/*from ww  w .  j ava 2 s .c o  m*/
            break;
        }
    }
    return flag;
}

From source file:Main.java

public static boolean isGzipContent(HttpResponse response) {
    return TextUtils.equals(getHeader(response, "Content-Encoding"), "gzip");
}

From source file:Main.java

public static boolean isSupportRange(HttpResponse response) {
    if (TextUtils.equals(getHeader(response, "Accept-Ranges"), "bytes")) {
        return true;
    }/*from   w  w  w  .  jav a 2s.  c  om*/
    String value = getHeader(response, "Content-Range");
    return value != null && value.startsWith("bytes");
}

From source file:Main.java

private static Method getMediadataMethod() {
    Method[] methods = MediaPlayer.class.getDeclaredMethods();
    for (Method method : methods) {
        if (TextUtils.equals(method.getName(), "getMetadata")) {
            return method;
        }//w  ww.  jav  a  2 s  . com
    }
    return null;
}

From source file:Main.java

private static Account getActiveAccount(final Account[] accounts, final String activeAccountName) {
    for (Account account : accounts) {
        if (TextUtils.equals(account.name, activeAccountName)) {
            return account;
        }/*  w  w  w.  ja  va 2  s.com*/
    }
    return null;
}

From source file:Main.java

public static String getParent(String path) {
    if (TextUtils.equals("/", path))
        return path;
    String parentPath = path;/*from   ww w. j a  va 2s . c  om*/
    if (parentPath.endsWith("/"))
        parentPath = parentPath.substring(0, parentPath.length() - 1);
    int index = parentPath.lastIndexOf('/');
    if (index > 0) {
        parentPath = parentPath.substring(0, index);
    } else if (index == 0)
        parentPath = "/";
    return parentPath;
}

From source file:io.square1.oembed.Oembed.java

public static boolean equals(Oembed o1, Oembed o2) {

    if (o1 == o2)
        return true;

    if (o1 != null && o2 != null) {
        return TextUtils.equals(o1.mMainUrl, o2.mMainUrl);
    }/*  w w  w .  j ava  2  s . c  o  m*/
    return false;
}

From source file:Main.java

public static boolean isDefaultDialer(Context context) {
    final boolean result = TextUtils.equals(context.getPackageName(),
            getTelecomManager(context).getDefaultDialerPackage());
    if (result) {
        sWarningLogged = false;/*from   w  w w.  j  a v a 2 s.co m*/
    } else {
        if (!sWarningLogged) {
            // Log only once to prevent spam.
            Log.w(TAG, "Dialer is not currently set to be default dialer");
            sWarningLogged = true;
        }
    }
    return result;
}

From source file:Main.java

public static boolean isSameWith(final @NonNull CharSequence text1, final @NonNull CharSequence text2) {
    return TextUtils.equals(text1, text2);
}

From source file:dev.nick.app.screencast.camera.MediaScratchFileProvider.java

public static boolean isMediaScratchSpaceUri(final Uri uri) {
    if (uri == null) {
        return false;
    }/*ww  w .  j  a  va 2  s. co  m*/

    final List<String> segments = uri.getPathSegments();
    return (TextUtils.equals(uri.getScheme(), ContentResolver.SCHEME_CONTENT)
            && TextUtils.equals(uri.getAuthority(), AUTHORITY) && segments.size() == 1
            && isValidFileId(segments.get(0)));
}