diff --git a/app/src/main/java/com/example/citrusclient/views/SettingsFragment.java b/app/src/main/java/com/example/citrusclient/views/SettingsFragment.java index e32be30..12d0925 100644 --- a/app/src/main/java/com/example/citrusclient/views/SettingsFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/SettingsFragment.java @@ -83,8 +83,9 @@ FavoritesViewModel favoritesViewModel; private Integer strAccountColor; //色 - private Integer totalamount = 0; + private int totalamount = 0; + private List bookList = new ArrayList<>(); @@ -214,7 +215,7 @@ //観察部 //ユーザ(主)が持つ本一覧 - List bookList = new ArrayList<>(); + //List bookList = new ArrayList<>(); List point = new ArrayList<>(); booksLiveData.observe(getViewLifecycleOwner(), new Observer>() { @@ -223,9 +224,12 @@ if(integerBookHashMap != null){ bookList.clear(); bookList.addAll(integerBookHashMap.keySet()); - + //デモ + loadFavoritesForBooks(); }else{ bookList.clear(); + TextView textLikes = (TextView) view.findViewById(R.id.textLikes); + textLikes.setText(Integer.toString(totalamount)); } } }); @@ -239,17 +243,25 @@ if(strings != null){ point.add(strings.size()); totalamount = point.stream().mapToInt(Integer::intValue).sum(); + TextView textLikes = (TextView) view.findViewById(R.id.textLikes); + textLikes.setText(Integer.toString(totalamount)); + }else{ + TextView textLikes = (TextView) view.findViewById(R.id.textLikes); + textLikes.setText(Integer.toString(totalamount)); } + } }); - + /* for(int i=0;i