diff --git a/app/src/main/java/com/example/nemophila/PostActivity.java b/app/src/main/java/com/example/nemophila/PostActivity.java index f67c1ee..36f7a4b 100644 --- a/app/src/main/java/com/example/nemophila/PostActivity.java +++ b/app/src/main/java/com/example/nemophila/PostActivity.java @@ -204,8 +204,9 @@ @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { genre = (String) genreSpinner.getSelectedItem(); -// System.out.println(gettedRate); -// System.out.println(rate); + if (genre.equals("ジャンルを選択")){ + genre = null; + } } }); @@ -240,14 +241,8 @@ //評価が未入力の時 - if(rate == 0) { - System.out.println("評価未設定クリック"); - Snackbar.make(v, "評価を入力してください", Snackbar.LENGTH_SHORT).show(); -// Intent intent = new Intent(getApplication(), ShopActivity.class); -// startActivity(intent); - } else { - //評価入力済の時 - + if(rate != 0 && genre != null) { + //評価とジャンル入力済の時 if (shop == null) { shopsViewModel.createShop(shopName, nemophila.getCurrentLongitude(), nemophila.getCurrentLatitude()); } else { @@ -262,7 +257,16 @@ Intent intent = new Intent(getApplication(), MapsActivity.class); startActivity(intent); } - } + }else if(rate == 0) { + //評価未入力 + System.out.println("評価未設定クリック"); + Snackbar.make(v, "評価を選択してください", Snackbar.LENGTH_SHORT).show(); +// Intent intent = new Intent(getApplication(), ShopActivity.class); +// startActivity(intent); + }else if (genre == null){ + System.out.println("ジャンル未設定クリック"); + Snackbar.make(v, "ジャンルを選択してください", Snackbar.LENGTH_SHORT).show(); + } } });