UI界面的样式的修改
This commit is contained in:
parent
0a3836a0cb
commit
e91dbf43d3
|
|
@ -0,0 +1,177 @@
|
||||||
|
package com.example.livestreaming;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.example.livestreaming.databinding.ActivityUserProfileReadOnlyBinding;
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UserProfileReadOnlyActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ActivityUserProfileReadOnlyBinding binding;
|
||||||
|
|
||||||
|
private UserWorksAdapter worksAdapter;
|
||||||
|
|
||||||
|
private static final String EXTRA_USER_ID = "extra_user_id";
|
||||||
|
private static final String EXTRA_NAME = "extra_name";
|
||||||
|
private static final String EXTRA_LOCATION = "extra_location";
|
||||||
|
private static final String EXTRA_BIO = "extra_bio";
|
||||||
|
private static final String EXTRA_AVATAR_RES = "extra_avatar_res";
|
||||||
|
|
||||||
|
private static final String PREFS_FRIENDS = "friends_prefs";
|
||||||
|
|
||||||
|
public static void start(Context context, String userId, String name, String location, String bio, int avatarRes) {
|
||||||
|
Intent intent = new Intent(context, UserProfileReadOnlyActivity.class);
|
||||||
|
intent.putExtra(EXTRA_USER_ID, userId);
|
||||||
|
intent.putExtra(EXTRA_NAME, name);
|
||||||
|
intent.putExtra(EXTRA_LOCATION, location);
|
||||||
|
intent.putExtra(EXTRA_BIO, bio);
|
||||||
|
intent.putExtra(EXTRA_AVATAR_RES, avatarRes);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
binding = ActivityUserProfileReadOnlyBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
|
binding.backButton.setOnClickListener(v -> finish());
|
||||||
|
|
||||||
|
String userId = getIntent().getStringExtra(EXTRA_USER_ID);
|
||||||
|
String name = getIntent().getStringExtra(EXTRA_NAME);
|
||||||
|
String location = getIntent().getStringExtra(EXTRA_LOCATION);
|
||||||
|
String bio = getIntent().getStringExtra(EXTRA_BIO);
|
||||||
|
int avatarRes = getIntent().getIntExtra(EXTRA_AVATAR_RES, R.drawable.wish_tree_checker_backup);
|
||||||
|
|
||||||
|
binding.name.setText(name != null ? name : "");
|
||||||
|
binding.location.setText(location != null ? location : "");
|
||||||
|
binding.bio.setText(bio != null ? bio : "");
|
||||||
|
binding.avatar.setImageResource(avatarRes);
|
||||||
|
|
||||||
|
setupTabsAndWorks();
|
||||||
|
bindDemoStatsAndWorks(userId);
|
||||||
|
|
||||||
|
boolean isFriend = isFriend(userId);
|
||||||
|
updateAddFriendButton(isFriend);
|
||||||
|
|
||||||
|
binding.addFriendButton.setOnClickListener(v -> {
|
||||||
|
if (TextUtils.isEmpty(userId)) {
|
||||||
|
Toast.makeText(this, "用户信息缺失", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean now = isFriend(userId);
|
||||||
|
if (!now) {
|
||||||
|
setFriend(userId, true);
|
||||||
|
updateAddFriendButton(true);
|
||||||
|
Toast.makeText(this, "已发送好友请求", Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "已添加", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupTabsAndWorks() {
|
||||||
|
if (binding == null) return;
|
||||||
|
|
||||||
|
if (binding.tabs.getTabCount() == 0) {
|
||||||
|
binding.tabs.addTab(binding.tabs.newTab().setText("作品"));
|
||||||
|
binding.tabs.addTab(binding.tabs.newTab().setText("动态"));
|
||||||
|
binding.tabs.addTab(binding.tabs.newTab().setText("资料"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (worksAdapter == null) {
|
||||||
|
worksAdapter = new UserWorksAdapter();
|
||||||
|
binding.worksRecycler.setLayoutManager(new GridLayoutManager(this, 3));
|
||||||
|
binding.worksRecycler.setAdapter(worksAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
showTab(0);
|
||||||
|
|
||||||
|
binding.tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
if (tab == null) return;
|
||||||
|
showTab(tab.getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
if (tab == null) return;
|
||||||
|
showTab(tab.getPosition());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showTab(int index) {
|
||||||
|
if (binding == null) return;
|
||||||
|
binding.worksRecycler.setVisibility(index == 0 ? android.view.View.VISIBLE : android.view.View.GONE);
|
||||||
|
binding.dynamicsPlaceholder.setVisibility(index == 1 ? android.view.View.VISIBLE : android.view.View.GONE);
|
||||||
|
binding.profilePlaceholder.setVisibility(index == 2 ? android.view.View.VISIBLE : android.view.View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bindDemoStatsAndWorks(String userId) {
|
||||||
|
if (binding == null) return;
|
||||||
|
|
||||||
|
String seed = !TextUtils.isEmpty(userId) ? userId : "demo";
|
||||||
|
int h = Math.abs(seed.hashCode());
|
||||||
|
|
||||||
|
int works = 6 + (h % 18);
|
||||||
|
int following = 10 + (h % 200);
|
||||||
|
int followers = 50 + (h % 5000);
|
||||||
|
int likes = 100 + (h % 20000);
|
||||||
|
|
||||||
|
binding.statWorksValue.setText(String.valueOf(works));
|
||||||
|
binding.statFollowingValue.setText(String.valueOf(following));
|
||||||
|
binding.statFollowersValue.setText(String.valueOf(followers));
|
||||||
|
binding.statLikesValue.setText(String.valueOf(likes));
|
||||||
|
|
||||||
|
List<Integer> images = new ArrayList<>();
|
||||||
|
int[] pool = new int[] {
|
||||||
|
R.drawable.wish_tree_checker_backup,
|
||||||
|
R.drawable.wish_tree_prev_no_bg,
|
||||||
|
R.drawable.wish_tree_trim_backup,
|
||||||
|
R.drawable.wish_tree_black,
|
||||||
|
R.drawable.wish_tree
|
||||||
|
};
|
||||||
|
for (int i = 0; i < 12; i++) {
|
||||||
|
images.add(pool[(h + i) % pool.length]);
|
||||||
|
}
|
||||||
|
if (worksAdapter != null) worksAdapter.submitList(images);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFriend(String userId) {
|
||||||
|
if (TextUtils.isEmpty(userId)) return false;
|
||||||
|
return getSharedPreferences(PREFS_FRIENDS, MODE_PRIVATE).getBoolean(userId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFriend(String userId, boolean value) {
|
||||||
|
if (TextUtils.isEmpty(userId)) return;
|
||||||
|
getSharedPreferences(PREFS_FRIENDS, MODE_PRIVATE).edit().putBoolean(userId, value).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAddFriendButton(boolean isFriend) {
|
||||||
|
if (binding == null) return;
|
||||||
|
if (isFriend) {
|
||||||
|
binding.addFriendButton.setText("已添加");
|
||||||
|
binding.addFriendButton.setAlpha(0.7f);
|
||||||
|
} else {
|
||||||
|
binding.addFriendButton.setText("加好友");
|
||||||
|
binding.addFriendButton.setAlpha(1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.example.livestreaming;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.example.livestreaming.databinding.ItemUserWorkBinding;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UserWorksAdapter extends RecyclerView.Adapter<UserWorksAdapter.VH> {
|
||||||
|
|
||||||
|
private final List<Integer> items = new ArrayList<>();
|
||||||
|
|
||||||
|
public void submitList(List<Integer> list) {
|
||||||
|
items.clear();
|
||||||
|
if (list != null) items.addAll(list);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
ItemUserWorkBinding binding = ItemUserWorkBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||||
|
return new VH(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull VH holder, int position) {
|
||||||
|
holder.bind(items.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class VH extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
private final ItemUserWorkBinding binding;
|
||||||
|
|
||||||
|
VH(ItemUserWorkBinding binding) {
|
||||||
|
super(binding.getRoot());
|
||||||
|
this.binding = binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(int drawableRes) {
|
||||||
|
binding.image.setImageResource(drawableRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||||
|
<solid android:color="@android:color/transparent" />
|
||||||
|
</shape>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||||
|
<solid android:color="#00000000" />
|
||||||
|
<stroke android:width="3dp" android:color="#FFFF7AAE" />
|
||||||
|
</shape>
|
||||||
|
|
@ -0,0 +1,316 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FFFFFF">
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:paddingTop="14dp"
|
||||||
|
android:paddingBottom="16dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/backButton"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:contentDescription="back"
|
||||||
|
android:src="@drawable/ic_arrow_back_24"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="TA的主页"
|
||||||
|
android:textColor="#111111"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/backButton"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/backButton"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/backButton" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/avatarRing"
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="96dp"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:background="@drawable/bg_avatar_ring_pink"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/backButton" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/avatar"
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:layout_margin="3dp"
|
||||||
|
android:background="@drawable/bg_avatar_circle_transparent"
|
||||||
|
android:clipToOutline="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/wish_tree_checker_backup"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/avatarRing"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/avatarRing"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/avatarRing"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/avatarRing" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="14dp"
|
||||||
|
android:layout_marginTop="22dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="昵称"
|
||||||
|
android:textColor="#111111"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/avatarRing"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/backButton" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/location"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="14dp"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="城市"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/avatarRing"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/name" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bio"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:text="签名"
|
||||||
|
android:textColor="#333333"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/avatarRing" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/addFriendButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:background="@drawable/bg_purple_999"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="加好友"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/bio" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/readOnlyHint"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="仅可查看对方资料,不能编辑"
|
||||||
|
android:textColor="#999999"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:gravity="center"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/addFriendButton" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/statsRow"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/readOnlyHint">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/statWorks"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/statFollowing"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/statWorksValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#111111"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="作品"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/statFollowing"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/statFollowers"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/statWorks"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/statFollowingValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#111111"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="关注"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/statFollowers"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/statLikes"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/statFollowing"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/statFollowersValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#111111"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="粉丝"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/statLikes"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/statFollowers"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/statLikesValue"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="0"
|
||||||
|
android:textColor="#111111"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:text="获赞"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/statsRow" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/worksRecycler"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tabs" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dynamicsPlaceholder"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="暂无动态"
|
||||||
|
android:textColor="#999999"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tabs" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/profilePlaceholder"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:text="资料\n\n生日:--\n性别:--\n所在地:--"
|
||||||
|
android:textColor="#333333"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tabs" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
28
android-app/app/src/main/res/layout/item_user_work.xml
Normal file
28
android-app/app/src/main/res/layout/item_user_work.xml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:cardUseCompatPadding="false">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:contentDescription="work"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
Loading…
Reference in New Issue
Block a user