public class UniformCost extends androidx.fragment.app.Fragment implements iUniformCost
Fragment
subclass.Modifier and Type | Class and Description |
---|---|
private class |
UniformCost.ButtonActions
Implementation of the actions for each button.
|
Modifier and Type | Field and Description |
---|---|
private int |
actualStep |
private int |
actualX |
private int |
actualY |
private ArrayList<String> |
biomes |
private android.widget.EditText[][] |
board |
private android.widget.Button |
btnStartAlgorithm |
private UniformCost.ButtonActions |
buttonActions |
private CharacterItem |
character |
private android.graphics.drawable.Drawable |
characterIcon |
private ArrayList<Integer> |
codes |
private ArrayList<Integer> |
colors |
private String |
contentFile |
private static String |
DOWN |
private ArrayList<String> |
expansionOrder |
private int |
finalX |
private int |
finalY |
private int |
initialX |
private int |
initialY |
private static String |
LEFT |
private int[][] |
mapValues |
private HeuristicPathTree.Node[][] |
nodes |
private int |
pathColor |
private static String |
RIGHT |
private android.widget.SeekBar |
sbRefreshBar |
(package private) float |
textSize |
private ResolverUniformCostThread |
thread |
private android.widget.TableLayout |
tlTableMap |
private HeuristicPathTree |
tree |
private android.widget.TextView |
tvRefreshRate |
private static String |
UP |
private long |
updateTime |
private String |
updateTimeText |
Constructor and Description |
---|
UniformCost()
Empty constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
createTable(int[][] mapValues)
The creation of the table with each tile as a text view and letters and numbers
for the first column and row.
|
void |
drawPath(HeuristicPathTree heuristicPathTree)
Method to control the whole drawing of the path once the algorithm finishes.
|
private void |
loadBoard()
Load the board with the initial information, like initial and final coordinates, and
check if its the first time running the app so we can show the tutorial.
|
void |
moveCharacter(int posY,
int posX)
For the update on the movement of the character, for logically and in the UI.
|
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
On create view we load all the importan information from the bundle, like the biomes,
codes, colors, relevant coordinates, etc...
|
void |
onStop()
Mehtod to stop the thread once the algorithm finishes.
|
private void |
putNodesInfo(android.widget.EditText et)
Method to be able to show the weight of each node in the graphic tree.
|
void |
setColorToField(int y,
int x)
Help method to color tiles, according to a specific color code.
|
private void |
setFieldColor(int y,
int x,
int color)
Set the color to a specific tile.
|
void |
showFailureMessage()
Method to show a failure message in case the algorithm is not able to reach the final tile.
|
private void |
stopThread()
Method called by onStop to stop the thread.
|
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onViewCreated, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
private static final String DOWN
private static final String UP
private static final String LEFT
private static final String RIGHT
float textSize
private String contentFile
private String updateTimeText
private int initialX
private int finalX
private int initialY
private int finalY
private int actualX
private int actualY
private int actualStep
private int[][] mapValues
private long updateTime
private CharacterItem character
private android.widget.TableLayout tlTableMap
private android.widget.EditText[][] board
private HeuristicPathTree.Node[][] nodes
private UniformCost.ButtonActions buttonActions
private android.graphics.drawable.Drawable characterIcon
private HeuristicPathTree tree
private android.widget.Button btnStartAlgorithm
private android.widget.TextView tvRefreshRate
private android.widget.SeekBar sbRefreshBar
private int pathColor
private ResolverUniformCostThread thread
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView
in class androidx.fragment.app.Fragment
inflater
- Layout.container
- view group.savedInstanceState
- Strings bundle for the information load.private void setFieldColor(int y, int x, int color)
y
- Y coordinate.x
- X coordinate.color
- specific color.private void loadBoard()
private void createTable(int[][] mapValues)
mapValues
- the map information to process in the creation of the table.public void showFailureMessage()
showFailureMessage
in interface iUniformCost
public void drawPath(HeuristicPathTree heuristicPathTree)
drawPath
in interface iUniformCost
heuristicPathTree
- the tree from which all the information is taken.private void putNodesInfo(android.widget.EditText et)
et
- The node which we are modifying to show the weight.public void moveCharacter(int posY, int posX)
moveCharacter
in interface iUniformCost
posY
- Y actual coordinate.posX
- X actual coordinate.public void setColorToField(int y, int x)
setColorToField
in interface iUniformCost
y
- Y coordinate.x
- X coordinate.public void onStop()
onStop
in class androidx.fragment.app.Fragment
private void stopThread()