PageRenderTime 53ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/app/src/main/java/com/viomi/oven/activity/BarcodeActivity.java

https://bitbucket.org/viomi_team/viomi_oven
Java | 127 lines | 0 code | 0 blank | 127 comment | 0 complexity | 6e3b12cbe59c1b0ea7e0aa0cf8e4e054 MD5 | raw file
  1. //package com.viomi.oven.activity;
  2. //
  3. //import android.app.Activity;
  4. //import android.content.Intent;
  5. //import android.os.Bundle;
  6. //import android.text.TextUtils;
  7. //import android.util.Log;
  8. //import android.widget.ImageView;
  9. //import android.widget.TextView;
  10. //import android.widget.Toast;
  11. //
  12. //import com.alibaba.fastjson.JSON;
  13. //import com.bumptech.glide.Glide;
  14. //import com.litesuits.http.LiteHttp;
  15. //import com.litesuits.http.exception.HttpException;
  16. //import com.litesuits.http.listener.HttpListener;
  17. //import com.litesuits.http.request.AbstractRequest;
  18. //import com.litesuits.http.request.StringRequest;
  19. //import com.litesuits.http.request.param.HttpMethods;
  20. //import com.litesuits.http.response.Response;
  21. //import com.mylhyl.zxing.scanner.common.Scanner;
  22. //import com.mylhyl.zxing.scanner.result.ISBNResult;
  23. //import com.mylhyl.zxing.scanner.result.ProductResult;
  24. //import com.mylhyl.zxing.scanner.sample.BasicActivity;
  25. //import com.mylhyl.zxing.scanner.sample.R;
  26. //import com.mylhyl.zxing.scanner.sample.entities.Barcode;
  27. //
  28. //import java.io.Serializable;
  29. //
  30. //public class BarcodeActivity extends BasicActivity {
  31. // private static final String TAG = "BarcodeActivity";
  32. // private ImageView mImageView;
  33. // private TextView mTextView4, mTextView5, mTextView6, mTextView7, mTextView8, mTextView9;
  34. //
  35. // @Override
  36. // protected void onCreate(Bundle savedInstanceState) {
  37. // super.onCreate(savedInstanceState);
  38. // setContentView(R.layout.activity_barcode);
  39. //
  40. // mTextView4 = (TextView) findViewById(R.id.textView4);
  41. // mTextView5 = (TextView) findViewById(R.id.textView5);
  42. // mTextView6 = (TextView) findViewById(R.id.textView6);
  43. // mTextView7 = (TextView) findViewById(R.id.textView7);
  44. // mTextView8 = (TextView) findViewById(R.id.textView8);
  45. // mTextView9 = (TextView) findViewById(R.id.textView9);
  46. // mImageView = (ImageView) findViewById(R.id.imageView2);
  47. //
  48. // Bundle extras = getIntent().getExtras();
  49. // if (extras == null) finish();
  50. //
  51. // Serializable serializable = extras.getSerializable(Scanner.Scan.RESULT);
  52. // if (serializable == null) finish();
  53. //
  54. // String productID = "";
  55. // if (serializable instanceof ProductResult) {
  56. // ProductResult productResult = (ProductResult) serializable;
  57. // productID = productResult.getProductID();
  58. // } else if (serializable instanceof ISBNResult) {
  59. // ISBNResult isbnResult = (ISBNResult) serializable;
  60. // productID = isbnResult.getISBN();
  61. // }
  62. //
  63. // LiteHttp liteHttp = LiteHttp.build(this)
  64. // .setSocketTimeout(5000)
  65. // .setConnectTimeout(5000)
  66. // .create();
  67. // executeAsync(liteHttp, productID);
  68. //
  69. // }
  70. //
  71. // private void executeAsync(LiteHttp liteHttp, String productID) {
  72. // //如果查询失败,请到 http://apistore.baidu.com/apiworks/servicedetail/1477.html 填写自己的apikey
  73. // StringRequest stringRequest = new StringRequest("http://apis.baidu.com/3023/barcode/barcode")
  74. // .setMethod(HttpMethods.Get)
  75. // .addHeader("apikey", "3cec8d8175109823b986b178803738db")
  76. // .addUrlParam("barcode", productID)
  77. // .setHttpListener(new HttpListener<String>() {
  78. // @Override
  79. // public void onLoading(AbstractRequest<String> request, long total, long len) {
  80. // super.onLoading(request, total, len);
  81. // }
  82. //
  83. // @Override
  84. // public void onSuccess(String s, Response<String> response) {
  85. // String result = response.getResult();
  86. // if (!TextUtils.isEmpty(result)) onSuccessDone(result);
  87. // }
  88. //
  89. // @Override
  90. // public void onFailure(HttpException e, Response<String> response) {
  91. // String result = response.getResult();
  92. // Toast.makeText(BarcodeActivity.this, result, Toast.LENGTH_SHORT).show();
  93. // }
  94. //
  95. // @Override
  96. // public void onStart(AbstractRequest<String> request) {
  97. // super.onStart(request);
  98. // }
  99. //
  100. // @Override
  101. // public void onUploading(AbstractRequest<String> request, long total, long len) {
  102. // super.onUploading(request, total, len);
  103. // }
  104. // });
  105. // liteHttp.executeAsync(stringRequest);
  106. // }
  107. //
  108. // private void onSuccessDone(String result) {
  109. // Log.i(TAG, "onSuccessDone: " + result);
  110. // Barcode barcode = JSON.parseObject(result, Barcode.class);
  111. // if (barcode == null) {
  112. // Log.e(TAG, "product is null");
  113. // return;
  114. // }
  115. // mTextView4.setText("名称:" + barcode.name);
  116. // mTextView5.setText("价格:" + barcode.price);
  117. // mTextView6.setText("规格:" + barcode.spec);
  118. // mTextView7.setText("品牌:" + barcode.brand);
  119. // mTextView8.setText("国家:" + barcode.country);
  120. // mTextView9.setText("公司:" + barcode.company);
  121. // Glide.with(this).load(barcode.gtin).into(mImageView);
  122. // }
  123. //
  124. // public static void gotoActivity(Activity activity, Bundle bundle) {
  125. // activity.startActivity(new Intent(activity, BarcodeActivity.class).putExtras(bundle));
  126. // }
  127. //}