diff --git a/Sources/app/src/main/java/Common/BuildingManager.java b/Sources/app/src/main/java/Common/BuildingManager.java index 72355fa63e4251a82ffe970efebdd89a469da7da..cdc0034d8fab196ca0f8c96497b588cd8512a28f 100644 --- a/Sources/app/src/main/java/Common/BuildingManager.java +++ b/Sources/app/src/main/java/Common/BuildingManager.java @@ -11,6 +11,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import Structures.BuildingInfo; @@ -28,7 +29,6 @@ public class BuildingManager { if (BuildingManager.buildings == null) loadBuildings(); BuildingManager.buildings.remove(b); - BuildingManager.saveBuildings(); new File(save_dir, b.getName()).delete(); } @@ -36,7 +36,7 @@ public class BuildingManager { if (BuildingManager.buildings == null) loadBuildings(); BuildingManager.buildings.add(b); - BuildingManager.saveBuildings(); + BuildingManager.saveBuilding(b); } public static List<BuildingInfo> getBuildings() { @@ -51,6 +51,15 @@ public class BuildingManager { return BuildingManager.buildings.get(index); } + public static BuildingInfo getBuilding(String name) { + if (BuildingManager.buildings == null) + loadBuildings(); + for(BuildingInfo b: BuildingManager.buildings) + if (b.getName().trim().toLowerCase(Locale.ROOT).equals(name.trim().toLowerCase(Locale.ROOT))) + return b; + return null; + } + public static void saveBuilding(BuildingInfo building) { Toast.makeText(context, "saving "+building.getName(), Toast.LENGTH_SHORT).show(); new File(save_dir, building.getName()).delete(); diff --git a/Sources/app/src/main/java/Structures/BuildingInfo.java b/Sources/app/src/main/java/Structures/BuildingInfo.java index b03dc86a3e9056334c47bd8af8a4b60970d6146f..c5716d40b8a9fcaf92b9ba9757862ee77d4df704 100644 --- a/Sources/app/src/main/java/Structures/BuildingInfo.java +++ b/Sources/app/src/main/java/Structures/BuildingInfo.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.Objects; import Common.BuildingManager; @@ -32,7 +33,7 @@ public class BuildingInfo implements Serializable { public RoomInfo getRoom(String name) { for (RoomInfo ri : this.rooms) - if (ri.getName().equals(name)) + if (ri.getName().trim().toLowerCase(Locale.ROOT).equals(name.trim().toLowerCase(Locale.ROOT))) return ri; return null; } diff --git a/Sources/app/src/main/java/Structures/PathDoor.java b/Sources/app/src/main/java/Structures/PathDoor.java index a006307a70be594b0059a5f0282a73cc912530bc..879dfd77af54e5fe41b76c7b73d393edc175c84f 100644 --- a/Sources/app/src/main/java/Structures/PathDoor.java +++ b/Sources/app/src/main/java/Structures/PathDoor.java @@ -7,7 +7,7 @@ public class PathDoor extends PathInfo implements Serializable { super(PathType.DOOR); } - public PathDoor(RoomInfo destination) { - super(destination, PathType.DOOR); + public PathDoor(String name, RoomInfo destination) { + super(name, destination, PathType.DOOR); } } diff --git a/Sources/app/src/main/java/Structures/PathInfo.java b/Sources/app/src/main/java/Structures/PathInfo.java index 78dd67de405b84d23e785b5d5cb7a88d2a064ea5..2441879111ab01cf06f3133e6efa0dfc3a0eef75 100644 --- a/Sources/app/src/main/java/Structures/PathInfo.java +++ b/Sources/app/src/main/java/Structures/PathInfo.java @@ -2,12 +2,8 @@ package Structures; import java.io.Serializable; -enum PathType { - STAIRS, - DOOR -} - public class PathInfo implements Serializable { + String name = ""; PathType type = PathType.DOOR; RoomInfo destination; @@ -15,7 +11,8 @@ public class PathInfo implements Serializable { } - public PathInfo(RoomInfo destination) { + public PathInfo(String name, RoomInfo destination) { + this.name = name; this.destination = destination; } @@ -23,11 +20,16 @@ public class PathInfo implements Serializable { this.type = type; } - public PathInfo(RoomInfo destination, PathType type) { + public PathInfo(String name, RoomInfo destination, PathType type) { + this.name = name; this.destination = destination; this.type = type; } + public String getName() { + return name; + } + public PathType getType() { return type; } diff --git a/Sources/app/src/main/java/Structures/PathStairs.java b/Sources/app/src/main/java/Structures/PathStairs.java index 3137e69d94d7f9dbd26236fb41ab4430156e3926..388bd3e8b8ca59c2f19017a82856a8faac80be49 100644 --- a/Sources/app/src/main/java/Structures/PathStairs.java +++ b/Sources/app/src/main/java/Structures/PathStairs.java @@ -2,12 +2,6 @@ package Structures; import java.io.Serializable; -enum StairsDirection { - UP, - DOWN, - BOTH -} - public class PathStairs extends PathInfo implements Serializable { RoomInfo roomDown; StairsDirection direction = StairsDirection.BOTH; @@ -16,10 +10,11 @@ public class PathStairs extends PathInfo implements Serializable { super(PathType.STAIRS); } - public PathStairs(RoomInfo roomUp, RoomInfo roomDown, StairsDirection direction) { - super(roomUp, PathType.STAIRS); + public PathStairs(String name, RoomInfo roomUp, RoomInfo roomDown) { + super(name, roomUp, PathType.STAIRS); this.roomDown = roomDown; - this.direction = direction; + this.direction = (roomUp == null)? StairsDirection.DOWN: + ( (roomDown == null)? StairsDirection.UP : StairsDirection.BOTH ); } public RoomInfo getDestination(StairsDirection direction) { diff --git a/Sources/app/src/main/java/Structures/PathType.java b/Sources/app/src/main/java/Structures/PathType.java new file mode 100644 index 0000000000000000000000000000000000000000..399b4822ede67b65e6e168cc0733754431a9e00a --- /dev/null +++ b/Sources/app/src/main/java/Structures/PathType.java @@ -0,0 +1,6 @@ +package Structures; + +public enum PathType { + STAIRS, + DOOR +} diff --git a/Sources/app/src/main/java/Structures/RoomInfo.java b/Sources/app/src/main/java/Structures/RoomInfo.java index 30ba7bd6f3b76a6ed47a2738da027aa4d67437fc..0987b8160d3e45dd8c3162d3e2fcfb14e8130e56 100644 --- a/Sources/app/src/main/java/Structures/RoomInfo.java +++ b/Sources/app/src/main/java/Structures/RoomInfo.java @@ -3,6 +3,7 @@ package Structures; import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Objects; enum RoomType { @@ -14,6 +15,7 @@ public class RoomInfo implements Serializable { String name = "X"; RoomType type = RoomType.ROOM; List<ZoneInfo> zones = new ArrayList<>(); + List<PathInfo> paths = new ArrayList<>(); BuildingInfo building = null; public RoomInfo() { @@ -33,13 +35,20 @@ public class RoomInfo implements Serializable { } public List<ZoneInfo> getZones() { - return zones; + return this.zones; } public ZoneInfo getZone(int i) { return this.zones.get(i); } + public ZoneInfo getZone(String name) { + for (ZoneInfo z : this.zones) + if (z.getName().trim().toLowerCase(Locale.ROOT).equals(name.trim().toLowerCase(Locale.ROOT))) + return z; + return null; + } + public void addZone(ZoneInfo zone) { this.zones.add(zone); if (this.building != null) this.building.save(); @@ -50,6 +59,31 @@ public class RoomInfo implements Serializable { if (this.building != null) this.building.save(); } + public List<PathInfo> getPaths() { + return this.paths; + } + + public PathInfo getPath(int i) { + return this.paths.get(i); + } + + public PathInfo getPath(String name) { + for (PathInfo p : this.paths) + if (p.getName().trim().toLowerCase(Locale.ROOT).equals(name.trim().toLowerCase(Locale.ROOT))) + return p; + return null; + } + + public void addPath(PathInfo path) { + this.paths.add(path); + if (this.building != null) this.building.save(); + } + + public void removePath(PathInfo path) { + this.paths.remove(path); + if (this.building != null) this.building.save(); + } + public int getNbZones() { return this.zones.size(); } public String getName() { diff --git a/Sources/app/src/main/java/Structures/StairsDirection.java b/Sources/app/src/main/java/Structures/StairsDirection.java new file mode 100644 index 0000000000000000000000000000000000000000..a7aac3495af4b7b56f9ec3dda4a6c06d57acd0f4 --- /dev/null +++ b/Sources/app/src/main/java/Structures/StairsDirection.java @@ -0,0 +1,7 @@ +package Structures; + +public enum StairsDirection { + UP, + DOWN, + BOTH +} diff --git a/Sources/app/src/main/java/com/furwaz/roomview/BuildingActivity.java b/Sources/app/src/main/java/com/furwaz/roomview/BuildingActivity.java index 5ca19454deea0a757641288f2f84035531c11cf0..0cd6e34c53c2d757f147c94235fe0a89c9f264ee 100644 --- a/Sources/app/src/main/java/com/furwaz/roomview/BuildingActivity.java +++ b/Sources/app/src/main/java/com/furwaz/roomview/BuildingActivity.java @@ -5,6 +5,8 @@ import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; @@ -105,10 +107,33 @@ public class BuildingActivity extends AppCompatActivity { dialog.setView(popup); dialog.setOnShowListener(dialogInterface -> { + TextView r_err = popup.findViewById(R.id.room_input_error_msg); EditText r_name = popup.findViewById(R.id.input_room_name); Button validate_btn = popup.findViewById(R.id.btn_validate_room); Button cancel_btn = popup.findViewById(R.id.btn_cancel_room); + validate_btn.setEnabled(false); + r_err.setText(""); + r_name.addTextChangedListener(new TextWatcher() { + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void afterTextChanged(Editable editable) { + validate_btn.setEnabled(false); + r_err.setText(""); + String input = editable.toString(); + if (input.length() == 0) { + r_err.setText(getResources().getString(R.string.specify_room_name)); + return; + } + if (building.getRoom(input) != null) { + r_err.setText(getResources().getString(R.string.room_exists)); + return; + } + // everything is correct, display the button + validate_btn.setEnabled(true); + } + }); + cancel_btn.setOnClickListener(view -> { dialog.dismiss(); }); diff --git a/Sources/app/src/main/java/com/furwaz/roomview/MainActivity.java b/Sources/app/src/main/java/com/furwaz/roomview/MainActivity.java index 741b1f5ab549f3d9dd80784c3271ed5929ed8460..fa296d2a662e5b66e33532ea3c0ed1e954ad8533 100644 --- a/Sources/app/src/main/java/com/furwaz/roomview/MainActivity.java +++ b/Sources/app/src/main/java/com/furwaz/roomview/MainActivity.java @@ -5,7 +5,10 @@ import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; import android.view.Gravity; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.Window; @@ -102,10 +105,33 @@ public class MainActivity extends AppCompatActivity { dialog.setView(popup); dialog.setOnShowListener(dialogInterface -> { + TextView b_err = popup.findViewById(R.id.building_input_error_msg); EditText b_name = popup.findViewById(R.id.input_building_name); Button validate_btn = popup.findViewById(R.id.btn_validate_building); Button cancel_btn = popup.findViewById(R.id.btn_cancel_building); + validate_btn.setEnabled(false); + b_err.setText(""); + b_name.addTextChangedListener(new TextWatcher() { + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void afterTextChanged(Editable editable) { + validate_btn.setEnabled(false); + b_err.setText(""); + String input = editable.toString(); + if (input.length() == 0) { + b_err.setText(getResources().getString(R.string.specify_building_name)); + return; + } + if (BuildingManager.getBuilding(input) != null) { + b_err.setText(getResources().getString(R.string.building_exists)); + return; + } + // everything is correct, display the button + validate_btn.setEnabled(true); + } + }); + cancel_btn.setOnClickListener(view -> { dialog.dismiss(); }); diff --git a/Sources/app/src/main/java/com/furwaz/roomview/RoomActivity.java b/Sources/app/src/main/java/com/furwaz/roomview/RoomActivity.java index 9cff2175775ad39bdc18e661985862312953106d..3e63bcb695da720d20543a91b2cac36927b70a25 100644 --- a/Sources/app/src/main/java/com/furwaz/roomview/RoomActivity.java +++ b/Sources/app/src/main/java/com/furwaz/roomview/RoomActivity.java @@ -3,80 +3,143 @@ package com.furwaz.roomview; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import android.graphics.Color; import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.SearchView; +import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + import Common.BuildingManager; import Common.InfoBinding; import Structures.BuildingInfo; +import Structures.PathDoor; +import Structures.PathInfo; +import Structures.PathStairs; +import Structures.PathType; import Structures.RoomInfo; +import Structures.StairsDirection; import Structures.ZoneInfo; import Views.InfoAdapter; public class RoomActivity extends AppCompatActivity { + BuildingInfo building = null; RoomInfo room = null; - InfoAdapter zone_adapter = null; + InfoAdapter<ZoneInfo> zone_adapter = null; + InfoAdapter<PathInfo> pathways_adapter = null; + boolean isViewInPathwaysMode = false; + + static String PATHWAY_DOOR = ""; + static String PATHWAY_STAIRS = ""; + + protected String beautifyString(String str) { + return str.substring(0, 1).toUpperCase(Locale.ROOT) + + str.substring(1, str.length()).toLowerCase(Locale.ROOT); + } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_room); + PATHWAY_DOOR = getResources().getString(R.string.door); + PATHWAY_STAIRS = getResources().getString(R.string.stairs); + int buildingIndex = getIntent().getExtras().getInt("building"); int roomIndex = getIntent().getExtras().getInt("room"); - BuildingInfo building = BuildingManager.getBuilding(buildingIndex); + building = BuildingManager.getBuilding(buildingIndex); room = building.getRoom(roomIndex); if (room == null) { Toast.makeText(this, "Error : Building is null !", Toast.LENGTH_SHORT).show(); return; } + View pathways_btn = findViewById(R.id.btn_tab_pathways); + pathways_btn.setOnClickListener(view -> switchToPathways()); + + View zones_btn = findViewById(R.id.btn_tab_zones); + zones_btn.setOnClickListener(view -> switchToZones()); + ListView room_lv = findViewById(R.id.zone_list); LinearLayout noDataLayout = findViewById(R.id.no_zone_layout); - zone_adapter = new InfoAdapter(this, room.getZones(), noDataLayout, R.layout.zone_tile); + zone_adapter = new InfoAdapter<ZoneInfo>(this, room.getZones(), noDataLayout, R.layout.zone_tile); room_lv.setAdapter(zone_adapter); - zone_adapter.setOnRemoveListener(param -> { - room.removeZone((ZoneInfo) param); - return null; - }); + zone_adapter.setOnRemoveListener(param -> { room.removeZone((ZoneInfo) param); return null; }); + zone_adapter.setOnEditListener(param -> null); + zone_adapter.setOnViewListener(param -> null); - zone_adapter.setOnEditListener(param -> { - return null; + zone_adapter.setBindings(new InfoBinding[]{ + new InfoBinding(param -> ((ZoneInfo) param).getName(), R.id.zone_name) }); - zone_adapter.setOnViewListener(param -> { - return null; - }); + ListView pathways_lv = findViewById(R.id.pathways_list); + LinearLayout noPathwaysLayout = findViewById(R.id.no_pathways_layout); - zone_adapter.setBindings(new InfoBinding[]{ - new InfoBinding(param -> ((ZoneInfo) param).getName(), R.id.zone_name) + pathways_adapter = new InfoAdapter<PathInfo>(this, room.getPaths(), noPathwaysLayout, R.layout.pathway_tile); + pathways_lv.setAdapter(pathways_adapter); + + pathways_adapter.setOnRemoveListener(param -> { room.removePath((PathInfo) param); return null; }); + pathways_adapter.setOnEditListener(param -> null); + pathways_adapter.setOnViewListener(param -> null); + + pathways_adapter.setBindings(new InfoBinding[]{ + new InfoBinding(param -> ((PathInfo) param).getName(), R.id.pathway_name), + new InfoBinding(param -> beautifyString(((PathInfo) param).getType().toString()), R.id.pathway_type), + new InfoBinding(param -> { + PathInfo path = ((PathInfo) param); + if (path.getType() == PathType.DOOR) { + return path.getDestination().getName(); + } else { + PathStairs stairs = (PathStairs) path; + switch (stairs.getDirection()) { + case UP: return stairs.getDestination(StairsDirection.UP).getName(); + case DOWN: return stairs.getDestination(StairsDirection.DOWN).getName(); + default: + return stairs.getDestination(StairsDirection.UP).getName() + + ", " + + stairs.getDestination(StairsDirection.DOWN).getName(); + } + } + }, R.id.pathway_dest) }); - SearchView building_sv = findViewById(R.id.zone_search); - building_sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + SearchView search_sv = findViewById(R.id.list_search); + search_sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { public boolean onQueryTextSubmit(String s) { return true; } - public boolean onQueryTextChange(String s) { - zone_adapter.setSearchQuery(s); - room_lv.setAdapter(zone_adapter); + if (isViewInPathwaysMode) { + pathways_adapter.setSearchQuery(s); + pathways_lv.setAdapter(pathways_adapter); + } else { + zone_adapter.setSearchQuery(s); + room_lv.setAdapter(zone_adapter); + } return true; } }); ImageButton add_btn = findViewById(R.id.add_zone_btn); add_btn.setOnClickListener(view -> { - showAddZonePopup(view); + if (isViewInPathwaysMode) showAddPathwayPopup(view); + else showAddZonePopup(view); }); TextView room_tv_name = findViewById(R.id.room_name); @@ -87,6 +150,47 @@ public class RoomActivity extends AppCompatActivity { protected void onResume() { super.onResume(); zone_adapter.setData(room.getZones()); + pathways_adapter.setData(room.getPaths()); + } + + protected void switchToPathways() { + isViewInPathwaysMode = true; + disableTabButton(R.id.btn_tab_zones); + enableTabButton(R.id.btn_tab_pathways); + findViewById(R.id.pathways_tab_view).setVisibility(View.VISIBLE); + findViewById(R.id.zones_tab_view).setVisibility(View.GONE); + } + + protected void switchToZones() { + isViewInPathwaysMode = false; + disableTabButton(R.id.btn_tab_pathways); + enableTabButton(R.id.btn_tab_zones); + findViewById(R.id.pathways_tab_view).setVisibility(View.GONE); + findViewById(R.id.zones_tab_view).setVisibility(View.VISIBLE); + } + + protected void enableTabButton(int id) { + TextView tv = findViewById(id); + tv.setTextColor(getResources().getColor(R.color.blue_500, getTheme())); + tv.setBackgroundColor(getResources().getColor(R.color.slate_200, getTheme())); + int padding = (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + 10f, + getResources().getDisplayMetrics() + ); + tv.setPadding(padding, padding, padding, padding); + } + + protected void disableTabButton(int id) { + TextView tv = findViewById(id); + tv.setTextColor(getResources().getColor(R.color.slate_400, getTheme())); + tv.setBackgroundColor(getResources().getColor(R.color.slate_100, getTheme())); + int padding = (int) TypedValue.applyDimension( + TypedValue.COMPLEX_UNIT_DIP, + 12f, + getResources().getDisplayMetrics() + ); + tv.setPadding(padding, padding, padding, padding); } protected void showAddZonePopup(View v) { @@ -97,17 +201,129 @@ public class RoomActivity extends AppCompatActivity { dialog.setView(popup); dialog.setOnShowListener(dialogInterface -> { - EditText r_name = popup.findViewById(R.id.input_zone_name); + TextView z_err = popup.findViewById(R.id.zone_input_error_msg); + EditText z_name = popup.findViewById(R.id.input_zone_name); Button validate_btn = popup.findViewById(R.id.btn_validate_room); Button cancel_btn = popup.findViewById(R.id.btn_cancel_room); + validate_btn.setEnabled(false); + z_err.setText(""); + z_name.addTextChangedListener(new TextWatcher() { + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void afterTextChanged(Editable editable) { + validate_btn.setEnabled(false); + z_err.setText(""); + String input = editable.toString(); + if (input.length() == 0) { + z_err.setText(getResources().getString(R.string.specify_zone_name)); + return; + } + if (room.getZone(input) != null) { + z_err.setText(getResources().getString(R.string.zone_exists)); + return; + } + // everything is correct, display the button + validate_btn.setEnabled(true); + } + }); + cancel_btn.setOnClickListener(view -> { dialog.dismiss(); }); validate_btn.setOnClickListener(view -> { - room.addZone(new ZoneInfo(r_name.getText().toString())); // TODO + room.addZone(new ZoneInfo(z_name.getText().toString())); + zone_adapter.setData(room.getZones()); + dialog.dismiss(); + }); + }); + dialog.show(); + } + + protected void showAddPathwayPopup(View v) { + AlertDialog.Builder builder = new AlertDialog.Builder(RoomActivity.this); + AlertDialog dialog = builder.create(); + LayoutInflater factory = LayoutInflater.from(RoomActivity.this); + View popup = factory.inflate(R.layout.add_pathway_popup, null); + dialog.setView(popup); + + dialog.setOnShowListener(dialogInterface -> { + TextView p_err = popup.findViewById(R.id.pathway_input_error_msg); + EditText p_name = popup.findViewById(R.id.input_pathway_name); + Button validate_btn = popup.findViewById(R.id.btn_validate_room); + Button cancel_btn = popup.findViewById(R.id.btn_cancel_room); + + validate_btn.setEnabled(false); + p_err.setText(""); + p_name.addTextChangedListener(new TextWatcher() { + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {} + public void afterTextChanged(Editable editable) { + validate_btn.setEnabled(false); + p_err.setText(""); + String input = editable.toString(); + if (input.length() == 0) { + p_err.setText(getResources().getString(R.string.specify_pathway_name)); + return; + } + if (room.getPath(input) != null) { + p_err.setText(getResources().getString(R.string.pathway_exists)); + return; + } + // everything is correct, display the button + validate_btn.setEnabled(true); + } + }); + + Spinner sp_type = dialog.findViewById(R.id.pathway_type); + String[] sp_type_items = new String[]{PATHWAY_DOOR, PATHWAY_STAIRS}; + sp_type.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, sp_type_items)); + + Spinner sp_dest_up = dialog.findViewById(R.id.pathway_dest_up); + Spinner sp_dest_down = dialog.findViewById(R.id.pathway_dest_down); + + List<String> names = new ArrayList<>(); + names.add("<"+getResources().getString(R.string.none)+">"); + for(RoomInfo r : building.getRooms()) names.add(r.getName()); + + String[] sp_dest_items = new String[names.size()]; + for (int i = 0; i < names.size(); i++) sp_dest_items[i] = names.get(i); + + sp_dest_up.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, sp_dest_items)); + sp_dest_down.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, sp_dest_items)); + + sp_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { + if (adapterView.getAdapter().getItem(i) == PATHWAY_DOOR) { + dialog.findViewById(R.id.dest_down_layout).setVisibility(View.GONE); + dialog.findViewById(R.id.pathway_dest_down_txt).setVisibility(View.GONE); + ((TextView) dialog.findViewById(R.id.pathway_dest_up_txt)).setText(R.string.pathway_destination); + } else { + dialog.findViewById(R.id.dest_down_layout).setVisibility(View.VISIBLE); + dialog.findViewById(R.id.pathway_dest_down_txt).setVisibility(View.VISIBLE); + ((TextView) dialog.findViewById(R.id.pathway_dest_down_txt)).setText(R.string.pathway_destination_down); + ((TextView) dialog.findViewById(R.id.pathway_dest_up_txt)).setText(R.string.pathway_destination_up); + } + } + public void onNothingSelected(AdapterView<?> adapterView) {} + }); + + cancel_btn.setOnClickListener(view -> { + dialog.dismiss(); + }); + + validate_btn.setOnClickListener(view -> { + RoomInfo dest_up = building.getRoom(sp_dest_up.getSelectedItem().toString()); + RoomInfo dest_down = building.getRoom(sp_dest_down.getSelectedItem().toString()); + + if (sp_type.getSelectedItem() == PATHWAY_DOOR) { // door + room.addPath(new PathDoor(p_name.getText().toString(), dest_up)); + } else { // stairs + room.addPath(new PathStairs(p_name.getText().toString(), dest_up, dest_down)); + } zone_adapter.setData(room.getZones()); + pathways_adapter.setData(room.getPaths()); dialog.dismiss(); }); }); diff --git a/Sources/app/src/main/res/drawable/ic_baseline_add_circle_24.xml b/Sources/app/src/main/res/drawable/ic_baseline_add_circle_24.xml index c3e7535977d195bc1fc110352510e16f69f12344..7c5a5e2b6256a1c2a9fa5c1c3879ad8664c8d7db 100644 --- a/Sources/app/src/main/res/drawable/ic_baseline_add_circle_24.xml +++ b/Sources/app/src/main/res/drawable/ic_baseline_add_circle_24.xml @@ -1,5 +1,5 @@ -<vector android:height="80dp" android:tint="@color/blue_500" +<vector android:height="70dp" android:tint="@color/blue_500" android:viewportHeight="24" android:viewportWidth="24" - android:width="80dp" xmlns:android="http://schemas.android.com/apk/res/android"> + android:width="70dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="@color/blue_500" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM17,13h-4v4h-2v-4L7,13v-2h4L11,7h2v4h4v2z"/> </vector> diff --git a/Sources/app/src/main/res/layout/activity_room.xml b/Sources/app/src/main/res/layout/activity_room.xml index e3c60fc30bc9a853114e99b6909f26c4654de819..84289c1a503f463725fa2e661fd94ef85edac70b 100644 --- a/Sources/app/src/main/res/layout/activity_room.xml +++ b/Sources/app/src/main/res/layout/activity_room.xml @@ -27,6 +27,53 @@ android:layout_height="match_parent" android:background="@color/blue_500" android:orientation="vertical"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="@color/blue_500" + android:gravity="bottom"> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="0dp" + android:layout_weight="1" + android:orientation="horizontal" + android:gravity="center"> + + <TextView + android:id="@+id/btn_tab_pathways" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/slate_100" + android:text="@string/pathways" + android:textColor="@color/slate_400" + android:textStyle="bold" + android:textAlignment="center" + android:textSize="20dp" + android:padding="12dp" + android:clickable="true"/> + </LinearLayout> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="0dp" + android:layout_weight="1" + android:orientation="horizontal" + android:gravity="center"> + <TextView + android:id="@+id/btn_tab_zones" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/slate_200" + android:text="@string/zones" + android:textColor="@color/blue_500" + android:padding="10dp" + android:textStyle="bold" + android:textAlignment="center" + android:textSize="20dp" + android:clickable="true"/> + </LinearLayout> + + </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" @@ -34,65 +81,104 @@ android:background="@color/slate_200" android:layout_marginBottom="6dp" android:paddingLeft="10dp" - android:paddingRight="10dp"> - <TextView + android:paddingRight="10dp" + android:gravity="right"> + <SearchView + android:id="@+id/list_search" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:gravity="center" - android:textSize="20sp" - android:textStyle="bold" - android:textColor="@color/slate_800" - android:text="@string/zones" /> + android:layout_height="wrap_content" + android:layout_gravity="end" + android:searchIcon="@drawable/ic_search_black" /> + </LinearLayout> + <LinearLayout + android:id="@+id/zones_tab_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" + android:background="@color/slate_50"> <LinearLayout + android:id="@+id/no_zone_layout" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="end"> - <SearchView - android:id="@+id/zone_search" - android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="vertical" + android:visibility="visible" + android:gravity="center" + android:background="@color/slate_50" > + <TextView + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="end" - android:searchIcon="@drawable/ic_search_black" /> + android:text="@string/no_zones" + android:textColor="@color/slate_400" + android:textStyle="bold" + android:textAlignment="center" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:textSize="24sp"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/no_zones_desc" + android:textColor="@color/slate_300" + android:textStyle="normal" + android:textAlignment="center" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:textSize="20sp"/> </LinearLayout> + <ListView + android:id="@+id/zone_list" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/slate_50" + android:divider="@null" + android:dividerHeight="0dp" + android:padding="10dp"/> </LinearLayout> <LinearLayout - android:id="@+id/no_zone_layout" + android:id="@+id/pathways_tab_view" + android:visibility="gone" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:visibility="visible" - android:gravity="center" - android:background="@color/slate_50" > - <TextView + android:orientation="horizontal" + android:background="@color/slate_50"> + <LinearLayout + android:id="@+id/no_pathways_layout" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/no_zones" - android:textColor="@color/slate_400" - android:textStyle="bold" - android:textAlignment="center" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" - android:textSize="24sp"/> - <TextView + android:layout_height="match_parent" + android:orientation="vertical" + android:visibility="visible" + android:gravity="center" + android:background="@color/slate_50" > + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/no_pathways" + android:textColor="@color/slate_400" + android:textStyle="bold" + android:textAlignment="center" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:textSize="24sp"/> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/no_pathways_desc" + android:textColor="@color/slate_300" + android:textStyle="normal" + android:textAlignment="center" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:textSize="20sp"/> + </LinearLayout> + <ListView + android:id="@+id/pathways_list" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/no_zones_desc" - android:textColor="@color/slate_300" - android:textStyle="normal" - android:textAlignment="center" - android:layout_marginStart="20dp" - android:layout_marginEnd="20dp" - android:textSize="20sp"/> + android:layout_height="match_parent" + android:background="@color/slate_50" + android:divider="@null" + android:dividerHeight="0dp" + android:padding="10dp"/> </LinearLayout> - <ListView - android:id="@+id/zone_list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/slate_50" - android:divider="@null" - android:dividerHeight="0dp" - android:padding="10dp"/> </LinearLayout> </LinearLayout> diff --git a/Sources/app/src/main/res/layout/add_building_popup.xml b/Sources/app/src/main/res/layout/add_building_popup.xml index 69c19f05f3e27237e4d355f66c2e660694564e19..24f6f0b5bb3332114632a45824588d7a47a83f75 100644 --- a/Sources/app/src/main/res/layout/add_building_popup.xml +++ b/Sources/app/src/main/res/layout/add_building_popup.xml @@ -43,6 +43,17 @@ android:textStyle="bold" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"/> + <TextView + android:id="@+id/building_input_error_msg" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="start" + android:textColor="@color/red_500" + android:textSize="12sp" + android:textStyle="normal" + android:text="" + android:layout_marginStart="14dp" + android:layout_marginEnd="10dp"/> <LinearLayout android:layout_width="match_parent" diff --git a/Sources/app/src/main/res/layout/add_pathway_popup.xml b/Sources/app/src/main/res/layout/add_pathway_popup.xml new file mode 100644 index 0000000000000000000000000000000000000000..c58b8d4ce26f17aaab82dc15b3875b281ceb394a --- /dev/null +++ b/Sources/app/src/main/res/layout/add_pathway_popup.xml @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:background="@color/slate_50"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="@color/blue_500" + android:layout_marginBottom="20dp"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/slate_200" + android:text="@string/new_pathway" + android:textColor="@color/blue_500" + android:textSize="20sp" + android:layout_marginBottom="4dp" + android:textStyle="bold" + android:padding="10dp"/> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="10dp"> + <EditText + android:id="@+id/input_pathway_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="text" + android:hint="@string/pathway_name" + android:textColorHint="@color/slate_300" + android:textColor="@color/slate_500" + android:backgroundTint="@color/blue_500" + android:textSize="20sp" + android:textStyle="bold"/> + <TextView + android:id="@+id/pathway_input_error_msg" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="start" + android:textColor="@color/red_500" + android:textSize="12sp" + android:textStyle="normal" + android:text="" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/slate_700" + android:textSize="16dp" + android:textStyle="normal" + android:text="@string/pathway_type" + android:paddingTop="20dp" + android:paddingBottom="4dp"/> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="@color/blue_500" + android:paddingBottom="4dp"> + <Spinner + android:id="@+id/pathway_type" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/slate_100" + android:text="@string/new_pathway" + android:textColor="@color/slate_800" + android:textSize="20sp" + android:textStyle="bold"/> + </LinearLayout> + + <TextView + android:id="@+id/pathway_dest_up_txt" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/slate_700" + android:textSize="16sp" + android:textStyle="normal" + android:text="@string/pathway_destination_up" + android:paddingTop="20dp" + android:paddingBottom="4dp"/> + <LinearLayout + android:id="@+id/dest_up_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="@color/blue_500" + android:paddingBottom="4dp"> + <Spinner + android:id="@+id/pathway_dest_up" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/slate_100" + android:text="@string/new_pathway" + android:textColor="@color/slate_800" + android:textSize="20sp" + android:textStyle="bold"/> + </LinearLayout> + + <TextView + android:visibility="gone" + android:id="@+id/pathway_dest_down_txt" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/slate_700" + android:textSize="16sp" + android:textStyle="normal" + android:text="@string/pathway_destination_down" + android:paddingTop="20dp" + android:paddingBottom="4dp"/> + <LinearLayout + android:visibility="gone" + android:id="@+id/dest_down_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:background="@color/blue_500" + android:paddingBottom="4dp"> + <Spinner + android:id="@+id/pathway_dest_down" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/slate_100" + android:text="@string/new_pathway" + android:textColor="@color/slate_800" + android:textSize="20sp" + android:textStyle="bold"/> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginTop="20dp" + android:padding="8dp"> + + <Button + android:id="@+id/btn_cancel_room" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@color/red_500" + style="@style/Widget.AppCompat.Button.Borderless" + android:text="@string/cancel"/> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="right"> + <Button + android:id="@+id/btn_validate_room" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:backgroundTint="@color/blue_500" + android:text="@string/create"/> + </LinearLayout> + </LinearLayout> + </LinearLayout> +</RelativeLayout> \ No newline at end of file diff --git a/Sources/app/src/main/res/layout/add_room_popup.xml b/Sources/app/src/main/res/layout/add_room_popup.xml index 7142aac0fe0bef613681f179d6f15ba0f62768aa..3c6ee5f997eb4fa76e378b277cda84a9bf3fb10f 100644 --- a/Sources/app/src/main/res/layout/add_room_popup.xml +++ b/Sources/app/src/main/res/layout/add_room_popup.xml @@ -43,6 +43,17 @@ android:textStyle="bold" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"/> + <TextView + android:id="@+id/room_input_error_msg" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="start" + android:textColor="@color/red_500" + android:textSize="12sp" + android:textStyle="normal" + android:text="" + android:layout_marginStart="14dp" + android:layout_marginEnd="10dp"/> <LinearLayout android:layout_width="match_parent" diff --git a/Sources/app/src/main/res/layout/add_zone_popup.xml b/Sources/app/src/main/res/layout/add_zone_popup.xml index 713153b18032b6ce9eb96e16dad7f2648825a2ff..420e6dcf847c40aa959fac763126a236fe3c6db1 100644 --- a/Sources/app/src/main/res/layout/add_zone_popup.xml +++ b/Sources/app/src/main/res/layout/add_zone_popup.xml @@ -43,6 +43,17 @@ android:textStyle="bold" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"/> + <TextView + android:id="@+id/zone_input_error_msg" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="start" + android:textColor="@color/red_500" + android:textSize="12sp" + android:textStyle="normal" + android:text="" + android:layout_marginStart="14dp" + android:layout_marginEnd="10dp"/> <LinearLayout android:layout_width="match_parent" diff --git a/Sources/app/src/main/res/layout/pathway_tile.xml b/Sources/app/src/main/res/layout/pathway_tile.xml new file mode 100644 index 0000000000000000000000000000000000000000..5defbbf179a5403499e6a29839c8282a30a40307 --- /dev/null +++ b/Sources/app/src/main/res/layout/pathway_tile.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingBottom="10dp"> + <LinearLayout + android:id="@+id/tile_box" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="10dp" + android:background="@drawable/round_bg" + tools:ignore="MissingConstraints"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + <TextView + android:id="@+id/pathway_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textStyle="bold" + android:text="Room name" + android:textSize="20sp" + android:textColor="@color/blue_500" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="right"> + <TextView + android:id="@+id/pathway_type" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textStyle="normal" + android:text="X" + android:textSize="18sp" + android:textColor="@color/slate_500" /> + </LinearLayout> + </LinearLayout> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textStyle="normal" + android:text="@string/to" + android:layout_marginEnd="4dp" + android:textSize="16sp" + android:textColor="@color/slate_500" /> + <TextView + android:id="@+id/pathway_dest" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textStyle="normal" + android:text="X" + android:layout_marginEnd="20dp" + android:textSize="16sp" + android:textColor="@color/slate_500" /> + </LinearLayout> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginTop="10dp"> + <Button + android:id="@+id/tile_remove" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:backgroundTint="@color/red_500" + android:text="@string/remove" + android:textSize="16sp" + android:textColor="@color/slate_50" + android:textStyle="normal"/> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="right"> + <Button + android:id="@+id/tile_edit" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:backgroundTint="@color/blue_500" + android:text="@string/edit" + android:textSize="16sp" + android:textColor="@color/slate_50" + android:textStyle="normal" /> + </LinearLayout> + </LinearLayout> + </LinearLayout> +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/Sources/app/src/main/res/values-fr/strings.xml b/Sources/app/src/main/res/values-fr/strings.xml index 917be1eb369ddff07a0ad05a7f6cbcfbfd7327be..c74c2cb94cfe09abbd5b899a2acb905724920ab2 100644 --- a/Sources/app/src/main/res/values-fr/strings.xml +++ b/Sources/app/src/main/res/values-fr/strings.xml @@ -18,4 +18,27 @@ <string name="room_name">Nom de la pièce ...</string> <string name="no_zones">Pas de zones</string> <string name="no_zones_desc">Appuyez sur l\'icône + pour ajouter une zone</string> + <string name="doors">Portes</string> + <string name="new_zone">Nouvelle zone</string> + <string name="zone_name">Nom de la zone ...</string> + <string name="no_pathways">Pas de chemins</string> + <string name="no_pathways_desc">Appuyez sur l\'icône + pour ajouter un chemin</string> + <string name="pathway_name">Nom du chemin ...</string> + <string name="new_pathway">Nouveau chemin</string> + <string name="pathway_destination_down">Destination du chemin (haut)</string> + <string name="pathway_destination_up">Destination du chemin (bas)</string> + <string name="pathway_destination">Destination du chemin</string> + <string name="pathway_type">Type de chemin</string> + <string name="none">Aucun(e)</string> + <string name="to">Vers</string> + <string name="door">Porte</string> + <string name="stairs">Escaliers</string> + <string name="specify_building_name">Spécifiez un nom de bâtiment</string> + <string name="building_exists">Le bâtiment existe déjà</string> + <string name="specify_room_name">Spécifiez un nom de pièce</string> + <string name="room_exists">La pièce existe déjà</string> + <string name="specify_zone_name">Spécifiez un nom de zone</string> + <string name="zone_exists">La zone existe déjà</string> + <string name="specify_pathway_name">Spécifiez un nom de chemin</string> + <string name="pathway_exists">le chemin existe déjà</string> </resources> \ No newline at end of file diff --git a/Sources/app/src/main/res/values/strings.xml b/Sources/app/src/main/res/values/strings.xml index 4a3bd2b8693629e6e8d886d927ae745ec37d0008..2fab35ed7d096ab1f6964441cc03351ec7ee3aa6 100644 --- a/Sources/app/src/main/res/values/strings.xml +++ b/Sources/app/src/main/res/values/strings.xml @@ -21,4 +21,24 @@ <string name="doors">Doors</string> <string name="new_zone">New zone</string> <string name="zone_name">Zone name ...</string> + <string name="no_pathways">No pathways</string> + <string name="no_pathways_desc">Click on the + icon to add a pathway</string> + <string name="pathway_name">Pathway name ...</string> + <string name="new_pathway">New pathway</string> + <string name="pathway_destination_down">Pathway destination (down):</string> + <string name="pathway_destination_up">Pathway destination (up):</string> + <string name="pathway_destination">Pathway destination</string> + <string name="pathway_type">Pathway type</string> + <string name="none">None</string> + <string name="to">To</string> + <string name="door">Door</string> + <string name="stairs">Stairs</string> + <string name="specify_building_name">Specify a building name</string> + <string name="building_exists">Building already exists</string> + <string name="specify_room_name">Specify a room name</string> + <string name="room_exists">Room already exists</string> + <string name="specify_zone_name">Specify a zone name</string> + <string name="zone_exists">Zone already exists</string> + <string name="specify_pathway_name">Specify a pathway name</string> + <string name="pathway_exists">Pathway already exists</string> </resources> \ No newline at end of file diff --git a/conception/diag_class.puml b/conception/diag_class.puml index c45fca5b665caf0af53c26b7398c716f0695e23c..94be1a28f347ee7f68c2cc88cb6db26453eea8aa 100644 --- a/conception/diag_class.puml +++ b/conception/diag_class.puml @@ -113,9 +113,14 @@ class Room { + getZone(i: int): Zone + addZone(z: Zone): void + removeZone(z: Zone): void + + getPaths(): List<Path> + + getPath(i: int): path + + addPath(p: Path): void + + removePath(p: Path): void } Room "1" --> "1" RoomType: - type Room "1" --> "*" Zone: - zones +Room "1" --> "*" Path: - paths enum Direction { @@ -165,7 +170,6 @@ class Building { + getNbRooms(): int } Building "1" -> "*" Room: - rooms -Zone "1" --> "*" Path: - paths class AppManager { diff --git a/conception/diag_class/Diagramme de classe.png b/conception/diag_class/Diagramme de classe.png index a6944f8b8c8ebcec360c3df9eb8cd9690d00196c..48c48b71e9f90af48374b8102d9e494ef8f5c822 100644 Binary files a/conception/diag_class/Diagramme de classe.png and b/conception/diag_class/Diagramme de classe.png differ