diff --git a/app/src/main/java/com/example/sprout/refactor/activity/RoomInputKeyActivity.java b/app/src/main/java/com/example/sprout/refactor/activity/RoomInputKeyActivity.java index 115f5a1..58dfaa8 100644 --- a/app/src/main/java/com/example/sprout/refactor/activity/RoomInputKeyActivity.java +++ b/app/src/main/java/com/example/sprout/refactor/activity/RoomInputKeyActivity.java @@ -1,14 +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.RfActivityRoomInputKeyBinding; -import com.example.sprout.refactor.common.ActivityEvent; import com.example.sprout.refactor.contract.ViewContract; import com.example.sprout.refactor.viewmodel.RoomInputKeyViewModel; @@ -17,7 +13,7 @@ * * @author matsumoto_k */ -public class RoomInputKeyActivity extends AppCompatActivity implements ViewContract { +public class RoomInputKeyActivity extends BaseActivity { private RfActivityRoomInputKeyBinding binding = null; private RoomInputKeyViewModel roomInputKeyViewModel = null; @@ -26,32 +22,20 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.rf_activity_room_input_key); - roomInputKeyViewModel = new RoomInputKeyViewModel((ViewContract) this); + roomInputKeyViewModel = new RoomInputKeyViewModel(); binding.setViewModel(roomInputKeyViewModel); getLifecycle().addObserver(roomInputKeyViewModel); } @Override - public void startActivity(ActivityEvent event) { - switch (event) { - case ROOM_MAIN: - startActivity(new Intent(RoomInputKeyActivity.this, RoomMainActivity.class)); - break; - } + protected void onResume() { + super.onResume(); + addUiObserver(roomInputKeyViewModel); } @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(roomInputKeyViewModel); } }