diff --git a/AndorsTrail/res/layout-land/quickitemview.xml b/AndorsTrail/res/layout-land/quickitemview.xml
deleted file mode 100644
index fec90c5e4..000000000
--- a/AndorsTrail/res/layout-land/quickitemview.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AndorsTrail/res/layout/main.xml b/AndorsTrail/res/layout/main.xml
index feb25065f..1c6030562 100644
--- a/AndorsTrail/res/layout/main.xml
+++ b/AndorsTrail/res/layout/main.xml
@@ -14,7 +14,7 @@
-
-
-
-
-
-
-
diff --git a/AndorsTrail/res/values/strings.xml b/AndorsTrail/res/values/strings.xml
index ba7969781..4d810d64d 100644
--- a/AndorsTrail/res/values/strings.xml
+++ b/AndorsTrail/res/values/strings.xml
@@ -629,4 +629,25 @@ Every skill level increases the attack chance of weapons with %1$d %% of their o
Increases damage potential of two-handed weapons by an additional %1$d %% of the original damage potential, in addition to the benefis given by the weapon style skill. The attack chances of two-handed weapons are also increased by %2$d %% of their original attack chances.
Increases both attack chances and damage potential of weapons. The attack chance is increased by %1$d %% of the original attack chance, and the damage potential is increased by %2$d %% of the original damage potential.
+ Quickslot position
+ Where to place the quickslots
+
+ - Center bottom
+ - Middle left
+ - Middle right
+ - Bottom left, along left border
+ - Bottom left, along bottom border
+ - Bottom right, along bottom border
+ - Bottom right, along right border
+
+
+ - 0
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+ - 6
+
+
diff --git a/AndorsTrail/res/values/ui_ids.xml b/AndorsTrail/res/values/ui_ids.xml
index aa33102f9..522234faa 100644
--- a/AndorsTrail/res/values/ui_ids.xml
+++ b/AndorsTrail/res/values/ui_ids.xml
@@ -3,9 +3,4 @@
-
- - @id/quickitemview_item1
- - @id/quickitemview_item2
- - @id/quickitemview_item3
-
diff --git a/AndorsTrail/res/xml/preferences.xml b/AndorsTrail/res/xml/preferences.xml
index 8605f2621..83e44b1cf 100644
--- a/AndorsTrail/res/xml/preferences.xml
+++ b/AndorsTrail/res/xml/preferences.xml
@@ -86,5 +86,12 @@
android:defaultValue="true"
android:summary="@string/preferences_ui_enable_animations"
android:key="enableUiAnimations" />
-
+
+
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/AndorsTrailPreferences.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/AndorsTrailPreferences.java
index 6c2b6a5c8..3bb001aba 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/AndorsTrailPreferences.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/AndorsTrailPreferences.java
@@ -25,7 +25,14 @@ public final class AndorsTrailPreferences {
public static final int CONFIRM_OVERWRITE_SAVEGAME_ALWAYS = 0;
public static final int CONFIRM_OVERWRITE_SAVEGAME_WHEN_PLAYERNAME_DIFFERS = 1;
public static final int CONFIRM_OVERWRITE_SAVEGAME_NEVER = 2;
-
+ public static final int QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM = 0;
+ public static final int QUICKSLOTS_POSITION_VERTICAL_CENTER_LEFT = 1;
+ public static final int QUICKSLOTS_POSITION_VERTICAL_CENTER_RIGHT = 2;
+ public static final int QUICKSLOTS_POSITION_VERTICAL_BOTTOM_LEFT = 3;
+ public static final int QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_LEFT = 4;
+ public static final int QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_RIGHT = 5;
+ public static final int QUICKSLOTS_POSITION_VERTICAL_BOTTOM_RIGHT = 6;
+
public boolean confirmRest = true;
public boolean confirmAttack = true;
public int displayLoot = DISPLAYLOOT_DIALOG;
@@ -39,6 +46,7 @@ public final class AndorsTrailPreferences {
public boolean optimizedDrawing = false;
public boolean enableUiAnimations = true;
public int displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
+ public int quickslotsPosition = QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM;
public void read(final Context androidContext) {
AndorsTrailPreferences dest = this;
@@ -56,7 +64,8 @@ public final class AndorsTrailPreferences {
dest.optimizedDrawing = prefs.getBoolean("optimized_drawing", false);
dest.enableUiAnimations = prefs.getBoolean("enableUiAnimations", true);
dest.displayOverwriteSavegame = Integer.parseInt(prefs.getString("display_overwrite_savegame", Integer.toString(CONFIRM_OVERWRITE_SAVEGAME_ALWAYS)));
-
+ dest.quickslotsPosition = Integer.parseInt(prefs.getString("quickslots_placement", Integer.toString(QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM)));
+
// This might be implemented as a skill in the future.
//dest.movementAggressiveness = Integer.parseInt(prefs.getString("movementaggressiveness", Integer.toString(MOVEMENTAGGRESSIVENESS_NORMAL)));
} catch (Exception e) {
@@ -73,15 +82,7 @@ public final class AndorsTrailPreferences {
dest.optimizedDrawing = false;
dest.enableUiAnimations = true;
dest.displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
+ dest.quickslotsPosition = QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM;
}
}
-
- public static boolean shouldUseFullscreen(final Context androidContext) {
- try {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(androidContext);
- return prefs.getBoolean("fullscreen", true);
- } catch (Exception e) {
- }
- return true;
- }
}
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/MainActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/MainActivity.java
index 037170cce..1b74def3b 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/MainActivity.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/MainActivity.java
@@ -99,6 +99,7 @@ public final class MainActivity extends Activity implements PlayerMovementListen
quickitemview.registerForContextMenu(this);
dpad.updateVisibility(preferences);
+ quickitemview.setPosition(preferences);
// Define which views are in front of each other.
dpad.bringToFront();
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/QuickitemView.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/QuickitemView.java
index 852777286..a0c15c6cd 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/QuickitemView.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/QuickitemView.java
@@ -9,9 +9,12 @@ import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.ViewGroup;
import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
+import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
import com.gpl.rpg.AndorsTrail.R;
import com.gpl.rpg.AndorsTrail.activity.MainActivity;
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
@@ -36,21 +39,33 @@ public final class QuickitemView extends LinearLayout implements OnClickListener
this.world = app.getWorld();
this.controllers = app.getControllerContext();
setFocusable(false);
- setOrientation(LinearLayout.HORIZONTAL);
- inflate(context, R.layout.quickitemview, this);
- Resources res = getResources();
+ int position = app.getPreferences().quickslotsPosition;
+ switch(position) {
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_LEFT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_RIGHT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM:
+ setOrientation(LinearLayout.HORIZONTAL);
+ break;
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_BOTTOM_LEFT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_BOTTOM_RIGHT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_CENTER_LEFT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_CENTER_RIGHT:
+ setOrientation(LinearLayout.VERTICAL);
+ break;
+ }
+
+ Resources res = getResources();
this.setBackgroundColor(res.getColor(color.transparent));
- TypedArray quickButtons = res.obtainTypedArray(R.array.quick_buttons);
- for(int i = 0; i < buttons.length; ++i) {
- buttons[i] = (QuickButton)findViewById(quickButtons.getResourceId(i, -1));
+ for(int i = 0; i < NUM_QUICK_SLOTS; ++i) {
+ buttons[i] = new QuickButton(context, null);
QuickButton item = buttons[i];
item.setIndex(i);
item.setItemType(null, world, tiles);
item.setOnClickListener(this);
+ addView(item);
}
- quickButtons.recycle();
}
public boolean isQuickButtonId(int id){
@@ -113,6 +128,37 @@ public final class QuickitemView extends LinearLayout implements OnClickListener
mainActivity.registerForContextMenu(item);
}
+ public void setPosition(AndorsTrailPreferences preferences) {
+ int positionRelativeTo = R.id.main_mainview;
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ switch (preferences.quickslotsPosition) {
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_LEFT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_BOTTOM_LEFT:
+ params.addRule(RelativeLayout.ALIGN_LEFT, positionRelativeTo);
+ params.addRule(RelativeLayout.ALIGN_BOTTOM, positionRelativeTo);
+ break;
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_HORIZONTAL_BOTTOM_RIGHT:
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_BOTTOM_RIGHT:
+ params.addRule(RelativeLayout.ALIGN_RIGHT, positionRelativeTo);
+ params.addRule(RelativeLayout.ALIGN_BOTTOM, positionRelativeTo);
+ break;
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM:
+ params.addRule(RelativeLayout.CENTER_HORIZONTAL);
+ params.addRule(RelativeLayout.ALIGN_BOTTOM, positionRelativeTo);
+ break;
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_CENTER_LEFT:
+ params.addRule(RelativeLayout.ALIGN_LEFT, positionRelativeTo);
+ params.addRule(RelativeLayout.CENTER_VERTICAL);
+ break;
+ case AndorsTrailPreferences.QUICKSLOTS_POSITION_VERTICAL_CENTER_RIGHT:
+ params.addRule(RelativeLayout.ALIGN_RIGHT, positionRelativeTo);
+ params.addRule(RelativeLayout.CENTER_VERTICAL);
+ break;
+ }
+
+ setLayoutParams(params);
+ }
+
@Override
public void onQuickSlotChanged(int slotId) {
refreshQuickitems();