com.example.labstatus.ui.SL2

## Class SL2Fragment

- java.lang.Object
- - androidx.fragment.app.Fragment
  - - com.example.labstatus.ui.SL2.SL2Fragment

All Implemented Interfaces:
  android.content.ComponentCallbacks, android.view.View.OnCreateContextMenuListener, androidx.lifecycle.LifecycleOwner, androidx.lifecycle.ViewModelStoreOwner, androidx.savedstate.SavedStateRegistryOwner, RecyclerViewAdapterSL2.ItemListener

    public class SL2Fragment
    extends androidx.fragment.app.Fragment
    implements RecyclerViewAdapterSL2.ItemListener

Author:
  Area51

### Nested Class Summary

### Nested classes/interfaces inherited from class androidx.fragment.app.Fragment

`androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState`

### Field Summary

Fields
`(package private) RecyclerViewAdapterSL2` `adapter`
`(package private) java.util.ArrayList` `arrayList`
`(package private) android.widget.ProgressBar` `bar`
`(package private) androidx.appcompat.app.AlertDialog.Builder` `builder`
`(package private) com.google.android.material.floatingactionbutton.FloatingActionButton` `fab`
`(package private) com.google.android.material.floatingactionbutton.FloatingActionButton` `fab_keyboard`
`(package private) com.google.android.material.floatingactionbutton.FloatingActionButton` `fab_lab`
`(package private) com.google.android.material.floatingactionbutton.FloatingActionButton` `fab_mouse`
`(package private) com.google.android.material.floatingactionbutton.FloatingActionButton` `fab_refresh`
`(package private) com.google.android.material.floatingactionbutton.FloatingActionButton` `fab_wakeup`
`(package private) boolean` `isFABOpen`
`(package private) int` `keyboard_request`
`(package private) java.lang.String` `lab`
`(package private) int` `lab_status`
`(package private) int` `mouse_request`
`(package private) com.google.android.material.bottomnavigation.BottomNavigationView` `navView`
`(package private) int` `port`
`(package private) androidx.recyclerview.widget.RecyclerView` `recyclerView`
`(package private) android.view.View` `root`
`(package private) java.lang.String` `ServerIP`
`(package private) int` `shutdown_request`
`(package private) int` `ShutDownFlag`
`(package private) java.lang.String` `SL2_ini`
`private SL2ViewModel` `SL2ViewModel`
`(package private) java.util.HashMap<java.lang.String,java.lang.Boolean>` `status`
`java.lang.String` `TAG`
`(package private) java.lang.String` `url`

### Constructor Summary

Constructors
Constructor and Description
`SL2Fragment()`

### Method Summary

All Methods Instance Methods Concrete Methods
`private void` `closeFABMenu()` Closes the expanded floating actions button.
`private void` `ExamModeOff()` Disables the exam mode in all the PC's of lab which enables the memory related external devices such as Pendrive to be connected
`private void` `ExamModeOn()` Enables the exam mode in all the PC's of lab which blocks the memory related external devices such as Pendrive from connecting to system
`private void` `get_info(java.lang.String response)` Parse the JSON response to get required values
`private void` `GetKeyboardStatus()` Gets the Keyboard Status via OKHttp Asynchronously
`private void` `GetLabStatus()` Gets the lab status of respective Lab.
`private void` `GetMouseStatus()` Gets the Mouse Status via OKHttp Asynchronously
`void` `onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater)`
`android.view.View` `onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)`
`void` `onItemClick(SL2ViewModel item)` Gets the lab status of respective Lab.
`boolean` `onOptionsItemSelected(android.view.MenuItem item)`
`private void` `post_processing_task()` Hides the progress bar
`private void` `preprocessing_task()` This will show the progress bar.
`private void` `showFABMenu()` Expands the floating actions button which are stacked over one another.
`private void` `showSnackBarMessage(java.lang.String msg)` This will print the passesd parameter msg in snackbar.
`private void` `ShutDownLab()` Shut down all the PC's of Lab
`private void` `update_UI(java.lang.String operation)` This will update the recycerView GridView according to the operation specified
`private void` `WakeOnLAN()` Turn on all the PC's of a Lab via WakeOnLan

### Methods inherited from class androidx.fragment.app.Fragment

`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, onDestroy, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, 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`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### adapter

    RecyclerViewAdapterSL2 adapter

#### arrayList

    java.util.ArrayList arrayList

#### bar

    android.widget.ProgressBar bar

#### builder

    androidx.appcompat.app.AlertDialog.Builder builder

#### fab

    com.google.android.material.floatingactionbutton.FloatingActionButton fab

#### fab_keyboard

    com.google.android.material.floatingactionbutton.FloatingActionButton fab_keyboard

#### fab_lab

    com.google.android.material.floatingactionbutton.FloatingActionButton fab_lab

#### fab_mouse

    com.google.android.material.floatingactionbutton.FloatingActionButton fab_mouse

#### fab_refresh

    com.google.android.material.floatingactionbutton.FloatingActionButton fab_refresh

#### fab_wakeup

    com.google.android.material.floatingactionbutton.FloatingActionButton fab_wakeup

#### isFABOpen

    boolean isFABOpen

#### keyboard_request

    int keyboard_request

#### lab

    java.lang.String lab

#### lab_status

    int lab_status

#### mouse_request

    int mouse_request

#### navView

    com.google.android.material.bottomnavigation.BottomNavigationView navView

#### port

    int port

#### recyclerView

    androidx.recyclerview.widget.RecyclerView recyclerView

#### root

    android.view.View root

#### ServerIP

    java.lang.String ServerIP

#### shutdown_request

    int shutdown_request

#### ShutDownFlag

    int ShutDownFlag

#### SL2_ini

    java.lang.String SL2_ini

#### SL2ViewModel

    private SL2ViewModel SL2ViewModel

#### status

    java.util.HashMap<java.lang.String,java.lang.Boolean> status

#### TAG

    public java.lang.String TAG

#### url

    java.lang.String url

### Constructor Detail

#### SL2Fragment

    public SL2Fragment()

### Method Detail

#### closeFABMenu

    private void closeFABMenu()

Closes the expanded floating actions button.

#### ExamModeOff

    private void ExamModeOff()

Disables the exam mode in all the PC's of lab which enables the memory related external devices such as Pendrive to be connected

#### ExamModeOn

    private void ExamModeOn()

Enables the exam mode in all the PC's of lab which blocks the memory related external devices such as Pendrive from connecting to system

#### get_info

    private void get_info(java.lang.String response)

Parse the JSON response to get required values

Parameters:
  `response` - JSON response

#### GetKeyboardStatus

    private void GetKeyboardStatus()

Gets the Keyboard Status via OKHttp Asynchronously

#### GetLabStatus

    private void GetLabStatus()
                       throws java.io.IOException

Gets the lab status of respective Lab.

Throws:
  `java.io.IOException`

#### GetMouseStatus

    private void GetMouseStatus()

Gets the Mouse Status via OKHttp Asynchronously

#### onCreateOptionsMenu

    public void onCreateOptionsMenu(android.view.Menu menu,
                                    android.view.MenuInflater inflater)

Overrides:
  `onCreateOptionsMenu` in class `androidx.fragment.app.Fragment`

#### onCreateView

    public android.view.View onCreateView(@NonNull
                                          android.view.LayoutInflater inflater,
                                          android.view.ViewGroup container,
                                          android.os.Bundle savedInstanceState)

Overrides:
  `onCreateView` in class `androidx.fragment.app.Fragment`

#### onItemClick

    public void onItemClick(SL2ViewModel item)

Gets the lab status of respective Lab.

Specified by:
  `onItemClick` in interface `RecyclerViewAdapterSL2.ItemListener`
Throws:
  `java.io.IOException`

#### onOptionsItemSelected

    public boolean onOptionsItemSelected(android.view.MenuItem item)

Overrides:
  `onOptionsItemSelected` in class `androidx.fragment.app.Fragment`

#### post_processing_task

    private void post_processing_task()

Hides the progress bar

#### preprocessing_task

    private void preprocessing_task()

This will show the progress bar.

#### showFABMenu

    private void showFABMenu()

Expands the floating actions button which are stacked over one another.

#### showSnackBarMessage

    private void showSnackBarMessage(java.lang.String msg)

This will print the passesd parameter msg in snackbar.

Parameters:
  `msg` - - message to be printed

#### ShutDownLab

    private void ShutDownLab()

Shut down all the PC's of Lab

#### update_UI

    private void update_UI(java.lang.String operation)

This will update the recycerView GridView according to the operation specified

Parameters:
  `operation` - The openation according thorugh which we need to update the UI

#### WakeOnLAN

    private void WakeOnLAN()

Turn on all the PC's of a Lab via WakeOnLan