当前位置: 首页>>代码示例>>Java>>正文


Java CaptureActivity类代码示例

本文整理汇总了Java中com.google.zxing.client.android.CaptureActivity的典型用法代码示例。如果您正苦于以下问题:Java CaptureActivity类的具体用法?Java CaptureActivity怎么用?Java CaptureActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CaptureActivity类属于com.google.zxing.client.android包,在下文中一共展示了CaptureActivity类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    this.button = (Button) findViewById(R.id.button);
    this.textView = (TextView) findViewById(R.id.textView);

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
            intent.setAction(Intents.Scan.ACTION);
            intent.putExtra(Intents.Scan.CHARACTER_SET, "utf-8");
            intent.putExtra(Intents.Scan.WIDTH, dip2px(220));
            intent.putExtra(Intents.Scan.HEIGHT, dip2px(220));
            intent.setClass(MainActivity.this, CaptureActivity.class);
            startActivityForResult(intent, REQUEST_CODE);
        }
    });
}
 
开发者ID:yingLanNull,项目名称:ZxingLite,代码行数:23,代码来源:MainActivity.java

示例2: onOptionsItemSelected

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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);
}
 
开发者ID:Laisly,项目名称:weex,代码行数:23,代码来源:IndexActivity.java

示例3: onOptionsItemSelected

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:29,代码来源:IndexActivity.java

示例4: onRequestPermissionsResult

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:10,代码来源:IndexActivity.java

示例5: makeResultHandler

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
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);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:28,代码来源:ResultHandlerFactory.java

示例6: onListItemClick

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:10,代码来源:HistoryActivity.java

示例7: makeResultHandler

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
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);
	}
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:28,代码来源:ResultHandlerFactory.java

示例8: onListItemClick

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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();
	}
}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:10,代码来源:HistoryActivity.java

示例9: onRequestPermissionsResult

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:Laisly,项目名称:weex,代码行数:10,代码来源:IndexActivity.java

示例10: makeResultHandler

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
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);
    }
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:28,代码来源:ResultHandlerFactory.java

示例11: onListItemClick

import com.google.zxing.client.android.CaptureActivity; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:yakovenkodenis,项目名称:Discounty,代码行数:10,代码来源:HistoryActivity.java


注:本文中的com.google.zxing.client.android.CaptureActivity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。