Adds screen to edit ability scores.

This commit is contained in:
2021-05-30 01:55:45 -07:00
committed by Tom Hicks
parent ab5a3c7c67
commit 611fa6c323
6 changed files with 464 additions and 89 deletions

View File

@@ -4,79 +4,99 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.NavBackStackEntry; import androidx.navigation.NavBackStackEntry;
import androidx.navigation.NavController; import androidx.navigation.NavController;
import androidx.navigation.Navigation; import androidx.navigation.Navigation;
import com.majinnaibu.monstercards.R; import com.majinnaibu.monstercards.R;
import com.majinnaibu.monstercards.ui.components.Stepper;
import com.majinnaibu.monstercards.ui.shared.MCFragment;
import java.util.Locale; public class EditAbilityScoresFragment extends Fragment {
public class EditAbilityScoresFragment extends MCFragment {
private final String ABILITY_SCORE_FORMAT = "%d (%+d)";
private EditMonsterViewModel mViewModel; private EditMonsterViewModel mViewModel;
private ViewHolder mHolder; private ViewHolder mHolder;
private int getModifier(int value) {
return value / 2 - 5;
}
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
NavController navController = Navigation.findNavController(requireActivity(), R.id.nav_host_fragment); NavController navController = Navigation.findNavController(requireActivity(), R.id.nav_host_fragment);
NavBackStackEntry backStackEntry = navController.getBackStackEntry(R.id.edit_monster_navigation); NavBackStackEntry backStackEntry = navController.getBackStackEntry(R.id.edit_monster_navigation);
mViewModel = new ViewModelProvider(backStackEntry).get(EditMonsterViewModel.class); mViewModel = new ViewModelProvider(backStackEntry).get(EditMonsterViewModel.class);
// Inflate the layout for this fragment
View root = inflater.inflate(R.layout.fragment_edit_ability_scores, container, false); View root = inflater.inflate(R.layout.fragment_edit_ability_scores, container, false);
mHolder = new ViewHolder(root); mHolder = new ViewHolder(root);
mViewModel.getStrength().observe(getViewLifecycleOwner(), value -> mHolder.strength.setValue(value)); mViewModel.getStrength().observe(getViewLifecycleOwner(), value -> mHolder.strength.setText(String.valueOf(value)));
mHolder.strength.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setStrength(newValue)); mHolder.increaseStrength.setOnClickListener(v -> mViewModel.incrementStrength());
mHolder.strength.setOnFormatValueCallback(value -> String.format(Locale.getDefault(), ABILITY_SCORE_FORMAT, value, getModifier(value))); mHolder.decreaseStrength.setOnClickListener(v -> mViewModel.decrementStrength());
mViewModel.getDexterity().observe(getViewLifecycleOwner(), value -> mHolder.dexterity.setValue(value)); mViewModel.getDexterity().observe(getViewLifecycleOwner(), value -> mHolder.dexterity.setText(String.valueOf(value)));
mHolder.dexterity.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setDexterity(newValue)); mHolder.increaseDexterity.setOnClickListener(v -> mViewModel.incrementDexterity());
mHolder.dexterity.setOnFormatValueCallback(value -> String.format(Locale.getDefault(), ABILITY_SCORE_FORMAT, value, getModifier(value))); mHolder.decreaseDexterity.setOnClickListener(v -> mViewModel.decrementDexterity());
mViewModel.getConstitution().observe(getViewLifecycleOwner(), value -> mHolder.constitution.setValue(value)); mViewModel.getConstitution().observe(getViewLifecycleOwner(), value -> mHolder.constitution.setText(String.valueOf(value)));
mHolder.constitution.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setConstitution(newValue)); mHolder.increaseConstitution.setOnClickListener(v -> mViewModel.incrementConstitution());
mHolder.constitution.setOnFormatValueCallback(value -> String.format(Locale.getDefault(), ABILITY_SCORE_FORMAT, value, getModifier(value))); mHolder.decreaseConstitution.setOnClickListener(v -> mViewModel.decrementConstitution());
mViewModel.getIntelligence().observe(getViewLifecycleOwner(), value -> mHolder.intelligence.setValue(value)); mViewModel.getIntelligence().observe(getViewLifecycleOwner(), value -> mHolder.intelligence.setText(String.valueOf(value)));
mHolder.intelligence.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setIntelligence(newValue)); mHolder.increaseIntelligence.setOnClickListener(v -> mViewModel.incrementIntelligence());
mHolder.intelligence.setOnFormatValueCallback(value -> String.format(Locale.getDefault(), ABILITY_SCORE_FORMAT, value, getModifier(value))); mHolder.decreaseIntelligence.setOnClickListener(v -> mViewModel.decrementIntelligence());
mViewModel.getWisdom().observe(getViewLifecycleOwner(), value -> mHolder.wisdom.setValue(value)); mViewModel.getWisdom().observe(getViewLifecycleOwner(), value -> mHolder.wisdom.setText(String.valueOf(value)));
mHolder.wisdom.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setWisdom(newValue)); mHolder.increaseWisdom.setOnClickListener(v -> mViewModel.incrementWisdom());
mHolder.wisdom.setOnFormatValueCallback(value -> String.format(Locale.getDefault(), ABILITY_SCORE_FORMAT, value, getModifier(value))); mHolder.decreaseWisdom.setOnClickListener(v -> mViewModel.decrementWisdom());
mViewModel.getCharisma().observe(getViewLifecycleOwner(), value -> mHolder.charisma.setValue(value)); mViewModel.getCharisma().observe(getViewLifecycleOwner(), value -> mHolder.charisma.setText(String.valueOf(value)));
mHolder.charisma.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setCharisma(newValue)); mHolder.increaseCharisma.setOnClickListener(v -> mViewModel.incrementCharisma());
mHolder.charisma.setOnFormatValueCallback(value -> String.format(Locale.getDefault(), ABILITY_SCORE_FORMAT, value, getModifier(value))); mHolder.decreaseCharisma.setOnClickListener(v -> mViewModel.decrementCharisma());
return root; return root;
} }
private static class ViewHolder { private static class ViewHolder {
final Stepper strength; TextView strength;
final Stepper dexterity; Button decreaseStrength;
final Stepper constitution; Button increaseStrength;
final Stepper intelligence; TextView dexterity;
final Stepper wisdom; Button increaseDexterity;
final Stepper charisma; Button decreaseDexterity;
TextView constitution;
Button increaseConstitution;
Button decreaseConstitution;
TextView intelligence;
Button increaseIntelligence;
Button decreaseIntelligence;
TextView wisdom;
Button increaseWisdom;
Button decreaseWisdom;
TextView charisma;
Button increaseCharisma;
Button decreaseCharisma;
ViewHolder(@NonNull View root) { ViewHolder(View root) {
strength = root.findViewById(R.id.strength); strength = root.findViewById(R.id.strength);
increaseStrength = root.findViewById(R.id.strength_increment);
decreaseStrength = root.findViewById(R.id.strength_decrement);
dexterity = root.findViewById(R.id.dexterity); dexterity = root.findViewById(R.id.dexterity);
increaseDexterity = root.findViewById(R.id.dexterity_increment);
decreaseDexterity = root.findViewById(R.id.dexterity_decrement);
constitution = root.findViewById(R.id.constitution); constitution = root.findViewById(R.id.constitution);
increaseConstitution = root.findViewById(R.id.constitution_increment);
decreaseConstitution = root.findViewById(R.id.constitution_decrement);
intelligence = root.findViewById(R.id.intelligence); intelligence = root.findViewById(R.id.intelligence);
increaseIntelligence = root.findViewById(R.id.intelligence_increment);
decreaseIntelligence = root.findViewById(R.id.intelligence_decrement);
wisdom = root.findViewById(R.id.wisdom); wisdom = root.findViewById(R.id.wisdom);
increaseWisdom = root.findViewById(R.id.wisdom_increment);
decreaseWisdom = root.findViewById(R.id.wisdom_decrement);
charisma = root.findViewById(R.id.charisma); charisma = root.findViewById(R.id.charisma);
increaseCharisma = root.findViewById(R.id.charisma_increment);
decreaseCharisma = root.findViewById(R.id.charisma_decrement);
} }
} }
} }

View File

@@ -102,6 +102,13 @@ public class EditMonsterFragment extends MCFragment {
Navigation.findNavController(view).navigate(action); Navigation.findNavController(view).navigate(action);
}); });
mHolder.abilityScoresButton.setOnClickListener(v -> {
NavDirections action = EditMonsterFragmentDirections.actionEditMonsterFragmentToEditAbilityScoresFragment();
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() {
@@ -154,11 +161,13 @@ public class EditMonsterFragment extends MCFragment {
TextView basicInfoButton; TextView basicInfoButton;
TextView armorButton; TextView armorButton;
TextView speedButton; TextView speedButton;
TextView abilityScoresButton;
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); speedButton = root.findViewById(R.id.speed);
abilityScoresButton = root.findViewById(R.id.abilityScores);
} }
} }
} }

View File

@@ -32,6 +32,12 @@ public class EditMonsterViewModel extends ViewModel {
private final MutableLiveData<Integer> mClimbSpeed; private final MutableLiveData<Integer> mClimbSpeed;
private final MutableLiveData<Integer> mFlySpeed; private final MutableLiveData<Integer> mFlySpeed;
private final MutableLiveData<Integer> mSwimSpeed; private final MutableLiveData<Integer> mSwimSpeed;
private final MutableLiveData<Integer> mStrength;
private final MutableLiveData<Integer> mDexterity;
private final MutableLiveData<Integer> mConstitution;
private final MutableLiveData<Integer> mIntelligence;
private final MutableLiveData<Integer> mWisdom;
private final MutableLiveData<Integer> mCharisma;
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;
@@ -69,6 +75,13 @@ public class EditMonsterViewModel extends ViewModel {
mCanHover = new MutableLiveData<>(false); mCanHover = new MutableLiveData<>(false);
mHasCustomSpeed = new MutableLiveData<>(false); mHasCustomSpeed = new MutableLiveData<>(false);
mCustomSpeed = new MutableLiveData<>(""); mCustomSpeed = new MutableLiveData<>("");
mStrength = new MutableLiveData<>(10);
mDexterity = new MutableLiveData<>(10);
mConstitution = new MutableLiveData<>(10);
mIntelligence = new MutableLiveData<>(10);
mWisdom = new MutableLiveData<>(10);
mCharisma = new MutableLiveData<>(10);
// 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);
} }
@@ -97,6 +110,12 @@ public class EditMonsterViewModel extends ViewModel {
mCanHover.setValue(monster.canHover); mCanHover.setValue(monster.canHover);
mHasCustomSpeed.setValue(monster.hasCustomSpeed); mHasCustomSpeed.setValue(monster.hasCustomSpeed);
mCustomSpeed.setValue(monster.customSpeedDescription); mCustomSpeed.setValue(monster.customSpeedDescription);
mStrength.setValue(monster.strengthScore);
mDexterity.setValue(monster.dexterityScore);
mConstitution.setValue(monster.constitutionScore);
mIntelligence.setValue(monster.intelligenceScore);
mWisdom.setValue(monster.wisdomScore);
mCharisma.setValue(monster.charismaScore);
mHasChanges.setValue(false); mHasChanges.setValue(false);
} }
@@ -330,7 +349,6 @@ public class EditMonsterViewModel extends ViewModel {
if (!Objects.equals(mWalkSpeed.getValue(), walkSpeed)) { if (!Objects.equals(mWalkSpeed.getValue(), walkSpeed)) {
mWalkSpeed.setValue(walkSpeed); mWalkSpeed.setValue(walkSpeed);
mHasChanges.setValue(true); mHasChanges.setValue(true);
Logger.logDebug(String.format("Setting walk speed to %d ft.", walkSpeed));
} }
} }
@@ -451,6 +469,119 @@ public class EditMonsterViewModel extends ViewModel {
setSwimSpeed(mSwimSpeed.getValue() - 5); setSwimSpeed(mSwimSpeed.getValue() - 5);
} }
public LiveData<Integer> getStrength() {
return mStrength;
}
public void setStrength(int strength) {
if (!Objects.equals(mStrength.getValue(), strength)) {
mStrength.setValue(strength);
mHasChanges.setValue(true);
}
}
public void incrementStrength() {
setStrength(mStrength.getValue() + 1);
}
public void decrementStrength() {
setStrength(mStrength.getValue() - 1);
}
public LiveData<Integer> getDexterity() {
return mDexterity;
}
public void setDexterity(int dexterity) {
if (!Objects.equals(mDexterity.getValue(), dexterity)) {
mDexterity.setValue(dexterity);
mHasChanges.setValue(true);
}
}
public void incrementDexterity() {
setDexterity(mDexterity.getValue() + 1);
}
public void decrementDexterity() {
setDexterity(mDexterity.getValue() - 1);
}
public LiveData<Integer> getConstitution() {
return mConstitution;
}
public void setConstitution(int constitution) {
if (!Objects.equals(mConstitution.getValue(), constitution)) {
mConstitution.setValue(constitution);
mHasChanges.setValue(true);
}
}
public void incrementConstitution() {
setConstitution(mConstitution.getValue() + 1);
}
public void decrementConstitution() {
setConstitution(mConstitution.getValue() - 1);
}
public LiveData<Integer> getIntelligence() {
return mIntelligence;
}
public void setIntelligence(int intelligence) {
if (!Objects.equals(mIntelligence.getValue(), intelligence)) {
mIntelligence.setValue(intelligence);
mHasChanges.setValue(true);
}
}
public void incrementIntelligence() {
setIntelligence(mIntelligence.getValue() + 1);
}
public void decrementIntelligence() {
setIntelligence(mIntelligence.getValue() - 1);
}
public LiveData<Integer> getWisdom() {
return mWisdom;
}
public void setWisdom(int wisdom) {
if (!Objects.equals(mWisdom.getValue(), wisdom)) {
mWisdom.setValue(wisdom);
mHasChanges.setValue(true);
}
}
public void incrementWisdom() {
setWisdom(mWisdom.getValue() + 1);
}
public void decrementWisdom() {
setWisdom(mWisdom.getValue() - 1);
}
public LiveData<Integer> getCharisma() {
return mCharisma;
}
public void setCharisma(int charisma) {
if (!Objects.equals(mCharisma.getValue(), charisma)) {
mCharisma.setValue(charisma);
mHasChanges.setValue(true);
}
}
public void incrementCharisma() {
setCharisma(mCharisma.getValue() + 1);
}
public void decrementCharisma() {
setCharisma(mCharisma.getValue() - 1);
}
public Monster buildMonster() { public Monster buildMonster() {
Monster monster = new Monster(); Monster monster = new Monster();
@@ -476,6 +607,12 @@ public class EditMonsterViewModel extends ViewModel {
monster.canHover = mCanHover.getValue(); monster.canHover = mCanHover.getValue();
monster.hasCustomSpeed = mHasCustomSpeed.getValue(); monster.hasCustomSpeed = mHasCustomSpeed.getValue();
monster.customSpeedDescription = mCustomSpeed.getValue(); monster.customSpeedDescription = mCustomSpeed.getValue();
monster.strengthScore = mStrength.getValue();
monster.dexterityScore = mDexterity.getValue();
monster.constitutionScore = mConstitution.getValue();
monster.intelligenceScore = mIntelligence.getValue();
monster.wisdomScore = mWisdom.getValue();
monster.charismaScore = mCharisma.getValue();
return monster; return monster;
} }

View File

@@ -11,64 +11,259 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.majinnaibu.monstercards.ui.components.Stepper <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/strength"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:layout_margin="@dimen/text_margin">
app:label="@string/label_strength"
app:maxValue="99"
app:minValue="1"
app:stepAmount="1" />
<com.majinnaibu.monstercards.ui.components.Stepper <TextView
android:id="@+id/dexterity" android:id="@+id/strength"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" app:layout_constraintBottom_toBottomOf="parent"
app:label="@string/label_dexterity" app:layout_constraintStart_toStartOf="parent"
app:maxValue="99" app:layout_constraintTop_toTopOf="parent"
app:minValue="1" tools:text="20 ft." />
app:stepAmount="1" />
<com.majinnaibu.monstercards.ui.components.Stepper <TextView
android:id="@+id/constitution" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:text="@string/label_strength"
android:layout_margin="@dimen/text_margin" android:textAppearance="?attr/textAppearanceSubtitle1"
app:label="@string/label_constitution" app:layout_constraintStart_toStartOf="parent"
app:maxValue="99" app:layout_constraintTop_toTopOf="parent" />
app:minValue="1"
app:stepAmount="1" />
<com.majinnaibu.monstercards.ui.components.Stepper <Button
android:id="@+id/intelligence" android:id="@+id/strength_decrement"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:text="@string/label_decrement_field"
app:label="@string/label_intelligence" app:layout_constraintBottom_toBottomOf="parent"
app:maxValue="99" app:layout_constraintEnd_toStartOf="@id/strength_increment"
app:minValue="1" app:layout_constraintTop_toTopOf="parent" />
app:stepAmount="1" />
<com.majinnaibu.monstercards.ui.components.Stepper <Button
android:id="@+id/wisdom" android:id="@+id/strength_increment"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:text="@string/label_increment_field"
app:label="@string/label_wisdom" app:layout_constraintBottom_toBottomOf="parent"
app:maxValue="99" app:layout_constraintEnd_toEndOf="parent"
app:minValue="1" app:layout_constraintTop_toTopOf="parent" />
app:stepAmount="1" />
<com.majinnaibu.monstercards.ui.components.Stepper </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/charisma"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin" android:layout_margin="@dimen/text_margin">
app:label="@string/label_charisma"
app:maxValue="99" <TextView
app:minValue="1" android:id="@+id/dexterity"
app:stepAmount="1" /> 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_dexterity"
android:textAppearance="?attr/textAppearanceSubtitle1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/dexterity_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/dexterity_increment"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/dexterity_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/constitution"
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_constitution"
android:textAppearance="?attr/textAppearanceSubtitle1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/constitution_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/constitution_increment"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/constitution_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/intelligence"
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_intelligence"
android:textAppearance="?attr/textAppearanceSubtitle1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/intelligence_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/intelligence_increment"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/intelligence_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/wisdom"
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_wisdom"
android:textAppearance="?attr/textAppearanceSubtitle1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/wisdom_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/wisdom_increment"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/wisdom_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/charisma"
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_charisma"
android:textAppearance="?attr/textAppearanceSubtitle1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/charisma_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/charisma_increment"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/charisma_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>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -81,6 +81,9 @@
<action <action
android:id="@+id/action_editMonsterFragment_to_editSpeedFragment" android:id="@+id/action_editMonsterFragment_to_editSpeedFragment"
app:destination="@id/editSpeedFragment" /> app:destination="@id/editSpeedFragment" />
<action
android:id="@+id/action_editMonsterFragment_to_editAbilityScoresFragment"
app:destination="@id/editAbilityScoresFragment" />
</fragment> </fragment>
<fragment <fragment
android:id="@+id/editBasicInfoFragment" android:id="@+id/editBasicInfoFragment"
@@ -97,6 +100,10 @@
android:name="com.majinnaibu.monstercards.ui.editmonster.EditSpeedFragment" android:name="com.majinnaibu.monstercards.ui.editmonster.EditSpeedFragment"
android:label="fragment_edit_speed" android:label="fragment_edit_speed"
tools:layout="@layout/fragment_edit_speed" /> tools:layout="@layout/fragment_edit_speed" />
<fragment
android:id="@+id/editAbilityScoresFragment"
android:name="com.majinnaibu.monstercards.ui.editmonster.EditAbilityScoresFragment"
android:label="EditAbilityScoresFragment" />
</navigation> </navigation>
</navigation> </navigation>

View File

@@ -19,8 +19,10 @@
<string name="label_burrow_speed">Burrow Speed</string> <string name="label_burrow_speed">Burrow Speed</string>
<string name="label_can_hover">Can Hover</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_charisma">Charisma</string>
<string name="label_climb_speed">Climb Speed</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_constitution">Constitution</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_custom_speed">Custom Speed</string>
@@ -28,11 +30,13 @@
<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_decrement_field">-</string>
<string name="label_dexterity">Dexterity</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_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_increment_field">+</string>
<string name="label_intelligence">Intelligence</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>
@@ -47,8 +51,10 @@
<string name="label_size">Size</string> <string name="label_size">Size</string>
<string name="label_skills">Skills</string> <string name="label_skills">Skills</string>
<string name="label_speed">Speed</string> <string name="label_speed">Speed</string>
<string name="label_strength">Strength</string>
<string name="label_subtype">Subtype</string> <string name="label_subtype">Subtype</string>
<string name="label_type">Type</string> <string name="label_type">Type</string>
<string name="label_wisdom">Wisdom</string>
<string name="section_divider">section divider</string> <string name="section_divider">section divider</string>
<string name="snackbar_failed_to_create_monster">Failed to create monster</string> <string name="snackbar_failed_to_create_monster">Failed to create monster</string>
<string name="snackbar_monster_created">%1$s created</string> <string name="snackbar_monster_created">%1$s created</string>
@@ -59,4 +65,5 @@
<string name="title_library">Library</string> <string name="title_library">Library</string>
<string name="title_search">Search</string> <string name="title_search">Search</string>
<string name="wisdom_abbreviation">WIS</string> <string name="wisdom_abbreviation">WIS</string>
</resources> </resources>