Merge pull request 'fix/fix_child_uinfo' (#167) from fix/fix_child_uinfo into main
Reviewed-on: #167
This commit is contained in:
commit
05e8d15a20
|
@ -177,10 +177,12 @@ public class MainActivity extends AppCompatActivity {
|
|||
boolean isEditMode = false;
|
||||
View view = getLayoutInflater().inflate(R.layout.user_info_dialog_layout, null);
|
||||
if (userSettings.getAppCommonSetting().isChildMode()) {
|
||||
((TextView) view.findViewById(R.id.userNameTextView)).setText(
|
||||
childData.getChild(userSettings.getAppCommonSetting().getChildId()).join().getName());
|
||||
((TextView) view.findViewById(R.id.emailTextView)).setText("子供モードはメールアドレスを設定できません");
|
||||
((Chip) view.findViewById(R.id.chip)).setText("子供/Child");
|
||||
childData.getChild(userSettings.getAppCommonSetting().getChildId()).thenAccept(childModel -> {
|
||||
((TextView) view.findViewById(R.id.userNameTextView)).setText(childModel.getName());
|
||||
logger.debug("ChildModel: " + childModel.getName());
|
||||
((TextView) view.findViewById(R.id.emailTextView)).setText("子供ユーザーはメールアドレスを設定できません");
|
||||
((Chip) view.findViewById(R.id.chip)).setText("子供/Child");
|
||||
}).join();
|
||||
} else {
|
||||
parentData.getParentDirect().thenAccept(parentModel -> {
|
||||
((TextView) view.findViewById(R.id.userNameTextView)).setText(parentModel.getName());
|
||||
|
@ -190,6 +192,13 @@ public class MainActivity extends AppCompatActivity {
|
|||
}).join();
|
||||
}
|
||||
|
||||
// Workaround
|
||||
if (userSettings.getAppCommonSetting().isChildMode()) {
|
||||
view.findViewById(R.id.userNameEditButton).setVisibility(View.GONE);
|
||||
} else {
|
||||
view.findViewById(R.id.userNameEditButton).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
view.findViewById(R.id.userNameEditButton).setOnClickListener(v -> {
|
||||
EditText editText = new EditText(this);
|
||||
editText.setText(((TextView) view.findViewById(R.id.userNameTextView)).getText());
|
||||
|
|
|
@ -36,7 +36,21 @@ public class ChildDataImpl implements ChildData {
|
|||
|
||||
@Override
|
||||
public CompletableFuture<ChildModel> getChild(String childId) {
|
||||
return null;
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
Call<ChildResponse> call = kidShiftApiService.getChild(childId);
|
||||
try {
|
||||
Response<ChildResponse> response = call.execute();
|
||||
if (response.isSuccessful()) {
|
||||
assert response.body() != null;
|
||||
logger.info("子供取得成功(childId: " + response.body().getId() + ")");
|
||||
return ChildModelConverter.childResponseToChildModel(response.body());
|
||||
} else {
|
||||
throw new RuntimeException("HTTP Status: " + response.code());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -137,6 +137,15 @@ public interface KidShiftApiService {
|
|||
@Headers(AuthorizationInterceptor.HEADER_PLACEHOLDER)
|
||||
Call<ChildListResponse> getChildList();
|
||||
|
||||
/**
|
||||
* 子供情報取得
|
||||
* @param id 子供ID
|
||||
* @return ChildResponse
|
||||
*/
|
||||
@GET("/child/{id}")
|
||||
@Headers(AuthorizationInterceptor.HEADER_PLACEHOLDER)
|
||||
Call<ChildResponse> getChild(@Path("id") String id);
|
||||
|
||||
/**
|
||||
* 子供追加
|
||||
* @param request ChildAddRequest
|
||||
|
|
Loading…
Reference in New Issue
Block a user