diff --git a/.gitignore b/.gitignore index e83a637..24195e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *.iml .gradle -/local.properties /.idea/caches /.idea/libraries /.idea/modules.xml @@ -12,5 +11,4 @@ /build /captures .externalNativeBuild -.cxx -local.properties +.cxx \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0ad711e --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 07b156a..921d88c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,8 +3,9 @@ diff --git a/app/build.gradle b/app/build.gradle index 4f8dfd2..2570292 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,6 +31,10 @@ } } +//repositories { +// mavenCentral() +//} + dependencies { implementation 'androidx.appcompat:appcompat:1.4.2' @@ -47,4 +51,8 @@ implementation 'com.squareup.retrofit2:converter-jackson:2.5.0' implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' + + //google用 + implementation 'com.google.maps:google-maps-services:0.2.5' + implementation 'org.slf4j:slf4j-nop:1.7.25' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cec1bf5..5ab2535 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -41,33 +41,35 @@ android:name=".MyPageActivity" android:exported="true" android:label="@string/title_activity_my_page"> - - - - - - - - - - - - + + + + + + + + + + + android:label="@string/title_activity_post"> + \ No newline at end of file diff --git a/app/src/main/java/com/example/nemophila/MainActivity.java b/app/src/main/java/com/example/nemophila/MainActivity.java index a01b35d..34a3d8c 100644 --- a/app/src/main/java/com/example/nemophila/MainActivity.java +++ b/app/src/main/java/com/example/nemophila/MainActivity.java @@ -43,9 +43,9 @@ public void onMapReady(GoogleMap googleMap) { mMap = googleMap; - // Add a marker in Sydney and move the camera - LatLng sydney = new LatLng(-34, 151); - mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); - mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); + // Add a marker in Sydney and move the + LatLng ntlab = new LatLng(34.73, 135.26); + mMap.addMarker(new MarkerOptions().position(ntlab).title("Marker in ntlab")); + mMap.moveCamera(CameraUpdateFactory.newLatLng(ntlab)); } } \ No newline at end of file diff --git a/app/src/main/java/com/example/nemophila/ShopActivity.java b/app/src/main/java/com/example/nemophila/ShopActivity.java new file mode 100644 index 0000000..e456f6c --- /dev/null +++ b/app/src/main/java/com/example/nemophila/ShopActivity.java @@ -0,0 +1,14 @@ +package com.example.nemophila; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class ShopActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_shop); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nemophila/entities/Account.java b/app/src/main/java/com/example/nemophila/entities/Account.java new file mode 100644 index 0000000..2664fa0 --- /dev/null +++ b/app/src/main/java/com/example/nemophila/entities/Account.java @@ -0,0 +1,4 @@ +package com.example.nemophila.entities; + +public class Account { +} diff --git a/app/src/main/java/com/example/nemophila/entities/Post.java b/app/src/main/java/com/example/nemophila/entities/Post.java new file mode 100644 index 0000000..8169350 --- /dev/null +++ b/app/src/main/java/com/example/nemophila/entities/Post.java @@ -0,0 +1,4 @@ +package com.example.nemophila.entities; + +public class Post { +} diff --git a/app/src/main/java/com/example/nemophila/entities/PostJson.java b/app/src/main/java/com/example/nemophila/entities/PostJson.java new file mode 100644 index 0000000..fff198d --- /dev/null +++ b/app/src/main/java/com/example/nemophila/entities/PostJson.java @@ -0,0 +1,4 @@ +package com.example.nemophila.entities; + +public class PostJson { +} diff --git a/app/src/main/java/com/example/nemophila/entities/Shop.java b/app/src/main/java/com/example/nemophila/entities/Shop.java new file mode 100644 index 0000000..6f68dee --- /dev/null +++ b/app/src/main/java/com/example/nemophila/entities/Shop.java @@ -0,0 +1,4 @@ +package com.example.nemophila.entities; + +public class Shop { +} diff --git a/app/src/main/java/com/example/nemophila/resources/AccountsRest.java b/app/src/main/java/com/example/nemophila/resources/AccountsRest.java index 776b3ae..e5bcc24 100644 --- a/app/src/main/java/com/example/nemophila/resources/AccountsRest.java +++ b/app/src/main/java/com/example/nemophila/resources/AccountsRest.java @@ -1,4 +1,64 @@ package com.example.nemophila.resources; +//import android.accounts.Account; + +import com.example.nemophila.entities.Account; +import com.example.nemophila.entities.Post; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; + +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; + public interface AccountsRest { + @GET("accounts") + Call getAccounts(); + + @FormUrlEncoded + @POST("accounts") + Call createAccounts( + @Field("name") String name, + @Field("pw") String pw + ); + + @GET("accounts/{uid}") + Call getAccount( + @Path("uid") String uid + ); + + @DELETE("accounts/{uid}") + Call deleteAccount( + @Path("uid") String uid + ); + + @FormUrlEncoded + @POST("accounts/{uid}/login") + Call getAccounts( + @Path("uid") String uid + ); + + @FormUrlEncoded + @PUT("accounts/{uid}/pw") + Call changePw( + @Path("uid") String uid, + @Field("oldPw") String oldPw, + @Field("newPw") String newPw, + @Field("token") String token + ); + + @FormUrlEncoded + @PUT("accounts/{uid}/name") + Call changeName( + @Path("uid") String uid, + @Field("name") String oldPw, + @Field("token") String token + ); } diff --git a/app/src/main/java/com/example/nemophila/resources/PostsRest.java b/app/src/main/java/com/example/nemophila/resources/PostsRest.java index a9f95a8..9b71482 100644 --- a/app/src/main/java/com/example/nemophila/resources/PostsRest.java +++ b/app/src/main/java/com/example/nemophila/resources/PostsRest.java @@ -1,4 +1,33 @@ package com.example.nemophila.resources; +import com.example.nemophila.entities.Post; + +import java.util.Collection; + +import retrofit2.Call; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; + public interface PostsRest { + @FormUrlEncoded + @POST("accounts/{uid}/posts") + Call postAccountPost( + @Path("uid") String uid, + @Field("token") String token, + @Field("sid") String sid, + @Field("rate") String rate, + @Field("genre") String genre, + @Field("comment")String comment, + @Field("image1") String img1, + @Field("image2") String img2, + @Field("image3") String img3 + ); + + @GET("accounts/{uid}/posts") + Call> getAccountPosts( + @Path("uid") String uid + ); } diff --git a/app/src/main/java/com/example/nemophila/resources/ShopsRest.java b/app/src/main/java/com/example/nemophila/resources/ShopsRest.java index 9f54b59..5626822 100644 --- a/app/src/main/java/com/example/nemophila/resources/ShopsRest.java +++ b/app/src/main/java/com/example/nemophila/resources/ShopsRest.java @@ -1,4 +1,56 @@ package com.example.nemophila.resources; +import com.example.nemophila.entities.PostJson; +import com.example.nemophila.entities.Shop; +import com.fasterxml.jackson.annotation.JsonFilter; + +import java.util.Collection; + +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; +import retrofit2.http.Query; + public interface ShopsRest { + + //----------------------------------------------- + //画面内のshopの情報を取得する。 + @GET("shops") + Call> getShops( + @Query("monitor_upper_right_longitude") double upperRightLongitude, + @Query("monitor_upper_right_latitude") double upperRightLatitude, + @Query("monitor_lower_left_longitude") double lowerLeftLongitude, + @Query("monitor_lower_left_latitude") double lowerLeftLatitude + ); + + @FormUrlEncoded + @POST("shops") + Call createShop( + @Field("name") String name, + @Field("longitude") double longitude, + @Field("latitude") double latitude + ); + + @GET("shops/{sid}") + Call getShop( + @Path("sid") String sid + ); + + @GET("shops/{sid}/posts") + Call getPosts( + @Path("sid") String sid + ); + + @DELETE("shops/{sid}/posts/{uid}/{pid}") + Call deletePost( + @Path("sid") String sid, + + @Path("uid") String uid, + @Path("pid") String pid, + @Field("token") String 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 new file mode 100644 index 0000000..c9f3dd6 --- /dev/null +++ b/app/src/main/java/com/example/nemophila/viewmodels/AccountViewModel.java @@ -0,0 +1,4 @@ +package com.example.nemophila.viewmodels; + +public class AccountViewModel { +} diff --git a/app/src/main/res/layout/activity_shop.xml b/app/src/main/res/layout/activity_shop.xml new file mode 100644 index 0000000..cbe3bd2 --- /dev/null +++ b/app/src/main/res/layout/activity_shop.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 207b5a1..b26e85e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,7 @@ MainActivity PostActivity MyPageActivity + ShopActivity LoginActivity SignUpActivity \ No newline at end of file diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..e572d48 --- /dev/null +++ b/local.properties @@ -0,0 +1,12 @@ +## This file is automatically generated by Android Studio. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file should *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=C\:\\Users\\Student\\AppData\\Local\\Android\\Sdk +#google maps apikey +MAPS_API_KEY = AIzaSyDSlrIzdvRq30wTpmbT1tY-61i-E-5qk8k \ No newline at end of file