Adds Edit Speed screen to the monster editor.
This commit is contained in:
@@ -80,12 +80,14 @@ public class EditMonsterFragment extends MCFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mHolder.basicInfoButton.setOnClickListener(v -> {
|
mHolder.basicInfoButton.setOnClickListener(v -> {
|
||||||
NavDirections action = EditMonsterFragmentDirections.actionEditMonsterFragmentToEditBasicInfoFragment();
|
NavDirections action = EditMonsterFragmentDirections.actionEditMonsterFragmentToEditBasicInfoFragment();
|
||||||
View view = getView();
|
View view = getView();
|
||||||
assert view != null;
|
assert view != null;
|
||||||
Navigation.findNavController(view).navigate(action);
|
Navigation.findNavController(view).navigate(action);
|
||||||
});
|
});
|
||||||
|
|
||||||
mHolder.armorButton.setOnClickListener(v -> {
|
mHolder.armorButton.setOnClickListener(v -> {
|
||||||
NavDirections action = EditMonsterFragmentDirections.actionEditMonsterFragmentToEditArmorFragment();
|
NavDirections action = EditMonsterFragmentDirections.actionEditMonsterFragmentToEditArmorFragment();
|
||||||
View view = getView();
|
View view = getView();
|
||||||
@@ -93,6 +95,13 @@ public class EditMonsterFragment extends MCFragment {
|
|||||||
Navigation.findNavController(view).navigate(action);
|
Navigation.findNavController(view).navigate(action);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mHolder.speedButton.setOnClickListener(v -> {
|
||||||
|
NavDirections action = EditMonsterFragmentDirections.actionEditMonsterFragmentToEditSpeedFragment();
|
||||||
|
View view = getView();
|
||||||
|
assert view != null;
|
||||||
|
Navigation.findNavController(view).navigate(action);
|
||||||
|
});
|
||||||
|
|
||||||
requireActivity().getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), new OnBackPressedCallback(true) {
|
requireActivity().getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), new OnBackPressedCallback(true) {
|
||||||
@Override
|
@Override
|
||||||
public void handleOnBackPressed() {
|
public void handleOnBackPressed() {
|
||||||
@@ -144,10 +153,12 @@ public class EditMonsterFragment extends MCFragment {
|
|||||||
|
|
||||||
TextView basicInfoButton;
|
TextView basicInfoButton;
|
||||||
TextView armorButton;
|
TextView armorButton;
|
||||||
|
TextView speedButton;
|
||||||
|
|
||||||
ViewHolder(View root) {
|
ViewHolder(View root) {
|
||||||
basicInfoButton = root.findViewById(R.id.basicInfo);
|
basicInfoButton = root.findViewById(R.id.basicInfo);
|
||||||
armorButton = root.findViewById(R.id.armor);
|
armorButton = root.findViewById(R.id.armor);
|
||||||
|
speedButton = root.findViewById(R.id.speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,10 +21,17 @@ public class EditMonsterViewModel extends ViewModel {
|
|||||||
private final MutableLiveData<Boolean> mHasChanges;
|
private final MutableLiveData<Boolean> mHasChanges;
|
||||||
private final MutableLiveData<Boolean> mHasCustomHitPoints;
|
private final MutableLiveData<Boolean> mHasCustomHitPoints;
|
||||||
private final MutableLiveData<Boolean> mHasShield;
|
private final MutableLiveData<Boolean> mHasShield;
|
||||||
|
private final MutableLiveData<Boolean> mCanHover;
|
||||||
|
private final MutableLiveData<Boolean> mHasCustomSpeed;
|
||||||
private final MutableLiveData<ArmorType> mArmorType;
|
private final MutableLiveData<ArmorType> mArmorType;
|
||||||
private final MutableLiveData<Integer> mHitDice;
|
private final MutableLiveData<Integer> mHitDice;
|
||||||
private final MutableLiveData<Integer> mNaturalArmorBonus;
|
private final MutableLiveData<Integer> mNaturalArmorBonus;
|
||||||
private final MutableLiveData<Integer> mShieldBonus;
|
private final MutableLiveData<Integer> mShieldBonus;
|
||||||
|
private final MutableLiveData<Integer> mWalkSpeed;
|
||||||
|
private final MutableLiveData<Integer> mBurrowSpeed;
|
||||||
|
private final MutableLiveData<Integer> mClimbSpeed;
|
||||||
|
private final MutableLiveData<Integer> mFlySpeed;
|
||||||
|
private final MutableLiveData<Integer> mSwimSpeed;
|
||||||
private final MutableLiveData<String> mName;
|
private final MutableLiveData<String> mName;
|
||||||
private final MutableLiveData<String> mErrorMessage;
|
private final MutableLiveData<String> mErrorMessage;
|
||||||
private final MutableLiveData<String> mSize;
|
private final MutableLiveData<String> mSize;
|
||||||
@@ -33,6 +40,7 @@ public class EditMonsterViewModel extends ViewModel {
|
|||||||
private final MutableLiveData<String> mAlignment;
|
private final MutableLiveData<String> mAlignment;
|
||||||
private final MutableLiveData<String> mCustomHitPoints;
|
private final MutableLiveData<String> mCustomHitPoints;
|
||||||
private final MutableLiveData<String> mCustomArmor;
|
private final MutableLiveData<String> mCustomArmor;
|
||||||
|
private final MutableLiveData<String> mCustomSpeed;
|
||||||
|
|
||||||
public EditMonsterViewModel() {
|
public EditMonsterViewModel() {
|
||||||
|
|
||||||
@@ -53,6 +61,14 @@ public class EditMonsterViewModel extends ViewModel {
|
|||||||
mHasShield = new MutableLiveData<>(false);
|
mHasShield = new MutableLiveData<>(false);
|
||||||
mShieldBonus = new MutableLiveData<>(0);
|
mShieldBonus = new MutableLiveData<>(0);
|
||||||
mCustomArmor = new MutableLiveData<>("");
|
mCustomArmor = new MutableLiveData<>("");
|
||||||
|
mWalkSpeed = new MutableLiveData<>(0);
|
||||||
|
mBurrowSpeed = new MutableLiveData<>(0);
|
||||||
|
mClimbSpeed = new MutableLiveData<>(0);
|
||||||
|
mFlySpeed = new MutableLiveData<>(0);
|
||||||
|
mSwimSpeed = new MutableLiveData<>(0);
|
||||||
|
mCanHover = new MutableLiveData<>(false);
|
||||||
|
mHasCustomSpeed = new MutableLiveData<>(false);
|
||||||
|
mCustomSpeed = new MutableLiveData<>("");
|
||||||
// TODO: consider initializing this to true so all new monsters need saving
|
// TODO: consider initializing this to true so all new monsters need saving
|
||||||
mHasChanges = new MutableLiveData<>(false);
|
mHasChanges = new MutableLiveData<>(false);
|
||||||
}
|
}
|
||||||
@@ -73,6 +89,15 @@ public class EditMonsterViewModel extends ViewModel {
|
|||||||
mHasShield.setValue(monster.shieldBonus != 0);
|
mHasShield.setValue(monster.shieldBonus != 0);
|
||||||
mShieldBonus.setValue(monster.shieldBonus);
|
mShieldBonus.setValue(monster.shieldBonus);
|
||||||
mCustomArmor.setValue(monster.otherArmorDescription);
|
mCustomArmor.setValue(monster.otherArmorDescription);
|
||||||
|
mWalkSpeed.setValue(monster.walkSpeed);
|
||||||
|
mBurrowSpeed.setValue(monster.burrowSpeed);
|
||||||
|
mClimbSpeed.setValue(monster.climbSpeed);
|
||||||
|
mFlySpeed.setValue(monster.flySpeed);
|
||||||
|
mSwimSpeed.setValue(monster.swimSpeed);
|
||||||
|
mCanHover.setValue(monster.canHover);
|
||||||
|
mHasCustomSpeed.setValue(monster.hasCustomSpeed);
|
||||||
|
mCustomSpeed.setValue(monster.customSpeedDescription);
|
||||||
|
|
||||||
mHasChanges.setValue(false);
|
mHasChanges.setValue(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,6 +322,136 @@ public class EditMonsterViewModel extends ViewModel {
|
|||||||
return mShieldBonus.getValue().toString();
|
return mShieldBonus.getValue().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<Integer> getWalkSpeed() {
|
||||||
|
return mWalkSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWalkSpeed(int walkSpeed) {
|
||||||
|
if (!Objects.equals(mWalkSpeed.getValue(), walkSpeed)) {
|
||||||
|
mWalkSpeed.setValue(walkSpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
Logger.logDebug(String.format("Setting walk speed to %d ft.", walkSpeed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementWalkSpeed() {
|
||||||
|
setWalkSpeed(mWalkSpeed.getValue() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementWalkSpeed() {
|
||||||
|
setWalkSpeed(mWalkSpeed.getValue() - 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Integer> getBurrowSpeed() {
|
||||||
|
return mBurrowSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBurrowSpeed(int burrowSpeed) {
|
||||||
|
if (!Objects.equals(mBurrowSpeed.getValue(), burrowSpeed)) {
|
||||||
|
mBurrowSpeed.setValue(burrowSpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Integer> getClimbSpeed() {
|
||||||
|
return mClimbSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClimbSpeed(int climbSpeed) {
|
||||||
|
if (!Objects.equals(mClimbSpeed.getValue(), climbSpeed)) {
|
||||||
|
mClimbSpeed.setValue(climbSpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Integer> getFlySpeed() {
|
||||||
|
return mFlySpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlySpeed(int flySpeed) {
|
||||||
|
if (!Objects.equals(mFlySpeed.getValue(), flySpeed)) {
|
||||||
|
mFlySpeed.setValue(flySpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Integer> getSwimSpeed() {
|
||||||
|
return mSwimSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSwimSpeed(int swimSpeed) {
|
||||||
|
if (!Objects.equals(mSwimSpeed.getValue(), swimSpeed)) {
|
||||||
|
mSwimSpeed.setValue(swimSpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Boolean> getCanHover() {
|
||||||
|
return mCanHover;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanHover(boolean canHover) {
|
||||||
|
if (!Objects.equals(mCanHover.getValue(), canHover)) {
|
||||||
|
mCanHover.setValue(canHover);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Boolean> getHasCustomSpeed() {
|
||||||
|
return mHasCustomSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCustomSpeed(boolean hasCustomSpeed) {
|
||||||
|
if (!Objects.equals(mHasCustomSpeed.getValue(), hasCustomSpeed)) {
|
||||||
|
mHasCustomSpeed.setValue(hasCustomSpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<String> getCustomSpeed() {
|
||||||
|
return mCustomSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomSpeed(String customSpeed) {
|
||||||
|
if (!Objects.equals(mCustomSpeed.getValue(), customSpeed)) {
|
||||||
|
mCustomSpeed.setValue(customSpeed);
|
||||||
|
mHasChanges.setValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementBurrowSpeed() {
|
||||||
|
setBurrowSpeed(mBurrowSpeed.getValue() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementBurrowSpeed() {
|
||||||
|
setBurrowSpeed(mBurrowSpeed.getValue() - 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementClimbSpeed() {
|
||||||
|
setClimbSpeed(mClimbSpeed.getValue() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementClimbSpeed() {
|
||||||
|
setClimbSpeed(mClimbSpeed.getValue() - 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementFlySpeed() {
|
||||||
|
setFlySpeed(mFlySpeed.getValue() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementFlySpeed() {
|
||||||
|
setFlySpeed(mFlySpeed.getValue() - 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementSwimSpeed() {
|
||||||
|
setSwimSpeed(mSwimSpeed.getValue() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decrementSwimSpeed() {
|
||||||
|
setSwimSpeed(mSwimSpeed.getValue() - 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Monster buildMonster() {
|
public Monster buildMonster() {
|
||||||
Monster monster = new Monster();
|
Monster monster = new Monster();
|
||||||
|
|
||||||
@@ -313,6 +468,14 @@ public class EditMonsterViewModel extends ViewModel {
|
|||||||
monster.naturalArmorBonus = mNaturalArmorBonus.getValue();
|
monster.naturalArmorBonus = mNaturalArmorBonus.getValue();
|
||||||
monster.shieldBonus = mShieldBonus.getValue();
|
monster.shieldBonus = mShieldBonus.getValue();
|
||||||
monster.otherArmorDescription = mCustomArmor.getValue();
|
monster.otherArmorDescription = mCustomArmor.getValue();
|
||||||
|
monster.walkSpeed = mWalkSpeed.getValue();
|
||||||
|
monster.burrowSpeed = mBurrowSpeed.getValue();
|
||||||
|
monster.climbSpeed = mClimbSpeed.getValue();
|
||||||
|
monster.flySpeed = mFlySpeed.getValue();
|
||||||
|
monster.swimSpeed = mSwimSpeed.getValue();
|
||||||
|
monster.canHover = mCanHover.getValue();
|
||||||
|
monster.hasCustomSpeed = mHasCustomSpeed.getValue();
|
||||||
|
monster.customSpeedDescription = mCustomSpeed.getValue();
|
||||||
|
|
||||||
return monster;
|
return monster;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.majinnaibu.monstercards.ui.editmonster;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.navigation.NavBackStackEntry;
|
||||||
|
import androidx.navigation.NavController;
|
||||||
|
import androidx.navigation.Navigation;
|
||||||
|
|
||||||
|
import com.majinnaibu.monstercards.R;
|
||||||
|
import com.majinnaibu.monstercards.utils.TextChangedListener;
|
||||||
|
|
||||||
|
public class EditSpeedFragment extends Fragment {
|
||||||
|
private EditMonsterViewModel mViewModel;
|
||||||
|
private ViewHolder mHolder;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
NavController navController = Navigation.findNavController(requireActivity(), R.id.nav_host_fragment);
|
||||||
|
NavBackStackEntry backStackEntry = navController.getBackStackEntry(R.id.edit_monster_navigation);
|
||||||
|
mViewModel = new ViewModelProvider(backStackEntry).get(EditMonsterViewModel.class);
|
||||||
|
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View root = inflater.inflate(R.layout.fragment_edit_speed, container, false);
|
||||||
|
|
||||||
|
mHolder = new ViewHolder(root);
|
||||||
|
|
||||||
|
mViewModel.getWalkSpeed().observe(getViewLifecycleOwner(), value -> {
|
||||||
|
mHolder.baseSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value));
|
||||||
|
});
|
||||||
|
mHolder.incrementBaseSpeed.setOnClickListener(v -> mViewModel.incrementWalkSpeed());
|
||||||
|
mHolder.decrementBaseSpeed.setOnClickListener(v -> mViewModel.decrementWalkSpeed());
|
||||||
|
|
||||||
|
mViewModel.getBurrowSpeed().observe(getViewLifecycleOwner(), value -> {
|
||||||
|
mHolder.burrowSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value));
|
||||||
|
});
|
||||||
|
mHolder.incrementBurrowSpeed.setOnClickListener(v -> mViewModel.incrementBurrowSpeed());
|
||||||
|
mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementBurrowSpeed());
|
||||||
|
|
||||||
|
mViewModel.getClimbSpeed().observe(getViewLifecycleOwner(), value -> mHolder.climbSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value)));
|
||||||
|
mHolder.incrementClimbSpeed.setOnClickListener(v -> mViewModel.incrementClimbSpeed());
|
||||||
|
mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementClimbSpeed());
|
||||||
|
|
||||||
|
mViewModel.getFlySpeed().observe(getViewLifecycleOwner(), value -> mHolder.flySpeed.setText(String.format(getString(R.string.format_distance_in_feet), value)));
|
||||||
|
mHolder.incrementFlySpeed.setOnClickListener(v -> mViewModel.incrementFlySpeed());
|
||||||
|
mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementFlySpeed());
|
||||||
|
|
||||||
|
mViewModel.getSwimSpeed().observe(getViewLifecycleOwner(), value -> mHolder.swimSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value)));
|
||||||
|
mHolder.incrementSwimSpeed.setOnClickListener(v -> mViewModel.incrementSwimSpeed());
|
||||||
|
mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementSwimSpeed());
|
||||||
|
|
||||||
|
mViewModel.getCanHover().observe(getViewLifecycleOwner(), value -> mHolder.canHover.setChecked(value));
|
||||||
|
mHolder.canHover.setOnCheckedChangeListener((buttonView, isChecked) -> mViewModel.setCanHover(isChecked));
|
||||||
|
|
||||||
|
mViewModel.getHasCustomSpeed().observe(getViewLifecycleOwner(), value -> mHolder.hasCustomSpeed.setChecked(value));
|
||||||
|
mHolder.hasCustomSpeed.setOnCheckedChangeListener((buttonView, isChecked) -> mViewModel.setHasCustomSpeed(isChecked));
|
||||||
|
|
||||||
|
//mViewModel.getCustomSpeed().observe(getViewLifecycleOwner(), value -> mHolder.customSpeed.setText(value));
|
||||||
|
mHolder.customSpeed.setText(mViewModel.getCustomSpeed().getValue());
|
||||||
|
mHolder.customSpeed.addTextChangedListener(new TextChangedListener((TextChangedListener.OnTextChangedCallback) (s, start, before, count) -> mViewModel.setCustomSpeed(s.toString())));
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ViewHolder {
|
||||||
|
|
||||||
|
final TextView baseSpeed;
|
||||||
|
final Button incrementBaseSpeed;
|
||||||
|
final Button decrementBaseSpeed;
|
||||||
|
final TextView burrowSpeed;
|
||||||
|
final Button incrementBurrowSpeed;
|
||||||
|
final Button decrementBurrowSpeed;
|
||||||
|
final TextView climbSpeed;
|
||||||
|
final Button incrementClimbSpeed;
|
||||||
|
final Button decrementClimbSpeed;
|
||||||
|
final TextView flySpeed;
|
||||||
|
final Button incrementFlySpeed;
|
||||||
|
final Button decrementFlySpeed;
|
||||||
|
final TextView swimSpeed;
|
||||||
|
final Button incrementSwimSpeed;
|
||||||
|
final Button decrementSwimSpeed;
|
||||||
|
final SwitchCompat canHover;
|
||||||
|
final SwitchCompat hasCustomSpeed;
|
||||||
|
final EditText customSpeed;
|
||||||
|
|
||||||
|
ViewHolder(View root) {
|
||||||
|
baseSpeed = root.findViewById(R.id.baseSpeed);
|
||||||
|
incrementBaseSpeed = root.findViewById(R.id.baseSpeed_increment);
|
||||||
|
decrementBaseSpeed = root.findViewById(R.id.baseSpeed_decrement);
|
||||||
|
burrowSpeed = root.findViewById(R.id.burrowSpeed);
|
||||||
|
incrementBurrowSpeed = root.findViewById(R.id.burrowSpeed_increment);
|
||||||
|
decrementBurrowSpeed = root.findViewById(R.id.burrowSpeed_decrement);
|
||||||
|
climbSpeed = root.findViewById(R.id.climbSpeed);
|
||||||
|
incrementClimbSpeed = root.findViewById(R.id.climbSpeed_increment);
|
||||||
|
decrementClimbSpeed = root.findViewById(R.id.climbSpeed_decrement);
|
||||||
|
flySpeed = root.findViewById(R.id.flySpeed);
|
||||||
|
incrementFlySpeed = root.findViewById(R.id.flySpeed_increment);
|
||||||
|
decrementFlySpeed = root.findViewById(R.id.flySpeed_decrement);
|
||||||
|
swimSpeed = root.findViewById(R.id.swimSpeed);
|
||||||
|
incrementSwimSpeed = root.findViewById(R.id.swimSpeed_increment);
|
||||||
|
decrementSwimSpeed = root.findViewById(R.id.swimSpeed_decrement);
|
||||||
|
canHover = root.findViewById(R.id.canHover);
|
||||||
|
hasCustomSpeed = root.findViewById(R.id.hasCustomSpeed);
|
||||||
|
customSpeed = root.findViewById(R.id.customSpeed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
255
app/src/main/res/layout/fragment_edit_speed.xml
Normal file
255
app/src/main/res/layout/fragment_edit_speed.xml
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.editmonster.EditBasicInfoFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/baseSpeed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="20 ft." />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_base_speed"
|
||||||
|
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/baseSpeed_decrement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_decrement_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/baseSpeed_increment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/baseSpeed_increment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_increment_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/burrowSpeed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="20 ft." />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_burrow_speed"
|
||||||
|
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/burrowSpeed_decrement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_decrement_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/burrowSpeed_increment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/burrowSpeed_increment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_increment_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/climbSpeed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="20 ft." />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_climb_speed"
|
||||||
|
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/climbSpeed_decrement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_decrement_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/climbSpeed_increment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/climbSpeed_increment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_increment_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/flySpeed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="20 ft." />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="Fly Speed" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/flySpeed_decrement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_decrement_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/flySpeed_increment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/flySpeed_increment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_increment_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/swimSpeed"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="20 ft." />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?attr/textAppearanceSubtitle1"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="Swim Speed" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/swimSpeed_decrement"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_decrement_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/swimSpeed_increment"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/swimSpeed_increment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_increment_field"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
android:id="@+id/canHover"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin"
|
||||||
|
android:text="@string/label_can_hover"
|
||||||
|
android:textSize="@dimen/text_h4_size" />
|
||||||
|
|
||||||
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
android:id="@+id/hasCustomSpeed"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin"
|
||||||
|
android:text="@string/label_has_custom_speed"
|
||||||
|
android:textSize="@dimen/text_h4_size" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/text_margin">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/customSpeed"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/label_custom_speed"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="text"
|
||||||
|
tools:text="John Doe" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
@@ -78,6 +78,9 @@
|
|||||||
<action
|
<action
|
||||||
android:id="@+id/action_editMonsterFragment_to_editArmorFragment"
|
android:id="@+id/action_editMonsterFragment_to_editArmorFragment"
|
||||||
app:destination="@id/editArmorFragment" />
|
app:destination="@id/editArmorFragment" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_editMonsterFragment_to_editSpeedFragment"
|
||||||
|
app:destination="@id/editSpeedFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/editBasicInfoFragment"
|
android:id="@+id/editBasicInfoFragment"
|
||||||
@@ -89,6 +92,11 @@
|
|||||||
android:name="com.majinnaibu.monstercards.ui.editmonster.EditArmorFragment"
|
android:name="com.majinnaibu.monstercards.ui.editmonster.EditArmorFragment"
|
||||||
android:label="fragment_edit_armor"
|
android:label="fragment_edit_armor"
|
||||||
tools:layout="@layout/fragment_edit_armor" />
|
tools:layout="@layout/fragment_edit_armor" />
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/editSpeedFragment"
|
||||||
|
android:name="com.majinnaibu.monstercards.ui.editmonster.EditSpeedFragment"
|
||||||
|
android:label="fragment_edit_speed"
|
||||||
|
tools:layout="@layout/fragment_edit_speed" />
|
||||||
</navigation>
|
</navigation>
|
||||||
|
|
||||||
</navigation>
|
</navigation>
|
||||||
@@ -7,23 +7,32 @@
|
|||||||
<string name="constitution_abbreviation">CON</string>
|
<string name="constitution_abbreviation">CON</string>
|
||||||
<string name="default_monster_name">Unnamed Monster</string>
|
<string name="default_monster_name">Unnamed Monster</string>
|
||||||
<string name="dexterity_abbreviation">DEX</string>
|
<string name="dexterity_abbreviation">DEX</string>
|
||||||
|
<string name="format_distance_in_feet">%d ft.</string>
|
||||||
<string name="intelligence_abbreviation">INT</string>
|
<string name="intelligence_abbreviation">INT</string>
|
||||||
<string name="label_ability_scores">Ability Scores</string>
|
<string name="label_ability_scores">Ability Scores</string>
|
||||||
<string name="label_abilities">Abilities</string>
|
<string name="label_abilities">Abilities</string>
|
||||||
<string name="label_actions">Actions</string>
|
<string name="label_actions">Actions</string>
|
||||||
<string name="label_alignment">Alignment</string>
|
<string name="label_alignment">Alignment</string>
|
||||||
<string name="label_armor">Armor</string>
|
<string name="label_armor">Armor</string>
|
||||||
|
<string name="label_base_speed">Base Speed</string>
|
||||||
<string name="label_basic_info">Basic Info</string>
|
<string name="label_basic_info">Basic Info</string>
|
||||||
|
<string name="label_burrow_speed">Burrow Speed</string>
|
||||||
|
<string name="label_can_hover">Can Hover</string>
|
||||||
<string name="label_challenge_rating">Challenge Rating</string>
|
<string name="label_challenge_rating">Challenge Rating</string>
|
||||||
|
<string name="label_climb_speed">Climb Speed</string>
|
||||||
<string name="label_condition_immunities">Condition Immunities</string>
|
<string name="label_condition_immunities">Condition Immunities</string>
|
||||||
<string name="label_custom_armor">Custom Armor</string>
|
<string name="label_custom_armor">Custom Armor</string>
|
||||||
<string name="label_custom_hp">Custom HP</string>
|
<string name="label_custom_hp">Custom HP</string>
|
||||||
|
<string name="label_custom_speed">Custom Speed</string>
|
||||||
<string name="label_damage_immunities">Damage Immunities</string>
|
<string name="label_damage_immunities">Damage Immunities</string>
|
||||||
<string name="label_damage_resistances">Damage Resistances</string>
|
<string name="label_damage_resistances">Damage Resistances</string>
|
||||||
<string name="label_damage_vulnerabilities">Damage Vulnerabilities</string>
|
<string name="label_damage_vulnerabilities">Damage Vulnerabilities</string>
|
||||||
|
<string name="label_decrement_field">-</string>
|
||||||
<string name="label_has_custom_hp">Has Custom HP</string>
|
<string name="label_has_custom_hp">Has Custom HP</string>
|
||||||
|
<string name="label_has_custom_speed">Has Custom Speed</string>
|
||||||
<string name="label_has_a_shield">Has a Shield</string>
|
<string name="label_has_a_shield">Has a Shield</string>
|
||||||
<string name="label_hit_dice">Hit Dice</string>
|
<string name="label_hit_dice">Hit Dice</string>
|
||||||
|
<string name="label_increment_field">+</string>
|
||||||
<string name="label_lair_actions">Lair Actions</string>
|
<string name="label_lair_actions">Lair Actions</string>
|
||||||
<string name="label_languages">Languages</string>
|
<string name="label_languages">Languages</string>
|
||||||
<string name="label_legendary_actions">Legendary Actions</string>
|
<string name="label_legendary_actions">Legendary Actions</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user