mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 00:37:59 -06:00
Add loading indicator for field data
This commit is contained in:
@@ -310,12 +310,13 @@ public class tallyType extends inputType {
|
|||||||
dataType dataPoint = data[teamNum].get(i);
|
dataType dataPoint = data[teamNum].get(i);
|
||||||
if(dataPoint == null || dataPoint.getValueType() != getValueType()) continue;
|
if(dataPoint == null || dataPoint.getValueType() != getValueType()) continue;
|
||||||
int num = (int) dataPoint.get();
|
int num = (int) dataPoint.get();
|
||||||
|
System.out.println(num);
|
||||||
if(num > max) max = num;
|
if(num > max) max = num;
|
||||||
if(num < min) min = num;
|
if(num < min) min = num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertManager.error("Min: " + min + " Max: " + max);
|
AlertManager.alert("Results","Min: " + min + " Max: " + max);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(dataType data){
|
public String toString(dataType data){
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import static com.ridgebotics.ridgescout.utility.DataManager.match_transferValue
|
|||||||
import static com.ridgebotics.ridgescout.utility.DataManager.match_values;
|
import static com.ridgebotics.ridgescout.utility.DataManager.match_values;
|
||||||
import static com.ridgebotics.ridgescout.utility.DataManager.rescout_list;
|
import static com.ridgebotics.ridgescout.utility.DataManager.rescout_list;
|
||||||
|
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -56,6 +57,8 @@ public class FieldDataFragment extends Fragment {
|
|||||||
if (fieldIndex == -1)
|
if (fieldIndex == -1)
|
||||||
return root;
|
return root;
|
||||||
|
|
||||||
|
startLoading("Loading data...");
|
||||||
|
|
||||||
Thread t = new Thread(() -> {
|
Thread t = new Thread(() -> {
|
||||||
|
|
||||||
List<dataType>[] data = new ArrayList[event.teams.size()];
|
List<dataType>[] data = new ArrayList[event.teams.size()];
|
||||||
@@ -81,9 +84,10 @@ public class FieldDataFragment extends Fragment {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// getActivity().runOnUiThread(() -> {
|
getActivity().runOnUiThread(() -> {
|
||||||
match_latest_values[fieldIndex].addDataToTable(binding.table, data);
|
match_latest_values[fieldIndex].addDataToTable(binding.table, data);
|
||||||
// });
|
stopLoading();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
t.start();
|
t.start();
|
||||||
@@ -91,4 +95,23 @@ public class FieldDataFragment extends Fragment {
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ProgressDialog loadingDialog;
|
||||||
|
|
||||||
|
private void startLoading(String title){
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
if(loadingDialog != null && loadingDialog.isShowing())
|
||||||
|
loadingDialog.dismiss();
|
||||||
|
loadingDialog = ProgressDialog.show(getActivity(), title, "Please wait...");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopLoading(){
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
if (loadingDialog != null)
|
||||||
|
loadingDialog.cancel();
|
||||||
|
loadingDialog = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user