diff --git a/.idea/misc.xml b/.idea/misc.xml
index 4343ab5..960c647 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -19,6 +19,7 @@
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4f46913..b19b47f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -104,10 +104,10 @@
android:exported="true"
android:label="@string/title_activity_requesting"
android:windowSoftInputMode="adjustPan">
-
-
-
-
+
+
+
+
>() {
@Override
public void onChanged(Collection accountNameJson) {
diff --git a/app/src/main/java/com/example/nemophila/RequestingActivity.java b/app/src/main/java/com/example/nemophila/RequestingActivity.java
index e8a6639..12f8900 100644
--- a/app/src/main/java/com/example/nemophila/RequestingActivity.java
+++ b/app/src/main/java/com/example/nemophila/RequestingActivity.java
@@ -79,23 +79,31 @@
//ViewModelからアカウントが返ってくれば(データ変更があれば)実行
@Override
public void onChanged(Account user) {
- requestingName = (user.getName());
+ if(user == null){
+ new AlertDialog.Builder(RequestingActivity.this)
+ .setTitle("IDが間違っています")
+ .setPositiveButton("OK", null)
+ .create()
+ .show();
+ }else {
+ requestingName = (user.getName());
- //申請を送るダイアログ
- RequestingDialogFragment dialog = new RequestingDialogFragment(RequestingActivity.this);
- //名前を渡す
- Bundle args = new Bundle();
- args.putString("message", requestingName);
- dialog.setArguments(args);
+ //申請を送るダイアログ
+ RequestingDialogFragment dialog = new RequestingDialogFragment(RequestingActivity.this);
+ //名前を渡す
+ Bundle args = new Bundle();
+ args.putString("message", requestingName);
+ dialog.setArguments(args);
- //ダイアログの表示
- dialog.show(getSupportFragmentManager(), "Requesting_dialog");
- //OK押したら申請するメソッドにuid、requestingId、tokenを渡す
+ //ダイアログの表示
+ dialog.show(getSupportFragmentManager(), "Requesting_dialog");
+ //OK押したら申請するメソッドにuid、requestingId、tokenを渡す
+ }
}
-
-
});
}
+
+
});
diff --git a/app/src/main/java/com/example/nemophila/viewmodels/AccountViewModel.java b/app/src/main/java/com/example/nemophila/viewmodels/AccountViewModel.java
index 8cc8f52..3216931 100644
--- a/app/src/main/java/com/example/nemophila/viewmodels/AccountViewModel.java
+++ b/app/src/main/java/com/example/nemophila/viewmodels/AccountViewModel.java
@@ -171,10 +171,16 @@
@Override
public void onResponse(Call call, Response response) {
if (response.isSuccessful()) {
- Account ac = new Account(response.body());
- accountLiveData.setValue(ac);
- System.out.println("success");
+ if(response.body() == null){
+ accountLiveData.setValue(null);
+ System.out.println("response error");
+ }else {
+ Account ac = new Account(response.body());
+ accountLiveData.setValue(ac);
+ System.out.println("success");
+ }
} else {
+ accountLiveData.setValue(null);
System.out.println("response error");
}
}
diff --git a/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java b/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java
index a7493ca..474849b 100644
--- a/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java
+++ b/app/src/main/java/com/example/nemophila/viewmodels/FriendViewModel.java
@@ -147,13 +147,13 @@
}
// 対象のアカウントのフレンド申請を行うときの情報削除
public void deleteRequesting(String uid,String requesting_id, String token) {
- Call call = friendsRest.deleteRequesting(uid,requesting_id,token);
+ Call call = friendsRest.deleteRequesting(uid, requesting_id, token);
call.enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
if (response.isSuccessful()) {
removeRequestingLiveData(requesting_id);
- System.out.println("Successful");
+ System.out.println("Successful Delete");
} else {
System.out.println("ResponseError: " + response.code());
}
@@ -236,8 +236,8 @@
continue;
}
preData.add(anj);
- friendsLiveData.setValue(preData);
}
+ friendsLiveData.setValue(preData);
}
private void removeRequestingLiveData(String id) {
@@ -247,8 +247,8 @@
continue;
}
preData.add(anj);
- requestingLiveData.setValue(preData);
}
+ requestingLiveData.setValue(preData);
}
private void removeRequestedLiveData(String id) {
@@ -258,7 +258,7 @@
continue;
}
preData.add(anj);
- requestedLiveData.setValue(preData);
}
+ requestedLiveData.setValue(preData);
}
}
diff --git a/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java b/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java
index 88ea984..e0a8dc9 100644
--- a/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java
+++ b/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java
@@ -35,11 +35,13 @@
// ライブデータ
final private MutableLiveData> shopsLiveData;
+ final private MutableLiveData> nearShopsLiveData;
final private MutableLiveData currentShopLiveData;
// コンストラクタ
public ShopsViewModel() {
this.shopsLiveData = new MutableLiveData<>();
+ this.nearShopsLiveData = new MutableLiveData<>();
this.currentShopLiveData = new MutableLiveData<>();
this.retrofit = new Retrofit.Builder()
.baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/nemophila/")
@@ -53,7 +55,10 @@
public LiveData> getShopsLiveData() {
return this.shopsLiveData;
}
- public LiveData getCurrentLiveData() { return this.currentShopLiveData; }
+ public LiveData> getNearShopsLiveData() { return this.nearShopsLiveData; }
+ public LiveData getCurrentLiveData() {
+ return this.currentShopLiveData;
+ }
// ShopToMarkerに新しく店と地図上のピンを紐づける
public void setShopAndMarker(Shop shop, Marker marker) {
@@ -61,7 +66,9 @@
}
// ShopToMarkerからkeyを指定して、要素を削除する
- public void removeShopAndMarker(Shop shop) { ShopToMarker.remove(shop); }
+ public void removeShopAndMarker(Shop shop) {
+ ShopToMarker.remove(shop);
+ }
// 店に紐づいたピンを返す
public Marker getMarker(Shop shop) {
@@ -122,23 +129,48 @@
});
}
- // 新しく店を生成する
- public void createShop(String name, double longitude, double latitude) {
- Call call = shopsRest.createShop(name, longitude, latitude);
+ public void longClickViewArea(double ux, double uy, double lx, double ly) {
+ // 画面内に収まる範囲の店舗を取得する
+ Call> call = shopsRest.getShops(ux, uy, lx, ly);
- call.enqueue(new Callback() {
+ call.enqueue(new Callback>() {
+ // 通信が成功
@Override
- public void onResponse(Call call, Response response) {
+ public void onResponse(Call> call, Response> response) {
+ // 通信が正常に動作
if (response.isSuccessful()) {
- currentShopLiveData.setValue(response.body());
+ nearShopsLiveData.setValue(response.body());
+ } else {
+ System.out.println("ShopsViewModel : 通信失敗");
}
}
+ // 通信が失敗
@Override
- public void onFailure(Call call, Throwable t) {
- System.out.println("通信失敗 : createShop");
- System.out.println(t);
- }
+ public void onFailure(Call> call, Throwable t) {
+ System.out.println("setViewModel : 通信失敗");
+ System.out.println(t);
+ }
});
}
-}
+
+ // 新しく店を生成する
+ public void createShop (String name,double longitude, double latitude){
+ Call call = shopsRest.createShop(name, longitude, latitude);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if (response.isSuccessful()) {
+ currentShopLiveData.setValue(response.body());
+ }
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ System.out.println("通信失敗 : createShop");
+ System.out.println(t);
+ }
+ });
+ }
+ }
diff --git a/app/src/main/res/drawable/ic_baseline_replay_24.xml b/app/src/main/res/drawable/ic_baseline_replay_24.xml
new file mode 100644
index 0000000..effe564
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_replay_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_friend.xml b/app/src/main/res/layout/activity_friend.xml
index 5ac6e12..8a95aba 100644
--- a/app/src/main/res/layout/activity_friend.xml
+++ b/app/src/main/res/layout/activity_friend.xml
@@ -1,43 +1,57 @@
-
+ tools:context=".FriendActivity"
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
\ No newline at end of file
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="0.87" />
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_my_page_editor.xml b/app/src/main/res/layout/activity_my_page_editor.xml
index 3b45611..e187d18 100644
--- a/app/src/main/res/layout/activity_my_page_editor.xml
+++ b/app/src/main/res/layout/activity_my_page_editor.xml
@@ -126,7 +126,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.023"
android:background="@drawable/circle_button"
- android:src="@drawable/ic_mypage"
+ android:src="@drawable/ic_baseline_replay_24"
android:scaleType="fitCenter"
android:padding="7dp"
/>
diff --git a/app/src/main/res/layout/friend_list_item.xml b/app/src/main/res/layout/friend_list_item.xml
new file mode 100644
index 0000000..a0353d9
--- /dev/null
+++ b/app/src/main/res/layout/friend_list_item.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_friends_activity.xml b/app/src/main/res/layout/layout_friends_activity.xml
deleted file mode 100644
index a0353d9..0000000
--- a/app/src/main/res/layout/layout_friends_activity.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file