CODE DOCUMENTATION - lixanfajardo/F45-Tech-Dashboard GitHub Wiki

CODE DOCUMENTATION


Main Activity

Contains overridden methods namely:

onCreate, onRestart, onStop, onBackPressed

  • onCreate - will basically initialize and create all objects needed. It will also call the custom methods.
  • onRestart - method will allow the timer to resume.
  • onStop - contains the line of code to pause the timer.
  • onBackPressed - will only allow the user exiting the app through the back button when pressed twice

Custom methods namely:

private Future makeGraphFuture()

  • Returns an ExecutorService(Executors.newSingleThreadExecutor()) that submits a runnable that calls makeGraph() function

private Future updateTicketsFuture()

  • Returns an ExecutorService(Executors.newSingleThreadExecutor()) that submits a runnable that calls updateTickets() function and in this runnable it also compares the previous number of tickets and the current number of tickets and swaps them

protected void makeGraph()

  • makeGraph() - Sets the settings for the Bar Chart, Sets the Labels for the X & Y Axis

protected void startFreshdeskRequest()

  • startFreshdeskRequest() - This function starts all the request that is from Freshdesk.

protected void checkComplete()

  • checkComplete() - This function checks if the freshdesk request is already complete and/or the pages is already null.

protected void updateTickets()

  • updateTickets() - This function is also called when updateTicketsfuture() is called so as to update the tickets including the notifications.

protected void startKlipfolio()

  • startKlipfolio() - this function starts all the request that is from Klipolio.

Methods

Model Package


Classes

TicketVolumeModel.Java

  • Contains the Pojo for Freshdesk

Controllers Package


Classes

TimeController.Java

Creates the CountDownTimer.


Methods

public void setTimer(long timeInMillis, long interval)

  • set the timer

Parameters:

Variable Name: timeInMillis

Definition: the time that the CountdownTimerStart()

Variable Name: long interval

Definition: the time that deducted in the CountDownTimer

private void initComponents()

  • initialize timerFragment.

public void setMinutesText(String text)

  • sets minutes.

Parameters:

Variable Name: text

Definition: the minutes to be set.

public void showAlert()

  • it shows alert layout and play the audio alarm for 5 seconds.

public void hideAlert()

  • it hides the alert layout and stops the audio alarm after 5 seconds.

public void pauseCount()

  • pauses the CountDownTimer.

public long getTimeleft()

  • gets time remaining.

public View getsLayout()

  • gets Layout.

TicketVolumeController.Java

creates and control the data of ticket fetch on the api.


Methods

private void initViews()

Initialize the tickect.xml view.

public void setTicketVolumeText(String text)

  • set the the volume of the ticket.

public void setResponseTimeText(String text)

  • set the response time of tickets.

public View getLayout()

*gets the layout.


NotificationController.Java

Manages the notification.


Methods

public int getPositon()

  • gets position.

public void setPosition(int position)

  • sets position.

public int getID()

  • gets the ID.

public String getSubject()

  • gets the subject.

public String getSource()

  • gets the source.

public String getPriority()

  • gets the priority.

public boolean getRead()

  • gets read.

public void setRead()

  • sets read.

NotificationAdapter.Java

.


Methods

public void setNotificationList(List notificationList)

  • This sets the notification list and notifies if data has changed

public NotificationViewHolder onCreateViewHolder(ViewGroup parent, int viewType)

  • This inflates the recycler view layout.

public void onBindViewHolder(final NotificationViewHolder holder, final int position)

  • This function sets the priority, source, and subject from the API.

public int getItemCount()

  • This gets the total number of items.

public NotificationViewHolder(View itemView)

  • This initializes and sets the R.id of the objects to be used in the class

Interface Package


Classes

TimerInterface.Java

creates the view of countdown timer and sets the CountdownTimer value.


Methods

public void setMinuteText(String text)

  • sets minutes.

Parameters:

Variable Name: text

Definition: the minutes to be set.

void setTimer(long time, long interval)

  • set the timer

Parameters:

Variable Name: time

Definition: the time that the CountdownTimerStart().

Variable Name: interval

Definition: the time that deducted in the CountDownTimer

View getLayout();

  • gets the timerview.xml.

void showAlert();

  • shows the alert method.

RetrofitClient.Java

Fetches data from the API.


Calls

@GET("/api/v2/tickets/")

  • gets data from the freshdesk.

@GET("/v3/tv_reports/")

  • gets data from klipholio.

TicketVolumeInterface.Java

creates the view of the volume of the ticket.


Methods

void setTicketVolumeText(String text)

  • set the the volume of the ticket.

Parameters:

Variable Name: text

Definition: the value of the volume of the text.

void setResponseTimeText(String text)

  • set the response time.

View getLayout()

  • gets the layout.