use of me.yluo.ruisiapp.widget.CircleImageView in project Ruisi by freedom10086.
the class UserDetailActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_detail);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.transparent));
}
toolbarLayout = findViewById(R.id.toolbar_layout);
infoList = findViewById(R.id.recycler_view);
CircleImageView imageView = findViewById(R.id.user_detail_img_avatar);
layout = findViewById(R.id.main_window);
progressView = findViewById(R.id.grade_progress);
progresText = findViewById(R.id.progress_text);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(v -> fab_click());
ViewCompat.setTransitionName(imageView, NAME_IMG_AVATAR);
username = getIntent().getStringExtra("loginName");
imageUrl = getIntent().getStringExtra("avatarUrl");
Picasso.with(this).load(imageUrl).placeholder(R.drawable.image_placeholder).into(imageView);
toolbarLayout.setTitle(username);
Toolbar mToolbar = findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
adapter = new SimpleListAdapter(ListType.INFO, this, datas);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
infoList.setLayoutManager(layoutManager);
infoList.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
infoList.setAdapter(adapter);
userUid = getIntent().getStringExtra("uid");
if (TextUtils.isEmpty(userUid)) {
userUid = GetId.getId("uid=", imageUrl);
}
// 如果是自己
if (userUid.equals(App.getUid(this))) {
fab.setImageResource(R.drawable.ic_close_24dp);
imageView.setOnClickListener(view -> {
final String[] items = { "修改密码" };
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("操作");
alertBuilder.setItems(items, (arg0, index) -> {
if (index == 0) {
startActivity(new Intent(UserDetailActivity.this, ChangePasswordActivity.class));
}
});
AlertDialog d = alertBuilder.create();
d.show();
});
}
loadData(UrlUtils.getUserHomeUrl(userUid, false));
}
Aggregations