use of com.zimincom.mafiaonline.adapter.MessageAdapter in project 2017-01-HUDI-MAC-CHAR by NHNNEXT.
the class GameRoomActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game_room);
ButterKnife.bind(this);
toolbar.setTitle("입장대기중");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
gson = new Gson();
mafiaRemoteService = ServiceGenerator.createService(MafiaRemoteService.class, getBaseContext());
bgm = MediaPlayer.create(getBaseContext(), day);
bgm.setLooping(true);
bgm.start();
gConfigs = new ArrayList<>();
gConfigs.add(new GameConfig(5, GameConfig.GameState.WAITING, "시작 대기중입니다."));
gConfigs.add(new GameConfig(60, GameConfig.GameState.DAY, "의심되는 플레이어를 선택하세요"));
gConfigs.add(new GameConfig(5, GameConfig.GameState.WAITING, "결과 처리중입니다."));
gConfigs.add(new GameConfig(30, GameConfig.GameState.NIGHT, "역할에 따라 선택하세요."));
gConfigs.add(new GameConfig(5, GameConfig.GameState.WAITING, "결과 처리중입니다."));
ArrayList<User> users = new ArrayList<>();
messages = new ArrayList<>();
intent = getIntent();
user = (User) intent.getSerializableExtra("user");
roomId = intent.getStringExtra("roomId");
userName = intent.getStringExtra("userName");
enterRoom(roomId);
playerAdapter = new PlayerAdapter(getBaseContext(), users, R.layout.item_player, userName, " ", gameHandler);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getBaseContext(), 4);
gridLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
playerListView.setLayoutManager(gridLayoutManager);
playerListView.setItemAnimator(new DefaultItemAnimator());
playerListView.setAdapter(playerAdapter);
messageAdapter = new MessageAdapter(getBaseContext(), messages, R.layout.my_chat, userName);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getBaseContext(), LinearLayoutManager.VERTICAL, false);
messageContainer.setLayoutManager(linearLayoutManager);
messageContainer.setItemAnimator(new DefaultItemAnimator());
messageContainer.setAdapter(messageAdapter);
slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
@Override
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
}
});
sendButton.setOnClickListener(this);
slideButton.setOnClickListener(this);
}
Aggregations