use of cl.smartcities.isci.transportinspector.adapters.GridAvatarAdapter in project androidApp by InspectorIncognito.
the class AccountSettingsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_user_settings);
currentAccount = TranSappAccountManager.getCurrentAccount();
int level = currentAccount.currentUser.level.getLevelPosition();
serverUserAvatarId = currentAccount.currentUser.avatarId;
serverShowImageAsAvatar = !currentAccount.currentUser.showAvatar;
userAvatarId = serverUserAvatarId;
showImageAsAvatar = serverShowImageAsAvatar;
RecyclerView userGridView = findViewById(R.id.activity_account_settings_user_avatar_grid_view);
userGridView.setLayoutManager(new GridLayoutManager(this, 4));
editText = findViewById(R.id.nickname_edit_text);
editText.setText(currentAccount.currentUser.nickname);
findViewById(R.id.level_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(AccountSettingsActivity.this, LevelActivity.class));
}
});
TextView levelName = findViewById(R.id.level_name);
levelName.setText(currentAccount.currentUser.level.getLevelName());
levelName.setTextColor(ContextCompat.getColor(this, currentAccount.currentUser.level.getLevelTextColor()));
ImageView levelImage = findViewById(R.id.level_image);
levelImage.setColorFilter(ContextCompat.getColor(this, currentAccount.currentUser.level.getLevelStarColor()));
AvatarView imageView = findViewById(R.id.avatar_image);
currentAccount.currentUser.loadImage(imageView);
Log.d("SettingsActivity", "creating grid");
GridAvatarAdapter userAdapter = new GridAvatarAdapter(AvatarLists.USER_AVATARS, new GridAvatarAdapter.AvatarClickListener() {
@Override
public void onNewAvatarSelected(int serverId) {
userAvatarId = serverId;
}
}, level, serverUserAvatarId);
Log.d("SettingsActivity", "setting grid");
userGridView.setAdapter(userAdapter);
Log.d("SettingsActivity", "grid ready");
Switch switchShowImage = findViewById(R.id.activity_account_settings_switch_button);
switchShowImage.setChecked(serverShowImageAsAvatar);
switchShowImage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
showImageAsAvatar = isChecked;
}
});
}
Aggregations