com.google.zxing.client.android.CaptureActivity Java Examples

The following examples show how to use com.google.zxing.client.android.CaptureActivity. 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: IndexActivity.java    From weex with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  int id = item.getItemId();
  if (id == R.id.action_refresh) {
    if(!TextUtils.equals(CURRENT_IP,DEFAULT_IP)){
      createWeexInstance();
      return true;
    }
  } else if (id == R.id.action_scan) {
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
      if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        Toast.makeText(this, "please give me the permission", Toast.LENGTH_SHORT).show();
      } else {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, CAMARA_PERMISSION_REQUEST_CODE);
      }
    } else {
      startActivity(new Intent(this, CaptureActivity.class));
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}
 
Example #2
Source File: MainActivity.java    From ZXing-Standalone-library with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    Button scanButton = (Button) findViewById(R.id.scan);
    scanButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(getApplicationContext(),CaptureActivity.class);
            intent.setAction("com.google.zxing.client.android.SCAN");
            intent.putExtra("SAVE_HISTORY", false);
            startActivityForResult(intent, 0);
        }
    });

}
 
Example #3
Source File: HistoryActivity.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #4
Source File: HistoryActivity.java    From android-apps with MIT License 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #5
Source File: ResultHandlerFactory.java    From android-apps with MIT License 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #6
Source File: HistoryActivity.java    From reacteu-app with MIT License 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #7
Source File: ResultHandlerFactory.java    From reacteu-app with MIT License 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #8
Source File: HistoryActivity.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #9
Source File: ResultHandlerFactory.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #10
Source File: HistoryActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #11
Source File: ResultHandlerFactory.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #12
Source File: ResultHandlerFactory.java    From weex with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #13
Source File: IndexActivity.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  if (requestCode == CAMARA_PERMISSION_REQUEST_CODE && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
    startActivity(new Intent(this, CaptureActivity.class));
  } else {
    Toast.makeText(this, "request camara permission fail!", Toast.LENGTH_SHORT).show();
  }
}
 
Example #14
Source File: HistoryActivity.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #15
Source File: ResultHandlerFactory.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #16
Source File: IndexActivity.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  if (requestCode == CAMERA_PERMISSION_REQUEST_CODE && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
    startActivity(new Intent(this, CaptureActivity.class));
  } else {
    Toast.makeText(this, "request camara permission fail!", Toast.LENGTH_SHORT).show();
  }
}
 
Example #17
Source File: IndexActivity.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  int id = item.getItemId();
  if (id == R.id.action_refresh) {
    if(!TextUtils.equals(CURRENT_IP,DEFAULT_IP)){
      createWeexInstance();
      if(TextUtils.equals(CURRENT_IP,DEFAULT_IP)){
        renderPage(WXFileUtils.loadAsset("index.js", this),WEEX_INDEX_URL);
      }else{
        renderPageByURL(WEEX_INDEX_URL);
      }
      mProgressBar.setVisibility(View.VISIBLE);
      return true;
    }
  } else if (id == R.id.action_scan) {
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
      if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        Toast.makeText(this, "please give me the permission", Toast.LENGTH_SHORT).show();
      } else {
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
      }
    } else {
      startActivity(new Intent(this, CaptureActivity.class));
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}
 
Example #18
Source File: HistoryActivity.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
  if (adapter.getItem(position).getResult() != null) {
    Intent intent = new Intent(this, CaptureActivity.class);
    intent.putExtra(Intents.History.ITEM_NUMBER, position);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }
}
 
Example #19
Source File: ResultHandlerFactory.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example #20
Source File: WifiResultHandler.java    From weex with Apache License 2.0 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}
 
Example #21
Source File: WifiResultHandler.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}
 
Example #22
Source File: WifiResultHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}
 
Example #23
Source File: MainActivity.java    From Study_Android_Demo with Apache License 2.0 4 votes vote down vote up
public void btnClick1(View view){
    //启动zxing自带的CaptureActivity
    startActivity(new Intent(this, CaptureActivity.class));
}
 
Example #24
Source File: WifiResultHandler.java    From barcodescanner-lib-aar with MIT License 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}
 
Example #25
Source File: WifiResultHandler.java    From reacteu-app with MIT License 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
  taskExec = new AsyncTaskExecManager().build();
}
 
Example #26
Source File: WifiResultHandler.java    From ZXing-Standalone-library with Apache License 2.0 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}
 
Example #27
Source File: WifiResultHandler.java    From android-apps with MIT License 4 votes vote down vote up
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}