com.google.zxing.client.result.SMSParsedResult Java Examples

The following examples show how to use com.google.zxing.client.result.SMSParsedResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SMSResultHandler.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String number = smsResult.getNumbers()[0];
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(number, smsResult.getBody());
      break;
    case 1:
      sendMMS(number, smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #2
Source File: SMSResultHandler.java    From zxingfragmentlib with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #3
Source File: SMSResultHandler.java    From zxingfragmentlib with Apache License 2.0 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String number = smsResult.getNumbers()[0];
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(number, smsResult.getBody());
      break;
    case 1:
      sendMMS(number, smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #4
Source File: SMSResultHandler.java    From android-quick-response-code with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    StringBuilder contents = new StringBuilder(50);
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
 
Example #5
Source File: SMSResultHandler.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    StringBuilder contents = new StringBuilder(50);
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
 
Example #6
Source File: SMSResultHandler.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #7
Source File: SMSResultHandler.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(smsResult.getNumbers()[0], smsResult.getBody());
      break;
    case 1:
      sendMMS(smsResult.getNumbers()[0], smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #8
Source File: SMSResultHandler.java    From reacteu-app with MIT License 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
 
Example #9
Source File: SMSResultHandler.java    From reacteu-app with MIT License 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(smsResult.getNumbers()[0], smsResult.getBody());
      break;
    case 1:
      sendMMS(smsResult.getNumbers()[0], smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #10
Source File: SMSResultHandler.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
@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();
}
 
Example #11
Source File: SMSResultHandler.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String number = smsResult.getNumbers()[0];
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(number, smsResult.getBody());
      break;
    case 1:
      sendMMS(number, smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #12
Source File: SMSResultFragment.java    From privacy-friendly-qr-scanner with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View v = inflater.inflate(R.layout.fragment_result_sms, container, false);
    result = (SMSParsedResult) parsedResult;

    TextView to = (TextView) v.findViewById(R.id.fragment_result_sms_to);
    TextView toLabel = (TextView) v.findViewById(R.id.fragment_result_sms_to_label);
    TextView via = (TextView) v.findViewById(R.id.fragment_result_sms_via);
    TextView viaLabel = (TextView) v.findViewById(R.id.fragment_result_sms_via_label);
    TextView subject = (TextView) v.findViewById(R.id.fragment_result_sms_subject);
    TextView subjectLabel = (TextView) v.findViewById(R.id.fragment_result_sms_subject_label);
    TextView body = (TextView) v.findViewById(R.id.fragment_result_sms_body);

    if(result != null) {
        StringBuilder numberSb = new StringBuilder();
        ParsedResult.maybeAppend(result.getNumbers(), numberSb);

        StringBuilder viaSb = new StringBuilder();
        ParsedResult.maybeAppend(result.getVias(), viaSb);

        to.setText(numberSb.toString());
        via.setText(viaSb.toString());
        subject.setText(result.getSubject());
        body.setText(result.getBody());

        to.setVisibility(TextUtils.isEmpty(numberSb.toString()) ? View.GONE : View.VISIBLE);
        toLabel.setVisibility(TextUtils.isEmpty(numberSb.toString()) ? View.GONE : View.VISIBLE);
        via.setVisibility(TextUtils.isEmpty(viaSb.toString()) ? View.GONE : View.VISIBLE);
        viaLabel.setVisibility(TextUtils.isEmpty(viaSb.toString()) ? View.GONE : View.VISIBLE);
        subject.setVisibility(TextUtils.isEmpty(result.getSubject()) ? View.GONE : View.VISIBLE);
        subjectLabel.setVisibility(TextUtils.isEmpty(result.getSubject()) ? View.GONE : View.VISIBLE);
        body.setVisibility(TextUtils.isEmpty(result.getBody()) ? View.GONE : View.VISIBLE);
    }

    return v;
}
 
Example #13
Source File: SMSResultHandler.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #14
Source File: SMSResultHandler.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String number = smsResult.getNumbers()[0];
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(number, smsResult.getBody());
      break;
    case 1:
      sendMMS(number, smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #15
Source File: SMSResultHandler.java    From weex with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #16
Source File: SMSResultHandler.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String number = smsResult.getNumbers()[0];
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(number, smsResult.getBody());
      break;
    case 1:
      sendMMS(number, smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #17
Source File: SMSResultHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #18
Source File: SMSResultHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
public void handleButtonPress(int index) {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String number = smsResult.getNumbers()[0];
  switch (index) {
    case 0:
      // Don't know of a way yet to express a SENDTO intent with multiple recipients
      sendSMS(number, smsResult.getBody());
      break;
    case 1:
      sendMMS(number, smsResult.getSubject(), smsResult.getBody());
      break;
  }
}
 
Example #19
Source File: SMSResultHandler.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
@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();
}