當前位置: 首頁>>代碼示例>>Java>>正文


Java ParsedResult.maybeAppend方法代碼示例

本文整理匯總了Java中com.google.zxing.client.result.ParsedResult.maybeAppend方法的典型用法代碼示例。如果您正苦於以下問題:Java ParsedResult.maybeAppend方法的具體用法?Java ParsedResult.maybeAppend怎麽用?Java ParsedResult.maybeAppend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.zxing.client.result.ParsedResult的用法示例。


在下文中一共展示了ParsedResult.maybeAppend方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String wifiLabel = parent.getString(R.string.wifi_ssid_label);
  ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
  String typeLabel = parent.getString(R.string.wifi_type_label);
  ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
  return contents.toString();
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:11,代碼來源:WifiResultHandler.java

示例2: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:15,代碼來源:SMSResultHandler.java

示例3: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {

    CalendarParsedResult calResult = (CalendarParsedResult) getResult();
    StringBuilder result = new StringBuilder(100);

    ParsedResult.maybeAppend(calResult.getSummary(), result);

    long start = calResult.getStartTimestamp();
    ParsedResult.maybeAppend(format(calResult.isStartAllDay(), start), result);

    long end = calResult.getEndTimestamp();
    if (end >= 0L) {
        if (calResult.isEndAllDay() && start != end) {
            // Show only year/month/day
            // if it's all-day and this is the end date, it's exclusive, so show the user
            // that it ends on the day before to make more intuitive sense.
            // But don't do it if the event already (incorrectly?) specifies the same start/end
            end -= 24 * 60 * 60 * 1000;
        }
        ParsedResult.maybeAppend(format(calResult.isEndAllDay(), end), result);
    }

    ParsedResult.maybeAppend(calResult.getLocation(), result);
    ParsedResult.maybeAppend(calResult.getOrganizer(), result);
    ParsedResult.maybeAppend(calResult.getAttendees(), result);
    ParsedResult.maybeAppend(calResult.getDescription(), result);
    return result.toString();
}
 
開發者ID:xiong-it,項目名稱:ZXingAndroidExt,代碼行數:30,代碼來源:CalendarResultHandler.java

示例4: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    StringBuilder contents = new StringBuilder(50);
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
 
開發者ID:xiong-it,項目名稱:ZXingAndroidExt,代碼行數:15,代碼來源:SMSResultHandler.java

示例5: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
	SMSParsedResult smsResult = (SMSParsedResult) getResult();
	String[] rawNumbers = smsResult.getNumbers();
	String[] formattedNumbers = new String[rawNumbers.length];
	for (int i = 0; i < rawNumbers.length; i++) {
		formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
	}
	StringBuilder contents = new StringBuilder(50);
	ParsedResult.maybeAppend(formattedNumbers, contents);
	ParsedResult.maybeAppend(smsResult.getSubject(), contents);
	ParsedResult.maybeAppend(smsResult.getBody(), contents);
	return contents.toString();
}
 
開發者ID:yun2win,項目名稱:tvConnect_android,代碼行數:15,代碼來源:SMSResultHandler.java

示例6: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
  AddressBookParsedResult result = (AddressBookParsedResult) getResult();
  StringBuilder contents = new StringBuilder(100);
  ParsedResult.maybeAppend(result.getNames(), contents);
  int namesLength = contents.length();

  String pronunciation = result.getPronunciation();
  if (pronunciation != null && !pronunciation.isEmpty()) {
    contents.append("\n(");
    contents.append(pronunciation);
    contents.append(')');
  }

  ParsedResult.maybeAppend(result.getTitle(), contents);
  ParsedResult.maybeAppend(result.getOrg(), contents);
  ParsedResult.maybeAppend(result.getAddresses(), contents);
  String[] numbers = result.getPhoneNumbers();
  if (numbers != null) {
    for (String number : numbers) {
      if (number != null) {
        ParsedResult.maybeAppend(PhoneNumberUtils.formatNumber(number), contents);
      }
    }
  }
  ParsedResult.maybeAppend(result.getEmails(), contents);
  ParsedResult.maybeAppend(result.getURLs(), contents);

  String birthday = result.getBirthday();
  if (birthday != null && !birthday.isEmpty()) {
    Date date = parseDate(birthday);
    if (date != null) {
      ParsedResult.maybeAppend(DateFormat.getDateInstance(DateFormat.MEDIUM).format(date.getTime()), contents);
    }
  }
  ParsedResult.maybeAppend(result.getNote(), contents);

  if (namesLength > 0) {
    // Bold the full name to make it stand out a bit.
    Spannable styled = new SpannableString(contents.toString());
    styled.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, namesLength, 0);
    return styled;
  } else {
    return contents.toString();
  }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:47,代碼來源:AddressBookResultHandler.java

示例7: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
    AddressBookParsedResult result = (AddressBookParsedResult) getResult();
    StringBuilder contents = new StringBuilder(100);
    ParsedResult.maybeAppend(result.getNames(), contents);
    int namesLength = contents.length();

    String pronunciation = result.getPronunciation();
    if (pronunciation != null && !pronunciation.isEmpty()) {
        contents.append("\n(");
        contents.append(pronunciation);
        contents.append(')');
    }

    ParsedResult.maybeAppend(result.getTitle(), contents);
    ParsedResult.maybeAppend(result.getOrg(), contents);
    ParsedResult.maybeAppend(result.getAddresses(), contents);
    String[] numbers = result.getPhoneNumbers();
    if (numbers != null) {
        for (String number : numbers) {
            if (number != null) {
                ParsedResult.maybeAppend(PhoneNumberUtils.formatNumber(number), contents);
            }
        }
    }
    ParsedResult.maybeAppend(result.getEmails(), contents);
    ParsedResult.maybeAppend(result.getURLs(), contents);

    String birthday = result.getBirthday();
    if (birthday != null && !birthday.isEmpty()) {
        long date = parseDate(birthday);
        if (date >= 0L) {
            ParsedResult.maybeAppend(DateFormat.getDateInstance(DateFormat.MEDIUM).format(date), contents);
        }
    }
    ParsedResult.maybeAppend(result.getNote(), contents);

    if (namesLength > 0) {
        // Bold the full name to make it stand out a bit.
        Spannable styled = new SpannableString(contents.toString());
        styled.setSpan(new StyleSpan(Typeface.BOLD), 0, namesLength, 0);
        return styled;
    } else {
        return contents.toString();
    }
}
 
開發者ID:xiong-it,項目名稱:ZXingAndroidExt,代碼行數:47,代碼來源:AddressBookResultHandler.java

示例8: getDisplayContents

import com.google.zxing.client.result.ParsedResult; //導入方法依賴的package包/類
@Override
public CharSequence getDisplayContents() {
	AddressBookParsedResult result = (AddressBookParsedResult) getResult();
	StringBuilder contents = new StringBuilder(100);
	ParsedResult.maybeAppend(result.getNames(), contents);
	int namesLength = contents.length();

	String pronunciation = result.getPronunciation();
	if (pronunciation != null && !pronunciation.isEmpty()) {
		contents.append("\n(");
		contents.append(pronunciation);
		contents.append(')');
	}

	ParsedResult.maybeAppend(result.getTitle(), contents);
	ParsedResult.maybeAppend(result.getOrg(), contents);
	ParsedResult.maybeAppend(result.getAddresses(), contents);
	String[] numbers = result.getPhoneNumbers();
	if (numbers != null) {
		for (String number : numbers) {
			if (number != null) {
				ParsedResult.maybeAppend(
						PhoneNumberUtils.formatNumber(number), contents);
			}
		}
	}
	ParsedResult.maybeAppend(result.getEmails(), contents);
	ParsedResult.maybeAppend(result.getURLs(), contents);

	String birthday = result.getBirthday();
	if (birthday != null && !birthday.isEmpty()) {
		Date date = parseDate(birthday);
		if (date != null) {
			ParsedResult.maybeAppend(
					DateFormat.getDateInstance(DateFormat.MEDIUM).format(
							date.getTime()), contents);
		}
	}
	ParsedResult.maybeAppend(result.getNote(), contents);

	if (namesLength > 0) {
		// Bold the full name to make it stand out a bit.
		Spannable styled = new SpannableString(contents.toString());
		styled.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0,
				namesLength, 0);
		return styled;
	} else {
		return contents.toString();
	}
}
 
開發者ID:yun2win,項目名稱:tvConnect_android,代碼行數:51,代碼來源:AddressBookResultHandler.java


注:本文中的com.google.zxing.client.result.ParsedResult.maybeAppend方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。