xuxiuxi
2017-04-24 d1bebb2cac8c3c810c47b57441274ed78e9c1786


git-svn-id: http://192.168.1.226/svn/proxy@531 454eff88-639b-444f-9e54-f578c98de674
2个文件已修改
84 ■■■■ 已修改文件
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/res/layout/fragment_register.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java
@@ -2,7 +2,6 @@
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;
@@ -30,15 +29,12 @@
import cn.com.basic.face.widget.register.RegisterRightFieldTextView;
import cn.com.basic.face.dialog.SelectDialog;
import com.facebook.drawee.view.SimpleDraweeView;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import org.xutils.http.RequestParams;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -67,35 +63,35 @@
    private RegisterRightFieldTextView fragment_register_company;
    @ViewInject(R.id.fragment_register_remark)
    private RegisterRightFieldTextView fragment_register_remark;
    @ViewInject(R.id.fragment_register_choose_photo)
    @ViewInject(R.id.fragment_register_surveillance_photo)
    private ImageView fragment_register_choose_photo;
    @ViewInject(R.id.fragment_register_update_photo)
    @ViewInject(R.id.fragment_register_upload_custom_photo)
    private ImageView fragment_register_update_photo;
    @ViewInject(R.id.fragment_register_id_card_photo)
    private ImageView fragment_register_id_card_photo;
    @ViewInject(R.id.fragment_register_linear_layout)
    private LinearLayout fragment_register_linear_layout;
    @ViewInject(R.id.fragment_register_choose_photo_placeholder_image)
    private ImageView fragment_register_choose_photo_placeholder_image;
    @ViewInject(R.id.fragment_register_update_photo_placeholder_image)
    private ImageView fragment_register_update_photo_placeholder_image;
    @ViewInject(R.id.fragment_register_surveillance_photo_placeholder_image)
    private ImageView fragment_register_surveillance_photo_placeholder_image;
    @ViewInject(R.id.fragment_register_upload_custom_photo_placeholder_image)
    private ImageView fragment_register_upload_custom_photo_placeholder_image;
    @ViewInject(R.id.fragment_register_id_card_photo_placeholder_image)
    private ImageView fragment_register_id_card_photo_placeholder_image;
    @ViewInject(R.id.fragment_register_choose_photo_placeholder_text_view)
    private TextView fragment_register_choose_photo_placeholder_text_view;
    @ViewInject(R.id.fragment_register_update_photo_placeholder_text_view)
    private TextView fragment_register_update_photo_placeholder_text_view;
    @ViewInject(R.id.fragment_register_surveillance_photo_placeholder_text_view)
    private TextView fragment_register_surveillance_photo_placeholder_text_view;
    @ViewInject(R.id.fragment_register_upload_custom_photo_placeholder_text_view)
    private TextView fragment_register_upload_custom_photo_placeholder_text_view;
    @ViewInject(R.id.fragment_register_id_card_photo_placeholder_text_view)
    private TextView fragment_register_id_card_photo_placeholder_text_view;
    private static final int fragment_register_choose_photo_ = 1;
    private static final int fragment_register_update_photo_ = 2;
    private static final int fragment_register_surveillance_photo_ = 1;
    private static final int fragment_register_upload_custom_photo_ = 2;
    private static final int fragment_register_id_card_photo_ = 3;
    private Bitmap fragment_register_choose_photo_img;
    private Bitmap fragment_register_update_photo_img;
    private Bitmap fragment_register_surveillance_photo_img;
    private Bitmap fragment_register_upload_custom_photo_img;
    private Bitmap fragment_register_id_card_photo_img;
    private static RegisterFragment instance = new RegisterFragment();
@@ -184,17 +180,17 @@
        params.addBodyParameter(Register.FieldNames.companyId, company);
        params.addBodyParameter(Register.FieldNames.birthday, birthday);
        if (fragment_register_choose_photo_img != null) {
        if (fragment_register_surveillance_photo_img != null) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            fragment_register_choose_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            fragment_register_surveillance_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            byte[] imageBytes = byteArrayOutputStream.toByteArray();
            String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
            params.addBodyParameter("choosePhoto", encodedImage);
        }
        if (fragment_register_update_photo_img != null) {
        if (fragment_register_upload_custom_photo_img != null) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            fragment_register_update_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            fragment_register_upload_custom_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            byte[] imageBytes = byteArrayOutputStream.toByteArray();
            String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
            params.addBodyParameter("uploadPhoto", encodedImage);
@@ -214,29 +210,29 @@
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == fragment_register_choose_photo_ && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) {
        if (requestCode == fragment_register_surveillance_photo_ && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) {
            Uri uri = data.getData();
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
                fragment_register_choose_photo.setImageBitmap(bitmap);
                fragment_register_choose_photo_img = bitmap;
                fragment_register_surveillance_photo_img = bitmap;
                fragment_register_choose_photo_placeholder_image.setVisibility(View.INVISIBLE);
                fragment_register_choose_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
                fragment_register_surveillance_photo_placeholder_image.setVisibility(View.INVISIBLE);
                fragment_register_surveillance_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (requestCode == fragment_register_update_photo_ && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) {
        if (requestCode == fragment_register_upload_custom_photo_ && resultCode == Activity.RESULT_OK && data != null && data.getData() != null) {
            Uri uri = data.getData();
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
                fragment_register_update_photo.setImageBitmap(bitmap);
                fragment_register_update_photo_img = bitmap;
                fragment_register_upload_custom_photo_img = bitmap;
                fragment_register_update_photo_placeholder_image.setVisibility(View.INVISIBLE);
                fragment_register_update_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
                fragment_register_upload_custom_photo_placeholder_image.setVisibility(View.INVISIBLE);
                fragment_register_upload_custom_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
                List<Bitmap> bitmapList = new ArrayList<>();
                bitmapList.add(0, bitmap);
@@ -327,20 +323,20 @@
        MainActivity.selectPage(0);
    }
    @OnClick(R.id.fragment_register_choose_photo)
    public void fragment_register_choose_photo_click(View view) {
    @OnClick(R.id.fragment_register_surveillance_photo)
    public void fragment_register_surveillance_photo_click(View view) {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "选择图片"), fragment_register_choose_photo_);
        startActivityForResult(Intent.createChooser(intent, "选择图片"), fragment_register_surveillance_photo_);
    }
    @OnClick(R.id.fragment_register_update_photo)
    public void fragment_register_update__photo_click(View view) {
    @OnClick(R.id.fragment_register_upload_custom_photo)
    public void fragment_register_upload_custom_photo_click(View view) {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "选择图片"), fragment_register_update_photo_);
        startActivityForResult(Intent.createChooser(intent, "选择图片"), fragment_register_upload_custom_photo_);
    }
    @OnClick(R.id.fragment_register_id_card_photo)
@@ -364,8 +360,8 @@
    public void setChoosePhoto(Bitmap bitmap) {
        fragment_register_choose_photo.setImageBitmap(bitmap);
        fragment_register_choose_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
        fragment_register_choose_photo_placeholder_image.setVisibility(View.INVISIBLE);
        fragment_register_surveillance_photo_placeholder_text_view.setVisibility(View.INVISIBLE);
        fragment_register_surveillance_photo_placeholder_image.setVisibility(View.INVISIBLE);
    }
}
VisitFace/DemoForBsk/app/src/main/res/layout/fragment_register.xml
@@ -67,14 +67,14 @@
                    android:gravity="center_horizontal"
                    >
                    <ImageView
                        android:id="@+id/fragment_register_choose_photo"
                        android:id="@+id/fragment_register_surveillance_photo"
                        android:layout_width="147dp"
                        android:layout_height="206dp"
                        android:background="#07000000"
                        android:gravity="center"
                        />
                    <ImageView
                        android:id="@+id/fragment_register_update_photo"
                        android:id="@+id/fragment_register_upload_custom_photo"
                        android:layout_width="147dp"
                        android:layout_height="206dp"
                        android:background="#07000000"
@@ -99,7 +99,7 @@
                    android:gravity="center_horizontal"
                    >
                    <ImageView
                        android:id="@+id/fragment_register_choose_photo_placeholder_image"
                        android:id="@+id/fragment_register_surveillance_photo_placeholder_image"
                        android:layout_width="147dp"
                        android:layout_height="206dp"
                        android:alpha="0.35"
@@ -109,7 +109,7 @@
                        android:paddingTop="70dp"
                        />
                    <ImageView
                        android:id="@+id/fragment_register_update_photo_placeholder_image"
                        android:id="@+id/fragment_register_upload_custom_photo_placeholder_image"
                        android:layout_width="147dp"
                        android:layout_height="206dp"
                        android:alpha="0.35"
@@ -139,7 +139,7 @@
                    android:gravity="center_horizontal"
                    >
                    <TextView
                        android:id="@+id/fragment_register_choose_photo_placeholder_text_view"
                        android:id="@+id/fragment_register_surveillance_photo_placeholder_text_view"
                        android:layout_width="147dp"
                        android:layout_height="206dp"
                        android:gravity="center"
@@ -149,7 +149,7 @@
                        android:paddingTop="70dp"
                        />
                    <TextView
                        android:id="@+id/fragment_register_update_photo_placeholder_text_view"
                        android:id="@+id/fragment_register_upload_custom_photo_placeholder_text_view"
                        android:layout_width="147dp"
                        android:layout_height="206dp"
                        android:background="#00000000"