daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 153 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.vb.servicehelp;
  2.  
  3. import android.Manifest;
  4. import android.app.Dialog;
  5. import android.app.DownloadManager;
  6. import android.app.ProgressDialog;
  7. import android.content.ActivityNotFoundException;
  8. import android.content.Context;
  9. import android.content.Intent;
  10. import android.content.SharedPreferences;
  11. import android.database.Cursor;
  12. import android.database.sqlite.SQLiteDatabase;
  13. import android.graphics.Color;
  14. import android.graphics.PorterDuff;
  15. import android.net.Uri;
  16. import android.os.AsyncTask;
  17. import android.os.Environment;
  18. import android.os.StrictMode;
  19. import android.preference.PreferenceActivity;
  20. import android.support.v7.app.AppCompatActivity;
  21. import android.os.Bundle;
  22. import android.text.TextUtils;
  23. import android.text.util.Linkify;
  24. import android.util.Log;
  25. import android.view.View;
  26. import android.widget.AdapterView;
  27. import android.widget.ArrayAdapter;
  28. import android.widget.Button;
  29. import android.widget.EditText;
  30. import android.widget.ListView;
  31. import android.widget.RadioButton;
  32. import android.widget.RadioGroup;
  33. import android.widget.TabHost;
  34. import android.widget.TextView;
  35. import android.widget.Toast;
  36.  
  37. import com.android.volley.RequestQueue;
  38. import com.android.volley.toolbox.Volley;
  39.  
  40. import org.json.JSONArray;
  41. import org.json.JSONException;
  42. import org.json.JSONObject;
  43.  
  44. import java.io.BufferedInputStream;
  45. import java.io.BufferedOutputStream;
  46. import java.io.BufferedReader;
  47. import java.io.BufferedWriter;
  48. import java.io.DataOutputStream;
  49. import java.io.IOException;
  50. import java.io.InputStream;
  51. import java.io.InputStreamReader;
  52. import java.io.OutputStream;
  53. import java.io.OutputStreamWriter;
  54. import java.io.StringWriter;
  55. import java.io.UnsupportedEncodingException;
  56. import java.net.HttpCookie;
  57. import java.net.HttpURLConnection;
  58. import java.net.MalformedURLException;
  59. import java.net.ProtocolException;
  60. import java.net.URL;
  61. import java.net.URLEncoder;
  62. import java.security.KeyManagementException;
  63. import java.security.NoSuchAlgorithmException;
  64. import java.text.DateFormat;
  65. import java.text.ParseException;
  66. import java.text.SimpleDateFormat;
  67. import java.util.ArrayList;
  68. import java.util.Arrays;
  69. import java.util.Calendar;
  70. import java.util.Collections;
  71. import java.util.Date;
  72. import java.util.HashMap;
  73. import java.util.Iterator;
  74. import java.util.List;
  75. import java.util.Map;
  76. import java.util.Set;
  77. import java.util.regex.Matcher;
  78. import java.util.regex.Pattern;
  79.  
  80. import javax.net.ssl.HttpsURLConnection;
  81. import javax.net.ssl.SSLContext;
  82.  
  83.  
  84. public class MainActivity extends AppCompatActivity
  85. {
  86.     public static ArrayAdapter numbersAdapter,kenmoreAdapter,questionAdapter,issueAdapter,questAdapter,modelAdapter,priceAdapter,searsAdapter,locationAdapter,partsAdapter,explodeAdapter,employeeAdapter,jobsAdapter;
  87.     public static ListView numbersList,kenmoreList,questionList,issueList,questList,modelList,priceList,searsList,locationList,partsList,explodeList,employeeList,jobsList;
  88.     public static RadioButton rlastname,rfirstname,rmodel,rserial,rtech,rmake,rcity,rorder,rphone;
  89.     public static EditText myText,myModel,myResults,myFrom,myTo;
  90.     public static TextView dataText,sfText;
  91.     public static List<String> ordertables,emptytables,modeltables,serialtables,desctables,techtables,maketables,lasttables,firsttables,addresstables,citytables,phonetables,datetables,problem1tables,problem2tables,problem3tables,repair1tables,repair2tables,repair3tables,notestables,searstables,locationtables,partstable,explodetable,employeetable,jobstable;
  92.     int category=0;
  93.     int[] location_array = new int[30000];
  94.     String[] cat_number = new String[1000];
  95.     String[] brand_number = new String[1000];
  96.     String[] model_number = new String[1000];
  97.     int model_number_value=0;
  98.     String[] documents_id = new String[1000];
  99.     String[] diagrams_number = new String[1000];
  100.     String[] component_description = new String[1000];
  101.     String[] part_number = new String[1000];
  102.     String[] jobDate = new String[100000];
  103.     String[] jobStatus = new String[100000];
  104.     String[] jobNumber = new String[100000];
  105.     String[] jobCustomer = new String[100000];
  106.     String[] jobCategory = new String[100000];
  107.     String[] jobTime = new String[100000];
  108.     String[] jobType = new String[100000];
  109.     String[] jobDescription = new String[100000];
  110.     String[] jobPostal = new String[100000];
  111.     String[] jobWarranty = new String[100000];
  112.     String[] jobid = new String[100000];
  113.     String[] jobCity = new String[100000];
  114.     String[] jobAddress = new String[100000];
  115.     String[] jobInternal = new String[100000];
  116.     String[] jobComp = new String[100000];
  117.     int job_array_counter = 0;
  118.     int job_array_number=0;
  119.     String new_cookie="";
  120.  
  121.     public void onRadioButtonLast(View view) {rorder.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  122.     public void onRadioButtonFirst(View view) {rlastname.setChecked(false);rorder.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  123.     public void onRadioButtonModel(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rorder.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  124.     public void onRadioButtonSerial(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rorder.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  125.     public void onRadioButtonTech(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rorder.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  126.     public void onRadioButtonMake(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rorder.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  127.     public void onRadioButtonCity(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rorder.setChecked(false);rphone.setChecked(false); }
  128.     public void onRadioButtonPhone(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rorder.setChecked(false); }
  129.     public void onRadioButtonOrder(View view) {rlastname.setChecked(false);rfirstname.setChecked(false);rmodel.setChecked(false);rserial.setChecked(false);rtech.setChecked(false);rmake.setChecked(false);rcity.setChecked(false);rphone.setChecked(false); }
  130.  
  131.  
  132.  
  133.  
  134.     private class SfJobRunner extends AsyncTask<String, String, String>
  135.     {
  136.         @Override
  137.         protected String doInBackground(String... params)
  138.         {
  139.  
  140.             try
  141.             {
  142.                 /* So Now it's telling me to goto dispatch after adding connection.setFollowRedirects(false); */
  143.                 URL detailUrl = new URL("https://admin.servicefusion.com/jobs/jobView?id="+params[1]);
  144.                 HttpsURLConnection connection = (HttpsURLConnection) detailUrl.openConnection();
  145.                 connection.setRequestMethod("GET");
  146.                 connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Linux; Android 8.1.0;SM-T597V Build/M1AJQ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Safari/537.36");
  147.                 connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  148.                 connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
  149.                 connection.addRequestProperty("Referer", "https://admin.servicefusion.com/");
  150.                 connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
  151.                 connection.setRequestProperty("Connection","keep-alive");
  152.                 connection.setRequestProperty("Upgrade-Insecure-Requests","1");
  153.                 connection.setRequestProperty("Cookie", new_cookie);
  154.                 int status = connection.getResponseCode();
  155.  
  156.                 if(status == 200)
  157.                 {
  158.                     BufferedReader out = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  159.                     String outputLine;
  160.                     StringBuffer website = new StringBuffer();
  161.                     while ((outputLine = out.readLine()) != null) {website.append(outputLine);}
  162.                     out.close();
  163.                     detailUrl = new URL("https://admin.servicefusion.com/jobs/printJob?dispatchJobId="+params[1]);
  164.                     connection = (HttpsURLConnection) detailUrl.openConnection();
  165.                     connection.setRequestMethod("GET");
  166.                     connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Linux; Android 8.1.0;SM-T597V Build/M1AJQ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Safari/537.36");
  167.                     connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  168.                     connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
  169.                     connection.addRequestProperty("Referer", "https://admin.servicefusion.com/");
  170.                     connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
  171.                     connection.setRequestProperty("Connection","keep-alive");
  172.                     connection.setRequestProperty("Upgrade-Insecure-Requests","1");
  173.                     connection.setRequestProperty("Cookie", new_cookie);
  174.                     status = connection.getResponseCode();
  175.                     if(status == 200)
  176.                     {
  177.                         out = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  178.                         String outputLine2;
  179.                         StringBuffer other_site = new StringBuffer();
  180.                         while ((outputLine2 = out.readLine()) != null) {other_site.append(outputLine2);}
  181.                         out.close();
  182.                         return website.toString()+other_site.toString();
  183.                     }
  184.  
  185.                     return website.toString();
  186.                 }
  187.                 return "Status: "+status+" ,possibly logged out.";
  188.  
  189.             }
  190.             catch (MalformedURLException e)
  191.             {
  192.                 return "Malformed URL: "+e.getMessage();
  193.             }
  194.             catch (ProtocolException e)
  195.             {
  196.                 return "Protocol Exception: "+e.getMessage();
  197.             }
  198.             catch (IOException e)
  199.             {
  200.                 return "IOException: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage();
  201.             }
  202.         }
  203.         @Override
  204.         protected void onPostExecute(String result)
  205.         {
  206.             String parts_received="",shelf_received="",home_phone_received="",mobile_phone_received="",model_received="";
  207.             if(result.indexOf("<strong>Parts Received?</strong></div>\t\t\t\t<div class=\"span8 borders\">\t\t\t\t") != -1)
  208.             {
  209.                 parts_received = result.substring(result.indexOf("<strong>Parts Received?</strong></div>\t\t\t\t<div class=\"span8 borders\">\t\t\t\t") + 73, result.indexOf("\t\t\t</div>\t\t</div>\t\t\t\t<div class=\"control-group clearfix span12 padding-adjust\" >"));
  210.             }
  211.             if(result.indexOf("<strong>Shelf Location?</strong></div>\t\t\t\t<div class=\"span8 borders\">\t\t\t\t") != -1)
  212.             {
  213.                 shelf_received = result.substring(result.indexOf("<strong>Shelf Location?</strong></div>\t\t\t\t<div class=\"span8 borders\">\t\t\t\t") + 73, result.indexOf("\t\t\t</div>\t\t</div>\t\t\t</div>\t\t<div class=\"tab-pane\" id=\"pictures\">"));
  214.             }
  215.             if(result.indexOf("</button>\" data-html=\"true\" data-placement=\"bottom\" rel=\"popover\"  data-dojo-dataid=\"pid0\" data-title=\"<b>Select Action</b> <button type='button' class='close hide-popover'>&times;</button>\" >    \t\t\t\t\t\t\t") != -1)
  216.             {
  217.                 home_phone_received = result.substring(result.indexOf("</button>\" data-html=\"true\" data-placement=\"bottom\" rel=\"popover\"  data-dojo-dataid=\"pid0\" data-title=\"<b>Select Action</b> <button type='button' class='close hide-popover'>&times;</button>\" >    \t\t\t\t\t\t\t") + 203, result.indexOf("    \t\t\t\t\t\t</a>    \t\t\t\t\t\t\t"));
  218.             }
  219.             if(result.indexOf("Send Text    \t\t\t\t\t\t\t\t    \t\t\t\t\t\t\t\t</button>\" data-html=\"true\" data-placement=\"bottom\" rel=\"popover\"  data-dojo-dataid=\"pid0\" data-title=\"<b>Select Action</b> <button type='button' class='close hide-popover'>&times;</button>\" >    \t\t\t\t\t\t\t") != -1)
  220.             {
  221.                 mobile_phone_received = result.substring(result.indexOf("Send Text    \t\t\t\t\t\t\t\t    \t\t\t\t\t\t\t\t</button>\" data-html=\"true\" data-placement=\"bottom\" rel=\"popover\"  data-dojo-dataid=\"pid0\" data-title=\"<b>Select Action</b> <button type='button' class='close hide-popover'>&times;</button>\" >    \t\t\t\t\t\t\t") + 236, result.indexOf("Send Text    \t\t\t\t\t\t\t\t    \t\t\t\t\t\t\t\t</button>\" data-html=\"true\" data-placement=\"bottom\" rel=\"popover\"  data-dojo-dataid=\"pid0\" data-title=\"<b>Select Action</b> <button type='button' class='close hide-popover'>&times;</button>\" >    \t\t\t\t\t\t\t")+250);
  222.             }
  223.             if(result.indexOf("Equipment</td></tr><tr><td colspan='0' style='width:100%; text-align:right; vertical-align: top;' class=''><table style='width:100%; table-layout: fixed;' border='0' cellpadding='0' cellspacing='0'><tr><td style='vertical-align: top;font-weight: bold;text-align:left;padding: 4px;word-wrap: break-word;'>") != -1)
  224.             {
  225.                 model_received = result.substring(result.indexOf("Equipment</td></tr><tr><td colspan='0' style='width:100%; text-align:right; vertical-align: top;' class=''><table style='width:100%; table-layout: fixed;' border='0' cellpadding='0' cellspacing='0'><tr><td style='vertical-align: top;font-weight: bold;text-align:left;padding: 4px;word-wrap: break-word;'>") + 304, result.indexOf("</td><td></td></tr><tr><td style='vertical-align: top;font-weight: bold;text-align:left;padding: 4px;word-wrap: break-word;'>"));
  226.             }
  227.             /* Display Information */
  228.             sfText.setText("Job Number: "+jobNumber[job_array_number]+"\n");
  229.             sfText.append("Status: "+jobStatus[job_array_number]+"\n");
  230.             sfText.append("Name: "+jobCustomer[job_array_number]+"\n");
  231.             if(mobile_phone_received.indexOf(home_phone_received) != -1  || mobile_phone_received == "" || home_phone_received == "")
  232.             {
  233.                 sfText.append("Phone: " + home_phone_received + "\n");
  234.             }
  235.             else
  236.             {
  237.                 sfText.append("Phone: " + home_phone_received + ":"+mobile_phone_received + "\n");
  238.             }
  239.             sfText.append("Address: "+jobAddress[job_array_number]+","+jobCity[job_array_number]+","+jobPostal[job_array_number]+"\n");
  240.             sfText.append("Warranty: "+jobCategory[job_array_number]+"\n");
  241.             sfText.append("Appliance: "+model_received+"\n");
  242.             sfText.append("Description: "+jobDescription[job_array_number]+"\n");
  243.             sfText.append("Internal: "+jobInternal[job_array_number]+"\n");
  244.             sfText.append("Completion: "+jobComp[job_array_number]+"\n");
  245.             sfText.append("Parts: "+parts_received + ";"+shelf_received+"\n");
  246.  
  247.             Pattern pattern = Pattern.compile("<div class=\"span12 note-list-item-div\">\t\t        \t\t\t        \t\t<p><b>(.*?)</b></p>");
  248.  
  249.             Pattern other_pattern = Pattern.compile("<div class=\"note-list-item-text-div\">(.*?)</div>");
  250.             Matcher matcher = pattern.matcher(result);
  251.             Matcher other_matcher = other_pattern.matcher(result);
  252.             while(matcher.find() && other_matcher.find())
  253.             {
  254.                 sfText.append("Notes: "+matcher.group(1)+":"+other_matcher.group(1)+"\n");
  255.             }
  256.             Pattern parts_pattern = Pattern.compile("<div class=\"span2 services-div-margin-service hide\">(.*?)</b>");
  257.             Matcher parts_matcher = parts_pattern.matcher(result);
  258.             while(parts_matcher.find())
  259.             {
  260.                 sfText.append("Items: "+parts_matcher.group(1).toString().replaceAll("\t","").trim().replaceAll(" +"," ").replaceAll("<(.*?)\\>","")+"\n");
  261.             }
  262.             Toast.makeText(MainActivity.this, "Finished", Toast.LENGTH_LONG).show();
  263.         }
  264.  
  265.     }
  266.  
  267.     private class AsyncSFRunner extends AsyncTask<String, String, String>
  268.     {
  269.         @Override
  270.         protected String doInBackground(String... params)
  271.         {
  272.             try
  273.             {
  274.                 String data = "Authenticate[company]=herberts&Authenticate[uid]=kel&Authenticate[pwd]=85ab3b56a7b&Authenticate[remember]=0&LoginLog[time]=Sat+Apr+28+2018+17:53:21+GMT-0600+(Mountain+Standard+Time)&LoginLog[viewport_size]=1280x577&LoginLog[screen_size]=1280x720";
  275.                 String detail_data ="date="+params[0]+"&from="+params[0]+"&to="+params[1]+"&view=W&selectedTypes=&selectedStatuses=&selectedServices=&selectedTechs=&selectedPriority=&selectedCategory=&filter=false&selectedCrews=&colorCode=status";
  276.                 URL newUrl = new URL("https://admin.servicefusion.com/login");
  277.                 HttpsURLConnection connection = (HttpsURLConnection) newUrl.openConnection();
  278.                 connection.setRequestMethod("POST");
  279.                 connection.setDoOutput(true);
  280.                 connection.setFollowRedirects(false);
  281.                 connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Linux; Android 8.1.0;SM-T597V Build/M1AJQ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Safari/537.36");
  282.                 connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  283.                 connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
  284.                 connection.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
  285.                 connection.addRequestProperty("Referer", "https://admin.servicefusion.com/");
  286.                 connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
  287.                 connection.setRequestProperty("Content-Length",String.valueOf(data.length()));
  288.                 connection.setRequestProperty("Connection","keep-alive");
  289.                 connection.setRequestProperty("Upgrade-Insecure-Requests","1");
  290.                 connection.setRequestProperty("Cookie","");
  291.                 BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
  292.                 writer.write(data);
  293.                 writer.flush();
  294.  
  295.  
  296.                 int status = connection.getResponseCode();
  297.                 String old_cookies = connection.getHeaderField("Set-Cookie");
  298.                 String location = connection.getHeaderField("Location");
  299.                 if (status == HttpsURLConnection.HTTP_MOVED_TEMP || status == HttpsURLConnection.HTTP_MOVED_PERM || status == HttpsURLConnection.HTTP_SEE_OTHER)
  300.                 {
  301.                     URL postUrl = new URL("https://admin.servicefusion.com/login");
  302.                     connection = (HttpsURLConnection) postUrl.openConnection();
  303.                     connection.setRequestMethod("POST");
  304.                     connection.setDoOutput(true);
  305.                     connection.setFollowRedirects(true);
  306.                     connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Linux; Android 8.1.0;SM-T597V Build/M1AJQ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Safari/537.36");
  307.                     connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  308.                     connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
  309.                     connection.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
  310.                     connection.addRequestProperty("Referer", "https://admin.servicefusion.com/");
  311.                     connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
  312.                     connection.setRequestProperty("Content-Length",String.valueOf(data.length()));
  313.                     connection.setRequestProperty("Connection","keep-alive");
  314.                     connection.setRequestProperty("Upgrade-Insecure-Requests","1");
  315.                     connection.setRequestProperty("Cookie", old_cookies);
  316.                     writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
  317.                     writer.write(data);
  318.                     writer.flush();
  319.                     status = connection.getResponseCode();
  320.  
  321.                     Map<String, List<String>> headerFields = connection.getHeaderFields();
  322.                     Set<String> headerFieldsSet = headerFields.keySet();
  323.                     Iterator<String> hearerFieldsIter = headerFieldsSet.iterator();
  324.                     String[] key = new String[1000];
  325.                     String[] val = new String[1000];
  326.                     StringBuilder output = new StringBuilder(10000);
  327.                     int counter=0;
  328.                     while (hearerFieldsIter.hasNext())
  329.                     {
  330.  
  331.                         String headerFieldKey = hearerFieldsIter.next();
  332.                         List<String> headerFieldValue = headerFields.get(headerFieldKey);
  333.  
  334.                         StringBuilder sb = new StringBuilder();
  335.                         for (String value : headerFieldValue)
  336.                         {
  337.                             sb.append(value);
  338.                             sb.append("");
  339.                         }
  340.                         key[counter] = headerFieldKey;
  341.                         val[counter] = sb.toString();
  342.                         output.append(key[counter]+" = "+val[counter]+"\n");
  343.                         counter++;
  344.  
  345.                     }
  346.                     new_cookie = val[11];
  347.  
  348.                     /* So Now it's telling me to goto dispatch after adding connection.setFollowRedirects(false); */
  349.                     URL detailUrl = new URL("https://admin.servicefusion.com/dispatch/getUserDetails");
  350.                     connection = (HttpsURLConnection) detailUrl.openConnection();
  351.                     connection.setRequestMethod("POST");
  352.                     connection.setDoOutput(true);
  353.                     connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Linux; Android 8.1.0;SM-T597V Build/M1AJQ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.126 Safari/537.36");
  354.                     connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
  355.                     connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5");
  356.                     connection.addRequestProperty("Referer", "https://admin.servicefusion.com/");
  357.                     connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
  358.                     connection.setRequestProperty("Content-Length",String.valueOf(detail_data.length()));
  359.                     connection.setRequestProperty("Connection","keep-alive");
  360.                     connection.setRequestProperty("Upgrade-Insecure-Requests","1");
  361.                     connection.setRequestProperty("Cookie", new_cookie);
  362.                     writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
  363.                     writer.write(detail_data);
  364.                     writer.flush();
  365.                     status = connection.getResponseCode();
  366.                     if(status == 200)
  367.                     {
  368.                         BufferedReader out = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  369.                         String outputLine;
  370.                         StringBuffer json = new StringBuffer();
  371.                         while ((outputLine = out.readLine()) != null) {json.append(outputLine);}
  372.                         out.close();
  373.                         return json.toString();
  374.                     }
  375.                     return "location: "+location+" cookies: "+new_cookie+"status: "+status+"\n"+output;
  376.                 }
  377.                 return "first page: "+status;
  378.             }
  379.             catch (MalformedURLException e)
  380.             {
  381.                 return "Malformed URL: "+e.getMessage();
  382.             }
  383.             catch (ProtocolException e)
  384.             {
  385.                 return "Protocol Exception: "+e.getMessage();
  386.             }
  387.             catch (IOException e)
  388.             {
  389.                 return "IOException: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage();
  390.             }
  391.  
  392.  
  393.         }
  394.         @Override
  395.         protected void onPostExecute(String result)
  396.         {
  397.             try
  398.             {
  399.                 employeetable.removeAll(employeetable);
  400.                 jobstable.removeAll(jobstable);
  401.                 JSONObject mainObject = new JSONObject(result);
  402.                 JSONObject netObject = mainObject.getJSONObject("ASSIGNED");
  403.                 /* Fill In Employee Table First */
  404.                 String[] employee_array = {"ZG_xRG1wBXOBaePEUp8tWvBSeXkKTOoKhIUoaABlqeE", "yg8prV_8B3NRWU9-XIKDgU9tg1WaGi9prUADmJU5mAc", "XBpqn5zf7FvzYP0zg-IxZC1n62HTN53OGzj_LIDzGIw","fV1Mj9lZcfl4FwOvROAJJPoAnFYt72DELOONQrX7_6k","ItUwIBssXs-mSWAj2t2JILqn__HhBDtL57MyZJHxpNE"};
  405.                 JSONArray netArray;
  406.                 String[] employee_name = new String[1000];
  407.                 String[] employee_status = new String[1000];
  408.                 String[] employee_time = new String[1000];
  409.                 String[] employee_phone = new String[1000];
  410.                 for(int i=0; i < 5;i++)
  411.                 {
  412.                     netArray = netObject.getJSONArray(employee_array[i]);
  413.                     JSONObject employeeObject = netArray.getJSONObject(0);
  414.                     if (employeeObject.has("name"))
  415.                     {
  416.                         employee_name[i] = employeeObject.getString("name");
  417.                     }
  418.                     if (employeeObject.has("userStatus"))
  419.                     {
  420.                         employee_status[i] = employeeObject.getString("userStatus");
  421.                     }
  422.                     if (employeeObject.has("dateTimeInfo"))
  423.                     {
  424.                         employee_time[i] = employeeObject.getString("dateTimeInfo");
  425.                     }
  426.                     if (employeeObject.has("phone"))
  427.                     {
  428.                         employee_phone[i] = employeeObject.getString("phone");
  429.                     }
  430.                 }
  431.                 for(int i=0; i < 5;i++)
  432.                 {
  433.                     employeetable.add(employee_name[i]+" - "+employee_status[i]+" - "+employee_time[i]+" - "+employee_phone[i]);
  434.                     employeeAdapter.notifyDataSetChanged();
  435.                 }
  436.                 /* Show Jobs In Order -  */
  437.                 JSONArray myArray = netObject.getJSONArray(employee_array[0]);//0 = aaron
  438.                 int counter=0;
  439.                 job_array_counter = myArray.length();
  440.                 for(int i=0; i < myArray.length();i++)
  441.                 {
  442.  
  443.                     JSONObject arrayObject = myArray.getJSONObject(i);
  444.                     if (arrayObject.has("jobStartDate"))
  445.                     {
  446.                         jobDate[counter] = arrayObject.getString("jobStartDate");
  447.                     }
  448.                     if (arrayObject.has("jobStatusName"))
  449.                     {
  450.                         jobStatus[counter] = arrayObject.getString("jobStatusName");
  451.                     }
  452.                     if (arrayObject.has("id"))
  453.                     {
  454.                         jobid[counter] = arrayObject.getString("id");
  455.                     }
  456.                     if (arrayObject.has("jobNumber"))
  457.                     {
  458.                         jobNumber[counter] = arrayObject.getString("jobNumber");
  459.                     }
  460.                     if (arrayObject.has("customerName"))
  461.                     {
  462.                         jobCustomer[counter] = arrayObject.getString("customerName");
  463.                     }
  464.                     if (arrayObject.has("job_category"))
  465.                     {
  466.                         jobCategory[counter] = arrayObject.getString("job_category");
  467.                         if(jobCategory[counter].indexOf("NW Service") != -1)
  468.                         {
  469.                             jobWarranty[counter] = "No Warranty";
  470.                         }
  471.                         else
  472.                         {
  473.                             jobWarranty[counter] = "   Warranty    ";
  474.                         }
  475.                     }
  476.                     if (arrayObject.has("type"))
  477.                     {
  478.                         jobType[counter] = arrayObject.getString("type");
  479.                     }
  480.                     if (arrayObject.has("description"))
  481.                     {
  482.                         jobDescription[counter] = arrayObject.getString("description");
  483.                     }
  484.                     if (arrayObject.has("postal_code"))
  485.                     {
  486.                         jobPostal[counter] = arrayObject.getString("postal_code");
  487.                     }
  488.                     if (arrayObject.has("street_addr"))
  489.                     {
  490.                         jobAddress[counter] = arrayObject.getString("street_addr");
  491.                     }
  492.                     if (arrayObject.has("city_state"))
  493.                     {
  494.                         jobCity[counter] = arrayObject.getString("city_state");
  495.                     }
  496.                     if (arrayObject.has("internal_notes"))
  497.                     {
  498.                         jobInternal[counter] = arrayObject.getString("internal_notes");
  499.                     }
  500.                     if (arrayObject.has("completion_notes"))
  501.                     {
  502.                         jobComp[counter] = arrayObject.getString("completion_notes");
  503.                     }
  504.                     if (arrayObject.has("title_head_weekly"))
  505.                     {
  506.                         String jobTimes = arrayObject.getString("title_head_weekly");
  507.                         if(jobTimes.lastIndexOf("+") != -1)
  508.                         {
  509.                             jobTime[counter++] = jobTimes.substring(0, jobTimes.lastIndexOf(" "));
  510.                         }
  511.                         else
  512.                         {
  513.                             jobTime[counter++] = arrayObject.getString("title_head_weekly");
  514.                         }
  515.                     }
  516.  
  517.                 }
  518.                 String[] oldDates = new String[100000];
  519.                 int no_go=0;
  520.                 for(int i=0,cal=0; i < counter;i++)
  521.                 {
  522.  
  523.                     for(int a=0; a< cal;a++)
  524.                     {
  525.                         if(oldDates[a].toString().indexOf(jobDate[i])!= -1){no_go=1;break;}
  526.                     }
  527.                     if(no_go == 0)
  528.                     {
  529.                         try
  530.                         {
  531.                             DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  532.                             Date date = dateFormat.parse(jobDate[i]);
  533.                             Calendar calendar = Calendar.getInstance();
  534.                             calendar.setTime(date);
  535.                             String weekDay = "";
  536.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 1) {weekDay = "• SUNDAY •";}
  537.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 2) {weekDay = "• MONDAY •";}
  538.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 3) {weekDay = "• TUESDAY •";}
  539.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 4) {weekDay = "• WEDNESDAY •";}
  540.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 5) {weekDay = "• THURSDAY •";}
  541.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 6) {weekDay = "• FRIDAY •";}
  542.                             if (calendar.get(Calendar.DAY_OF_WEEK) == 7) {weekDay = "• SATURDAY •";}
  543.                             jobstable.add(jobDate[i] + "       " + weekDay);
  544.                             oldDates[cal++] = jobDate[i];
  545.                         }
  546.                         catch (ParseException e){e.printStackTrace();}
  547.                     }
  548.  
  549.                     if(jobNumber[i].length() > 0)
  550.                     {
  551.                         jobstable.add(jobDate[i] + "      " + jobTime[i] + "      " + jobNumber[i]+"      "+jobPostal[i]+"      "+jobWarranty[i]+"      "+jobStatus[i]+"      "+jobCustomer[i]);
  552.                     }
  553.                     else
  554.                     {
  555.                         String description = jobDescription[i];
  556.                         jobstable.add(jobDate[i] + "      [" +jobType[i] + "]      " + description.substring(0,Math.min(description.length(), 20)));
  557.                     }
  558.                     no_go=0;
  559.  
  560.                 }
  561.                 Collections.sort(jobstable);
  562.                 Collections.sort(jobstable, String.CASE_INSENSITIVE_ORDER);
  563.                 jobsAdapter.notifyDataSetChanged();
  564.  
  565.  
  566.  
  567.  
  568.                 Toast.makeText(MainActivity.this,"Finished!",Toast.LENGTH_LONG).show();
  569.  
  570.             }
  571.             catch (JSONException e)
  572.             {
  573.                 Toast.makeText(MainActivity.this,"JSON Error: "+e.getMessage(),Toast.LENGTH_LONG).show();
  574.             }
  575.         }
  576.  
  577.     }
  578.     private class AsyncSearsRunner extends AsyncTask<String, String, String>
  579.     {
  580.         @Override
  581.         protected String doInBackground(String... params)
  582.         {
  583.  
  584.            try
  585.             {
  586.                 URL newUrl = new URL("https://searspartsdirectapis.com/pd-services/search/v1/suggest?q="+params[0]+"&limit="+params[1]);
  587.                 HttpsURLConnection connection = (HttpsURLConnection) newUrl.openConnection();
  588.                 connection.setRequestMethod("GET");
  589.                 connection.connect();
  590.                 int status = connection.getResponseCode();
  591.                 if(status != 200){return "status: "+status;}
  592.                 BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  593.                 String inputLine;
  594.                 StringBuffer json = new StringBuffer();
  595.                 while ((inputLine = in.readLine()) != null) {json.append(inputLine);}
  596.                 in.close();
  597.                 return json.toString();
  598.  
  599.             }
  600.             catch (MalformedURLException e)
  601.             {
  602.                 return "Malformed URL: "+e.getMessage();
  603.             }
  604.             catch (ProtocolException e)
  605.             {
  606.                 return "Protocol Exception: "+e.getMessage();
  607.             }
  608.             catch (IOException e)
  609.             {
  610.                 return "IOException: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage();
  611.             }
  612.         }
  613.         @Override
  614.         protected void onPostExecute(String result)
  615.         {
  616.             try
  617.             {
  618.                 JSONObject mainObject = new JSONObject(result);
  619.                 String total_models = mainObject.getString("totalModels");
  620.                 JSONArray resultsArray = mainObject.getJSONArray("results");
  621.                 String[] category_number = new String[resultsArray.length()];
  622.                 String[] desc_number = new String[resultsArray.length()];
  623.                 if(resultsArray.length() == 0){Toast.makeText(MainActivity.this,"No Result Found For Partial Model.",Toast.LENGTH_LONG).show();}
  624.                 for(int i=0; i < resultsArray.length();i++)
  625.                 {
  626.                     JSONObject arrayObject = resultsArray.getJSONObject(i);
  627.                     model_number[i] = arrayObject.getString("modelNumber");
  628.                     category_number[i] = arrayObject.getString("categoryName");
  629.                     desc_number[i] = arrayObject.getString("modelDescription");
  630.                     cat_number[i] = arrayObject.getString("categoryId");
  631.                     brand_number[i] = arrayObject.getString("brandId");
  632.                 }
  633.                 for(int i=0; i < resultsArray.length();i++)
  634.                 {
  635.                     searstables.add(model_number[i] + ":"+category_number[i]+":"+desc_number[i]);
  636.                     searsAdapter.notifyDataSetChanged();
  637.                 }
  638.                 /* Clear Other Fields */
  639.                 locationtables.removeAll(locationtables);
  640.                 locationtables.add(" ");
  641.                 locationAdapter.notifyDataSetChanged();
  642.                 partstable.removeAll(partstable);
  643.                 partstable.add(" ");
  644.                 partsAdapter.notifyDataSetChanged();
  645.                 explodetable.removeAll(explodetable);
  646.                 explodetable.add(" ");
  647.                 explodeAdapter.notifyDataSetChanged();
  648.             }
  649.             catch (JSONException e)
  650.             {
  651.                 Toast.makeText(MainActivity.this,"JSON Error: "+e.getMessage(),Toast.LENGTH_LONG).show();
  652.             }
  653.         }
  654.  
  655.     }
  656.  
  657.     private class AsyncPartsRunner extends AsyncTask<String, String, String>
  658.     {
  659.         @Override
  660.         protected String doInBackground(String... params)
  661.         {
  662.  
  663.             try
  664.             {
  665.                 URL newUrl = new URL("https://www.searspartsdirect.com/model-number/"+params[0]+"/"+params[1]+"/"+params[2]+".html");
  666.                 HttpsURLConnection connection = (HttpsURLConnection) newUrl.openConnection();
  667.                 connection.setRequestMethod("GET");//Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
  668.                 connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0 Waterfox/56.2.7");
  669.                 connection.connect();
  670.                 int status = connection.getResponseCode();
  671.                 if(status != 200){return "status: "+status;}
  672.                 BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  673.                 String inputLine;
  674.                 StringBuffer website = new StringBuffer();
  675.                 while ((inputLine = in.readLine()) != null) {website.append(inputLine);}
  676.                 in.close();
  677.                 return website.toString();
  678.  
  679.             }
  680.             catch (MalformedURLException e)
  681.             {
  682.                 return "Malformed URL: "+e.getMessage();
  683.             }
  684.             catch (ProtocolException e)
  685.             {
  686.                 return "Protocol Exception: "+e.getMessage();
  687.             }
  688.             catch (IOException e)
  689.             {
  690.                 return "IOException: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage();
  691.             }
  692.         }
  693.         @Override
  694.         protected void onPostExecute(String result)
  695.         {
  696.             try
  697.             {
  698.                 /* Test Methods - 1 = regular version, 2 = new version*/
  699.                 if(result.indexOf("diagramPageId: \"") != -1)
  700.                 {
  701.                     //old version
  702.                     String diagrams_first = result.substring(result.indexOf("diagramPageId: \"") + 16, result.indexOf("diagramPageId: \"") + 21);
  703.                     documents_id[0] = result.substring(result.indexOf("documentId: \"") + 13, result.indexOf("documentId: \"") + 21);
  704.                     String diagrams_last = result.substring(result.lastIndexOf("diagramPageId: \"") + 17, result.lastIndexOf("diagramPageId: \"") + 21);
  705.                     /* Display */
  706.                     locationtables.removeAll(locationtables);
  707.                     explodetable.removeAll(explodetable);
  708.                     Pattern pattern = Pattern.compile("componentDescription: \"(.*?)\",");
  709.                     Matcher matcher = pattern.matcher(result);
  710.                     int a = 0;
  711.                     while (matcher.find())
  712.                     {
  713.                         component_description[a++] = matcher.group(1);
  714.                         locationtables.add(matcher.group(1));
  715.                         explodetable.add("Explode: "+matcher.group(1));
  716.                     }
  717.                     for (int i = 0; i < Integer.parseInt(diagrams_last); i++)
  718.                     {
  719.                         if((i+1) >= 10)
  720.                         {
  721.                             diagrams_number[i] = "000" + (i + 1);
  722.                         }
  723.                         else
  724.                         {
  725.                             diagrams_number[i] = "0000" + (i + 1);
  726.                         }
  727.                     }
  728.                 }
  729.                 else
  730.                 {
  731.                     //new version
  732.                     Toast.makeText(MainActivity.this,"New Version detected",Toast.LENGTH_LONG).show();
  733.  
  734.                     //have to reorder everything so it's 1,2,3,4,5..etc pages, click on it, opens
  735.                     //<span class="">Component Description</span>
  736.                     //no particular order: https://c.searspartsdirect.com/lis_png/PLDM/     "I2204553-00005"     .png" class
  737.                     //extract id:page#:, then get from 0 to indexof - for id, and indexof - +1 to string length for pages
  738.                     //determine the highest page, on incoming, if(parseint(number) > my_number){my_number = parseint(number)}
  739.  
  740.                 }
  741.  
  742.  
  743.                 locationAdapter.notifyDataSetChanged();
  744.                 explodeAdapter.notifyDataSetChanged();
  745.                 partstable.removeAll(partstable);
  746.                 partstable.add(" ");
  747.                 partsAdapter.notifyDataSetChanged();
  748.  
  749.             }
  750.             catch (Exception e)
  751.             {
  752.                 Toast.makeText(MainActivity.this,"Error Exception: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage(),Toast.LENGTH_LONG).show();
  753.             }
  754.         }
  755.  
  756.     }
  757.     private class AsyncDetailRunner extends AsyncTask<String, String, String>
  758.     {
  759.         @Override
  760.         protected String doInBackground(String... params)
  761.         {
  762.  
  763.             try
  764.             {
  765.                 /* Find Parts */
  766.                 URL newUrl = new URL("https://searspartsdirectapis.com/pd-services/models/details?modelNumber="+params[0]+"&brandId="+params[1]+"&productCategoryId="+params[2]+"&diagramPageId="+params[3]+"&documentId="+params[4]);
  767.                 HttpsURLConnection connect = (HttpsURLConnection) newUrl.openConnection();
  768.                 connect.setRequestMethod("GET");
  769.                 connect.connect();
  770.                 int status = connect.getResponseCode();
  771.                 if(status != 200){return "status: "+status;}
  772.                 BufferedReader out = new BufferedReader(new InputStreamReader(connect.getInputStream()));
  773.                 String outputLine;
  774.                 StringBuffer json = new StringBuffer();
  775.                 while ((outputLine = out.readLine()) != null) {json.append(outputLine);}
  776.                 out.close();
  777.                 connect.disconnect();
  778.  
  779.                 return json.toString();
  780.  
  781.             }
  782.             catch (MalformedURLException e)
  783.             {
  784.                 return "Malformed URL: "+e.getMessage();
  785.             }
  786.             catch (ProtocolException e)
  787.             {
  788.                 return "Protocol Exception: "+e.getMessage();
  789.             }
  790.             catch (IOException e)
  791.             {
  792.                 return "IOException: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage();
  793.             }
  794.         }
  795.         @Override
  796.         protected void onPostExecute(String result)
  797.         {
  798.             try
  799.             {
  800.                 partstable.removeAll(partstable);
  801.                 JSONObject mainObject = new JSONObject(result);
  802.                 JSONArray partsArray = mainObject.getJSONArray("parts");
  803.                 String[] part_description = new String[1000];
  804.                 String[] part_keyid = new String[1000];
  805.                 for(int i=0; i < partsArray.length();i++)
  806.                 {
  807.                     JSONObject arrayObject = partsArray.getJSONObject(i);
  808.                     JSONObject compObject = arrayObject.getJSONObject("partCompositeKey");
  809.                     part_description[i] = arrayObject.getString("description");
  810.                     part_number[i] = compObject.getString("partNumber");
  811.                     if (arrayObject.has("keyId"))
  812.                     {
  813.                         part_keyid[i] = arrayObject.getString("keyId");
  814.                     }
  815.  
  816.                     partstable.add("{"+part_keyid[i]+"}"+part_description[i] + ":[" +part_number[i]+"]");
  817.                 }
  818.                 partsAdapter.notifyDataSetChanged();
  819.  
  820.             }
  821.             catch (JSONException e)
  822.             {
  823.                 Toast.makeText(MainActivity.this,"JSON Error: "+e.getMessage()+":"+result,Toast.LENGTH_LONG).show();
  824.             }
  825.             catch (Exception e)
  826.             {
  827.                 Toast.makeText(MainActivity.this,"Error Exception: "+e.getMessage()+":"+e.getLocalizedMessage()+":"+e.getCause()+":"+e.getLocalizedMessage(),Toast.LENGTH_LONG).show();
  828.             }
  829.         }
  830.  
  831.     }
  832.     public void onButtonLoadSF(View view)
  833.     {
  834.         if(myTo.getText().toString().length() > 9 && myFrom.getText().toString().length() > 9)
  835.         {
  836.             AsyncSFRunner sf_runner = new AsyncSFRunner();
  837.             sf_runner.execute(myFrom.getText().toString(), myTo.getText().toString());
  838.         }
  839.         else{Toast.makeText(MainActivity.this,"Please Add Values Greater Than 9 Characters.",Toast.LENGTH_LONG).show();}
  840.     }
  841.     public void onButtonLoadSears(View view)
  842.     {
  843.         searstables.removeAll(searstables);
  844.         AsyncSearsRunner sears_runner = new AsyncSearsRunner();
  845.         if(myModel.getText().toString().length() > 2 && myResults.getText().toString().length() > 0)
  846.         {
  847.             sears_runner.execute(myModel.getText().toString(), myResults.getText().toString());
  848.         }
  849.         else{Toast.makeText(MainActivity.this,"Please Add Values Greater Than 3 Characters for Model & Number of Results a valid number.",Toast.LENGTH_LONG).show();}
  850.     }
  851.     public void onButtonScanDB(View view)
  852.     {
  853.         /* Get the text from editcontrol */
  854.         String result = myText.getText().toString();
  855.         emptytables.removeAll(emptytables);
  856.         int found=0;
  857.         if(result.length() != 0)
  858.         {
  859.             /* Work Orders */
  860.             if (rorder.isChecked())
  861.             {
  862.                 for (int counter = 0,a=0; counter < ordertables.size(); counter++)
  863.                 {
  864.                     if(ordertables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  865.                     {
  866.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(ordertables.get(counter))+":"+String.valueOf(lasttables.get(counter))+":"+String.valueOf(techtables.get(counter))+":"+String.valueOf(maketables.get(counter))+":"+String.valueOf(modeltables.get(counter)));
  867.                         modelAdapter.notifyDataSetChanged();
  868.                         found=1;
  869.                         location_array[a++] = counter;
  870.                     }
  871.                 }
  872.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  873.             }
  874.             /* Phone Numbers */
  875.             if (rphone.isChecked())
  876.             {
  877.                 for (int counter = 0,a=0; counter < phonetables.size(); counter++)
  878.                 {
  879.                     if(phonetables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  880.                     {
  881.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(phonetables.get(counter))+":"+String.valueOf(lasttables.get(counter))+":"+String.valueOf(ordertables.get(counter)));
  882.                         modelAdapter.notifyDataSetChanged();
  883.                         found=1;
  884.                         location_array[a++] = counter;
  885.                     }
  886.                 }
  887.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  888.             }
  889.             /* City */
  890.             if (rcity.isChecked())
  891.             {
  892.                 for (int counter = 0,a=0; counter < citytables.size(); counter++)
  893.                 {
  894.                     if(citytables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  895.                     {
  896.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(citytables.get(counter))+":"+String.valueOf(ordertables.get(counter))+":"+String.valueOf(techtables.get(counter)));
  897.                         modelAdapter.notifyDataSetChanged();
  898.                         found=1;
  899.                         location_array[a++] = counter;
  900.                     }
  901.                 }
  902.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  903.             }
  904.             /* Make */
  905.             if (rmake.isChecked())
  906.             {
  907.                 for (int counter = 0,a=0; counter < maketables.size(); counter++)
  908.                 {
  909.                     if(maketables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  910.                     {
  911.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(maketables.get(counter))+":"+String.valueOf(modeltables.get(counter))+":"+String.valueOf(ordertables.get(counter))+":"+String.valueOf(techtables.get(counter)));
  912.                         modelAdapter.notifyDataSetChanged();
  913.                         found=1;
  914.                         location_array[a++] = counter;
  915.                     }
  916.                 }
  917.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  918.             }
  919.             /* Tech */
  920.             if (rtech.isChecked())
  921.             {
  922.                 for (int counter = 0,a=0; counter < techtables.size(); counter++)
  923.                 {
  924.                     if(techtables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  925.                     {
  926.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(techtables.get(counter))+":"+String.valueOf(ordertables.get(counter))+":"+String.valueOf(modeltables.get(counter)));
  927.                         modelAdapter.notifyDataSetChanged();
  928.                         found=1;
  929.                         location_array[a++] = counter;
  930.                     }
  931.                 }
  932.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  933.             }
  934.             /* Serial */
  935.             if (rserial.isChecked())
  936.             {
  937.                 for (int counter = 0,a=0; counter < serialtables.size(); counter++)
  938.                 {
  939.                     if(serialtables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  940.                     {
  941.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(serialtables.get(counter))+":"+String.valueOf(modeltables.get(counter))+":"+String.valueOf(ordertables.get(counter)));
  942.                         modelAdapter.notifyDataSetChanged();
  943.                         found=1;
  944.                         location_array[a++] = counter;
  945.                     }
  946.                 }
  947.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  948.             }
  949.             /* Model */
  950.             if (rmodel.isChecked())
  951.             {
  952.                 for (int counter = 0,a=0; counter < modeltables.size(); counter++)
  953.                 {
  954.                     if(modeltables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  955.                     {
  956.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(modeltables.get(counter))+":"+String.valueOf(serialtables.get(counter))+":"+String.valueOf(ordertables.get(counter))+":"+String.valueOf(problem1tables.get(counter))+"-"+String.valueOf(problem2tables.get(counter)));
  957.                         modelAdapter.notifyDataSetChanged();
  958.                         found=1;
  959.                         location_array[a++] = counter;
  960.                     }
  961.                 }
  962.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  963.             }
  964.             /* First Name */
  965.             if (rfirstname.isChecked())
  966.             {
  967.                 for (int counter = 0,a=0; counter < firsttables.size(); counter++)
  968.                 {
  969.                     if(firsttables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  970.                     {
  971.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(firsttables.get(counter))+":"+String.valueOf(lasttables.get(counter))+":"+String.valueOf(maketables.get(counter))+":"+String.valueOf(ordertables.get(counter)));
  972.                         modelAdapter.notifyDataSetChanged();
  973.                         found=1;
  974.                         location_array[a++] = counter;
  975.                     }
  976.                 }
  977.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  978.             }
  979.             /* Last Name */
  980.             if (rlastname.isChecked())
  981.             {
  982.                 for (int counter = 0,a=0; counter < lasttables.size(); counter++)
  983.                 {
  984.                     if(lasttables.get(counter).toLowerCase().indexOf(result.toLowerCase()) != -1)
  985.                     {
  986.                         emptytables.add(String.valueOf((a+1))+". "+String.valueOf(lasttables.get(counter))+":"+String.valueOf(firsttables.get(counter))+":"+String.valueOf(maketables.get(counter))+":"+String.valueOf(ordertables.get(counter)));
  987.                         modelAdapter.notifyDataSetChanged();
  988.                         found=1;
  989.                         location_array[a++] = counter;
  990.                     }
  991.                 }
  992.                 if(found == 0){emptytables.add(" ");modelAdapter.notifyDataSetChanged();Toast.makeText(MainActivity.this,"Nothing Found In Database",Toast.LENGTH_LONG).show();}
  993.             }
  994.         }
  995.         else{Toast.makeText(MainActivity.this,"Input Text Then Press Scan",Toast.LENGTH_LONG).show();}
  996.  
  997.     }
  998.     @Override
  999.     protected void onCreate(Bundle savedInstanceState)
  1000.     {
  1001.         super.onCreate(savedInstanceState);
  1002.         setContentView(R.layout.activity_main);
  1003.         TabHost host = (TabHost)findViewById(R.id.tabHost);
  1004.         final TextView phone_number = (TextView) findViewById (R.id.phone_id);
  1005.         final TextView account_number = (TextView) findViewById (R.id.account_id);
  1006.         final TextView username_number = (TextView) findViewById (R.id.username_id);
  1007.         final TextView password_number = (TextView) findViewById (R.id.password_id);
  1008.         final TextView website_number = (TextView) findViewById (R.id.website_id);
  1009.         /* Fill in date */
  1010.         myFrom = (EditText)findViewById(R.id.frominput);
  1011.         myTo = (EditText)findViewById(R.id.toinput);
  1012.         Date cDate = new Date();
  1013.         String fDate = new SimpleDateFormat("yyyy/MM/dd").format(cDate);
  1014.         SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
  1015.         myFrom.setText(fDate);
  1016.         Calendar c = Calendar.getInstance();
  1017.         try
  1018.         {
  1019.             c.setTime(sdf.parse(fDate));
  1020.         }
  1021.         catch (ParseException e)
  1022.         {
  1023.             e.printStackTrace();
  1024.         }
  1025.         c.add(Calendar.DATE, 10);
  1026.         SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd");
  1027.         String nDate = sdf1.format(c.getTime());
  1028.         myTo.setText(nDate);
  1029.  
  1030.  
  1031.  
  1032.         /* textview */
  1033.         dataText = (TextView) findViewById(R.id.text_view_id);
  1034.         sfText = (TextView) findViewById(R.id.sf_information);
  1035.         /* Radio Buttons */
  1036.         rlastname=(RadioButton)findViewById(R.id.radiolastname);
  1037.         rfirstname=(RadioButton)findViewById(R.id.radiofirstname);
  1038.         rmodel=(RadioButton)findViewById(R.id.radiomodel);
  1039.         rserial=(RadioButton)findViewById(R.id.radioserial);
  1040.         rtech=(RadioButton)findViewById(R.id.radiotech);
  1041.         rmake=(RadioButton)findViewById(R.id.radiomake);
  1042.         rcity=(RadioButton)findViewById(R.id.radiocity);
  1043.         rphone=(RadioButton)findViewById(R.id.radiophone);
  1044.         rorder=(RadioButton)findViewById(R.id.radioworkorder);
  1045.         rorder.setChecked(true);
  1046.         /* Buttons */
  1047.         final Button scan_button = findViewById(R.id.scan_database);
  1048.         scan_button.setEnabled(false);
  1049.         /* Edit Text */
  1050.         myText = (EditText)findViewById(R.id.plain_text_input);
  1051.         myModel = (EditText)findViewById(R.id.model_text_input);
  1052.         myResults = (EditText)findViewById(R.id.results_text_input);
  1053.  
  1054.         host.setup();
  1055.         //Tab 1
  1056.         TabHost.TabSpec spec = host.newTabSpec("Accounts");
  1057.         spec.setContent(R.id.tab1);
  1058.         spec.setIndicator("Accounts");
  1059.         host.addTab(spec);
  1060.  
  1061.         //Tab 2
  1062.         spec = host.newTabSpec("Reference");
  1063.         spec.setContent(R.id.tab2);
  1064.         spec.setIndicator("Reference");
  1065.         host.addTab(spec);
  1066.  
  1067.         //Tab 3
  1068.         spec = host.newTabSpec("Questions");
  1069.         spec.setContent(R.id.tab3);
  1070.         spec.setIndicator("Questions");
  1071.         host.addTab(spec);
  1072.  
  1073.         //Tab 4
  1074.         spec = host.newTabSpec("Attendant");
  1075.         spec.setContent(R.id.tab4);
  1076.         spec.setIndicator("Attendant");
  1077.         host.addTab(spec);
  1078.  
  1079.         //Tab 5
  1080.         spec = host.newTabSpec("Fusion");
  1081.         spec.setContent(R.id.tab5);
  1082.         spec.setIndicator("Fusion");
  1083.         host.addTab(spec);
  1084.  
  1085.         //Tab 6
  1086.         spec = host.newTabSpec("Sears");
  1087.         spec.setContent(R.id.tab6);
  1088.         spec.setIndicator("Sears");
  1089.         host.addTab(spec);
  1090.  
  1091.         /* Jobs Listview */
  1092.         jobstable = new ArrayList<>();
  1093.         jobstable.add(" ");
  1094.         this.jobsAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,jobstable);
  1095.         this.jobsList = ((ListView)findViewById(R.id.jobsview));
  1096.         this.jobsList.setAdapter(this.jobsAdapter);
  1097.         this.jobsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1098.             public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1099.             {
  1100.                 if(String.valueOf(jobstable.get(arg3)) != " ")
  1101.                 {
  1102.                     String selectedFromList = (String) jobsList.getItemAtPosition(arg3);
  1103.                     if(selectedFromList.indexOf("m      ") != -1)
  1104.                     {
  1105.                         String job_number = selectedFromList.substring(selectedFromList.indexOf("m      ") + 7, selectedFromList.indexOf("m      ") + 15);
  1106.                         for(int i=0; i < job_array_counter;i++)
  1107.                         {
  1108.                            if(Arrays.asList(jobNumber[i]).contains(job_number))
  1109.                            {
  1110.                                /* Grab Data From Webpage Data */
  1111.                                //Toast.makeText(MainActivity.this, jobStatus[i], Toast.LENGTH_LONG).show();
  1112.                                job_array_number=i;
  1113.                                SfJobRunner sfjob_runner = new SfJobRunner();
  1114.                                sfjob_runner.execute(new_cookie,jobid[i]);
  1115.  
  1116.                            }
  1117.                         }
  1118.                     }
  1119.                 }
  1120.                 else
  1121.                 {
  1122.                     Toast.makeText(MainActivity.this,"Nothing Selected",Toast.LENGTH_LONG).show();
  1123.                 }
  1124.             }});
  1125.  
  1126.         /* Employee Listview */
  1127.         employeetable = new ArrayList<>();
  1128.         employeetable.add(" ");
  1129.         this.employeeAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,employeetable);
  1130.         this.employeeList = ((ListView)findViewById(R.id.employeeview));
  1131.         this.employeeList.setAdapter(this.employeeAdapter);
  1132.         this.employeeList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1133.             public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1134.             {
  1135.             }});
  1136.  
  1137.  
  1138.  
  1139.  
  1140.         /* exploded Listview */
  1141.         explodetable = new ArrayList<>();
  1142.         explodetable.add(" ");
  1143.         this.explodeAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,explodetable);
  1144.         this.explodeList = ((ListView)findViewById(R.id.explodeview));
  1145.         this.explodeList.setAdapter(this.explodeAdapter);
  1146.         this.explodeList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1147.             public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1148.             {
  1149.                 if(String.valueOf(explodetable.get(arg3)) != " ")
  1150.                 {
  1151.                     Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://c.searspartsdirect.com/lis_png/PLDM/"+documents_id[0]+"-"+diagrams_number[arg3]+".png"));
  1152.                     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  1153.                     intent.setPackage("com.android.chrome");
  1154.                     try
  1155.                     {
  1156.                         MainActivity.this.startActivity(intent);
  1157.                     } catch (ActivityNotFoundException ex)
  1158.                     {
  1159.                         // Chrome browser presumably not installed so allow user to choose instead
  1160.                         intent.setPackage(null);
  1161.                         MainActivity.this.startActivity(intent);
  1162.                     }
  1163.                 }
  1164.             }});
  1165.  
  1166.         /* Parts Listview */
  1167.         partstable = new ArrayList<>();
  1168.         partstable.add(" ");
  1169.         this.partsAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,partstable);
  1170.         this.partsList = ((ListView)findViewById(R.id.partsview));
  1171.         this.partsList.setAdapter(this.partsAdapter);
  1172.         this.partsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1173.             public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1174.             {
  1175.                 if(String.valueOf(partstable.get(arg3)) != " ")
  1176.                 {
  1177.                     Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.google.com/search?q="+part_number[arg3]+"&tbm=isch"));
  1178.                     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  1179.                     intent.setPackage("com.android.chrome");
  1180.                     try
  1181.                     {
  1182.                         MainActivity.this.startActivity(intent);
  1183.                     } catch (ActivityNotFoundException ex)
  1184.                     {
  1185.                         // Chrome browser presumably not installed so allow user to choose instead
  1186.                         intent.setPackage(null);
  1187.                         MainActivity.this.startActivity(intent);
  1188.                     }
  1189.                 }
  1190.             }});
  1191.  
  1192.         /* Location Listview */
  1193.         locationtables = new ArrayList<>();
  1194.         locationtables.add(" ");
  1195.         this.locationAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,locationtables);
  1196.         this.locationList = ((ListView)findViewById(R.id.locationview));
  1197.         this.locationList.setAdapter(this.locationAdapter);
  1198.         this.locationList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1199.             public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1200.             {
  1201.                 if(String.valueOf(locationtables.get(arg3)) != " ")
  1202.                 {
  1203.                     AsyncDetailRunner detail_runner = new AsyncDetailRunner();
  1204.                     detail_runner.execute(model_number[model_number_value],brand_number[model_number_value],cat_number[model_number_value],diagrams_number[arg3],documents_id[0]);
  1205.                 }
  1206.             }});
  1207.  
  1208.         /* Sears Listview */
  1209.         searstables = new ArrayList<>();
  1210.         searstables.add(" ");
  1211.         this.searsAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,searstables);
  1212.         this.searsList = ((ListView)findViewById(R.id.searsview));
  1213.         this.searsList.setAdapter(this.searsAdapter);
  1214.         this.searsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1215.         public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1216.         {
  1217.             if(String.valueOf(searstables.get(arg3)) != " ")
  1218.             {
  1219.                 model_number_value = arg3;
  1220.                 AsyncPartsRunner parts_runner = new AsyncPartsRunner();
  1221.                 parts_runner.execute(model_number[arg3],brand_number[arg3],cat_number[arg3]);
  1222.             }
  1223.         }});
  1224.  
  1225.  
  1226.         /* Phone and Accounts */
  1227.         this.numbersAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, new String[] {"Whirlpool","Samsung","LG","GE","Bosch","Frigidaire","Viking","Subzero","Sundberg"});
  1228.         this.numbersList = ((ListView)findViewById(R.id.numbersview));
  1229.         this.numbersList.setAdapter(this.numbersAdapter);
  1230.         this.numbersList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1231.         public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1232.         {
  1233.             if(arg3 == 0)
  1234.             {
  1235.                 phone_number.setText("Phone Number: 1-800-832-7174");
  1236.                 account_number.setText("Account: 67686");
  1237.                 username_number.setText("Username: Baro2");
  1238.                 password_number.setText("Password: Go01");
  1239.                 website_number.setText("Website: https://servicematters.com/en_US");
  1240.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1241.             }
  1242.             if(arg3 == 1)
  1243.             {
  1244.                phone_number.setText("Phone Number: 1888-751-4086");
  1245.                account_number.setText("Account: 63528");
  1246.                username_number.setText("Username: HER01039923");
  1247.                password_number.setText("Password: Hb454*");
  1248.                website_number.setText("Website: https://support-us.samsung.com/stg/login");
  1249.                Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1250.             }
  1251.             if(arg3 == 2)
  1252.             {
  1253.                 phone_number.setText("Phone Number: 1800-847-7597");
  1254.                 account_number.setText("Account: 21300");
  1255.                 username_number.setText("Username: servi8ce");
  1256.                 password_number.setText("Password: servi");
  1257.                 website_number.setText("Website: https://www.lgtechassist.com/kms/login.php");
  1258.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1259.             }
  1260.             if(arg3 == 3)
  1261.             {
  1262.                 phone_number.setText("Phone Number: 1800-256-6873");
  1263.                 account_number.setText("Account: 6XC8 & Appliance Tech: v10");
  1264.                 username_number.setText("Username: L51459");
  1265.                 password_number.setText("Password: sm32sm");
  1266.                 website_number.setText("Website: https://customernet.geappliances.com/CustomerNet/index.html");
  1267.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1268.             }
  1269.             if(arg3 == 4)
  1270.             {
  1271.                 phone_number.setText("Phone Number: 1800-444-9091");
  1272.                 account_number.setText("Account: 138");
  1273.                 username_number.setText("Username: 38");
  1274.                 password_number.setText("Password: zj2OSlirNcrYg");
  1275.                 website_number.setText("Website: https://portal.bsh-partner.com/portal(bD1lbiZjPTA2MA==)/LoginFrame.htm?PORTAL_REGIONINDEX=20");
  1276.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1277.             }
  1278.             if(arg3 == 5)
  1279.             {
  1280.                 phone_number.setText("Phone Number: 1888-842-3660");
  1281.                 account_number.setText("Account: 44500");
  1282.                 username_number.setText("Username: ");
  1283.                 password_number.setText("Password: ");
  1284.                 website_number.setText("Website: https://b2b.frigidaire.com");
  1285.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1286.             }
  1287.             if(arg3 == 6)
  1288.             {
  1289.                 phone_number.setText("Phone Number:  1-800-914-4799");
  1290.                 account_number.setText("Account: APP (Service Bench)SP13640");
  1291.                 username_number.setText("Username: servic");
  1292.                 password_number.setText("Password: 1-Ch89h");
  1293.                 website_number.setText("Website: https://documoto.digabit.com/ui/");
  1294.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1295.             }
  1296.             if(arg3 == 7)
  1297.             {
  1298.                 phone_number.setText("Phone Number: 1800-919-8324");
  1299.                 account_number.setText("Account: Applian ch");
  1300.                 username_number.setText("Username: ");
  1301.                 password_number.setText("Password: ");
  1302.                 website_number.setText("Website: ");
  1303.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1304.             }
  1305.             if(arg3 == 8)
  1306.             {
  1307.                 phone_number.setText("Phone Number: 406-252-9616");
  1308.                 account_number.setText("Account: ");
  1309.                 username_number.setText("Username: AARkev");
  1310.                 password_number.setText("Password: HAR88");
  1311.                 website_number.setText("Website: https://www.sundbergamerica.com/");
  1312.                 Linkify.addLinks(website_number, Linkify.WEB_URLS);
  1313.             }
  1314.         }});
  1315.         /* Kenmore */
  1316.         this.kenmoreAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, new String[] {"103 : Roper","106 : Whirlpool","110 : Whirlpool","116 : Absocold","118 : Corning","119 : Frigidaire","126 : Absocold","143 : Monarch","153 : State Industries","154 : Whirlpool","155 : Whirlpool","174 : Caloric","175 : In-Sink Erator","183 : Haier","196 : Brown Stove","198 : Whirlpool","223 : Broan","251 : Winix Inc","253 : Frigidaire","255 : Midea","266 : GE","267 : GE","274 : RCA","278 : Roper","293 : Fedders","335 : Amana","336 : Electrolux","342 : York","362 : Roper","363 : GE-LG","401 : Samsung","402 : Samsung","405 : Guangdong Midea","407 : Gree","416 : Carrier","417 : Frigidaire","461 : Midea","464 : Shunde Midea","465 : GE","473 : Maytag","484 : Hoover","501 : Fedders-Whirlpool","562 : LG","564 : Toshiba","565 : Sanyo","566 : Sanyo","567 : Sanyo","568 : Sanyo","575 : Panasonic","580 : Sharp","586 : LG","587 : Panasonic","592 : Frigidaire","596 : Samsung","612 : Amana","622 : ACME","628 : Frigidaire","629 : Frigidaire","630 : Jenn-Air","647 : Bosch","651 : Roper","664 : Speed Queen","665 : Whirlpool","666 : Whirlpool","675 : Kitchenaid","683 : WC Wood Co.","719 : Philco Italy","721 : Frigidaire","747 : LG","757 : Litton","767 : Marvel-Imperial","789 : LG","790 : Defiance","791 : Frigidaire","795 : LG","796 : LG","835 : Roper","840 : Friedrich","850 : Whirlpool","867 : Keeprite","880 : Whirlpool","911 : Roper","917 : Roper","925 : Maytag","934 : Hitachi","960 : Roper","970 : Frigidaire"});
  1317.         this.kenmoreList = ((ListView)findViewById(R.id.kenmoreview));
  1318.         this.kenmoreList.setAdapter(this.kenmoreAdapter);
  1319.         /* Pricing */
  1320.         this.priceAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, new String[] {"C11 : 19.98","F12 : 39.58","J13 : 54.98","L14 : 72.57","N15 : 85.62","Q16 : 126.50","S17 : 202.98","U18 : 231.78","W19 : 272.95","X20 : 495.00","2nd Appliance: 70.00","Minor service Call: 79.95","Service Call: 89.95","LG & Samsung: 99.95","Built In: 119.95","NW Mileage: (miles * 2) * .6","FixYourBoard: (cost * 2) + labor + sc"});
  1321.         this.priceList = ((ListView)findViewById(R.id.priceview));
  1322.         this.priceList.setAdapter(this.priceAdapter);
  1323.         /* Questions */
  1324.         this.questionAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, new String[] {"Refrigerator","Washer","Dryer","Dishwasher","Microwave","Range"});
  1325.         this.questionList = ((ListView)findViewById(R.id.machineview));
  1326.         this.questionList.setAdapter(this.questionAdapter);
  1327.         this.questionList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1328.         public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1329.         {
  1330.            MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1331.            questList.setAdapter(null);
  1332.            if(arg3 == 0)
  1333.            {
  1334.                MainActivity.this.issueAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Not Cooling","Noise","Ice Making","Frost Build Up","Shuts Off","Leaking","Lights Not Working","Water Not Dispensing","Too Cold"});
  1335.                MainActivity.this.issueList = ((ListView)findViewById(R.id.issueview));
  1336.                MainActivity.this.issueList.setAdapter(MainActivity.this.issueAdapter);
  1337.                category=0;
  1338.            }
  1339.            if(arg3 == 1)
  1340.            {
  1341.                MainActivity.this.issueAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Spinning Issues or Clothes Still Wet","Noise Issue","Doesn't Work At All","Doesn't Drain","Incoming Water Issues","Overflow With Water","Shakes or Vibration Issues","Clothes Not Clean","Leaking"});
  1342.                MainActivity.this.issueList = ((ListView)findViewById(R.id.issueview));
  1343.                MainActivity.this.issueList.setAdapter(MainActivity.this.issueAdapter);
  1344.                category=1;
  1345.            }
  1346.            if(arg3 == 2)
  1347.            {
  1348.                MainActivity.this.issueAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Clothes Not Dry Or Takes A Long Time","Noise Issue","Doesn't Work At All"});
  1349.                MainActivity.this.issueList = ((ListView)findViewById(R.id.issueview));
  1350.                MainActivity.this.issueList.setAdapter(MainActivity.this.issueAdapter);
  1351.                category=2;
  1352.            }
  1353.            if(arg3 == 3)
  1354.            {
  1355.                MainActivity.this.issueAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Dishes Not Clean At All Or Not Enough","No water Incoming","Leaking","Noise Issue","Doesn't Work At All"});
  1356.                MainActivity.this.issueList = ((ListView)findViewById(R.id.issueview));
  1357.                MainActivity.this.issueList.setAdapter(MainActivity.this.issueAdapter);
  1358.                category=3;
  1359.            }
  1360.             if(arg3 == 4)
  1361.             {
  1362.                 MainActivity.this.issueAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Doesn't Work At All","Display Works But Won't Run","Not Heat","Turns Itself On Automatically","Noise Issues","Sparking And Arcing"});
  1363.                 MainActivity.this.issueList = ((ListView)findViewById(R.id.issueview));
  1364.                 MainActivity.this.issueList.setAdapter(MainActivity.this.issueAdapter);
  1365.                 category=4;
  1366.             }
  1367.             if(arg3 == 5)
  1368.             {
  1369.                 MainActivity.this.issueAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Display Doesn't Work","Oven Doesn't Work","Burners Not Working"});
  1370.                 MainActivity.this.issueList = ((ListView)findViewById(R.id.issueview));
  1371.                 MainActivity.this.issueList.setAdapter(MainActivity.this.issueAdapter);
  1372.                 category=5;
  1373.             }
  1374.         }});
  1375.         this.issueList = ((ListView)findViewById(R.id.issueview));
  1376.         this.issueList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1377.         public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1378.         {
  1379.            /* Refrigerators */
  1380.            if(arg3 == 0 && category == 0)
  1381.            {
  1382.                MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Do you hear compressor on?","Do you hear fan motors?","Do you hear any sounds?","Lights come on?","What is the temperature, how do you know?","Both refrigerator and freezer?","Has it ever cooled right?","Have you tried unplugging it for a while?","Has anybody else looked at it?","Did you think it slowly got warmer overtime?","Any other issues?"});
  1383.                MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1384.                MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1385.            }
  1386.             if(arg3 == 1 && category == 0)
  1387.             {
  1388.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"What do you think the noise is?","Does the noise go away when open refrigerator door?","Can you describe the noise: humming or clicking or screeching?","Is there a no cooling issues also?","Has it always made the noise since you had it?","Have you tried unplugging it for a while?","Has anybody else looked at it?","Did you think it slowly got worse overtime?","Any other issues?"});
  1389.                 MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1390.                 MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1391.             }
  1392.             if(arg3 == 2 && category == 0)
  1393.             {
  1394.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Any idea whats wrong with the ice maker?","Does it have a water dispenser and does the water come out okay?","Do you have any noise issues associated with it?","Is there a no cooling issues also?","Has it ever made ice before?","Have you tried unplugging it for a while?","Has anybody else looked at it?","Any other issues?"});
  1395.                 MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1396.                 MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1397.             }
  1398.             if(arg3 == 3 && category == 0)
  1399.             {
  1400.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue?","Is the frost in freezer or refrigerator?","Where is the frost located towards front or back of machine?","Has it always done this?","Has anybody else worked on this?","Any other issues?"});
  1401.                 MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1402.                 MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1403.             }
  1404.             if(arg3 == 4 && category == 0)
  1405.             {
  1406.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","Does your breaker have a ground fault?","Did you check with an electrician?","How many times does it shut off day/week/month?","When it shuts upp does it say off, til you unplug it?","Any other issues?"});
  1407.                 MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1408.                 MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1409.             }
  1410.             if(arg3 == 5 && category == 0)
  1411.             {
  1412.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","Has it always leaked since you had it?","What do you think the issue is?","location of the leak: back front sides?","Do you have to shut off the water/ice maker?","Has anybody else worked on it?","Any other issues?"});
  1413.                 MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1414.                 MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1415.             }
  1416.             if(arg3 == 6 && category == 0)
  1417.             {
  1418.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","Has it always did this since you had it?","Does it have 120v at the outlet?","Does anything come on?","What do you think the issue is?","Do you hear any noises?","Any other issues?"});
  1419.                 MainActivity.this.questList = ((ListView)findViewById(R.id.questionview));
  1420.                 MainActivity.this.questList.setAdapter(MainActivity.this.questAdapter);
  1421.             }
  1422.             if(arg3 == 7 && category == 0)
  1423.             {
  1424.                 MainActivity.this.questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Notice any leaking?","Hear clicking sound when trying to dispense water?","Ice Maker working?","Any other issues?"});
  1425.                 MainActivity.this.questList = findViewById(R.id.questionview);
  1426.                 questList.setAdapter(questAdapter);
  1427.             }
  1428.             if(arg3 == 8 && category == 0)
  1429.             {
  1430.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Are you blocking air flow at top of refrigerator?","What exactly is frozen if anything in refrigerator","How do you know the temperatures?","Any other issues?"});
  1431.                 questList = findViewById(R.id.questionview);
  1432.                 questList.setAdapter(questAdapter);
  1433.             }
  1434.             /* Washers */
  1435.             if(arg3 == 0 && category == 1)
  1436.             {
  1437.                 /* Spinning Issues or Clothes Still Wet */
  1438.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started or progressively got worse?","Does the machine spin do you think?","Is there pooling water after the cycle?","Any strange noises?","Does the machine stop and start spinning?","Is the machine level?","Are the floor boards a firm foundation?","Any other issues?"});
  1439.                 questList = findViewById(R.id.questionview);
  1440.                 questList.setAdapter(questAdapter);
  1441.             }
  1442.             if(arg3 == 1 && category == 1)
  1443.             {
  1444.                 /* Noise Issue */
  1445.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started or progressively got worse?","When does it make the during, what part of the cycle?","How would you describe the noise sounding screeching or banging?","Any other issues?"});
  1446.                 questList = findViewById(R.id.questionview);
  1447.                 questList.setAdapter(questAdapter);
  1448.             }
  1449.             if(arg3 == 2 && category == 1)
  1450.             {
  1451.                 /* Doesn't Work At All */
  1452.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Does anything still function?","Have you checked the power supply 120v?","Any other issues?"});
  1453.                 questList = findViewById(R.id.questionview);
  1454.                 questList.setAdapter(questAdapter);
  1455.             }
  1456.             if(arg3 == 3 && category == 1)
  1457.             {
  1458.                 /* Doesn't Drain */
  1459.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Can you hear any noises?","How many times have you tried it?","Any other issues?"});
  1460.                 questList = findViewById(R.id.questionview);
  1461.                 questList.setAdapter(questAdapter);
  1462.             }
  1463.             if(arg3 == 4 && category == 1)
  1464.             {
  1465.                 /* Incoming Water Issue */
  1466.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Is some water barely dripping out?","Any Error Codes?","Is the water on?","Does either cold or hot water work on cycle?","Any other issues?"});
  1467.                 questList = findViewById(R.id.questionview);
  1468.                 questList.setAdapter(questAdapter);
  1469.             }
  1470.             if(arg3 == 5 && category == 1)
  1471.             {
  1472.                 /* Overflow With Water*/
  1473.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened?","Any other issues?"});
  1474.                 questList = findViewById(R.id.questionview);
  1475.                 questList.setAdapter(questAdapter);
  1476.             }
  1477.             if(arg3 == 6 && category == 1)
  1478.             {
  1479.                 /* Shakes or Vibrates */
  1480.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened?","Any odd noises associated with the shakes?","Is the washer sitting on a firm foundation?","Any other issues?"});
  1481.                 questList = findViewById(R.id.questionview);
  1482.                 questList.setAdapter(questAdapter);
  1483.             }
  1484.             if(arg3 == 7 && category == 1)
  1485.             {
  1486.                 /* Shakes or Vibrates */
  1487.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened?","What times of soaps do you use: liquid or dry or pouch","Do you know if you have hard water or soft water","Any other issues?"});
  1488.                 questList = findViewById(R.id.questionview);
  1489.                 questList.setAdapter(questAdapter);
  1490.             }
  1491.             if(arg3 == 8 && category == 1)
  1492.             {
  1493.                 /* Leaking */
  1494.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened?","Where does it appear the water comes out: front/back/side?","Any other issues?"});
  1495.                 questList = findViewById(R.id.questionview);
  1496.                 questList.setAdapter(questAdapter);
  1497.             }
  1498.             /* Dryers */
  1499.             if(arg3 == 0 && category == 2)
  1500.             {
  1501.                 /* Clothes Not Dry Or Takes A Long Time */
  1502.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened?","Does it not dry at all or take too long to dry?","Does your venting go up to the roof?","Is your venting clear do you think?","Any other issues?"});
  1503.                 questList = findViewById(R.id.questionview);
  1504.                 questList.setAdapter(questAdapter);
  1505.             }
  1506.             if(arg3 == 1 && category == 2)
  1507.             {
  1508.                 /* Noise Issues */
  1509.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened, almost every time?","How would you describe the noise: screeching, banging, thumping, or whistling","The noise happens when it tumbles right?","Any other issues?"});
  1510.                 questList = findViewById(R.id.questionview);
  1511.                 questList.setAdapter(questAdapter);
  1512.             }
  1513.             if(arg3 == 2 && category == 2)
  1514.             {
  1515.                 /* Doesn't Work At All*/
  1516.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Have you tried unplugging, and it still doesn't work?","So the display doesn't work? Nothing works?","Can you think of an event that might have trigger this?","Any other issues?"});
  1517.                 questList = findViewById(R.id.questionview);
  1518.                 questList.setAdapter(questAdapter);
  1519.             }
  1520.             /* Dishwashers */
  1521.             if(arg3 == 0 && category == 3)
  1522.             {
  1523.                 /* Dishes Not Clean At All Or Not Enough */
  1524.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Is the incoming water hot, and how long does it take water to get hot in faucet?","Does the soap dispense?","What type of soap are you using?","Do you the water temperature is hot?","Does you hear circulation pump turn on?","Any other issues?"});
  1525.                 questList = findViewById(R.id.questionview);
  1526.                 questList.setAdapter(questAdapter);
  1527.             }
  1528.             if(arg3 == 1 && category == 3)
  1529.             {
  1530.                 /* No Incomming Water */
  1531.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Any other issues?"});
  1532.                 questList = findViewById(R.id.questionview);
  1533.                 questList.setAdapter(questAdapter);
  1534.             }
  1535.             if(arg3 == 2 && category == 3)
  1536.             {
  1537.                 /* Noise Issues */
  1538.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened, almost every time?","How would you describe the noise: screeching, banging, thumping, or whistling","During which part of the cycle: right away or few minutes or hour?","Any other issues?"});
  1539.                 questList = findViewById(R.id.questionview);
  1540.                 questList.setAdapter(questAdapter);
  1541.             }
  1542.             if(arg3 == 3 && category == 3)
  1543.             {
  1544.                 /* Doesn't Work At All*/
  1545.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Have you tried unplugging, and it still doesn't work?","So the display doesn't work? Nothing works?","Can you think of an event that might have trigger this?","Any other issues?"});
  1546.                 questList = findViewById(R.id.questionview);
  1547.                 questList.setAdapter(questAdapter);
  1548.             }
  1549.             /* Microwaves */
  1550.             if(arg3 == 0 && category == 4)
  1551.             {
  1552.                 /* Doesn't Work At All*/
  1553.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Have you tried unplugging, and it still doesn't work?","So the display doesn't work? Nothing works?","Can you think of an event that might have trigger this?","Got 120v to outlet?","Any other issues?"});
  1554.                 questList = findViewById(R.id.questionview);
  1555.                 questList.setAdapter(questAdapter);
  1556.             }
  1557.             if(arg3 == 1 && category == 4)
  1558.             {
  1559.                 /* Display Works But Won't Run */
  1560.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Have you tried unplugging, and it still doesn't work?","So the keypad button doesn't work? What works?","Can you think of an event that might have trigger this?","Any other issues?"});
  1561.                 questList = findViewById(R.id.questionview);
  1562.                 questList.setAdapter(questAdapter);
  1563.             }
  1564.             if(arg3 == 2 && category == 4)
  1565.             {
  1566.                 /* Not Heat */
  1567.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Is it intermittent? Or all the time?","Can you hear any fans on when you press start?","Hear a buzzing noise at all?","Any other issues?"});
  1568.                 questList = findViewById(R.id.questionview);
  1569.                 questList.setAdapter(questAdapter);
  1570.             }
  1571.             if(arg3 == 3 && category == 4)
  1572.             {
  1573.                 /* Turns Itself On Automatically */
  1574.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Can you think of an event that might have trigger this?","Any other issues?"});
  1575.                 questList = findViewById(R.id.questionview);
  1576.                 questList.setAdapter(questAdapter);
  1577.             }
  1578.             if(arg3 == 4 && category == 4)
  1579.             {
  1580.                 /* Noise Issues */
  1581.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","How many times has this happened, almost every time?","How would you describe the noise: screeching, banging, thumping, or whistling","The noise happens right away or takes a while?","Any other issues?"});
  1582.                 questList = findViewById(R.id.questionview);
  1583.                 questList.setAdapter(questAdapter);
  1584.             }
  1585.             if(arg3 == 5 && category == 4)
  1586.             {
  1587.                 /* Sparking And Arcing */
  1588.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Using microwave safe plates right?","Location of the arcing is where, any burn marks?","Any other issues?"});
  1589.                 questList = findViewById(R.id.questionview);
  1590.                 questList.setAdapter(questAdapter);
  1591.             }
  1592.             /* Ranges */
  1593.             //"Display Doesn't Work","Oven Doesn't Work","Burners Not Working"
  1594.             if(arg3 == 0 && category == 5)
  1595.             {
  1596.                 /* Display Doesn't Work */
  1597.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Do you remember how this happened when it when out?","The burners still work correct?","Any other issues?"});
  1598.                 questList = findViewById(R.id.questionview);
  1599.                 questList.setAdapter(questAdapter);
  1600.             }
  1601.             if(arg3 == 1 && category == 5)
  1602.             {
  1603.                 /* Oven Doesn't Work*/
  1604.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Did you use self clean?","It takes 20 minutes sometimes to get to the temperature.","Is it warm at all in oven?","Any other issues?"});
  1605.                 questList = findViewById(R.id.questionview);
  1606.                 questList.setAdapter(questAdapter);
  1607.             }
  1608.             if(arg3 == 2 && category == 5)
  1609.             {
  1610.                 /* Burners Not Working */
  1611.                 questAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"Tell me a little more about this issue.","What do you think the issue is?","Has anybody else worked on it?","Has it always done this or just started?","Do any of the burners work, or just one is bad?","Any other issues?"});
  1612.                 questList = findViewById(R.id.questionview);
  1613.                 questList.setAdapter(questAdapter);
  1614.             }
  1615.         }});
  1616.         /* Service Attendant */
  1617.         final Button load_button = findViewById(R.id.load_database);
  1618.         load_button.setOnClickListener(new View.OnClickListener() {
  1619.             public void onClick(View v)
  1620.             {
  1621.                 //Toast.makeText(MainActivity.this, "hello", Toast.LENGTH_LONG).show();
  1622.                 load_button.setEnabled(false);
  1623.                 try
  1624.                {
  1625.                    /* Open database - In order to do this need to settings->app->service help->permissions*/
  1626.                    //String text_find = "";
  1627.                    int data_size=0;
  1628.                    String path = Environment.getExternalStorageDirectory().getPath() + "/Database/data.sqlite";
  1629.                    SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY);
  1630.                    /* Grab Data */
  1631.                    Cursor c = db.rawQuery("SELECT MODEL FROM Repair", null);
  1632.                    Cursor d = db.rawQuery("SELECT SERIAL FROM Repair", null);
  1633.                    Cursor e = db.rawQuery("SELECT DESCRIPT FROM Repair", null);
  1634.                    Cursor f = db.rawQuery("SELECT TECHNICIAN FROM Repair", null);
  1635.                    Cursor g = db.rawQuery("SELECT MAKE FROM Repair", null);
  1636.                    Cursor h = db.rawQuery("SELECT LNAME FROM Repair", null);
  1637.                    Cursor i = db.rawQuery("SELECT FNAME FROM Repair", null);
  1638.                    Cursor j = db.rawQuery("SELECT ADDRESS FROM Repair", null);
  1639.                    Cursor k = db.rawQuery("SELECT CITY FROM Repair", null);
  1640.                    Cursor l = db.rawQuery("SELECT PHONE1 FROM Repair", null);
  1641.                    Cursor m = db.rawQuery("SELECT DATE_IN FROM Repair", null);
  1642.                    Cursor n = db.rawQuery("SELECT PROBLEM1 FROM Repair", null);
  1643.                    Cursor o = db.rawQuery("SELECT PROBLEM2 FROM Repair", null);
  1644.                    Cursor p = db.rawQuery("SELECT PROBLEM3 FROM Repair", null);
  1645.                    Cursor q = db.rawQuery("SELECT REPAIR1 FROM Repair", null);
  1646.                    Cursor r = db.rawQuery("SELECT REPAIR2 FROM Repair", null);
  1647.                    Cursor s = db.rawQuery("SELECT REPAIR3 FROM Repair", null);
  1648.                    Cursor t = db.rawQuery("SELECT WORKORDER FROM Repair", null);
  1649.                    Cursor u = db.rawQuery("SELECT NOTES FROM Repair", null);
  1650.                    modeltables = new ArrayList<>();
  1651.                    serialtables = new ArrayList<>();
  1652.                    desctables = new ArrayList<>();
  1653.                    techtables = new ArrayList<>();
  1654.                    maketables = new ArrayList<>();
  1655.                    lasttables = new ArrayList<>();
  1656.                    firsttables = new ArrayList<>();
  1657.                    addresstables = new ArrayList<>();
  1658.                    citytables = new ArrayList<>();
  1659.                    phonetables = new ArrayList<>();
  1660.                    datetables = new ArrayList<>();
  1661.                    problem1tables = new ArrayList<>();
  1662.                    problem2tables = new ArrayList<>();
  1663.                    problem3tables = new ArrayList<>();
  1664.                    repair1tables = new ArrayList<>();
  1665.                    repair2tables = new ArrayList<>();
  1666.                    repair3tables = new ArrayList<>();
  1667.                    ordertables = new ArrayList<>();
  1668.                    notestables = new ArrayList<>();
  1669.                    emptytables = new ArrayList<>();
  1670.                    while (c.moveToNext())
  1671.                    {
  1672.                        d.moveToNext();
  1673.                        e.moveToNext();
  1674.                        f.moveToNext();
  1675.                        g.moveToNext();
  1676.                        h.moveToNext();
  1677.                        i.moveToNext();
  1678.                        j.moveToNext();
  1679.                        k.moveToNext();
  1680.                        l.moveToNext();
  1681.                        m.moveToNext();
  1682.                        n.moveToNext();
  1683.                        o.moveToNext();
  1684.                        p.moveToNext();
  1685.                        q.moveToNext();
  1686.                        r.moveToNext();
  1687.                        s.moveToNext();
  1688.                        t.moveToNext();
  1689.                        u.moveToNext();
  1690.                        data_size++;
  1691.                        modeltables.add(c.getString(0));
  1692.                        serialtables.add(d.getString(0));
  1693.                        desctables.add(e.getString(0));
  1694.                        techtables.add(f.getString(0));
  1695.                        maketables.add(g.getString(0));
  1696.                        lasttables.add(h.getString(0));
  1697.                        firsttables.add(i.getString(0));
  1698.                        addresstables.add(j.getString(0));
  1699.                        citytables.add(k.getString(0));
  1700.                        phonetables.add(l.getString(0));
  1701.                        datetables.add(m.getString(0));
  1702.                        problem1tables.add(n.getString(0));
  1703.                        problem2tables.add(o.getString(0));
  1704.                        problem3tables.add(p.getString(0));
  1705.                        repair1tables.add(q.getString(0));
  1706.                        repair2tables.add(r.getString(0));
  1707.                        repair3tables.add(s.getString(0));
  1708.                        ordertables.add(t.getString(0));
  1709.                        notestables.add(u.getString(0));
  1710.                    }
  1711.                    /* Display Data */
  1712.                    modelAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, emptytables);
  1713.                    modelList = findViewById(R.id.modelview);
  1714.                    modelList.setAdapter(modelAdapter);
  1715.  
  1716.  
  1717.                    Toast.makeText(MainActivity.this,"Database Extracted: "+data_size + " entries.", Toast.LENGTH_LONG).show();
  1718.                    db.close();
  1719.                    scan_button.setEnabled(true);
  1720.                }
  1721.                catch(Exception e)
  1722.                 {
  1723.                     Toast.makeText(MainActivity.this,"Error " + e.getMessage(), Toast.LENGTH_LONG).show();
  1724.                 }
  1725.  
  1726.  
  1727.             }
  1728.         });
  1729.         /* Service Attendant Continued - click on listbox item*/
  1730.         modelList = findViewById(R.id.modelview);
  1731.         modelList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  1732.         public void onItemClick(android.widget.AdapterView<?> arg1, View arg2, int arg3, long arg4)
  1733.         {
  1734.  
  1735.             if(String.valueOf(emptytables.get(arg3)) != " ")
  1736.             {
  1737.                 /* Print The File Information */
  1738.  
  1739.                 dataText.setText("Work Order: "+ordertables.get(location_array[arg3])+"\n");
  1740.                 dataText.append("Name: "+firsttables.get(location_array[arg3])+" "+lasttables.get(location_array[arg3])+"\n");
  1741.                 dataText.append("Location: "+addresstables.get(location_array[arg3])+","+citytables.get(location_array[arg3])+"\n");
  1742.                 dataText.append("Contact: "+phonetables.get(location_array[arg3])+"\n");
  1743.                 dataText.append("Service Date: "+datetables.get(location_array[arg3])+"\n");
  1744.                 dataText.append("Machine: "+maketables.get(location_array[arg3])+" "+modeltables.get(location_array[arg3])+" "+serialtables.get(location_array[arg3])+"\n");
  1745.                 dataText.append("Technician: "+techtables.get(location_array[arg3])+"\n");
  1746.                 dataText.append("Description: "+desctables.get(location_array[arg3])+"\n");
  1747.                 dataText.append("Problem: "+problem1tables.get(location_array[arg3])+";"+problem2tables.get(location_array[arg3])+";"+problem3tables.get(location_array[arg3])+"\n");
  1748.                 dataText.append("Repair: "+repair1tables.get(location_array[arg3])+";"+repair2tables.get(location_array[arg3])+";"+repair3tables.get(location_array[arg3])+"\n");
  1749.                 dataText.append("Note: "+notestables.get(location_array[arg3])+"\n");
  1750.             }
  1751.             else
  1752.             {
  1753.                 Toast.makeText(MainActivity.this,"Nothing selected!", Toast.LENGTH_LONG).show();
  1754.             }
  1755.  
  1756.         }});
  1757.  
  1758.     }
  1759. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top