77 lines
2.3 KiB
Java
77 lines
2.3 KiB
Java
package com.example.livestreaming;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
import com.example.livestreaming.databinding.ActivityPeaceEliteBinding;
|
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
|
|
|
public class PeaceEliteActivity extends AppCompatActivity {
|
|
|
|
private ActivityPeaceEliteBinding binding;
|
|
|
|
public static void start(Context context) {
|
|
Intent intent = new Intent(context, PeaceEliteActivity.class);
|
|
context.startActivity(intent);
|
|
}
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
binding = ActivityPeaceEliteBinding.inflate(getLayoutInflater());
|
|
setContentView(binding.getRoot());
|
|
|
|
setupUI();
|
|
}
|
|
|
|
private void setupUI() {
|
|
binding.backButton.setOnClickListener(v -> finish());
|
|
|
|
BottomNavigationView bottomNavigation = binding.bottomNavInclude.bottomNavigation;
|
|
bottomNavigation.setSelectedItemId(R.id.nav_friends);
|
|
|
|
// 更新未读消息徽章
|
|
UnreadMessageManager.updateBadge(bottomNavigation);
|
|
|
|
bottomNavigation.setOnItemSelectedListener(item -> {
|
|
int id = item.getItemId();
|
|
if (id == R.id.nav_home) {
|
|
startActivity(new Intent(this, MainActivity.class));
|
|
finish();
|
|
return true;
|
|
}
|
|
if (id == R.id.nav_wish_tree) {
|
|
WishTreeActivity.start(this);
|
|
finish();
|
|
return true;
|
|
}
|
|
if (id == R.id.nav_messages) {
|
|
MessagesActivity.start(this);
|
|
finish();
|
|
return true;
|
|
}
|
|
if (id == R.id.nav_profile) {
|
|
ProfileActivity.start(this);
|
|
finish();
|
|
return true;
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
|
|
@Override
|
|
protected void onResume() {
|
|
super.onResume();
|
|
if (binding != null) {
|
|
BottomNavigationView bottomNav = binding.bottomNavInclude.bottomNavigation;
|
|
bottomNav.setSelectedItemId(R.id.nav_friends);
|
|
// 更新未读消息徽章
|
|
UnreadMessageManager.updateBadge(bottomNav);
|
|
}
|
|
}
|
|
}
|
|
|