package [Link].
ev_telematics;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].ev_telematics.constants.Constant_URLS;
import [Link].ev_telematics.[Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].ev_telematics.[Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class DashboardActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
private ActivityDashboardBinding binding;
ImageView imageView;
ImageView imagelogo;
TextView txtdatetime;
ImageView imagevehicle;
ImageView imagekyc;
ImageView imgignition;
//ImageView imagetrips;
ImageView imagerequests;
ImageView imgbatterylevelindicator;
//ImageView imageservice;
TextView txtcustomername;
TextView textCustomerName1;
TextView txtcustomerid;
TextView txtDataDisplayDate;
String strUserName;
TextView textViewemail;
int vehicleCount= 0;
String a="";
String strCustomerID="";
ImageView imagecustomer;
ImageView batterycharge;
Thread myThread1 = null;
String vehicleNo="";
TextView textkmsrun;
TextView textbatterylevel;
TextView textkmsleft;
String vehicles[];
ArrayList<String> mylist = new ArrayList<String>();
ArrayList<String> mylist1 = new ArrayList<String>();
ArrayAdapter<String> adapter;
AutoCompleteTextView acTextView;
TextView txtTotalVehicles;
TextView textUserName;
TextView textMobileNo;
TextView textIdleState;
private ProgressBar progressBar;
protected void onResume() {
[Link]();
adapter = new ArrayAdapter<String>(this,
[Link].select_dialog_singlechoice, mylist);
//Find TextView control
acTextView = (AutoCompleteTextView) findViewById([Link]);
if ([Link]() > 0) {
//[Link]([Link], " rama krishna",
Toast.LENGTH_SHORT).show();
[Link]([Link]);
}
[Link]();
[Link](1);
//Set the adapter
[Link](adapter);
if([Link] == 1)
{
[Link]([Link]);
[Link](null, null, null,
null);
[Link]([Link]);
[Link](false);
}else{
[Link]([Link]);
[Link]("Vehicle(s) Count : " +
[Link]);
[Link](true);
}
[Link](new [Link]() {
@Override
public void onClick(View v) {
}
});
[Link]([Link] == "disp" ?
[Link] : [Link]);
[Link]([Link]);
[Link]("0 mi [Idle]");
Runnable myRunnableThread = new [Link]();
myThread1 = new Thread(myRunnableThread);
[Link]();
}
@Override
public void onBackPressed()
{
myThread1=null;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
binding = [Link](getLayoutInflater());
setContentView([Link]());
setSupportActionBar([Link]);
[Link](new [Link]() {
@Override
public void onClick(View view) {
//[Link](view, "Replace with your own action",
Snackbar.LENGTH_LONG)
//.setAction("Action", null).show();
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
DrawerLayout drawer = [Link];
NavigationView navigationView = [Link];
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new [Link](
[Link].nav_home, [Link].nav_profile, [Link].nav_changepassword)
.setOpenableLayout(drawer)
.build();
NavController navController = [Link](this,
[Link].nav_host_fragment_content_dashboard);
[Link](this, navController,
mAppBarConfiguration);
[Link](navigationView, navController);
MenuItem logOutItem = [Link]().findItem([Link].nav_logout);
[Link](new
[Link]() {
@Override
public boolean onMenuItemClick(MenuItem item) {
finishAffinity();
[Link](0);
return true;
}
});
getVehicleNosData();
vehicles= new String[[Link]()];
for (int i = 0; i < [Link](); i++) {
vehicles[i] = [Link](i);
textkmsrun = findViewById([Link]);
textbatterylevel = findViewById([Link]);
textkmsleft = findViewById([Link]);
txtTotalVehicles = findViewById([Link]);
txtDataDisplayDate= findViewById([Link]);
batterycharge= findViewById([Link]);
textUserName= findViewById([Link]);
textMobileNo= findViewById([Link]);
textIdleState= findViewById([Link]);
/*Integer[] image =
{ [Link].b10,[Link].b9,[Link].b8,[Link].b7,[Link].b6,[Link]
.b5,[Link].b4,[Link].b3,[Link].b2 };
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
//[Link]([Link].b10);
for(int i=0;i<9;i++){
[Link](image[i]);
}
}
public void onFinish() {
//[Link]("done!");
}
}.start();*/
progressBar = findViewById([Link]);
imgbatterylevelindicator= findViewById([Link]);
imgignition= findViewById([Link]);
imagevehicle = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
vehiclesInfo();
[Link]([Link]);
}
});
imagekyc = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
/*
imageservice= findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
imagetrips= findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
*/
imagerequests= findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
strUserName="suresh";
[Link]=strUserName;
txtdatetime= findViewById([Link]);
//imagecustomer = findViewById([Link]);
//nav_view
//NavigationView navigationView1 = (NavigationView)
findViewById([Link].nav_header_dashboard);
//View header = [Link](0) ;
//TextView userTxt = (TextView) [Link]([Link]); //your
ID
// [Link](email);
//View header = [Link](0);
//LinearLayout navHeader=(LinearLayout)
[Link](this).inflate([Link].nav_header_dashboard, null);
//[Link](linearLayout);
//TextView mProfileName = (TextView)
[Link]([Link].profile_name);
//TextView mProfileEmail = (TextView)
[Link]([Link].profile_email);
//View headerView =
[Link]([Link].nav_header_dashboard);
//[Link]([Link].navigation_header_text);
View header = [Link](0) ;
MenuItem homeItem = [Link]().findItem([Link].nav_home);
[Link](new [Link]()
{
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
return true;
}
});
try {
textViewemail = (TextView) [Link]([Link]);
textCustomerName1 = (TextView)
[Link]([Link].textCustomerName1);
imageView= (ImageView) [Link]([Link]);
//[Link]("rama");
//[Link]([Link], " EV Telematics Data " +
[Link](), Toast.LENGTH_SHORT).show();
}catch(Exception ex){
//[Link]([Link], " EV Telematics Data null " +
[Link](), Toast.LENGTH_SHORT).show();
}
Thread myThread = null;
Runnable myRunnableThread = new CountDownRunner();
myThread = new Thread(myRunnableThread);
[Link]();
//[Link]([Link], "1", Toast.LENGTH_LONG).show();
if ([Link] == "") {
try {
//[Link]([Link], "12",
Toast.LENGTH_LONG).show();
String url = Constant_URLS.BASE_URL +
"/customerRoutes/getCustomerDataByUserName/" + [Link];
//[Link]([Link],"Result" +
url,Toast.LENGTH_LONG).show();
//[Link]([Link]);
final RequestQueue requestQueue =
[Link]([Link]);
final RequestQueue mRequestQueue =
[Link]([Link]);//image request
final RequestQueue mRequestQueueRCFront =
[Link]([Link]);//image request
//final RequestQueue mRequestStateQueue =
[Link]([Link]);//state name
//final RequestQueue mRequestCityQueue =
[Link]([Link]);//city name
StringRequest stringRequest = new
StringRequest([Link], url,
new [Link]<String>() {
@Override
public void onResponse(String response) {
if (response != null) {
//[Link]([Link],
"123", Toast.LENGTH_LONG).show();
try {
//[Link]([Link], "1234", Toast.LENGTH_LONG).show();
JSONObject object = new
JSONObject(response);
//URL newurl = new
URL(Constant_URLS.BASE_URL + "/customer/" + [Link]("UserPhoto"));
String name
=[Link]("FirstName") + " " + ([Link]("LastName") != "null" ?
[Link]("LastName") : "");
[Link] =name;
//[Link]([Link]("FirstName") + " " +
[Link]("LastName"));
//[Link]([Link]("CustomerID"));
[Link]([Link]("FirstName") + " " +
[Link]("LastName"));
strCustomerID=[Link]("CustomerID");
[Link] =
[Link]("UserName");
[Link] =
[Link]("CustomerID");
[Link] =
[Link]("DisplayName");
//[Link]([Link],[Link],Toast.LENGTH_LONG).
show();
if([Link]("disp"))
{
[Link]([Link]);
}else{
[Link]([Link]);
}
[Link]([Link]);
[Link]("0 mi [Idle]");
getVehicleCount();
//strCustomerID=
[Link]("CustomerID");
[Link] =
[Link]("DealerID");
[Link] =
[Link]("MobileNo");
[Link] =
[Link]("EmailAddress");
//[Link]([Link]("EmailAddress"));
[Link]([Link]("EmailAddress"));
[Link] =
[Link]("Address");
[Link] =
[Link]("StateCode");
[Link] =
[Link]("CityCode");
[Link] =
[Link]("AadharCardNo");
[Link] =
[Link]("PanCardNo");
[Link] =
[Link]("RCFrontTitle");
//[Link] =
[Link]("RCFrontImage");
[Link] =
[Link]("RCBackTitle");
//[Link] =
[Link]("RCBackImage");
PrefManager.Kyc2Title =
[Link]("Kyc2Title");
//PrefManager.Kyc2Image =
[Link]("Kyc2Image");
PrefManager.Kyc3Title =
[Link]("Kyc3Title");
//PrefManager.Kyc3Image =
[Link]("Kyc3Image");
PrefManager.Kyc4Title =
[Link]("Kyc4Title");
//PrefManager.Kyc4Image =
[Link]("Kyc4Image");
[Link] =
[Link]("Status");
//Customer Image
ImageRequest imageRequest = new
ImageRequest(Constant_URLS.BASE_URL + "/customer/" + [Link]("UserPhoto"),
new BitmapListener(), 0, 0, null, null, new MyErrorListener());
[Link](imageRequest);
ImageRequest imageRequestRCF = new
ImageRequest(Constant_URLS.BASE_URL + "/customer/" +
[Link]("RCFrontImage"), new BitmapListenerRCFront(), 0, 0, null, null,
new MyErrorListener());
[Link](imageRequestRCF);
ImageRequest imageRequestRCB = new
ImageRequest(Constant_URLS.BASE_URL + "/customer/" +
[Link]("RCBackImage"), new BitmapListenerRCBack(), 0, 0, null, null, new
MyErrorListener());
[Link](imageRequestRCB);
ImageRequest imageRequestBWB = new
ImageRequest(Constant_URLS.BASE_URL + "/customer/" + [Link]("Kyc2Image"),
new BitmapListenerBWB(), 0, 0, null, null, new MyErrorListener());
[Link](imageRequestBWB);
if([Link](""))
{
PrefManager.Kyc3Title="";
}else {
ImageRequest imageRequestKYC1 = new
ImageRequest(Constant_URLS.BASE_URL + "/customer/" + [Link]("Kyc3Image"),
new BitmapListenerKYC1(), 0, 0, null, null, new MyErrorListener());
[Link](imageRequestKYC1);
}
if([Link](""))
{
PrefManager.Kyc4Title="";
}else {
ImageRequest imageRequestKYC2 = new
ImageRequest(Constant_URLS.BASE_URL + "/customer/" + [Link]("Kyc4Image"),
new BitmapListenerKYC2(), 0, 0, null, null, new MyErrorListener());
[Link](imageRequestKYC2);
}
//[Link]([Link]);
//[Link]();
[Link]([Link]);
} catch (JSONException e) {
[Link]([Link],
"12345", Toast.LENGTH_LONG).show();
throw new RuntimeException(e);
}
} else {
[Link]([Link], " EV
Telematics Data null ", Toast.LENGTH_SHORT).show();
}
//Log.d("response", [Link]());
//[Link]([Link],"Result" +
response,Toast.LENGTH_LONG).show();
//[Link]();
}
},
new [Link]() {
@Override
public void onErrorResponse(VolleyError error) {
// Do something when get error
//tv_respuesta.setText([Link]());
Log.d("error", [Link]());
[Link]([Link], "hello
Not Okey" + error, Toast.LENGTH_LONG).show();
[Link]();
//[Link]([Link]);
}
}
);
//[Link](stringRequest);
[Link](stringRequest);
//[Link]([Link], "123456",
Toast.LENGTH_LONG).show();
}catch (Exception e)
{
//[Link]([Link], "1234567",
Toast.LENGTH_LONG).show();
}
//[Link]([Link]);
} else {
//[Link]([Link], "12345678",
Toast.LENGTH_LONG).show();
[Link]([Link]);
//[Link]([Link]);
//[Link]([Link]);
[Link]([Link]);
[Link]([Link]);
//[Link]([Link]);
[Link]([Link]);
//[Link]([Link]);
}
[Link]([Link]);
//[Link]();
}
public void getVehicleNo(){
RequestQueue queue = [Link]([Link]);
// in this case the data we are getting is in the form
// of array so we are making a json array request.
// below is the line where we are making an json array
// request and then extracting data from each json object.
String url = Constant_URLS.BASE_URL +
"/vehicleRoutes/getVehiclesByCustomerID/" + [Link];
JsonArrayRequest jsonArrayRequest = new
JsonArrayRequest([Link], url, null, new [Link]<JSONArray>()
{
@Override
public void onResponse(JSONArray response) {
[Link]([Link]);
//[Link]([Link]);
for (int i = 0; i < [Link](); i++) {
// creating a new json object and
// getting each object from our json array.
try {
// we are getting each json object.
JSONObject responseObj = [Link](i);
// now we get our response from API in json object format.
// in below line we are extracting a string with
// its key value from our json object.
// similarly we are extracting all the strings from our
json object.
//String vehicleno="Vehicle No : " +
[Link]("VehicleNo");
[Link]=
[Link]("VehicleNo");
[Link]([Link]);
[Link](false);
getSelectedVehicleNoIMEINo([Link]);
} catch (JSONException e) {
[Link]();
}
}
}
}, new [Link]() {
@Override
public void onErrorResponse(VolleyError error) {
[Link]([Link], "Fail " + error,
Toast.LENGTH_SHORT).show();
}
});
[Link](jsonArrayRequest);
}
public void getVehicleCount(){
try {
final RequestQueue requestQueue1 =
[Link]([Link]);
String url1 = Constant_URLS.BASE_URL +
"/vehicleRoutes/getAllVehiclesCountByCustomerID/" + [Link];
StringRequest stringRequest1 = new StringRequest([Link],
url1,
new [Link]<String>() {
@Override
public void onResponse(String response) {
if (response != null) {
try {
JSONObject object1 = new JSONObject(response);
[Link] =
[Link]("VehicleCount");
[Link] =
[Link]("VehicleCount");
if([Link] == 1)
{
[Link](null, null, null, null);
[Link]([Link]);
//[Link]([Link], "
Vehicle No Code ", Toast.LENGTH_SHORT).show();
getVehicleNo();
}else{
[Link]([Link]);
[Link]("Vehicle(s)
Count : " + [Link]);
}
[Link]([Link]);
//vehiclesInfo();
} catch (JSONException e) {
[Link]();
Log.e("JSON", "Json parsing error: " +
[Link]());
}
} else {
[Link]([Link], " Vehicle
Count Data null ", Toast.LENGTH_SHORT).show();
}
//Log.d("response", [Link]());
//[Link]([Link],"Result" +
response,Toast.LENGTH_LONG).show();
//[Link]();
}
},
new [Link]() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("error", [Link]());
[Link]([Link], "Not Okey
Vehicle Count" + error, Toast.LENGTH_LONG).show();
}
}
);
[Link](stringRequest1);
}catch(Exception e){
[Link]([Link], "Not Okey Vehicle Count
getVehicleCount" + e, Toast.LENGTH_LONG).show();
}
//[Link]([Link]);
}
public Bitmap fudiao(Bitmap bmpOriginal) {
int width, height, r,g, b, c,a, gry,c1,a1,r1,g1,b1,red,green,blue;
height = [Link]();
width = [Link]();
int depth = 30;
Bitmap bmpSephia = [Link](width, height,
[Link].RGB_565);
Canvas canvas = new Canvas(bmpSephia);
Paint paint = new Paint();
// ColorMatrix cm = new ColorMatrix();
// [Link](.3f, .3f, .3f, 1.0f);
// ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
// [Link](f);
[Link](bmpOriginal, 0, 0, null);
for(int y=1; y< height-1; y++) {
for(int x=1; x < width-1; x++) {
c = [Link](x, y);
r = [Link](c);
g = [Link](c);
b = [Link](c);
c1 = [Link](x-1, y-1);
r1 = [Link](c1);
g1 = [Link](c1);
b1 = [Link](c1);
red = [Link](67, [Link](255, [Link](r - r1 + 128)));
green = [Link](67, [Link](255, [Link](g - g1 + 128)));
blue = [Link](67, [Link](255, [Link](b - b1 + 128)));
if (red > 255)
{
red = 255;
}
else if (red < 0)
{
red = 0;
}
if (green > 255)
{
green = 255;
}
else if (green < 0)
{
green = 0;
}
if (blue > 255)
{
blue = 255;
}
else if (blue < 0)
{
blue = 0;
}
[Link](x, y, [Link](red, green, blue));
// [Link](x, y, [Link](a1, red, green, blue));
}
}
return bmpSephia;
}
private void getVehicleNosData() {
final RequestQueue requestQueue1 =
[Link]([Link]);
String url1 = Constant_URLS.BASE_URL +
"/vehicleRoutes/getVehiclesByCustomerID/" + [Link];//to be changed
JsonArrayRequest jsonArrayRequest = new
JsonArrayRequest([Link], url1, null, new [Link]<JSONArray>()
{
@Override
public void onResponse(JSONArray response) {
//[Link]([Link]);
//[Link]([Link]);
for (int i = 0; i < [Link](); i++) {
// creating a new json object and
// getting each object from our json array.
try {
JSONObject responseObj = [Link](i);
String vehicleno= [Link]("VehicleNo");
//[Link]([Link], "Oket " +
vehicleno, Toast.LENGTH_SHORT).show();
[Link](vehicleno);
[Link](vehicleno);
} catch (JSONException e) {
[Link]();
[Link]([Link], "Fail " + e,
Toast.LENGTH_SHORT).show();
}
}
}
}, new [Link]() {
@Override
public void onErrorResponse(VolleyError error) {
//[Link]([Link], "Fail " + error,
Toast.LENGTH_SHORT).show();
}
});
[Link](jsonArrayRequest);
adapter = new
ArrayAdapter<String>(this,[Link].select_dialog_singlechoice, mylist);
//Find TextView control
acTextView = (AutoCompleteTextView) findViewById([Link]);
//Set the number of characters the user must type before the drop down list
is shown
[Link](1);
//Set the adapter
[Link](adapter);
[Link](new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int
after) {
@Override
public void onTextChanged(CharSequence s, int start, int before, int
count) {
@Override
public void afterTextChanged(Editable s) {
String selectedItem=[Link]();
if(selectedItem != "" && [Link]()>9) {
vehicleNo=[Link]();
[Link]=vehicleNo;
getSelectedVehicleNoIMEINo([Link]);
// Showing selected spinner item
[Link]([Link], "Selected: " +
selectedItem, Toast.LENGTH_LONG).show();
}
}
});
[Link](new [Link]() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
String
selectedItem=[Link]().getItem(position).toString();
if(selectedItem != "") {
vehicleNo=[Link]();
[Link]=vehicleNo;
getSelectedVehicleNoIMEINo([Link]);
// Showing selected spinner item
[Link]([Link](), "Selected: " +
selectedItem, Toast.LENGTH_LONG).show();
}
}
});
//[Link]([Link]);
}
public void getSelectedVehicleNoIMEINo(String strVehicleNO){
String url2 = Constant_URLS.BASE_URL +
"/deviceRoutes/getDeviceByVehicelNo/" + strVehicleNO;
//[Link]([Link],"Result" +
url,Toast.LENGTH_LONG).show();
//[Link]([Link]);
final RequestQueue requestQueue =
[Link]([Link]);
StringRequest stringRequest1 = new StringRequest([Link], url2,
new [Link]<String>() {
@Override
public void onResponse(String response) {
if (response != null) {
try {
JSONObject object1 = new JSONObject(response);
[Link]=[Link]("IMEINo");
} catch (JSONException e) {
[Link]();
Log.e("JSON", "Json parsing error: " +
[Link]());
}
} else {
[Link]([Link], " Vehicle Count
Data null ", Toast.LENGTH_SHORT).show();
}
//Log.d("response", [Link]());
//[Link]([Link],"Result" +
response,Toast.LENGTH_LONG).show();
//[Link]();
}
},
new [Link]() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("error", [Link]());
[Link]([Link], "Not Okey Vehicle
Count" + error, Toast.LENGTH_LONG).show();
}
}
);
[Link](stringRequest1);
Runnable myRunnableThread = new [Link]();
myThread1 = new Thread(myRunnableThread);
[Link]();
}
public void vehiclesInfo(){
if([Link]("0")){
}else {
//[Link]([Link], " Vehicle Count Data " +
[Link], Toast.LENGTH_SHORT).show();
//if ([Link]([Link]) > 1) {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
/*} else {
Intent intent = new Intent([Link],
[Link]);
[Link](Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}*/
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate([Link], menu);
return true;
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = [Link](this,
[Link].nav_host_fragment_content_dashboard);
return [Link](navController, mAppBarConfiguration)
|| [Link]();
}
private String getDateTime() {
DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss aa");
Date date = new Date();
return [Link](date);
}
public void doWork() {
runOnUiThread(new Runnable() {
public void run() {
try{
TextView txtdatetime= (TextView)findViewById([Link]);
/*Date dt = new Date();
int day = [Link]();
int month = [Link]();
int year = [Link]();
int hours = [Link]();
int minutes = [Link]();
int seconds = [Link]();
String curTime = day + "-" + month+"-" + year + " " + hours +
":" + minutes + ":" + seconds;*/
String curTime =getDateTime();
[Link](curTime);
}catch (Exception e) {}
}
});
}
public void doWork1() {
runOnUiThread(new Runnable() {
public void run() {
try{
getSpeed();
}catch (Exception e) {}
}
});
}
/*
Check Internet and Network Connectivity
private boolean NetworkIsConnected() {
ConnectivityManager cm = (ConnectivityManager)
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
return [Link]() != null;
}
public boolean InternetIsConnected() {
try {
String command = "ping -c 1 [Link]";
return ([Link]().exec(command).waitFor() == 0);
} catch (Exception e) {
return false;
}
}
*/
String recNo="";
public void getSpeed(){
//[Link]([Link], "New IMEI No : " +
[Link] , Toast.LENGTH_SHORT).show();
if([Link]()>0) {
String url = Constant_URLS.BASE_URL +
"/locationDataRoutes/getAllDashboardDataIMEINoRange/" + [Link];
final RequestQueue requestQueue =
[Link]([Link]);
StringRequest stringRequest = new StringRequest([Link],
url,
new [Link]<String>() {
@Override
public void onResponse(String response) {
if (response != null) {
try {
JSONObject object = new
JSONObject(response);
String dspeed = [Link]("speed");
String dvoltage =
[Link]("voltage");
String iprojected =
[Link]("projectedMilage");
int iIgnition = [Link]("ignition");
String iLastRecordDate =
[Link]("logDateTime");
//recNo= [Link]("slno");
//Double
dlongitude=[Link]("longitude");
//createmarker(dlatitude,dlongitude);
//TextView textkmsrun=
(TextView)findViewById([Link]);
if(iIgnition== 0)
{
[Link]([Link]([Link],
[Link]));
}else{
[Link]([Link]([Link],
[Link]));
}
[Link]([Link]());
[Link]([Link]() + " %");
[Link]([Link]());
//DateConverter(iLastRecordDate);
//Date date = new Date(iLastRecordDate);
//String strDate1 =
formatDateToString(date, "dd MMM yyyy hh:mm:ss a", "IST");
//[Link]([Link], "
strDate1 " + strDate1, Toast.LENGTH_SHORT).show();
[Link]([Link](iLastRecordDate));
DateDifference(iLastRecordDate);
//double iVoltage=
[Link]("voltage");
double
iVoltage=[Link]([Link]());
//[Link]([Link], "
Battery Level " + iVoltage, Toast.LENGTH_SHORT).show();
if(iVoltage >= 90)
{
[Link]([Link].b10);
}else if(iVoltage >= 80 && iVoltage <=89){
[Link]([Link].b9);
}
else if(iVoltage >= 70 && iVoltage <=79){
[Link]([Link].b8);
}
else if(iVoltage >= 60 && iVoltage <=69){
[Link]([Link].b7);
}
else if(iVoltage >= 50 && iVoltage <=59){
[Link]([Link].b6);
}
else if(iVoltage >= 40 && iVoltage <=49){
[Link]([Link].b5);
}
else if(iVoltage >= 30 && iVoltage <=39){
[Link]([Link].b4);
}
else if(iVoltage >= 20 && iVoltage <=29){
[Link]([Link].b3);
}
else if(iVoltage >= 10 && iVoltage <=19) {
[Link]([Link].b2);
}
else if(iVoltage >= 0 && iVoltage <=10){
[Link]([Link].b2);
}
else if(iVoltage < 0 && iVoltage <=10){
[Link]([Link].b1);
}
//[Link]([Link],
"Speed : " + dspeed , Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
[Link]();
Log.e("JSON", "Json parsing error: " +
[Link]());
}
} else {
[Link]([Link], " IMEI
Data null ", Toast.LENGTH_SHORT).show();
}
//Log.d("response", [Link]());
//[Link]([Link],"Result" +
response,Toast.LENGTH_LONG).show();
[Link]();
}
},
new [Link]() {
@Override
public void onErrorResponse(VolleyError error) {
// Do something when get error
//tv_respuesta.setText([Link]());
Log.d("error", [Link]());
[Link]([Link], " Not Okey "
+ error, Toast.LENGTH_LONG).show();
[Link]();
//[Link]([Link]);
}
}
);
[Link](stringRequest);
}
}
public void DateDifference(String lastDate){
String formattedDate="";
try {
SimpleDateFormat readFormat = new SimpleDateFormat("yyyy-MM-
dd'T'HH:mm:[Link]'Z'");
TimeZone utcZone = [Link]("UTC");
[Link](utcZone);
[Link] convertedDate = [Link](lastDate);
//formattedDate = [Link](convertedDate);
Date currentDate = new Date();
long diff = [Link]() - [Link]();
long seconds = diff / 1000;
long minutes = seconds / 60;
long hours = minutes / 60;
long days = hours / 24;
if(minutes != 0 && hours== 0 && days == 0)
{
[Link](minutes + " minutes [Idle]");
}else if(hours != 0 && days == 0)
{
[Link](hours + " hours [Idle]");
}else if( days !=0)
{
[Link](days + " days [Idle]");
}
} catch (ParseException e) {
//[Link]([Link], recNo + " " + [Link](),
Toast.LENGTH_LONG).show();
[Link]();
}
/*
String toyBornTime = "2014-06-18 12:56:50";
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
try {
Date oldDate = [Link](toyBornTime);
[Link](oldDate);
Date currentDate = new Date();
long diff = [Link]() - [Link]();
long seconds = diff / 1000;
long minutes = seconds / 60;
long hours = minutes / 60;
long days = hours / 24;
if ([Link](currentDate)) {
Log.e("oldDate", "is previous date");
Log.e("Difference: ", " seconds: " + seconds + " minutes: " +
minutes
+ " hours: " + hours + " days: " + days);
[Link]([Link], "Difference: "+ " seconds:
" + seconds + " minutes: " + minutes
+ " hours: " + hours + " days: " + days,
Toast.LENGTH_LONG).show();
// Log.e("toyBornTime", "" + toyBornTime);
} catch (ParseException e) {
[Link]();
}*/
}
private class BitmapListener implements [Link]<Bitmap> {
@Override
public void onResponse(Bitmap response) {
// response = your url's bitmap
//[Link](response);
[Link](response);
[Link]=response;
}
}
private class BitmapListenerRCFront implements [Link]<Bitmap> {
@Override
public void onResponse(Bitmap response) {
// response = your url's bitmap
//[Link](response);
[Link]=response;
}
}
private class BitmapListenerRCBack implements [Link]<Bitmap> {
@Override
public void onResponse(Bitmap response) {
// response = your url's bitmap
//[Link](response);
[Link]=response;
}
}
private class BitmapListenerBWB implements [Link]<Bitmap> {
@Override
public void onResponse(Bitmap response) {
// response = your url's bitmap
//[Link](response);
PrefManager.Kyc2Image=response;
}
}
private class BitmapListenerKYC1 implements [Link]<Bitmap> {
@Override
public void onResponse(Bitmap response) {
// response = your url's bitmap
//[Link](response);
PrefManager.Kyc3Image=response;
}
}
private class BitmapListenerKYC2 implements [Link]<Bitmap> {
@Override
public void onResponse(Bitmap response) {
// response = your url's bitmap
//[Link](response);
PrefManager.Kyc4Image=response;
}
}
private class MyErrorListener implements [Link] {
@Override
public void onErrorResponse(VolleyError error) {
//store a default image if connection failed
//[Link]([Link].error_icon);
}
}
class CountDownRunner implements Runnable{
// @Override
public void run() {
while(![Link]().isInterrupted()){
try {
doWork();
[Link](1000); // Pause of 1 Second
} catch (InterruptedException e) {
[Link]().interrupt();
}catch(Exception e){
}
}
}
}
class CountDownGetSpeed implements Runnable{
// @Override
public void run() {
while(![Link]().isInterrupted()){
try {
doWork1();
[Link](1000); // Pause of 1 Second
} catch (InterruptedException e) {
[Link]().interrupt();
}catch(Exception e){
}
}
}
}
}