mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-01-21 02:51:20 +01:00
Remove in-game menu.
* Move Save from menu to toolbox * Move preferences to startscreen * Remove exit on startscreen
This commit is contained in:
@@ -10,32 +10,7 @@
|
||||
</component>
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/assets" />
|
||||
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/libs" />
|
||||
<option name="USE_CUSTOM_APK_RESOURCE_FOLDER" value="false" />
|
||||
<option name="CUSTOM_APK_RESOURCE_FOLDER" value="" />
|
||||
<option name="USE_CUSTOM_COMPILER_MANIFEST" value="false" />
|
||||
<option name="CUSTOM_COMPILER_MANIFEST" value="" />
|
||||
<option name="APK_PATH" value="" />
|
||||
<option name="LIBRARY_PROJECT" value="false" />
|
||||
<option name="RUN_PROCESS_RESOURCES_MAVEN_TASK" value="true" />
|
||||
<option name="GENERATE_UNSIGNED_APK" value="false" />
|
||||
<option name="CUSTOM_DEBUG_KEYSTORE_PATH" value="" />
|
||||
<option name="PACK_TEST_CODE" value="false" />
|
||||
<option name="RUN_PROGUARD" value="false" />
|
||||
<option name="PROGUARD_CFG_PATH" value="/proguard-project.txt" />
|
||||
<resOverlayFolders>
|
||||
<path>/res-overlay</path>
|
||||
</resOverlayFolders>
|
||||
<includeSystemProguardFile>true</includeSystemProguardFile>
|
||||
<includeAssetsFromLibraries>false</includeAssetsFromLibraries>
|
||||
<additionalNativeLibs />
|
||||
</configuration>
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/startscreen_version"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -97,6 +97,13 @@
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/startscreen_preferences"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/menu_settings"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/startscreen_about"
|
||||
android:layout_width="0dip"
|
||||
@@ -104,12 +111,5 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/startscreen_about"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/startscreen_quit"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/exit"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -7,14 +7,19 @@
|
||||
android:background="@drawable/ui_gradientshape"
|
||||
>
|
||||
|
||||
<ImageButton
|
||||
<ImageButton
|
||||
android:id="@+id/toolbox_save"
|
||||
style="@style/toolboxButtonDrawable"
|
||||
android:src="@android:drawable/ic_menu_save"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/toolbox_map"
|
||||
style="@style/toolboxButton"
|
||||
style="@style/toolboxButtonTile"
|
||||
android:src="@drawable/ui_icon_map"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/toolbox_quickitems"
|
||||
style="@style/toolboxButton"
|
||||
style="@style/toolboxButtonTile"
|
||||
android:src="@drawable/ui_icon_equipment"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -30,10 +30,16 @@
|
||||
<item name="android:layout_height">@dimen/smalltext_buttonheight</item>
|
||||
</style>
|
||||
|
||||
<style name="toolboxButton">
|
||||
<style name="toolboxButtonTile">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
</style>
|
||||
|
||||
<style name="toolboxButtonDrawable">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:padding">0dp</item>
|
||||
</style>
|
||||
|
||||
<style name="traitsinfo_label" parent="android:Widget.TextView">
|
||||
<item name="android:layout_marginRight">10sp</item>
|
||||
|
||||
@@ -40,7 +40,8 @@ public final class AndorsTrailPreferences {
|
||||
public boolean enableUiAnimations = true;
|
||||
public int displayOverwriteSavegame = CONFIRM_OVERWRITE_SAVEGAME_ALWAYS;
|
||||
|
||||
public static void read(final Context androidContext, AndorsTrailPreferences dest) {
|
||||
public void read(final Context androidContext) {
|
||||
AndorsTrailPreferences dest = this;
|
||||
try {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(androidContext);
|
||||
dest.confirmRest = prefs.getBoolean("confirm_rest", true);
|
||||
|
||||
@@ -270,20 +270,16 @@ public final class Dialogs {
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void showPreferences(final Activity currentActivity) {
|
||||
Intent intent = new Intent(currentActivity, Preferences.class);
|
||||
currentActivity.startActivityForResult(intent, MainActivity.INTENTREQUEST_PREFERENCES);
|
||||
}
|
||||
|
||||
public static void showSave(final MainActivity mainActivity, final ControllerContext controllerContext, final WorldContext world) {
|
||||
public static boolean showSave(final Activity mainActivity, final ControllerContext controllerContext, final WorldContext world) {
|
||||
if (world.model.uiSelections.isInCombat) {
|
||||
mainActivity.showToast(mainActivity.getResources().getString(R.string.menu_save_saving_not_allowed_in_combat), Toast.LENGTH_SHORT);
|
||||
return;
|
||||
Toast.makeText(mainActivity, R.string.menu_save_saving_not_allowed_in_combat, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
controllerContext.gameRoundController.pause();
|
||||
Intent intent = new Intent(mainActivity, LoadSaveActivity.class);
|
||||
intent.setData(Uri.parse("content://com.gpl.rpg.AndorsTrail/save"));
|
||||
mainActivity.startActivityForResult(intent, MainActivity.INTENTREQUEST_SAVEGAME);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void showLoad(final Activity currentActivity) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@@ -13,6 +14,8 @@ import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class DebugInterface {
|
||||
private final ControllerContext controllerContext;
|
||||
@@ -37,7 +40,7 @@ public final class DebugInterface {
|
||||
world.model.player.damagePotential.set(99, 99);
|
||||
world.model.player.attackChance = 200;
|
||||
world.model.player.attackCost = 1;
|
||||
mainActivity.showToast("DEBUG: damagePotential=99, chance=200%, cost=1", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: damagePotential=99, chance=200%, cost=1", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
/*,new DebugButton("dmg=1", new OnClickListener() {
|
||||
@@ -45,7 +48,7 @@ public final class DebugInterface {
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.traits.combatTraits.set(1, 1);
|
||||
mainActivity.updateStatus();
|
||||
mainActivity.showToast("DEBUG: damagePotential=1", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: damagePotential=1", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})*/
|
||||
/*,new DebugButton("items", new OnClickListener() {
|
||||
@@ -65,7 +68,7 @@ public final class DebugInterface {
|
||||
world.model.player.inventory.addItem(world.itemTypes.getItemType("chaosreaper"));
|
||||
|
||||
mainActivity.updateStatus();
|
||||
mainActivity.showToast("DEBUG: added items", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: added items", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})*/
|
||||
/*new DebugButton("skills++", new OnClickListener() {
|
||||
@@ -80,7 +83,7 @@ public final class DebugInterface {
|
||||
}
|
||||
ActorStatsController.recalculatePlayerCombatTraits(world.model.player);
|
||||
updateStatus();
|
||||
showToast("DEBUG: all skills raised " + N + " levels", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: all skills raised " + N + " levels", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})*/
|
||||
/*,new DebugButton("bwm", new OnClickListener() {
|
||||
@@ -111,7 +114,7 @@ public final class DebugInterface {
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.addExperience(10000);
|
||||
mainActivity.updateStatus();
|
||||
mainActivity.showToast("DEBUG: given 10000 exp", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: given 10000 exp", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})*/
|
||||
,new DebugButton("reset", new OnClickListener() {
|
||||
@@ -120,7 +123,7 @@ public final class DebugInterface {
|
||||
for(PredefinedMap map : world.maps.getAllMaps()) {
|
||||
map.resetTemporaryData();
|
||||
}
|
||||
mainActivity.showToast("DEBUG: maps respawned", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: maps respawned", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("hp", new OnClickListener() {
|
||||
@@ -130,7 +133,7 @@ public final class DebugInterface {
|
||||
world.model.player.health.max = world.model.player.baseTraits.maxHP;
|
||||
controllerContext.actorStatsController.setActorMaxHealth(world.model.player);
|
||||
world.model.player.conditions.clear();
|
||||
mainActivity.showToast("DEBUG: hp set to max", Toast.LENGTH_SHORT);
|
||||
showToast(mainActivity, "DEBUG: hp set to max", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
/*
|
||||
@@ -175,6 +178,10 @@ public final class DebugInterface {
|
||||
});
|
||||
}
|
||||
|
||||
private void showToast(Context context, String msg, int duration) {
|
||||
Toast.makeText(context, msg, duration).show();
|
||||
}
|
||||
|
||||
private static class DebugButton {
|
||||
public final String text;
|
||||
public final OnClickListener listener;
|
||||
|
||||
@@ -54,7 +54,6 @@ public final class MainActivity extends Activity implements PlayerMovementListen
|
||||
public static final int INTENTREQUEST_ITEMINFO = 3;
|
||||
public static final int INTENTREQUEST_CONVERSATION = 4;
|
||||
public static final int INTENTREQUEST_LEVELUP = 6;
|
||||
public static final int INTENTREQUEST_PREFERENCES = 7;
|
||||
public static final int INTENTREQUEST_SAVEGAME = 8;
|
||||
public static final int INTENTREQUEST_BULKSELECT_BUY = 9;
|
||||
public static final int INTENTREQUEST_BULKSELECT_SELL = 10;
|
||||
@@ -138,13 +137,6 @@ public final class MainActivity extends Activity implements PlayerMovementListen
|
||||
case INTENTREQUEST_CONVERSATION:
|
||||
MovementController.refreshMonsterAggressiveness(world.model.currentMap, world.model.player);
|
||||
break;
|
||||
case INTENTREQUEST_PREFERENCES:
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
AndorsTrailPreferences preferences = app.getPreferences();
|
||||
AndorsTrailPreferences.read(this, preferences);
|
||||
world.tileManager.updatePreferences(preferences);
|
||||
dpad.updateVisibility(preferences);
|
||||
break;
|
||||
case INTENTREQUEST_SAVEGAME:
|
||||
if (resultCode != Activity.RESULT_OK) break;
|
||||
final int slot = data.getIntExtra("slot", 1);
|
||||
@@ -212,38 +204,6 @@ public final class MainActivity extends Activity implements PlayerMovementListen
|
||||
combatview.subscribe();
|
||||
activeConditions.subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(R.string.exit_to_menu)
|
||||
.setIcon(android.R.drawable.ic_menu_close_clear_cancel)
|
||||
.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem arg0) {
|
||||
MainActivity.this.finish();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
menu.add(R.string.menu_save)
|
||||
.setIcon(android.R.drawable.ic_menu_save)
|
||||
.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem arg0) {
|
||||
Dialogs.showSave(MainActivity.this, controllers, world);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
menu.add(R.string.menu_settings)
|
||||
.setIcon(android.R.drawable.ic_menu_preferences)
|
||||
.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem arg0) {
|
||||
Dialogs.showPreferences(MainActivity.this);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||
@@ -316,7 +276,7 @@ public final class MainActivity extends Activity implements PlayerMovementListen
|
||||
statusText.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void showToast(String msg, int duration) {
|
||||
private void showToast(String msg, int duration) {
|
||||
Toast t = null;
|
||||
if (lastToast != null) t = lastToast.get();
|
||||
if (t == null) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.widget.*;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
||||
import com.gpl.rpg.AndorsTrail.Dialogs;
|
||||
@@ -20,13 +21,10 @@ import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public final class StartScreenActivity extends Activity {
|
||||
|
||||
|
||||
public static final int INTENTREQUEST_PREFERENCES = 7;
|
||||
public static final int INTENTREQUEST_LOADGAME = 9;
|
||||
|
||||
private boolean hasExistingGame = false;
|
||||
@@ -41,9 +39,7 @@ public final class StartScreenActivity extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
final AndorsTrailPreferences preferences = app.getPreferences();
|
||||
AndorsTrailPreferences.read(this, preferences);
|
||||
app.setWindowParameters(this);
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.startscreen);
|
||||
|
||||
@@ -81,13 +77,13 @@ public final class StartScreenActivity extends Activity {
|
||||
startActivity(new Intent(StartScreenActivity.this, AboutActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
b = (Button) findViewById(R.id.startscreen_quit);
|
||||
b.setOnClickListener(new OnClickListener() {
|
||||
|
||||
b = (Button) findViewById(R.id.startscreen_preferences);
|
||||
b.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
//comfirmQuit();
|
||||
StartScreenActivity.this.finish();
|
||||
Intent intent = new Intent(StartScreenActivity.this, Preferences.class);
|
||||
startActivityForResult(intent, INTENTREQUEST_PREFERENCES);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -107,7 +103,7 @@ public final class StartScreenActivity extends Activity {
|
||||
final Resources res = getResources();
|
||||
TileManager tileManager = app.getWorld().tileManager;
|
||||
tileManager.setDensity(res);
|
||||
tileManager.updatePreferences(preferences);
|
||||
updatePreferences();
|
||||
app.getWorldSetup().startResourceLoader(res);
|
||||
|
||||
if (AndorsTrailApplication.DEVELOPMENT_FORCE_STARTNEWGAME) {
|
||||
@@ -120,7 +116,13 @@ public final class StartScreenActivity extends Activity {
|
||||
continueGame(false, Savegames.SLOT_QUICKSAVE, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updatePreferences() {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
AndorsTrailPreferences preferences = app.getPreferences();
|
||||
preferences.read(this);
|
||||
app.getWorld().tileManager.updatePreferences(preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
@@ -161,6 +163,9 @@ public final class StartScreenActivity extends Activity {
|
||||
final int slot = data.getIntExtra("slot", 1);
|
||||
continueGame(false, slot, null);
|
||||
break;
|
||||
case INTENTREQUEST_PREFERENCES:
|
||||
updatePreferences();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,21 +227,4 @@ public final class StartScreenActivity extends Activity {
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create().show();
|
||||
}
|
||||
|
||||
/*
|
||||
private void comfirmQuit() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.dialog_confirmexit_title)
|
||||
.setMessage(R.string.dialog_confirmexit_message)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
StartScreenActivity.this.finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create().show();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gpl.rpg.AndorsTrail.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
@@ -12,50 +13,57 @@ import android.widget.LinearLayout;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
||||
import com.gpl.rpg.AndorsTrail.Dialogs;
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.WorldMapController;
|
||||
import com.gpl.rpg.AndorsTrail.resource.tiles.TileManager;
|
||||
|
||||
public final class ToolboxView extends LinearLayout implements OnClickListener {
|
||||
private final WorldContext world;
|
||||
private final ControllerContext controllers;
|
||||
private final AndorsTrailPreferences preferences;
|
||||
private final Animation showAnimation;
|
||||
private final Animation hideAnimation;
|
||||
private final ImageButton toolbox_quickitems;
|
||||
private final ImageButton toolbox_map;
|
||||
private final ImageButton toolbox_save;
|
||||
private ImageButton toggleVisibility;
|
||||
private QuickitemView quickitemView;
|
||||
|
||||
|
||||
public ToolboxView(final Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivityContext(context);
|
||||
this.world = app.getWorld();
|
||||
this.preferences = app.getPreferences();
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivityContext(context);
|
||||
this.world = app.getWorld();
|
||||
this.controllers = app.getControllerContext();
|
||||
this.preferences = app.getPreferences();
|
||||
|
||||
inflate(context, R.layout.toolboxview, this);
|
||||
|
||||
inflate(context, R.layout.toolboxview, this);
|
||||
|
||||
this.showAnimation = AnimationUtils.loadAnimation(context, R.anim.showtoolbox);
|
||||
this.hideAnimation = AnimationUtils.loadAnimation(context, R.anim.hidetoolbox);
|
||||
this.hideAnimation.setAnimationListener(new AnimationListener() {
|
||||
@Override public void onAnimationStart(Animation animation) { }
|
||||
@Override public void onAnimationRepeat(Animation animation) { }
|
||||
@Override public void onAnimationEnd(Animation animation) {
|
||||
ToolboxView.this.setVisibility(View.GONE);
|
||||
}
|
||||
this.hideAnimation = AnimationUtils.loadAnimation(context, R.anim.hidetoolbox);
|
||||
this.hideAnimation.setAnimationListener(new AnimationListener() {
|
||||
@Override public void onAnimationStart(Animation animation) { }
|
||||
@Override public void onAnimationRepeat(Animation animation) { }
|
||||
@Override public void onAnimationEnd(Animation animation) {
|
||||
ToolboxView.this.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
toolbox_quickitems = (ImageButton)findViewById(R.id.toolbox_quickitems);
|
||||
toolbox_quickitems.setOnClickListener(this);
|
||||
toolbox_map = (ImageButton)findViewById(R.id.toolbox_map);
|
||||
toolbox_map.setOnClickListener(this);
|
||||
|
||||
toolbox_quickitems = (ImageButton)findViewById(R.id.toolbox_quickitems);
|
||||
toolbox_quickitems.setOnClickListener(this);
|
||||
toolbox_map = (ImageButton)findViewById(R.id.toolbox_map);
|
||||
toolbox_map.setOnClickListener(this);
|
||||
toolbox_save = (ImageButton)findViewById(R.id.toolbox_save);
|
||||
toolbox_save.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void registerToolboxViews(ImageButton toggleVisibility, QuickitemView quickitemView) {
|
||||
this.toggleVisibility = toggleVisibility;
|
||||
this.quickitemView = quickitemView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View btn) {
|
||||
Context context = getContext();
|
||||
@@ -64,9 +72,13 @@ public final class ToolboxView extends LinearLayout implements OnClickListener {
|
||||
} else if (btn == toolbox_map) {
|
||||
if (!WorldMapController.displayWorldMap(context, world)) return;
|
||||
setVisibility(View.GONE);
|
||||
} else if (btn == toolbox_save) {
|
||||
if (Dialogs.showSave((Activity)getContext(), controllers, world)) {
|
||||
setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void toggleQuickItemView() {
|
||||
if (quickitemView.getVisibility() == View.VISIBLE){
|
||||
quickitemView.setVisibility(View.GONE);
|
||||
@@ -91,11 +103,11 @@ public final class ToolboxView extends LinearLayout implements OnClickListener {
|
||||
setToolboxIcon(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateIcons() {
|
||||
setToolboxIcon(getVisibility() == View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
private void setToolboxIcon(boolean opened) {
|
||||
if (opened) {
|
||||
world.tileManager.setImageViewTileForUIIcon(toggleVisibility, TileManager.iconID_boxopened);
|
||||
|
||||
Reference in New Issue
Block a user