diff --git a/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java b/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java index c27b4b5..a2fcea4 100644 --- a/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java +++ b/app/src/main/java/org/ntlab/amaryllis/client/fragment/MapsFragment.java @@ -28,12 +28,23 @@ import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; +import org.ntlab.amaryllis.client.Amaryllis; import org.ntlab.amaryllis.client.R; import org.ntlab.amaryllis.client.VoiceActivity; +import org.ntlab.amaryllis.client.entities.SignUpJson; +import org.ntlab.amaryllis.client.entities.Voicememo; +import org.ntlab.amaryllis.client.resources.AccountsRest; +import org.ntlab.amaryllis.client.resources.VoicememosRest; import java.io.File; import java.io.FileInputStream; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.jackson.JacksonConverterFactory; + public class MapsFragment extends Fragment { @@ -74,6 +85,8 @@ googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); } }; + private VoicememosRest voicememosService; + private Amaryllis amaryllis; @Nullable @Override @@ -88,6 +101,13 @@ @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); + + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/amaryllis/") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + voicememosService = retrofit.create(VoicememosRest.class); + amaryllis = (Amaryllis) getActivity().getApplication(); //file = new File(getFilesDir(),"Sample.3gp"); mp = new MediaPlayer(); @@ -147,8 +167,6 @@ try { FileInputStream in = new FileInputStream(filePath); // ファイル読み込み用 - - TextView textView1 = (TextView)getView().findViewById(R.id.Notice); textView1.setText("Record End!"); mr.stop(); @@ -157,8 +175,21 @@ in.read(byteData); byte2short(shortData, byteData); - Base64.encodeToString(byteData, 0,byteData.length, Base64.DEFAULT); + String data = Base64.encodeToString(byteData, 0,byteData.length, Base64.DEFAULT); + + Call call = voicememosService.postVoicememos(amaryllis.getUid(),amaryllis.getToken(),10,data,35,135,"untitled",""); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + Voicememo voicememo = response.body(); + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); StartChange = 1; R_Stoping.setAlpha(1.0f); R_Playing.setAlpha(0.0f);