diff --git a/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java b/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java index 43dd7dd..34a766f 100644 --- a/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java +++ b/app/src/main/java/org/ntlab/amaryllis/client/MyDialogFragment.java @@ -439,83 +439,86 @@ //button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { + //タイトルが最低1文字入力されているかを調べる if(editText.getText().toString().equals("") == false) { - //タイトルの入力 - EditText editText = ((Dialog) dialog).findViewById(R.id.editTitle); - String editTitle = editText.getText().toString(); - TextView Title = (TextView) getActivity().findViewById(R.id.VoiceTitle); - Title.setText(editTitle); - - //概要の入力 - EditText editText2 = ((Dialog) dialog).findViewById(R.id.editOverview); - String editOverview = editText2.getText().toString(); - TextView Overview = (TextView) getActivity().findViewById(R.id.VoiceOverview); - Overview.setText(editOverview); - - - - - //for(int i = 0;i list = new ArrayList<>(); - //ViewGroup layout = check; - //int count = layout.getChildCount(); - //for(int j = 0;j< count;j++){ - //v = layout.getChildAt(j); - //if(v instanceof CheckBox){ - //CheckBox box = (CheckBox) v; - //if(box.isChecked())list.add(box.getText().toString()); - - //} - //} - //} - - //checkbox1がチェックされた状態だった + //一つもチェックされていないcheckboxがあるかを調べる for(int i = 0;i call = voicememosService.postVoicememos(amaryllis.getUid(), amaryllis.getToken(), 10, str, latitude, longitude, "untitled", "abcde",category); - call.enqueue(new Callback() { - @Override - public void onResponse(Call call, Response response) { - Voicememo voicememo = response.body(); - String aa = voicememo.getVid(); - System.out.println("Success!!!!!!!"); - System.out.println(aa); - } + //List list = new ArrayList<>(); + //ViewGroup layout = check; + //int count = layout.getChildCount(); + //for(int j = 0;j< count;j++){ + //v = layout.getChildAt(j); + //if(v instanceof CheckBox){ + //CheckBox box = (CheckBox) v; + //if(box.isChecked())list.add(box.getText().toString()); - @Override - public void onFailure(Call call, Throwable t) { - System.out.println("failed!!!!!!!!!!!!!"); - } - }); + //} + //} + //} + //aaaa = new MapsFragment(); - dismiss(); + 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 = (Amaryllis) getActivity().getApplication(); + data = amaryllis.getData(); + //voiceデータの改行を消去 + String str = data.replace("\n", ""); + //String str = "AAAAGGZ0eXAzZ3A0AAAAAGlzb20zZ3A0AAACkm1vb3YAAABsbXZoZAAAAADbz/QR28/0EQAAA+gAAEYAAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAB5bWV0YQAAACFoZGxyAAAAAAAAAABtZHRhAAAAAAAAAAAAAAAAAAAAACtrZXlzAAAAAAAAAAEAAAAbbWR0YWNvbS5hbmRyb2lkLnZlcnNpb24AAAAlaWxzdAAAAB0AAAABAAAAFWRhdGEAAAABAAAAADguMC4wAAABpXRyYWsAAABcdGtoZAAAAAfbz/QR28/0EQAAAAEAAAAAAABGAAAAAAAAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAUFtZGlhAAAAIG1kaGQAAAAA28/0EdvP9BEAAB9AAAIwAAAAAAAAAAAsaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlAAAAAO1taW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAALFzdGJsAAAARXN0c2QAAAAAAAAAAQAAADVzYW1yAAAAAAAAAAEAAAAAAAAAAAABABAAAAAAH0AAAAAAABFkYW1yICAgAACD/wABAAAAIHN0dHMAAAAAAAAAAgAAAAEAAACgAAADfwAAAKAAAAAUc3RzegAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; + + Call call = voicememosService.postVoicememos(amaryllis.getUid(), amaryllis.getToken(), 10, str, latitude, longitude, "untitled", "abcde", category); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + Voicememo voicememo = response.body(); + String aa = voicememo.getVid(); + System.out.println("Success!!!!!!!"); + System.out.println(aa); + } + + @Override + public void onFailure(Call call, Throwable t) { + System.out.println("failed!!!!!!!!!!!!!"); + } + }); + + + dismiss(); + }else{ + Toast toast = Toast.makeText(v.getContext(), "カテゴリが一つも選択されていません", Toast.LENGTH_LONG); + toast.show(); + CheckChange = 0; + } }else{ Toast toast = Toast.makeText(v.getContext(), "タイトルが入力されていません", Toast.LENGTH_LONG); toast.show();