Remove a redundant method.

This commit is contained in:
akwizgran
2018-05-11 11:41:49 +01:00
parent 648793e092
commit 9a5a1489ef
4 changed files with 12 additions and 12 deletions

View File

@@ -112,15 +112,17 @@ public class PasswordFragment extends SetupFragment {
@Override
public void onClick(View view) {
if (!setupController.needToShowDozeFragment()) {
nextButton.setVisibility(INVISIBLE);
progressBar.setVisibility(VISIBLE);
}
IBinder token = passwordEntry.getWindowToken();
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
((InputMethodManager) o).hideSoftInputFromWindow(token, 0);
setupController.setPassword(passwordEntry.getText().toString());
setupController.showDozeFragmentOrCreateAccount();
if (setupController.needToShowDozeFragment()) {
setupController.showDozeFragment();
} else {
nextButton.setVisibility(INVISIBLE);
progressBar.setVisibility(VISIBLE);
setupController.createAccount();
}
}
}

View File

@@ -22,10 +22,9 @@ public interface SetupController {
/**
* This should be called after the author name and the password have been
* set. It decides whether to show the doze fragment or create the account
* right away.
* set.
*/
void showDozeFragmentOrCreateAccount();
void showDozeFragment();
/**
* This should be called after the author name and the password have been

View File

@@ -63,10 +63,9 @@ public class SetupControllerImpl extends PasswordControllerImpl
}
@Override
public void showDozeFragmentOrCreateAccount() {
public void showDozeFragment() {
if (setupActivity == null) throw new IllegalStateException();
if (needToShowDozeFragment()) setupActivity.showDozeFragment();
else createAccount();
setupActivity.showDozeFragment();
}
@Override

View File

@@ -73,7 +73,7 @@ public class PasswordFragmentTest {
// assert controller has been called properly
verify(setupController, times(1)).setPassword(safePass);
verify(setupController, times(1)).showDozeFragmentOrCreateAccount();
verify(setupController, times(1)).createAccount();
}
@Test