| |
---|
| | |
---|
| | return root; |
---|
| | } |
---|
| | |
---|
| | //------------------------------------------------------------------------------------------------- |
---|
| | //listView |
---|
| | @Override |
---|
| | public void onActivityCreated(Bundle savedInstanceState) { |
---|
| | super.onActivityCreated(savedInstanceState); |
---|
| | |
---|
| |
---|
| | AnimationJsonList = new ArrayList<>(); |
---|
| | ListView listView = (ListView) getActivity().findViewById(R.id.list_view); |
---|
| | |
---|
| | editViewModel.getWorkJson().observe(getViewLifecycleOwner(), new Observer<WorkJson>() { |
---|
| | |
---|
| | //listViewの表示をしている |
---|
| | @Override |
---|
| | public void onChanged(@Nullable WorkJson workJson) { |
---|
| | aidList = (ArrayList<Integer>) editViewModel.getWorkJson().getValue().getAid(); |
---|
| | AnimationJsonList = (ArrayList<AnimationJson>) acanthus.getAnimationJsonList(); |
---|
| | |
---|
| | if(AnimationJsonList != null){ |
---|
| | for(int i=0; i<AnimationJsonList.size(); i++){ |
---|
| | //acanthusのAnimationJsonListにとってきたaidが該当するかを探索する |
---|
| | if(aidList.contains(AnimationJsonList.get(i).getAid())){ |
---|
| | AnimationName = AnimationJsonList.get(i).getAnimationName(); |
---|
| | nameList.add(AnimationName); |
---|
| | } |
---|
| |
---|
| | BaseAdapter adapter = new WorkListViewAdapter(getActivity(), |
---|
| | R.layout.work_list, nameList, nameList); |
---|
| | listView.setAdapter(adapter); |
---|
| | } |
---|
| | |
---|
| | |
---|
| | }); |
---|
| | } |
---|
| | |
---|
| | //------------------------------------------------------------------------------------------------- |
---|
| | |
---|
| | @Override |
---|
| | public void onDestroyView() { |
---|
| | super.onDestroyView(); |
---|
| |
---|
| | Integer uid = 1; |
---|
| | String token = "abc0"; |
---|
| | editViewModel.getWorkList(uid, token); |
---|
| | |
---|
| | //編集ボタン |
---|
| | Button editButton = view.findViewById(R.id.Edit_button); |
---|
| | |
---|
| | appButton.setOnClickListener(v -> { |
---|
| | Acanthus acanthus = (Acanthus) getActivity().getApplication(); |
---|
| | //Integer uid = acanthus.getPreferenceUid(); |
---|
| | String name = ((EditText)view.findViewById(R.id.AnimationName)).getText().toString(); |
---|
| | //String token = acanthus.getPreferenceToken(); |
---|
| | Integer aid = editViewModel.startWorkEdit(uid, name, token); |
---|
| | acanthus.setAid(aid); |
---|
| | transitionPaintActivity(); |
---|
| | }); |
---|
| | |
---|
| | editButton.setOnClickListener(v -> { |
---|
| | Acanthus acanthus = (Acanthus) getActivity().getApplication(); |
---|
| | //dummy--------- |
---|
| | Integer aid = 1111; |
---|
| | //-------------- |
---|
| | acanthus.setAid(aid); |
---|
| | transitionPaintActivity(); |
---|
| | }); |
---|
| | } |
---|
| |
---|
| | Acanthus acanthus = (Acanthus) getActivity().getApplication(); |
---|
| | Intent intent = new Intent(acanthus, PaintActivity.class); |
---|
| | startActivity(intent); |
---|
| | } |
---|
| | |
---|
| | |
---|
| | } |
---|
| | |