Search in sources :

Example 1 with RoomAdapter

use of com.zimincom.mafiaonline.adapter.RoomAdapter in project 2017-01-HUDI-MAC-CHAR by NHNNEXT.

the class RoomListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_room_list);
    mafiaRemoteService = ServiceGenerator.createService(MafiaRemoteService.class, context);
    user = (User) getIntent().getSerializableExtra("user");
    roomCreate = (Button) findViewById(R.id.create_room);
    logout = (Button) findViewById(R.id.logout);
    nickNameText = (TextView) findViewById(R.id.userName);
    roomCreate.setOnClickListener(this);
    logout.setOnClickListener(this);
    nickNameText.setText(user.getNickName());
    roomListView = (RecyclerView) findViewById(R.id.room_list);
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    RoomAdapter roomAdapter = new RoomAdapter(context, rooms, user, R.layout.item_room);
    roomListView.setLayoutManager(layoutManager);
    roomListView.setItemAnimator(new DefaultItemAnimator());
    roomListView.setAdapter(roomAdapter);
    roomUpdateTask = new RoomUpdateTask(handler);
    timer = new Timer();
    timer.schedule(roomUpdateTask, 0, 500);
}
Also used : Timer(java.util.Timer) MafiaRemoteService(com.zimincom.mafiaonline.remote.MafiaRemoteService) RoomUpdateTask(com.zimincom.mafiaonline.tasks.RoomUpdateTask) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RoomAdapter(com.zimincom.mafiaonline.adapter.RoomAdapter) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RoomAdapter (com.zimincom.mafiaonline.adapter.RoomAdapter)1 MafiaRemoteService (com.zimincom.mafiaonline.remote.MafiaRemoteService)1 RoomUpdateTask (com.zimincom.mafiaonline.tasks.RoomUpdateTask)1 Timer (java.util.Timer)1