diff --git a/app/src/main/java/com/example/sprout/refactor/activity/RoomCreateActivity.java b/app/src/main/java/com/example/sprout/refactor/activity/RoomCreateActivity.java index 4d853aa..e03f763 100644 --- a/app/src/main/java/com/example/sprout/refactor/activity/RoomCreateActivity.java +++ b/app/src/main/java/com/example/sprout/refactor/activity/RoomCreateActivity.java @@ -1,15 +1,10 @@ package com.example.sprout.refactor.activity; -import android.content.Intent; import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.widget.Toast; import com.example.sprout.R; import com.example.sprout.databinding.RfActivityRoomCreateBinding; -import com.example.sprout.refactor.common.ActivityEvent; -import com.example.sprout.refactor.contract.ViewContract; import com.example.sprout.refactor.viewmodel.RoomCreateViewModel; /** @@ -17,38 +12,29 @@ * * @author matsumoto_k */ -public class RoomCreateActivity extends AppCompatActivity implements ViewContract { +public class RoomCreateActivity extends BaseActivity { + + private RoomCreateViewModel roomCreateViewModel = null; + private RfActivityRoomCreateBinding binding = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - RfActivityRoomCreateBinding binding = DataBindingUtil.setContentView(this, R.layout.rf_activity_room_create); - RoomCreateViewModel roomCreateViewModel = new RoomCreateViewModel((ViewContract) this); + binding = DataBindingUtil.setContentView(this, R.layout.rf_activity_room_create); + roomCreateViewModel = new RoomCreateViewModel(); binding.setViewModel(roomCreateViewModel); getLifecycle().addObserver(roomCreateViewModel); } @Override - public void startActivity(ActivityEvent event) { - switch (event) { - case ROOM_MAIN: - startActivity(new Intent(RoomCreateActivity.this, RoomMainActivity.class)); - break; - } + protected void onResume() { + super.onResume(); + addUiObserver(roomCreateViewModel); } @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(); + protected void onPause() { + super.onPause(); + removeUiObserver(roomCreateViewModel); } }