diff --git a/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/CharacterSheetFragment.java b/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/CharacterSheetFragment.java
index 849dfa0..760c5f6 100644
--- a/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/CharacterSheetFragment.java
+++ b/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/CharacterSheetFragment.java
@@ -3,11 +3,12 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
import android.widget.Button;
+import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
@@ -54,7 +55,7 @@ public class CharacterSheetFragment extends Fragment
Button mTotalHitsButton;
Button mHitsButton;
Button mAttackButton;
- Button mEquippedWeaponButton;
+ Spinner mEquippedWeaponSpinner;
Button mInitiativeButton;
Button mAPbutton;
Button mDEbutton;
@@ -217,22 +218,28 @@ public void onClick(View v){
}
});
- mEquippedWeaponButton = (Button) rootView.findViewById(R.id.equipped_weapon_button);
+ mEquippedWeaponSpinner = (Spinner) rootView.findViewById(R.id.equipped_weapon_spinner);
+ DetailedWeaponAdapter weaponAdapter = new DetailedWeaponAdapter(getContext(), mSheetPlayerCharacter.getWeapons());
+ mEquippedWeaponSpinner.setAdapter(weaponAdapter);
//Get equipped weapon from character Class
//int equippedWeaponID = R.string.barb_axe;
- Weapon equippedWeapon = mSheetPlayerCharacter.getCurrentWeapon();
+ /*Weapon equippedWeapon = mSheetPlayerCharacter.getCurrentWeapon();
if (equippedWeapon != null) {
int equippedWeaponID = equippedWeapon.getResId();
- mEquippedWeaponButton.setText(equippedWeaponID);
+ mEquippedWeaponSpinner.setText(equippedWeaponID);
} else {
- mEquippedWeaponButton.setText("-");
- }
+ mEquippedWeaponSpinner.setText("-");
+ }*/
- mEquippedWeaponButton.setOnClickListener(new View.OnClickListener() {
+ mEquippedWeaponSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
- public void onClick(View v) {
- Toast.makeText(getActivity(),
- "Will soon open a listpicker", Toast.LENGTH_SHORT).show();
+ public void onItemSelected(AdapterView> adapterView, View view, int i, long l) {
+ mSheetPlayerCharacter.setCurrentWeapon((Weapon) adapterView.getItemAtPosition(i));
+ populateSheet();
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> adapterView) {
}
});
@@ -444,7 +451,8 @@ private void populateSheet(PlayerCharacter character) {
}
if (wepToDisplay != null) {
- mEquippedWeaponButton.setText(wepToDisplay.getResId());
+ DetailedWeaponAdapter adapter = (DetailedWeaponAdapter) mEquippedWeaponSpinner.getAdapter();
+ mEquippedWeaponSpinner.setSelection(adapter.getDataset().indexOf(wepToDisplay));
mAttackType.setText(wepToDisplay.getWeaponType());
if (wepToDisplay.getWeaponType() == R.string.melee) {
mAttackButton.setText(Integer.toString(character.getMeleeMod()));
diff --git a/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/NewCharacter/CreateCharacter.java b/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/NewCharacter/CreateCharacter.java
index a5458c2..a1fa29d 100644
--- a/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/NewCharacter/CreateCharacter.java
+++ b/MazesAndMinotaurs/app/src/main/java/com/example/cis/mazeminotaurs/NewCharacter/CreateCharacter.java
@@ -103,7 +103,7 @@ public void afterTextChanged(Editable editable) {
mMFButton = (Button) rootView.findViewById(R.id.mystic_fortitude_button);
mPVButton = (Button) rootView.findViewById(R.id.physical_vigor_button);
mInitButton = (Button) rootView.findViewById(R.id.initiative_modifier_button);
- mWeaponNameButton = (Button) rootView.findViewById(R.id.equipped_weapon_button);
+ mWeaponNameButton = (Button) rootView.findViewById(R.id.equipped_weapon_spinner);
mWeaponTypeButton = (Button) rootView.findViewById(R.id.attack_button);
// Confirm button
diff --git a/MazesAndMinotaurs/app/src/main/res/layout/fragment_character_sheet.xml b/MazesAndMinotaurs/app/src/main/res/layout/fragment_character_sheet.xml
index 5f26158..bb67268 100644
--- a/MazesAndMinotaurs/app/src/main/res/layout/fragment_character_sheet.xml
+++ b/MazesAndMinotaurs/app/src/main/res/layout/fragment_character_sheet.xml
@@ -377,9 +377,9 @@
android:textAlignment="center"
android:textSize="24sp"/>
-