diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index e69de29..95b35cb 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/nemophila/RequestingActivity.java b/app/src/main/java/com/example/nemophila/RequestingActivity.java index 94df1eb..6119827 100644 --- a/app/src/main/java/com/example/nemophila/RequestingActivity.java +++ b/app/src/main/java/com/example/nemophila/RequestingActivity.java @@ -101,6 +101,7 @@ } } }); + } diff --git a/app/src/main/java/com/example/nemophila/ShopActivity.java b/app/src/main/java/com/example/nemophila/ShopActivity.java index 0c88111..429d0a4 100644 --- a/app/src/main/java/com/example/nemophila/ShopActivity.java +++ b/app/src/main/java/com/example/nemophila/ShopActivity.java @@ -30,7 +30,6 @@ import java.util.List; public class ShopActivity extends AppCompatActivity { - Nemophila nemophila; private ShopAcAdapter adapter = null; @Override @@ -41,6 +40,7 @@ Shop shop; String shopName; String sid; + String myUid = ((Nemophila)getApplication()).getUid(); //NemophilaからcurrentShopを取得、店名の表示 shop = ((Nemophila)getApplication()).getCurrentShop(); @@ -78,8 +78,8 @@ RecyclerView rv = (RecyclerView) findViewById(R.id.postsList); adapter = new ShopAcAdapter(postsDataset); - //一行ずつを縦に(LinearLayout)表示するLayoutManagerを宣言 - LinearLayoutManager llm = new LinearLayoutManager(this); + //一行ずつを縦に(LinearLayout)表示するLayoutManagerを宣言 第三引数のtrueで降順に表示 + LinearLayoutManager llm = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true); // RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL); @@ -114,7 +114,7 @@ //postsDatasetを一旦クリアし、LiveDataから受け取ったデータを一つずつセット(重複しないように) postsDataset.clear(); - int friendFrag; + int postViewFrag; for (Post post: ShopPosts){ //dataを宣言 dataに投稿の必要なデータをセットし、それをpostsDatasetに追加してリストを作る @@ -124,16 +124,20 @@ String uid = post.getUid(); String name = post.getName(); - //投稿がフレンドのものかチェック - friendFrag = 0; - for(AccountNameJson friendNJ: friends){ - if(uid.equals(friendNJ.getUid())){ - friendFrag = 1; + //投稿が自分もしくはフレンドのものかチェック + postViewFrag = 0; + if(uid.equals(myUid)) { + postViewFrag = 1; + }else { + for (AccountNameJson friendNJ : friends) { + if (uid.equals(friendNJ.getUid())) { + postViewFrag = 1; + } } } - //フレンドの投稿のみdataにセット - if(friendFrag == 1) { + //表示する投稿のみdataにセット + if(postViewFrag == 1) { // if(friends.contains(uid)){ //選択が何もない場合は全ての投稿を、選択がある場合は一致する投稿をdataにセット if (selectingGenre.isEmpty() || selectingGenre.contains(genre)) {