|
@@ -27,6 +27,7 @@ import com.sharix.sportsmanfriend.BaseDialogClass;
|
|
import com.sharix.sportsmanfriend.BaseFragmentClass;
|
|
import com.sharix.sportsmanfriend.BaseFragmentClass;
|
|
import com.sharix.sportsmanfriend.PhotoHelperClass;
|
|
import com.sharix.sportsmanfriend.PhotoHelperClass;
|
|
import com.sharix.sportsmanfriend.R;
|
|
import com.sharix.sportsmanfriend.R;
|
|
|
|
+import com.sharix.sportsmanfriend.dialogs.AgeLimitDialog;
|
|
import com.sharix.sportsmanfriend.dialogs.ChoiceOfGenderDialog;
|
|
import com.sharix.sportsmanfriend.dialogs.ChoiceOfGenderDialog;
|
|
import com.sharix.sportsmanfriend.dialogs.ChoiceOfSportDialog;
|
|
import com.sharix.sportsmanfriend.dialogs.ChoiceOfSportDialog;
|
|
import com.sharix.sportsmanfriend.dialogs.DateOfEventDialog;
|
|
import com.sharix.sportsmanfriend.dialogs.DateOfEventDialog;
|
|
@@ -43,11 +44,11 @@ import java.util.Objects;
|
|
public class CreateEventFragment extends BaseFragmentClass implements BaseDialogClass.DialogListener {
|
|
public class CreateEventFragment extends BaseFragmentClass implements BaseDialogClass.DialogListener {
|
|
// Элементы на которые будет вызываться диалоговое окно
|
|
// Элементы на которые будет вызываться диалоговое окно
|
|
private ConstraintLayout locationBlock, sportBlock, memberLimitBlock, dayBlock, timeBlock, endRegistrationBlock,
|
|
private ConstraintLayout locationBlock, sportBlock, memberLimitBlock, dayBlock, timeBlock, endRegistrationBlock,
|
|
- levelBlock, genderBlock;
|
|
|
|
|
|
+ levelBlock, genderBlock, ageLimitBlock;
|
|
private ImageButton btnGetImageFromGallery, btnGetImageFromCamera;
|
|
private ImageButton btnGetImageFromGallery, btnGetImageFromCamera;
|
|
// поля для отображения выбранных значений в диалогах
|
|
// поля для отображения выбранных значений в диалогах
|
|
private TextView locationBlockText, sportBlockText, memberLimitsBlockText, dayBlockText, timeBlockText,
|
|
private TextView locationBlockText, sportBlockText, memberLimitsBlockText, dayBlockText, timeBlockText,
|
|
- endRegistrationBlockText, levelBlockText, genderBlockText;
|
|
|
|
|
|
+ endRegistrationBlockText, levelBlockText, genderBlockText, ageLimitBlockText;
|
|
private ShapeableImageView LocationBlockImage;
|
|
private ShapeableImageView LocationBlockImage;
|
|
// данные для бд
|
|
// данные для бд
|
|
private String description;
|
|
private String description;
|
|
@@ -82,6 +83,8 @@ public class CreateEventFragment extends BaseFragmentClass implements BaseDialog
|
|
levelBlockText = v.findViewById(R.id.levelBlockText);
|
|
levelBlockText = v.findViewById(R.id.levelBlockText);
|
|
genderBlock = v.findViewById(R.id.genderBlock);
|
|
genderBlock = v.findViewById(R.id.genderBlock);
|
|
genderBlockText = v.findViewById(R.id.genderBlockText);
|
|
genderBlockText = v.findViewById(R.id.genderBlockText);
|
|
|
|
+ ageLimitBlock = v.findViewById(R.id.ageLimitBlock);
|
|
|
|
+ ageLimitBlockText = v.findViewById(R.id.ageLimitBlockText);
|
|
btnGetImageFromGallery = v.findViewById(R.id.btn_get_image_from_galary);
|
|
btnGetImageFromGallery = v.findViewById(R.id.btn_get_image_from_galary);
|
|
btnGetImageFromCamera = v.findViewById(R.id.btn_get_image_from_camera);
|
|
btnGetImageFromCamera = v.findViewById(R.id.btn_get_image_from_camera);
|
|
photoContainer = v.findViewById(R.id.photo_container);
|
|
photoContainer = v.findViewById(R.id.photo_container);
|
|
@@ -144,6 +147,12 @@ public class CreateEventFragment extends BaseFragmentClass implements BaseDialog
|
|
choiceOfGenderDialog.show(requireActivity().getSupportFragmentManager(), "choiceOfGenderDialog");
|
|
choiceOfGenderDialog.show(requireActivity().getSupportFragmentManager(), "choiceOfGenderDialog");
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ ageLimitBlock.setOnClickListener(v -> {
|
|
|
|
+ AgeLimitDialog ageLimitDialog = new AgeLimitDialog();
|
|
|
|
+ ageLimitDialog.setTargetFragment(CreateEventFragment.this, 0);
|
|
|
|
+ ageLimitDialog.show(requireActivity().getSupportFragmentManager(), "ageLimitDialog");
|
|
|
|
+ });
|
|
|
|
+
|
|
btnGetImageFromGallery.setOnClickListener(v -> {
|
|
btnGetImageFromGallery.setOnClickListener(v -> {
|
|
Intent intent = new Intent();
|
|
Intent intent = new Intent();
|
|
intent.setType("image/*");
|
|
intent.setType("image/*");
|
|
@@ -158,15 +167,12 @@ public class CreateEventFragment extends BaseFragmentClass implements BaseDialog
|
|
startActivityForResult(cameraIntent, CAMERA_REQUEST);
|
|
startActivityForResult(cameraIntent, CAMERA_REQUEST);
|
|
});
|
|
});
|
|
|
|
|
|
- saveButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onClick(View v) {
|
|
|
|
- FragmentManager fragmentManager = requireActivity().getSupportFragmentManager();
|
|
|
|
- FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
|
|
|
- CreateEventFragment myFragment = new CreateEventFragment();
|
|
|
|
- fragmentTransaction.replace(R.id.frameWindow, myFragment);
|
|
|
|
- fragmentTransaction.commit();
|
|
|
|
- }
|
|
|
|
|
|
+ saveButton.setOnClickListener(v -> {
|
|
|
|
+ FragmentManager fragmentManager = requireActivity().getSupportFragmentManager();
|
|
|
|
+ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
|
|
|
+ CreateEventFragment myFragment = new CreateEventFragment();
|
|
|
|
+ fragmentTransaction.replace(R.id.frameWindow, myFragment);
|
|
|
|
+ fragmentTransaction.commit();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -252,6 +258,9 @@ public class CreateEventFragment extends BaseFragmentClass implements BaseDialog
|
|
case "GenderBlock":
|
|
case "GenderBlock":
|
|
genderBlockText.setText(bundle.getString("Name"));
|
|
genderBlockText.setText(bundle.getString("Name"));
|
|
break;
|
|
break;
|
|
|
|
+ case "AgeLimitBlock":
|
|
|
|
+ ageLimitBlockText.setText(String.format("%s - %s", bundle.getFloat("LimitFrom"), bundle.getFloat("LimitTo")));
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|