diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 467c560..90507b0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -45,12 +45,12 @@
android:name=".SignUpActivity"
android:exported="true"
android:label="@string/title_activity_sign_up">
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
>() {
@Override
public void onChanged(List ShopPosts) {
+
+ //Nemophilaから選択中のジャンルを受け取って表示
+// HashSet selectingGenre = ((Nemophila)getApplication()).getSelectGenres();
+ //テスト用にHashsetにジャンルを入力
+ HashSet selectingGenre = new HashSet<>();
+ selectingGenre.add("ラーメン");
+ selectingGenre.add("中華");
+
+ if(!(selectingGenre.isEmpty())) {
+ String unitGenre = "";
+// for (String list : selectingGenre) {
+// unitGenre += selectingGenre;
+// unitGenre += ", ";
+// }
+ TextView genreView = (TextView) findViewById(R.id.shopAcGenre);
+ genreView.setText("選択中のジャンル:" + selectingGenre);
+ }
+
+ //テスト用にジャンルをラーメンにセット
+ String selectTestGenre = "";
+ selectTestGenre = "ラーメン";
+// if(!(selectTestGenre.isEmpty())) {
+// TextView genreView = (TextView) findViewById(R.id.shopAcGenre);
+// genreView.setText("選択中のジャンル:" + selectTestGenre);
+// }
+
//postsDatasetを一旦クリアし、LiveDataから受け取ったデータを一つずつセット(重複しないように)
postsDataset.clear();
for (Post post: ShopPosts){
+ //投稿一つあたりの各要素をdataにセット
PostDataModel data = new PostDataModel();
- data.setName(post.getName());
- data.setDate(post.getDate());
- //rateはintで受け取った評価に対応した星の数のStringに変換してセット
- int intRate = post.getRate();
- String strRate = "";
- for (int i = 0; i < 5; i++){
- if(intRate > i ){
- strRate += "★";
- }else{
- strRate += "☆";
- }
- }
- data.setRate(strRate);
- data.setGenre(post.getGenre());
- data.setComment(post.getComment());
+ //選択したgenreで絞り込み検索(どれか一つでもあれば)
+ String genre = post.getGenre();
- postsDataset.add(data);
+ if(selectingGenre.contains(genre)) {
+ data.setName(post.getName());
+ data.setDate(post.getDate());
+ //rateはintで受け取った評価に対応した星の数のStringに変換してセット
+ int intRate = post.getRate();
+ String strRate = "";
+ for (int i = 0; i < 5; i++) {
+ if (intRate > i) {
+ strRate += "★";
+ } else {
+ strRate += "☆";
+ }
+ }
+ data.setRate(strRate);
+ data.setGenre(genre);
+ data.setComment(post.getComment());
+
+ //投稿一つの情報がdataに全部セットされたらDatasetに追加
+ postsDataset.add(data);
+ }
}
//RecyclerViewをonChangedが呼ばれるたび表示(アダプターを更新してRecyclerViewにセット)
adapter.setList(postsDataset);
diff --git a/app/src/main/res/layout/activity_shop.xml b/app/src/main/res/layout/activity_shop.xml
index 394e0cc..5c98568 100644
--- a/app/src/main/res/layout/activity_shop.xml
+++ b/app/src/main/res/layout/activity_shop.xml
@@ -16,7 +16,7 @@
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.496"
+ app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.047" />
@@ -52,12 +52,24 @@
+ app:layout_constraintTop_toBottomOf="@+id/shopAcGenre"
+ app:layout_constraintVertical_bias="0.669" />
+
+
\ No newline at end of file