Adds a Stepper control and uses it for the steppers in the editor.
This commit is contained in:
		| @@ -0,0 +1,144 @@ | |||||||
|  | package com.majinnaibu.monstercards.ui.components; | ||||||
|  |  | ||||||
|  | import android.content.Context; | ||||||
|  | import android.content.res.TypedArray; | ||||||
|  | import android.util.AttributeSet; | ||||||
|  | import android.view.LayoutInflater; | ||||||
|  | import android.view.View; | ||||||
|  | import android.widget.Button; | ||||||
|  | import android.widget.TextView; | ||||||
|  |  | ||||||
|  | import androidx.annotation.NonNull; | ||||||
|  | import androidx.annotation.Nullable; | ||||||
|  | import androidx.constraintlayout.widget.ConstraintLayout; | ||||||
|  |  | ||||||
|  | import com.majinnaibu.monstercards.R; | ||||||
|  | import com.majinnaibu.monstercards.utils.Logger; | ||||||
|  |  | ||||||
|  | import java.util.Objects; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | public class Stepper extends ConstraintLayout { | ||||||
|  |     private final ViewHolder mHolder; | ||||||
|  |     private int mCurrentValue; | ||||||
|  |     private int mStep; | ||||||
|  |     private int mMinValue; | ||||||
|  |     private int mMaxValue; | ||||||
|  |     private String mLabel; | ||||||
|  |     private OnValueChangeListener mOnValueChangeListener; | ||||||
|  |     private OnFormatValueCallback mOnFormatValueCallback; | ||||||
|  |  | ||||||
|  |     public Stepper(@NonNull Context context, @Nullable AttributeSet attrs) { | ||||||
|  |         super(context, attrs); | ||||||
|  |  | ||||||
|  |         mCurrentValue = 0; | ||||||
|  |  | ||||||
|  |         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Stepper, 0, 0); | ||||||
|  |         mStep = a.getInt(R.styleable.Stepper_stepAmount, 1); | ||||||
|  |         mMinValue = a.getInt(R.styleable.Stepper_minValue, Integer.MIN_VALUE); | ||||||
|  |         mMaxValue = a.getInt(R.styleable.Stepper_maxValue, Integer.MAX_VALUE); | ||||||
|  |         mLabel = a.getString(R.styleable.Stepper_label); | ||||||
|  |         a.recycle(); | ||||||
|  |  | ||||||
|  |         LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||||||
|  |         View root = inflater.inflate(R.layout.component_stepper, this, true); | ||||||
|  |  | ||||||
|  |         mHolder = new ViewHolder(root); | ||||||
|  |  | ||||||
|  |         setValue(mCurrentValue); | ||||||
|  |         mHolder.increment.setOnClickListener(v -> setValue(mCurrentValue + mStep)); | ||||||
|  |         mHolder.decrement.setOnClickListener(v -> setValue(mCurrentValue - mStep)); | ||||||
|  |  | ||||||
|  |         mHolder.label.setText(mLabel); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public Stepper(Context context) { | ||||||
|  |         this(context, null); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public String getLabel() { | ||||||
|  |         return mLabel; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setLabel(String newLabel) { | ||||||
|  |         if (!Objects.equals(mLabel, newLabel)) { | ||||||
|  |             mLabel = newLabel; | ||||||
|  |             mHolder.label.setText(mLabel); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public int getValue() { | ||||||
|  |         return mCurrentValue; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setValue(int value) { | ||||||
|  |         int oldValue = this.mCurrentValue; | ||||||
|  |         int newValue = Math.min(mMaxValue, Math.max(mMinValue, value)); | ||||||
|  |         Logger.logDebug(String.format("Setting stepper value value: %d, oldValue: %d, newValue: %d", value, oldValue, newValue)); | ||||||
|  |         if (newValue != oldValue) { | ||||||
|  |             this.mCurrentValue = newValue; | ||||||
|  |             if (mOnValueChangeListener != null) { | ||||||
|  |                 mOnValueChangeListener.onChange(newValue, oldValue); | ||||||
|  |             } | ||||||
|  |             if (mOnFormatValueCallback != null) { | ||||||
|  |                 mHolder.text.setText(mOnFormatValueCallback.onFormatValue(this.mCurrentValue)); | ||||||
|  |             } else { | ||||||
|  |                 mHolder.text.setText(String.valueOf(this.mCurrentValue)); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setOnValueChangeListener(OnValueChangeListener listener) { | ||||||
|  |         mOnValueChangeListener = listener; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setOnFormatValueCallback(OnFormatValueCallback callback) { | ||||||
|  |         mOnFormatValueCallback = callback; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public int getStep() { | ||||||
|  |         return mStep; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setStep(int step) { | ||||||
|  |         this.mStep = step; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public int getMinValue() { | ||||||
|  |         return mMinValue; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setMinValue(int minValue) { | ||||||
|  |         this.mMinValue = minValue; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public int getMaxValue() { | ||||||
|  |         return mMaxValue; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setMaxValue(int maxValue) { | ||||||
|  |         this.mMaxValue = maxValue; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public interface OnValueChangeListener { | ||||||
|  |         void onChange(int value, int previousValue); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public interface OnFormatValueCallback { | ||||||
|  |         String onFormatValue(int value); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private static class ViewHolder { | ||||||
|  |         final TextView text; | ||||||
|  |         final TextView label; | ||||||
|  |         final Button increment; | ||||||
|  |         final Button decrement; | ||||||
|  |  | ||||||
|  |         ViewHolder(View root) { | ||||||
|  |             text = root.findViewById(R.id.text); | ||||||
|  |             label = root.findViewById(R.id.label); | ||||||
|  |             increment = root.findViewById(R.id.increment); | ||||||
|  |             decrement = root.findViewById(R.id.decrement); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -4,8 +4,6 @@ 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.fragment.app.Fragment; | import androidx.fragment.app.Fragment; | ||||||
| import androidx.lifecycle.ViewModelProvider; | import androidx.lifecycle.ViewModelProvider; | ||||||
| @@ -14,11 +12,17 @@ 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; | ||||||
|  |  | ||||||
| public class EditAbilityScoresFragment extends Fragment { | public class EditAbilityScoresFragment extends Fragment { | ||||||
|  |     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(LayoutInflater inflater, ViewGroup container, |     public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||||||
|                              Bundle savedInstanceState) { |                              Bundle savedInstanceState) { | ||||||
| @@ -31,72 +35,48 @@ public class EditAbilityScoresFragment extends Fragment { | |||||||
|  |  | ||||||
|         mHolder = new ViewHolder(root); |         mHolder = new ViewHolder(root); | ||||||
|  |  | ||||||
|         mViewModel.getStrength().observe(getViewLifecycleOwner(), value -> mHolder.strength.setText(String.valueOf(value))); |         mViewModel.getStrength().observe(getViewLifecycleOwner(), value -> mHolder.strength.setValue(value)); | ||||||
|         mHolder.increaseStrength.setOnClickListener(v -> mViewModel.incrementStrength()); |         mHolder.strength.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setStrength(newValue)); | ||||||
|         mHolder.decreaseStrength.setOnClickListener(v -> mViewModel.decrementStrength()); |         mHolder.strength.setOnFormatValueCallback(value -> String.format(ABILITY_SCORE_FORMAT, value, getModifier(value))); | ||||||
|  |  | ||||||
|         mViewModel.getDexterity().observe(getViewLifecycleOwner(), value -> mHolder.dexterity.setText(String.valueOf(value))); |         mViewModel.getDexterity().observe(getViewLifecycleOwner(), value -> mHolder.dexterity.setValue(value)); | ||||||
|         mHolder.increaseDexterity.setOnClickListener(v -> mViewModel.incrementDexterity()); |         mHolder.dexterity.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setDexterity(newValue)); | ||||||
|         mHolder.decreaseDexterity.setOnClickListener(v -> mViewModel.decrementDexterity()); |         mHolder.dexterity.setOnFormatValueCallback(value -> String.format(ABILITY_SCORE_FORMAT, value, getModifier(value))); | ||||||
|  |  | ||||||
|         mViewModel.getConstitution().observe(getViewLifecycleOwner(), value -> mHolder.constitution.setText(String.valueOf(value))); |         mViewModel.getConstitution().observe(getViewLifecycleOwner(), value -> mHolder.constitution.setValue(value)); | ||||||
|         mHolder.increaseConstitution.setOnClickListener(v -> mViewModel.incrementConstitution()); |         mHolder.constitution.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setConstitution(newValue)); | ||||||
|         mHolder.decreaseConstitution.setOnClickListener(v -> mViewModel.decrementConstitution()); |         mHolder.constitution.setOnFormatValueCallback(value -> String.format(ABILITY_SCORE_FORMAT, value, getModifier(value))); | ||||||
|  |  | ||||||
|         mViewModel.getIntelligence().observe(getViewLifecycleOwner(), value -> mHolder.intelligence.setText(String.valueOf(value))); |         mViewModel.getIntelligence().observe(getViewLifecycleOwner(), value -> mHolder.intelligence.setValue(value)); | ||||||
|         mHolder.increaseIntelligence.setOnClickListener(v -> mViewModel.incrementIntelligence()); |         mHolder.intelligence.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setIntelligence(newValue)); | ||||||
|         mHolder.decreaseIntelligence.setOnClickListener(v -> mViewModel.decrementIntelligence()); |         mHolder.intelligence.setOnFormatValueCallback(value -> String.format(ABILITY_SCORE_FORMAT, value, getModifier(value))); | ||||||
|  |  | ||||||
|         mViewModel.getWisdom().observe(getViewLifecycleOwner(), value -> mHolder.wisdom.setText(String.valueOf(value))); |         mViewModel.getWisdom().observe(getViewLifecycleOwner(), value -> mHolder.wisdom.setValue(value)); | ||||||
|         mHolder.increaseWisdom.setOnClickListener(v -> mViewModel.incrementWisdom()); |         mHolder.wisdom.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setWisdom(newValue)); | ||||||
|         mHolder.decreaseWisdom.setOnClickListener(v -> mViewModel.decrementWisdom()); |         mHolder.wisdom.setOnFormatValueCallback(value -> String.format(ABILITY_SCORE_FORMAT, value, getModifier(value))); | ||||||
|  |  | ||||||
|         mViewModel.getCharisma().observe(getViewLifecycleOwner(), value -> mHolder.charisma.setText(String.valueOf(value))); |         mViewModel.getCharisma().observe(getViewLifecycleOwner(), value -> mHolder.charisma.setValue(value)); | ||||||
|         mHolder.increaseCharisma.setOnClickListener(v -> mViewModel.incrementCharisma()); |         mHolder.charisma.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setCharisma(newValue)); | ||||||
|         mHolder.decreaseCharisma.setOnClickListener(v -> mViewModel.decrementCharisma()); |         mHolder.charisma.setOnFormatValueCallback(value -> String.format(ABILITY_SCORE_FORMAT, value, getModifier(value))); | ||||||
|  |  | ||||||
|         return root; |         return root; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private static class ViewHolder { |     private static class ViewHolder { | ||||||
|         TextView strength; |         final Stepper strength; | ||||||
|         Button decreaseStrength; |         final Stepper dexterity; | ||||||
|         Button increaseStrength; |         final Stepper constitution; | ||||||
|         TextView dexterity; |         final Stepper intelligence; | ||||||
|         Button increaseDexterity; |         final Stepper wisdom; | ||||||
|         Button decreaseDexterity; |         final Stepper charisma; | ||||||
|         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(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); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -4,9 +4,7 @@ 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.EditText; | import android.widget.EditText; | ||||||
| import android.widget.TextView; |  | ||||||
|  |  | ||||||
| import androidx.appcompat.widget.SwitchCompat; | import androidx.appcompat.widget.SwitchCompat; | ||||||
| import androidx.fragment.app.Fragment; | import androidx.fragment.app.Fragment; | ||||||
| @@ -16,6 +14,7 @@ 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.utils.TextChangedListener; | import com.majinnaibu.monstercards.utils.TextChangedListener; | ||||||
|  |  | ||||||
| public class EditSpeedFragment extends Fragment { | public class EditSpeedFragment extends Fragment { | ||||||
| @@ -34,29 +33,25 @@ public class EditSpeedFragment extends Fragment { | |||||||
|  |  | ||||||
|         mHolder = new ViewHolder(root); |         mHolder = new ViewHolder(root); | ||||||
|  |  | ||||||
|         mViewModel.getWalkSpeed().observe(getViewLifecycleOwner(), value -> { |         mHolder.baseSpeed.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setWalkSpeed(newValue)); | ||||||
|             mHolder.baseSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value)); |         mHolder.baseSpeed.setOnFormatValueCallback(value -> String.format(getString(R.string.format_distance_in_feet), value)); | ||||||
|         }); |         mViewModel.getWalkSpeed().observe(getViewLifecycleOwner(), value -> mHolder.baseSpeed.setValue(value)); | ||||||
|         mHolder.incrementBaseSpeed.setOnClickListener(v -> mViewModel.incrementWalkSpeed()); |  | ||||||
|         mHolder.decrementBaseSpeed.setOnClickListener(v -> mViewModel.decrementWalkSpeed()); |  | ||||||
|  |  | ||||||
|         mViewModel.getBurrowSpeed().observe(getViewLifecycleOwner(), value -> { |         mHolder.burrowSpeed.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setBurrowSpeed(newValue)); | ||||||
|             mHolder.burrowSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value)); |         mHolder.burrowSpeed.setOnFormatValueCallback(value -> String.format(getString(R.string.format_distance_in_feet), value)); | ||||||
|         }); |         mViewModel.getBurrowSpeed().observe(getViewLifecycleOwner(), value -> mHolder.burrowSpeed.setValue(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.climbSpeed.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setClimbSpeed(newValue)); | ||||||
|         mHolder.incrementClimbSpeed.setOnClickListener(v -> mViewModel.incrementClimbSpeed()); |         mHolder.climbSpeed.setOnFormatValueCallback(value -> String.format(getString(R.string.format_distance_in_feet), value)); | ||||||
|         mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementClimbSpeed()); |         mViewModel.getClimbSpeed().observe(getViewLifecycleOwner(), value -> mHolder.climbSpeed.setValue(value)); | ||||||
|  |  | ||||||
|         mViewModel.getFlySpeed().observe(getViewLifecycleOwner(), value -> mHolder.flySpeed.setText(String.format(getString(R.string.format_distance_in_feet), value))); |         mHolder.flySpeed.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setFlySpeed(newValue)); | ||||||
|         mHolder.incrementFlySpeed.setOnClickListener(v -> mViewModel.incrementFlySpeed()); |         mHolder.flySpeed.setOnFormatValueCallback(value -> String.format(getString(R.string.format_distance_in_feet), value)); | ||||||
|         mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementFlySpeed()); |         mViewModel.getFlySpeed().observe(getViewLifecycleOwner(), value -> mHolder.flySpeed.setValue(value)); | ||||||
|  |  | ||||||
|         mViewModel.getSwimSpeed().observe(getViewLifecycleOwner(), value -> mHolder.swimSpeed.setText(String.format(getString(R.string.format_distance_in_feet), value))); |         mHolder.swimSpeed.setOnValueChangeListener((newValue, oldValue) -> mViewModel.setSwimSpeed(newValue)); | ||||||
|         mHolder.incrementSwimSpeed.setOnClickListener(v -> mViewModel.incrementSwimSpeed()); |         mHolder.swimSpeed.setOnFormatValueCallback(value -> String.format(getString(R.string.format_distance_in_feet), value)); | ||||||
|         mHolder.decrementBurrowSpeed.setOnClickListener(v -> mViewModel.decrementSwimSpeed()); |         mViewModel.getSwimSpeed().observe(getViewLifecycleOwner(), value -> mHolder.swimSpeed.setValue(value)); | ||||||
|  |  | ||||||
|         mViewModel.getCanHover().observe(getViewLifecycleOwner(), value -> mHolder.canHover.setChecked(value)); |         mViewModel.getCanHover().observe(getViewLifecycleOwner(), value -> mHolder.canHover.setChecked(value)); | ||||||
|         mHolder.canHover.setOnCheckedChangeListener((buttonView, isChecked) -> mViewModel.setCanHover(isChecked)); |         mHolder.canHover.setOnCheckedChangeListener((buttonView, isChecked) -> mViewModel.setCanHover(isChecked)); | ||||||
| @@ -73,41 +68,21 @@ public class EditSpeedFragment extends Fragment { | |||||||
|  |  | ||||||
|     private static class ViewHolder { |     private static class ViewHolder { | ||||||
|  |  | ||||||
|         final TextView baseSpeed; |         final Stepper baseSpeed; | ||||||
|         final Button incrementBaseSpeed; |         final Stepper burrowSpeed; | ||||||
|         final Button decrementBaseSpeed; |         final Stepper climbSpeed; | ||||||
|         final TextView burrowSpeed; |         final Stepper flySpeed; | ||||||
|         final Button incrementBurrowSpeed; |         final Stepper swimSpeed; | ||||||
|         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 canHover; | ||||||
|         final SwitchCompat hasCustomSpeed; |         final SwitchCompat hasCustomSpeed; | ||||||
|         final EditText customSpeed; |         final EditText customSpeed; | ||||||
|  |  | ||||||
|         ViewHolder(View root) { |         ViewHolder(View root) { | ||||||
|             baseSpeed = root.findViewById(R.id.baseSpeed); |             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); |             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); |             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); |             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); |             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); |             canHover = root.findViewById(R.id.canHover); | ||||||
|             hasCustomSpeed = root.findViewById(R.id.hasCustomSpeed); |             hasCustomSpeed = root.findViewById(R.id.hasCustomSpeed); | ||||||
|             customSpeed = root.findViewById(R.id.customSpeed); |             customSpeed = root.findViewById(R.id.customSpeed); | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								app/src/main/res/layout/component_stepper.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								app/src/main/res/layout/component_stepper.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <merge 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" | ||||||
|  |     android:layout_margin="@dimen/text_margin" | ||||||
|  |     tools:context=".ui.components.Stepper"> | ||||||
|  |  | ||||||
|  |     <TextView | ||||||
|  |         android:id="@+id/text" | ||||||
|  |         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 (+5)" /> | ||||||
|  |  | ||||||
|  |     <TextView | ||||||
|  |         android:id="@+id/label" | ||||||
|  |         android:layout_width="wrap_content" | ||||||
|  |         android:layout_height="wrap_content" | ||||||
|  |         android:text="" | ||||||
|  |         android:textAppearance="?attr/textAppearanceSubtitle1" | ||||||
|  |         app:layout_constraintStart_toStartOf="parent" | ||||||
|  |         app:layout_constraintTop_toTopOf="parent" | ||||||
|  |         tools:text="Strength" /> | ||||||
|  |  | ||||||
|  |     <Button | ||||||
|  |         android:id="@+id/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/increment" | ||||||
|  |         app:layout_constraintTop_toTopOf="parent" /> | ||||||
|  |  | ||||||
|  |     <Button | ||||||
|  |         android:id="@+id/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" /> | ||||||
|  | </merge> | ||||||
| @@ -11,259 +11,64 @@ | |||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:orientation="vertical"> |         android:orientation="vertical"> | ||||||
|  |  | ||||||
|         <androidx.constraintlayout.widget.ConstraintLayout |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:layout_width="match_parent" |  | ||||||
|             android:layout_height="wrap_content" |  | ||||||
|             android:layout_margin="@dimen/text_margin"> |  | ||||||
|  |  | ||||||
|             <TextView |  | ||||||
|             android:id="@+id/strength" |             android:id="@+id/strength" | ||||||
|                 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_strength" |  | ||||||
|                 android:textAppearance="?attr/textAppearanceSubtitle1" |  | ||||||
|                 app:layout_constraintStart_toStartOf="parent" |  | ||||||
|                 app:layout_constraintTop_toTopOf="parent" /> |  | ||||||
|  |  | ||||||
|             <Button |  | ||||||
|                 android:id="@+id/strength_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/strength_increment" |  | ||||||
|                 app:layout_constraintTop_toTopOf="parent" /> |  | ||||||
|  |  | ||||||
|             <Button |  | ||||||
|                 android:id="@+id/strength_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_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" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/dexterity" |             android:id="@+id/dexterity" | ||||||
|                 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_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_dexterity" | ||||||
|  |             app:maxValue="99" | ||||||
|  |             app:minValue="1" | ||||||
|  |             app:stepAmount="1" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/constitution" |             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_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_constitution" | ||||||
|  |             app:maxValue="99" | ||||||
|  |             app:minValue="1" | ||||||
|  |             app:stepAmount="1" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/intelligence" |             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_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_intelligence" | ||||||
|  |             app:maxValue="99" | ||||||
|  |             app:minValue="1" | ||||||
|  |             app:stepAmount="1" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/wisdom" |             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_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_wisdom" | ||||||
|  |             app:maxValue="99" | ||||||
|  |             app:minValue="1" | ||||||
|  |             app:stepAmount="1" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/charisma" |             android:id="@+id/charisma" | ||||||
|                 android:layout_width="wrap_content" |             android:layout_width="match_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|                 app:layout_constraintBottom_toBottomOf="parent" |             android:layout_margin="@dimen/text_margin" | ||||||
|                 app:layout_constraintStart_toStartOf="parent" |             app:label="@string/label_charisma" | ||||||
|                 app:layout_constraintTop_toTopOf="parent" |             app:maxValue="99" | ||||||
|                 tools:text="20 ft." /> |             app:minValue="1" | ||||||
|  |             app:stepAmount="1" /> | ||||||
|             <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> | ||||||
|   | |||||||
| @@ -11,215 +11,55 @@ | |||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:orientation="vertical"> |         android:orientation="vertical"> | ||||||
|  |  | ||||||
|         <androidx.constraintlayout.widget.ConstraintLayout |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:layout_width="match_parent" |  | ||||||
|             android:layout_height="wrap_content" |  | ||||||
|             android:layout_margin="@dimen/text_margin"> |  | ||||||
|  |  | ||||||
|             <TextView |  | ||||||
|             android:id="@+id/baseSpeed" |             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_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_base_speed" | ||||||
|  |             app:maxValue="1000" | ||||||
|  |             app:minValue="0" | ||||||
|  |             app:stepAmount="5" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/burrowSpeed" |             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_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_burrow_speed" | ||||||
|  |             app:maxValue="1000" | ||||||
|  |             app:minValue="0" | ||||||
|  |             app:stepAmount="5" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/climbSpeed" |             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_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_climb_speed" | ||||||
|  |             app:maxValue="1000" | ||||||
|  |             app:minValue="0" | ||||||
|  |             app:stepAmount="5" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/flySpeed" |             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_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_fly_speed" | ||||||
|  |             app:maxValue="1000" | ||||||
|  |             app:minValue="0" | ||||||
|  |             app:stepAmount="5" /> | ||||||
|  |  | ||||||
|             <TextView |         <com.majinnaibu.monstercards.ui.components.Stepper | ||||||
|             android:id="@+id/swimSpeed" |             android:id="@+id/swimSpeed" | ||||||
|                 android:layout_width="wrap_content" |             android:layout_width="match_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|                 app:layout_constraintBottom_toBottomOf="parent" |             android:layout_margin="@dimen/text_margin" | ||||||
|                 app:layout_constraintStart_toStartOf="parent" |             app:label="@string/label_swim_speed" | ||||||
|                 app:layout_constraintTop_toTopOf="parent" |             app:maxValue="1000" | ||||||
|                 tools:text="20 ft." /> |             app:minValue="0" | ||||||
|  |             app:stepAmount="5" /> | ||||||
|             <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 |         <com.google.android.material.switchmaterial.SwitchMaterial | ||||||
|             android:id="@+id/canHover" |             android:id="@+id/canHover" | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								app/src/main/res/values/attrs.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/src/main/res/values/attrs.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <resources> | ||||||
|  |     <declare-styleable name="Stepper"> | ||||||
|  |         <attr name="stepAmount" format="integer" /> | ||||||
|  |         <attr name="minValue" format="integer" /> | ||||||
|  |         <attr name="maxValue" format="integer" /> | ||||||
|  |         <attr name="label" format="string" localization="suggested" /> | ||||||
|  |     </declare-styleable> | ||||||
|  | </resources> | ||||||
| @@ -65,5 +65,7 @@ | |||||||
|     <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> | ||||||
|  |     <string name="label_fly_speed">Fly Speed</string> | ||||||
|  |     <string name="label_swim_speed">Swim Speed</string> | ||||||
|  |  | ||||||
| </resources> | </resources> | ||||||
		Reference in New Issue
	
	Block a user