package com.bwie.xiexibo20190226;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.bwie.xiexibo20190226.wegitview.CustomView;
import org.json.JSONObject;
public class ShowActivity extends AppCompatActivity {
private CustomView customView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show);
//获取传值
Intent intent = getIntent();
String json = intent.getStringExtra("json");
//控件
customView = findViewById(R.id.custom_view);
//解析
try {
JSONObject jsonObject = new JSONObject(json);
JSONObject result = jsonObject.getJSONObject("result");
String headPic = result.getString("headPic");
String nickName = result.getString("nickName");
String phone = result.getString("phone");
customView.name.setText(nickName + "");
customView.tel.setText(phone + "");
/**
* 加载圆形图片
*/
Glide.with(ShowActivity.this).load(headPic).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(customView.img);
customView.setClickImg(new CustomView.onClickImg() {
@Override
public void click(View v) {
/**
* 属性动画
*/
ObjectAnimator animator = ObjectAnimator.ofFloat(customView.img, "rotation", 360f);
animator.setDuration(3000);
animator.start();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}