| | |
| | | import org.xutils.http.RequestParams;
|
| | |
|
| | | import java.io.ByteArrayOutputStream;
|
| | | import java.nio.ByteBuffer;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | private Bitmap fragment_register_upload_custom_photo_img;
|
| | | private Bitmap fragment_register_id_card_photo_img;
|
| | |
|
| | | private SurveillanceQueryItem surveillanceQueryItem;
|
| | | private SurveillanceQueryItem surveillanceQueryItem_selectPhoto;
|
| | | private SurveillanceQueryItem surveillanceQueryItem_uploadPhoto;
|
| | |
|
| | | private static RegisterFragment instance = new RegisterFragment();
|
| | |
|
| | |
| | |
|
| | | @OnClick(R.id.fragment_register_add)
|
| | | public void fragment_register_add_click(View view) {
|
| | | // byte[] b = new byte[100];
|
| | | //
|
| | | // List<NativeImg> faceImages = new ArrayList<>();
|
| | | // NativeImg test = new NativeImg();
|
| | | // test.height = 102;
|
| | | // test.width = 122;
|
| | | // test.image = new byte[49776];
|
| | | // test.size = 49776;
|
| | | // faceImages.add(test);
|
| | | //
|
| | | // List<SurveillanceQueryItem> bitmapList = new ArrayList();
|
| | | // for (int i = 0; i < faceImages.size(); i++) {
|
| | | // NativeImg item = faceImages.get(i);
|
| | | // SurveillanceQueryItem surveillanceQueryItem = new SurveillanceQueryItem();
|
| | | // int offset = 0;
|
| | | // int size = item.size;
|
| | | // Bitmap bitmap = Bitmap.createBitmap(item.width,item.height, Bitmap.Config.ARGB_8888);
|
| | | // ByteBuffer byteBuffer = ByteBuffer.wrap(item.image, offset, size);
|
| | | // bitmap.copyPixelsFromBuffer(byteBuffer);
|
| | | // String str = Base64.encodeToString(item.image, offset, size, Base64.DEFAULT);
|
| | | // System.out.println(str.length());
|
| | | // System.out.println(str);
|
| | | // byte[] b1 = Base64.decode(str, Base64.DEFAULT);
|
| | | // surveillanceQueryItem.setBase64Image(str);
|
| | | // surveillanceQueryItem.setBitmap(bitmap);
|
| | | // surveillanceQueryItem.setWidth(item.width+"");
|
| | | // surveillanceQueryItem.setHeight(item.height+"");
|
| | | // bitmapList.add(surveillanceQueryItem);
|
| | | // }
|
| | | // SurveillanceMng.getInstance().addBitmap(bitmapList, b, 100, 1+"");
|
| | | resetForm();
|
| | | }
|
| | |
|
| | |
| | | DisplayMetrics displayMetrics = BaseApplication.getInstance().getResources().getDisplayMetrics();
|
| | | float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
|
| | | float dpWidth = displayMetrics.widthPixels / displayMetrics.density;
|
| | |
|
| | | if (1==1) {
|
| | | //return;
|
| | | }
|
| | |
|
| | | String name = fragment_register_name.getValue();
|
| | | if (name.trim().length() <= 0) {
|
| | |
| | | params.addBodyParameter(Register.FieldNames.companyId, company);
|
| | | params.addBodyParameter(Register.FieldNames.birthday, birthday);
|
| | |
|
| | | if (surveillanceQueryItem != null) {
|
| | | params.addBodyParameter("width", surveillanceQueryItem.getWidth());
|
| | | params.addBodyParameter("height", surveillanceQueryItem.getHeight());
|
| | | fragment_register_surveillance_photo_img = surveillanceQueryItem.getBitmap();
|
| | | if (surveillanceQueryItem_selectPhoto != null) {
|
| | | params.addBodyParameter("width", surveillanceQueryItem_selectPhoto.getWidth());
|
| | | params.addBodyParameter("height", surveillanceQueryItem_selectPhoto.getHeight());
|
| | | fragment_register_surveillance_photo_img = surveillanceQueryItem_selectPhoto.getBitmap();
|
| | |
|
| | | NativeImg nativeImg = surveillanceQueryItem.getNativeImg();
|
| | | NativeImg nativeImg = surveillanceQueryItem_selectPhoto.getNativeImg();
|
| | | String str = Base64.encodeToString(nativeImg.image, 0, nativeImg.size, Base64.DEFAULT);
|
| | |
|
| | | params.addBodyParameter("base64Image", str);
|
| | | }
|
| | |
|
| | | if (surveillanceQueryItem_uploadPhoto != null) {
|
| | | // params.addBodyParameter("width", surveillanceQueryItem_uploadPhoto.getWidth());
|
| | | // params.addBodyParameter("height", surveillanceQueryItem_uploadPhoto.getHeight());
|
| | | // fragment_register_surveillance_photo_img = surveillanceQueryItem_uploadPhoto.getBitmap();
|
| | | //
|
| | | // NativeImg nativeImg = surveillanceQueryItem_uploadPhoto.getNativeImg();
|
| | | // String str = Base64.encodeToString(nativeImg.image, 0, nativeImg.size, Base64.DEFAULT);
|
| | | //
|
| | | // params.addBodyParameter("base64Image", str);
|
| | | }
|
| | |
|
| | | if (fragment_register_surveillance_photo_img != null) {
|
| | |
| | | }
|
| | |
|
| | | public void set_fragment_register_surveillance_photo(SurveillanceQueryItem item) {
|
| | | surveillanceQueryItem = item;
|
| | | surveillanceQueryItem_selectPhoto = item;
|
| | | fragment_register_surveillance_photo.setImageBitmap(item.getBitmap());
|
| | | fragment_register_surveillance_photo_img = item.getBitmap();
|
| | | fragment_register_surveillance_photo_placeholder_image.setVisibility(View.INVISIBLE);
|
| | |
| | | }
|
| | |
|
| | | public void set_fragment_register_upload_custom_photo(SurveillanceQueryItem item) {
|
| | | surveillanceQueryItem_uploadPhoto = item;
|
| | | fragment_register_upload_custom_photo.setImageBitmap(item.getBitmap());
|
| | | fragment_register_upload_custom_photo_img = item.getBitmap();
|
| | |
|
| | | fragment_register_upload_custom_photo_placeholder_image.setVisibility(View.INVISIBLE);
|
| | | fragment_register_upload_custom_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | // byte[] imageBytes = byteArrayOutputStream.toByteArray();
|
| | | // String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
|
| | | // item.setBase64Image(encodedImage);
|
| | | setSurveillanceQueryItem(item);
|
| | | setSurveillanceQueryItem_selectPhoto(item);
|
| | | bitmapList.add(item);
|
| | | bitmapList.add(item);
|
| | | bitmapList.add(item);
|
| | |
| | | fragment_register_upload_custom_photo_placeholder_text_view.setVisibility(View.VISIBLE);
|
| | | fragment_register_id_card_photo_placeholder_image.setVisibility(View.VISIBLE);
|
| | | fragment_register_id_card_photo_placeholder_text_view.setVisibility(View.VISIBLE);
|
| | | this.surveillanceQueryItem = null;
|
| | | this.surveillanceQueryItem_selectPhoto = null;
|
| | | this.surveillanceQueryItem_uploadPhoto = null;
|
| | | }
|
| | |
|
| | | @OnClick(R.id.fragment_register_country)
|
| | |
| | | fragment_register_surveillance_photo_placeholder_image.setVisibility(View.INVISIBLE);
|
| | | }
|
| | |
|
| | | public void setSurveillanceQueryItem(SurveillanceQueryItem item) {
|
| | | this.surveillanceQueryItem = item;
|
| | | public void setSurveillanceQueryItem_selectPhoto(SurveillanceQueryItem item) {
|
| | | this.surveillanceQueryItem_selectPhoto = item;
|
| | | }
|
| | |
|
| | | @Override
|