List of usage examples for java.lang Character toString
public static String toString(int codePoint)
From source file:com.lgallardo.qbittorrentclient.TorrentDetailsFragment.java
public void updateDetails(Torrent torrent) { // Log.d("Debug", "Updating details"); try {/* w ww .j a v a 2 s. c o m*/ // Hide herderInfo in phone's view if (getActivity().findViewById(R.id.one_frame) != null) { MainActivity.headerInfo.setVisibility(View.GONE); } // Get values from current activity name = torrent.getFile(); size = torrent.getSize(); hash = torrent.getHash(); ratio = torrent.getRatio(); state = torrent.getState(); leechs = torrent.getLeechs(); seeds = torrent.getSeeds(); progress = torrent.getProgress(); priority = torrent.getPriority(); eta = torrent.getEta(); uploadSpeed = torrent.getUploadSpeed(); downloadSpeed = torrent.getDownloadSpeed(); downloaded = torrent.getDownloaded(); addedOn = torrent.getAddedOn(); completionOn = torrent.getCompletionOn(); label = torrent.getLabel(); int index = torrent.getProgress().indexOf("."); if (index == -1) { index = torrent.getProgress().indexOf(","); if (index == -1) { index = torrent.getProgress().length(); } } percentage = torrent.getProgress().substring(0, index); FragmentManager fragmentManager = getFragmentManager(); TorrentDetailsFragment detailsFragment = null; if (getActivity().findViewById(R.id.one_frame) != null) { detailsFragment = (TorrentDetailsFragment) fragmentManager.findFragmentByTag("firstFragment"); } else { detailsFragment = (TorrentDetailsFragment) fragmentManager.findFragmentByTag("secondFragment"); } View rootView = detailsFragment.getView(); TextView nameTextView = (TextView) rootView.findViewById(R.id.torrentName); TextView sizeTextView = (TextView) rootView.findViewById(R.id.torrentSize); TextView ratioTextView = (TextView) rootView.findViewById(R.id.torrentRatio); TextView priorityTextView = (TextView) rootView.findViewById(R.id.torrentPriority); TextView stateTextView = (TextView) rootView.findViewById(R.id.torrentState); TextView leechsTextView = (TextView) rootView.findViewById(R.id.torrentLeechs); TextView seedsTextView = (TextView) rootView.findViewById(R.id.torrentSeeds); TextView progressTextView = (TextView) rootView.findViewById(R.id.torrentProgress); TextView hashTextView = (TextView) rootView.findViewById(R.id.torrentHash); TextView etaTextView = (TextView) rootView.findViewById(R.id.torrentEta); TextView uploadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentUploadSpeed); TextView downloadSpeedTextView = (TextView) rootView.findViewById(R.id.torrentDownloadSpeed); CheckBox sequentialDownloadCheckBox; CheckBox firstLAstPiecePrioCheckBox; nameTextView.setText(name); ratioTextView.setText(ratio); stateTextView.setText(state); leechsTextView.setText(leechs); seedsTextView.setText(seeds); progressTextView.setText(progress); hashTextView.setText(hash); priorityTextView.setText(priority); etaTextView.setText(eta); if (MainActivity.qb_version.equals("3.2.x")) { sequentialDownloadCheckBox = (CheckBox) rootView.findViewById(R.id.torrentSequentialDownload); firstLAstPiecePrioCheckBox = (CheckBox) rootView.findViewById(R.id.torrentFirstLastPiecePrio); sequentialDownloadCheckBox.setChecked(torrent.getSequentialDownload()); firstLAstPiecePrioCheckBox.setChecked(torrent.getisFirstLastPiecePrio()); TextView addedOnTextView = (TextView) rootView.findViewById(R.id.torrentAddedOn); TextView completionOnTextView = (TextView) rootView.findViewById(R.id.torrentCompletionOn); TextView labelTextView = (TextView) rootView.findViewById(R.id.torrentLabel); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); if (addedOn != null && !(addedOn.equals("null")) && !(addedOn.equals("4294967295"))) { if (Integer.parseInt(MainActivity.qb_api) < 10) { // Old time format 2016-07-25T20:52:07 addedOnTextView .setText(new SimpleDateFormat("dd/MM/yyyy - HH:mm").format(sdf.parse(addedOn))); } else { // New unix timestamp format 4294967295 addedOnTextView.setText(Common.timestampToDate(addedOn)); } } else { addedOnTextView.setText(""); } if (completionOn != null && !(completionOn.equals("null")) && !(completionOn.equals("4294967295"))) { if (Integer.parseInt(MainActivity.qb_api) < 10) { // Old time format 2016-07-25T20:52:07 completionOnTextView.setText( new SimpleDateFormat("dd/MM/yyyy - HH:mm").format(sdf.parse(completionOn))); } else { // New unix timestamp format 4294967295 completionOnTextView.setText(Common.timestampToDate(completionOn)); } } else { completionOnTextView.setText(""); } if (label != null && !(label.equals("null"))) { labelTextView.setText(label); } else { labelTextView.setText(""); } } // Set Downloaded vs Total size sizeTextView.setText(downloaded + " / " + size); // Only for Pro version if (MainActivity.packageName.equals("com.lgallardo.qbittorrentclientpro")) { downloadSpeedTextView.setText(Character.toString('\u2193') + " " + downloadSpeed); uploadSpeedTextView.setText(Character.toString('\u2191') + " " + uploadSpeed); // Set progress bar ProgressBar progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1); TextView percentageTV = (TextView) rootView.findViewById(R.id.percentage); progressBar.setProgress(Integer.parseInt(percentage)); percentageTV.setText(percentage + "%"); } else { downloadSpeedTextView.setText(downloadSpeed); uploadSpeedTextView.setText(uploadSpeed); } nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0); if ("pausedUP".equals(state) || "pausedDL".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.paused, 0, 0, 0); } if ("stalledUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalledup, 0, 0, 0); } if ("stalledDL".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.stalleddl, 0, 0, 0); } if ("downloading".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.downloading, 0, 0, 0); } if ("uploading".equals(state) || "forcedUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.uploading, 0, 0, 0); } if ("queuedDL".equals(state) || "queuedUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.queued, 0, 0, 0); } if ("checkingDL".equals(state) || "checkingUP".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_recheck, 0, 0, 0); } if ("error".equals(state) || "missingFiles".equals(state) || "unknown".equals(state)) { nameTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.error, 0, 0, 0); } // // Get Content files in background ContentFileTask cft = new ContentFileTask(); cft.execute(new String[] { hash }); // Get trackers in background TrackersTask tt = new TrackersTask(); tt.execute(new String[] { hash }); // Get General info labels generalInfoItems = new ArrayList<GeneralInfoItem>(); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_save_path), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_created_date), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_comment), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_total_wasted), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_total_uploaded), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_total_downloaded), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_time_elapsed), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_num_connections), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_share_ratio), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_upload_rate_limit), null, GeneralInfoItem.GENERALINFO, "generalInfo")); generalInfoItems.add(new GeneralInfoItem(getString(R.string.torrent_details_download_rate_limit), null, GeneralInfoItem.GENERALINFO, "generalInfo")); // Get General info in background; GeneralInfoTask git = new GeneralInfoTask(); git.execute(new String[] { hash }); } catch (Exception e) { Log.e("Debug", "TorrentDetailsFragment - onCreateView: " + e.toString()); } }
From source file:edu.cornell.med.icb.goby.modes.MethylationRateVCFOutputFormat.java
private String findGenomicContext(int referenceIndex, int position) { int zeroBasedPos = position - 1; char currentBase = genome.get(referenceIndex, zeroBasedPos); int referenceLength = genome.getLength(referenceIndex); char nextBase = '?'; String tempContext = new StringBuilder().append('C').append('p').toString(); char concatBase = '?'; if (currentBase == 'C') { if (referenceLength == position) { return Character.toString(currentBase); }//from ww w .j a va2s. co m nextBase = genome.get(referenceIndex, (zeroBasedPos + 1)); concatBase = nextBase; } else { if (currentBase == 'G') { if (zeroBasedPos == 0) { return Character.toString(currentBase); } nextBase = genome.get(referenceIndex, (zeroBasedPos - 1)); switch (nextBase) { case 'C': concatBase = 'G'; break; case 'A': concatBase = 'T'; break; case 'T': concatBase = 'A'; break; case 'G': concatBase = 'C'; break; } } } tempContext = tempContext.concat(Character.toString(concatBase)); return tempContext; }
From source file:edu.emory.cci.aiw.i2b2etl.ksb.I2b2KnowledgeSourceBackend.java
public String getInoutPropertyValueSetDelimiter() { return Character.toString(inoutPropertyValueSetDelimiter); }
From source file:com.appeaser.sublimepickerlibrary.timepicker.SublimeTimePicker.java
/** * The time separator is defined in the Unicode CLDR and cannot be supposed to be ":". * <p/>/*from ww w. j a v a 2 s. co m*/ * See http://unicode.org/cldr/trac/browser/trunk/common/main * <p/> * We pass the correct "skeleton" depending on 12 or 24 hours view and then extract the * separator as the character which is just after the hour marker in the returned pattern. */ private void updateHeaderSeparator() { String timePattern; // Available on API >= 18 if (SUtils.isApi_18_OrHigher()) { timePattern = DateFormat.getBestDateTimePattern(mCurrentLocale, (mIs24HourView) ? "Hm" : "hm"); } else { timePattern = DateTimePatternHelper.getBestDateTimePattern(mCurrentLocale, (mIs24HourView) ? DateTimePatternHelper.PATTERN_Hm : DateTimePatternHelper.PATTERN_hm); } final String separatorText; // See http://www.unicode.org/reports/tr35/tr35-dates.html for hour formats final char[] hourFormats = { 'H', 'h', 'K', 'k' }; int hIndex = lastIndexOfAny(timePattern, hourFormats); if (hIndex == -1) { // Default case separatorText = ":"; } else { separatorText = Character.toString(timePattern.charAt(hIndex + 1)); } mSeparatorView.setText(separatorText); }
From source file:org.apache.vxquery.index.IndexDocumentBuilder.java
private String[] printString(UTF8StringPointable utf8sp, String path) { int utfLen = utf8sp.getUTF8Length(); int offset = utf8sp.getMetaDataLength(); String[] result = { "", path }; while (utfLen > 0) { char c = utf8sp.charAt(offset); switch (c) { case '<': result[0] += "<"; break; case '>': result[0] += ">"; break; case '&': result[0] += "&"; break; case '"': result[0] += """; break; case '\'': result[0] += "'"; break; default://from w ww.ja va 2s.co m result[0] += Character.toString(c); break; } int cLen = utf8sp.charSize(offset); offset += cLen; utfLen -= cLen; } result[1] = path + "/" + result[0]; return result; }
From source file:edu.harvard.iq.dataverse.ingest.tabulardata.impl.plugins.por.PORFileReader.java
private void decodeNumberOfVariables(BufferedReader reader) throws IOException { if (reader == null) { throw new IllegalArgumentException("decodeNumberOfVariables: reader == null!"); }//ww w .j av a 2s. c o m String temp = null; char[] tmp = new char[1]; StringBuilder sb = new StringBuilder(); while (reader.read(tmp) > 0) { temp = Character.toString(tmp[0]); if (temp.equals("/")) { break; } else { sb.append(temp); } } String rawNumberOfVariables = sb.toString(); int rawLength = rawNumberOfVariables.length(); String numberOfVariables = StringUtils.stripStart((StringUtils.strip(rawNumberOfVariables)), "0"); if ((numberOfVariables.equals("")) && (numberOfVariables.length() == rawLength)) { numberOfVariables = "0"; } varQnty = Integer.valueOf(numberOfVariables, 30); dataTable.setVarQuantity(Long.valueOf(numberOfVariables, 30)); }
From source file:edu.cornell.med.icb.goby.stats.AnnotationAveragingWriter.java
private String findGenomicContext(int referenceIndex, int position) { int referenceLength = genome.getLength(referenceIndex); int zeroBasedPos = position - 1; char currentBase = genome.get(referenceIndex, zeroBasedPos); char nextBase = '?'; String tempContext = new StringBuilder().append('C').append('p').toString(); char concatBase = 'N'; if (currentBase == 'C') { if (referenceLength == position) { return Character.toString(currentBase); }//from w w w . j av a2 s.com nextBase = genome.get(referenceIndex, (zeroBasedPos + 1)); concatBase = nextBase; } else { if (currentBase == 'G') { if (zeroBasedPos == 0) { return Character.toString(currentBase); } nextBase = genome.get(referenceIndex, (zeroBasedPos - 1)); switch (nextBase) { case 'C': concatBase = 'G'; break; case 'A': concatBase = 'T'; break; case 'T': concatBase = 'A'; break; case 'G': concatBase = 'C'; break; } } } tempContext = tempContext.concat(Character.toString(concatBase)); return tempContext; }
From source file:com.webcohesion.enunciate.modules.csharp_client.CSharpXMLClientModule.java
protected String packageToNamespace(String pckg) { if (pckg == null) { return null; } else {// w ww.ja va 2s . c o m StringBuilder ns = new StringBuilder(); for (StringTokenizer toks = new StringTokenizer(pckg, "."); toks.hasMoreTokens();) { String tok = toks.nextToken(); ns.append(Character.toString(tok.charAt(0)).toUpperCase()); if (tok.length() > 1) { ns.append(tok.substring(1)); } if (toks.hasMoreTokens()) { ns.append('.'); } } return ns.toString(); } }
From source file:com.gst.infrastructure.core.serialization.JsonParserHelper.java
public BigDecimal convertFrom(final String numericalValueFormatted, final String parameterName, final Locale clientApplicationLocale) { if (clientApplicationLocale == null) { final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final String defaultMessage = new StringBuilder( "The parameter '" + parameterName + "' requires a 'locale' parameter to be passed with it.") .toString();// ww w. j av a2 s . co m final ApiParameterError error = ApiParameterError .parameterError("validation.msg.missing.locale.parameter", defaultMessage, parameterName); dataValidationErrors.add(error); throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors); } try { BigDecimal number = null; if (StringUtils.isNotBlank(numericalValueFormatted)) { String source = numericalValueFormatted.trim(); final NumberFormat format = NumberFormat.getNumberInstance(clientApplicationLocale); final DecimalFormat df = (DecimalFormat) format; final DecimalFormatSymbols symbols = df.getDecimalFormatSymbols(); // http://bugs.sun.com/view_bug.do?bug_id=4510618 final char groupingSeparator = symbols.getGroupingSeparator(); if (groupingSeparator == '\u00a0') { source = source.replaceAll(" ", Character.toString('\u00a0')); } final NumberFormatter numberFormatter = new NumberFormatter(); final Number parsedNumber = numberFormatter.parse(source, clientApplicationLocale); if (parsedNumber instanceof BigDecimal) { number = (BigDecimal) parsedNumber; } else { number = BigDecimal.valueOf(Double.valueOf(parsedNumber.doubleValue())); } } return number; } catch (final ParseException e) { final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError( "validation.msg.invalid.decimal.format", "The parameter " + parameterName + " has value: " + numericalValueFormatted + " which is invalid decimal value for provided locale of [" + clientApplicationLocale.toString() + "].", parameterName, numericalValueFormatted, clientApplicationLocale); error.setValue(numericalValueFormatted); dataValidationErrors.add(error); throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors); } }
From source file:de.tudarmstadt.ukp.clarin.webanno.crowdflower.NamedEntityTaskManager.java
/** * Helper function that retrieves the first token number in a task1 html span * @param spans/* w ww. ja v a2 s. c om*/ * @return first number in span offset string */ private int getFirstSpanOffset(String spans) { String firstNum = "0"; boolean foundDigit = false; // span beginn will look like: "<span id='token=num'>", so will just search the first number // in the string /* * regex for this would be: * Pattern p = Pattern.compile("(^|\\s)([0-9]+)($|\\s)"); * Matcher m = p.matcher(s); * if (m.find()) { String num = m.group(2); } */ // but hey, extractSpan gets called a lot, this is faster: for (int i = 0; i < spans.length(); i++) { if (Character.isDigit(spans.charAt(i))) { foundDigit = true; firstNum = firstNum + Character.toString(spans.charAt(i)); } else if (foundDigit && !Character.isDigit(spans.charAt(i))) { break; } } int offset = Integer.valueOf(firstNum); return offset; }