Java 类android.text.TextUtils.SimpleStringSplitter 实例源码

项目:ApkAutoInstaller    文件:InstallerUtils.java   
public static boolean isEnableAutoInstall() {
    Context mContext = AutoInstallerContext.getContext();
    SimpleStringSplitter simpleStringSplitter = new SimpleStringSplitter(':');
    if (!SettingsUtil.isAccessibiltiyEnable(mContext)) {
        return false;
    }
    String string = Secure.getString(mContext.getContentResolver(), "enabled_accessibility_services");
    if (string == null) {
        return false;
    }
    simpleStringSplitter.setString(string);
    while (simpleStringSplitter.hasNext()) {
        if (simpleStringSplitter.next().equalsIgnoreCase(
                AutoInstallerContext.getTargetService())) {
            return true;
        }
    }
    return false;
}
项目:LTB-android    文件:LTCScraper.java   
void loadStopLocations(String routeNum, HashMap<Integer, LTCStop> stops) throws ScrapeException, IOException {
    StringBuilder builder = new StringBuilder(8192);
    String line;
    URL url;
    HttpURLConnection connection;
    boolean try_proxy = PROXY_ENABLED;
    while (true) {
        try {
            if (try_proxy) {
                url = new URL(String.format(PROXY_BASE + LOCATIONS_PATH, routeNum));
                connection = (HttpURLConnection) url.openConnection();
            } else {
                url = new URL(String.format(LTC_BASE + LOCATIONS_PATH, routeNum));
                connection = (HttpURLConnection) url.openConnection();
            }
            connection.setConnectTimeout(MAXIMUM_FETCH_TIMEOUT);
            connection.setReadTimeout(MAXIMUM_FETCH_TIMEOUT);
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
            int offset = 0;
            String stopData = builder.toString();
            // skip past the crap at the start by finding the 1st asterisk
            for (int i = 0; i < 1; ++i) {
                offset = stopData.indexOf('*', offset) + 1;
            }
            /* get the interesting part, and while we're at it, remove all asterisks
     * so we don't have to deal with them at the start of latitudes later
     */
            String actualStopText = stopData.substring(offset).replace("*", "");
            StringSplitter splitter = new SimpleStringSplitter(';');
            splitter.setString(actualStopText);
            for (String stopInfo : splitter) {
                String elems[] = stopInfo.split("\\|");
                if (elems.length == 7) {
                    double latitude = Double.valueOf(elems[0]);
                    double longitude = Double.valueOf(elems[1]);
                    Matcher stopNumMatch = LOCATION_STOP_PATTERN.matcher(elems[4]);
                    if (stopNumMatch.find()) {
                        int stopNum = Integer.valueOf(stopNumMatch.group(1));
                        LTCStop stop = stops.get(stopNum);
                        if (stop != null) {
                            stop.latitude = latitude;
                            stop.longitude = longitude;
                        }
                    }
                }
            }
            connection.disconnect();
            return;
        } catch (SocketException e) {
            if (try_proxy) {
                try_proxy = false;
                continue;
            }
            // if this is already not the proxy, give up
            throw e;
        }
    }
}
项目:aakash-fdroid-client    文件:DB.java   
@Override
public Iterator<String> iterator() {
          SimpleStringSplitter splitter = new SimpleStringSplitter(',');
          splitter.setString(value);
          return splitter.iterator();
      }
项目:aakash_bazaar_client    文件:DB.java   
@Override
public Iterator<String> iterator() {
    SimpleStringSplitter splitter = new SimpleStringSplitter(',');
    splitter.setString(value);
    return splitter.iterator();
}