'More' button in item info view to go back and forth between simple

click and long click menus in the inventory.
This commit is contained in:
Zukero
2017-11-09 16:52:57 +01:00
parent 6394353fa0
commit e3ca04cde7
4 changed files with 25 additions and 0 deletions

View File

@@ -88,6 +88,13 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/dialog_close" />
<Button
android:id="@+id/iteminfo_more"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/dialog_more" />
</LinearLayout>
</LinearLayout>

View File

@@ -21,6 +21,7 @@
<string name="dialog_loading_failed_incorrectversion">Andor\'s Trail was unable to load the savegame file. This savegame file is created with a newer version than what is currently running.</string>
<string name="dialog_close">Close</string>
<string name="dialog_more">More</string>
<string name="dialog_monsterencounter_title">Encounter</string>
<string name="dialog_monsterencounter_message">Do you want to attack?\nDifficulty: %1$s</string>

View File

@@ -22,6 +22,8 @@ public final class ItemInfoActivity extends Activity {
public static enum ItemInfoAction {
none, use, equip, unequip, buy, sell
}
public static final int RESULT_MORE_ACTIONS = Activity.RESULT_FIRST_USER;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -76,6 +78,17 @@ public final class ItemInfoActivity extends Activity {
ItemInfoActivity.this.finish();
}
});
b = (Button) findViewById(R.id.iteminfo_more);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent result = new Intent();
result.putExtras(intent);
setResult(RESULT_MORE_ACTIONS, intent);
ItemInfoActivity.this.finish();
}
});
b = (Button) findViewById(R.id.iteminfo_action);
if (buttonText != null && buttonText.length() > 0) {

View File

@@ -179,6 +179,10 @@ public final class HeroinfoActivity_Inventory extends Fragment implements Custom
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case INTENTREQUEST_ITEMINFO:
if (resultCode == ItemInfoActivity.RESULT_MORE_ACTIONS) {
showContextMenuForItem( world.itemTypes.getItemType(data.getExtras().getString("itemTypeID")));
break;
}
if (resultCode != Activity.RESULT_OK) break;
ItemType itemType = world.itemTypes.getItemType(data.getExtras().getString("itemTypeID"));