diff --git a/app/src/main/java/com/example/sprout/refactor/activity/RoomMainActivity.java b/app/src/main/java/com/example/sprout/refactor/activity/RoomMainActivity.java index 2eecb99..0817bda 100644 --- a/app/src/main/java/com/example/sprout/refactor/activity/RoomMainActivity.java +++ b/app/src/main/java/com/example/sprout/refactor/activity/RoomMainActivity.java @@ -2,19 +2,16 @@ import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.widget.Toast; import com.example.sprout.R; import com.example.sprout.databinding.RfActivityRoomMainBinding; import com.example.sprout.refactor.Constant; import com.example.sprout.refactor.adapter.RoomMainAdapter; -import com.example.sprout.refactor.common.ActivityEvent; -import com.example.sprout.refactor.contract.ViewContract; import com.example.sprout.refactor.viewmodel.RoomMainViewModel; import framework.gameMain.RealTimeActivity; -public class RoomMainActivity extends RealTimeActivity implements ViewContract { +public class RoomMainActivity extends RealTimeActivity { private RoomMainViewModel roomMainViewModel = null; @@ -22,7 +19,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RfActivityRoomMainBinding binding = DataBindingUtil.setContentView(this, R.layout.rf_activity_room_main); - roomMainViewModel = new RoomMainViewModel(new RoomMainAdapter(this), (ViewContract) this); + roomMainViewModel = new RoomMainViewModel(new RoomMainAdapter(this)); binding.setViewModel(roomMainViewModel); getLifecycle().addObserver(roomMainViewModel); } @@ -31,6 +28,7 @@ protected void onResume() { super.onResume(); this.start(Constant.ROOM_UPDATE_DELAY, Constant.ROOM_UPDATE_INTERVAL); + addUiObserver(roomMainViewModel); } @Override @@ -43,24 +41,4 @@ protected void update(long interval) { roomMainViewModel.update(); } - - @Override - public void startActivity(ActivityEvent event) { - - } - - @Override - public void finishActivity() { - finish(); - } - - @Override - public void showShortToast(String message) { - Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); - } - - @Override - public void showLongToast(String message) { - Toast.makeText(this, message, Toast.LENGTH_LONG).show(); - } }