マップ表示のバグ修正

This commit is contained in:
nemukemo 2024-07-14 01:12:56 +09:00
parent ecbb551c35
commit 4e20d0006f
2 changed files with 24 additions and 12 deletions

View File

@ -27,8 +27,11 @@ public class FirestoreReception {
//ClassIdを引数にデータの作成を行う //ClassIdを引数にデータの作成を行う
public void getDocumentsByClassId(int classId) { public void getDocumentsByClassId(int classId) {
myDataList.clear(); myDataList.clear();
CollectionReference collectionRef = db.collection("testDistinct"); //pixel6a
CollectionReference collectionRef = db.collection("test0711Data");
//xiaomi
// CollectionReference collectionRef = db.collection("testDistinct");
// classIdが引数のものを取得する // classIdが引数のものを取得する
collectionRef.whereEqualTo("classId", classId).get() collectionRef.whereEqualTo("classId", classId).get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {

View File

@ -42,9 +42,6 @@ import java.util.Map;
public class Maps extends FragmentActivity implements OnMapReadyCallback, View.OnClickListener, GoogleMap.OnMarkerClickListener { public class Maps extends FragmentActivity implements OnMapReadyCallback, View.OnClickListener, GoogleMap.OnMarkerClickListener {
ImageView backMain;
private GoogleMap mMap;
private LinearLayout locationsName;
//GoogleMapAPiで使用可能な色 //GoogleMapAPiで使用可能な色
private static final int[] COLORS = new int[]{Color.parseColor("#007FFF"), // HUE_AZURE private static final int[] COLORS = new int[]{Color.parseColor("#007FFF"), // HUE_AZURE
Color.parseColor("#0000FF"), // HUE_BLUE Color.parseColor("#0000FF"), // HUE_BLUE
@ -57,13 +54,14 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
Color.parseColor("#8A2BE2"), // HUE_VIOLET Color.parseColor("#8A2BE2"), // HUE_VIOLET
Color.parseColor("#FFFF00") // HUE_YELLOW Color.parseColor("#FFFF00") // HUE_YELLOW
}; };
private int colorIndex = 0;
private final List<LatLng> latLngList = new ArrayList<>(); private final List<LatLng> latLngList = new ArrayList<>();
private final List<String> nameList = new ArrayList<>(); private final List<String> nameList = new ArrayList<>();
private final List<Integer> colorList = new ArrayList<>(); private final List<Integer> colorList = new ArrayList<>();
private final Map<String, Runnable> dateMap = new HashMap<>(); private final Map<String, Runnable> dateMap = new HashMap<>();
ImageView backMain;
private GoogleMap mMap;
private LinearLayout locationsName;
private int colorIndex = 0;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -213,11 +211,22 @@ public class Maps extends FragmentActivity implements OnMapReadyCallback, View.O
//家庭訪問のscheduleを7桁の整数から(604120006月12日05時20分)に変換 //家庭訪問のscheduleを7桁の整数から(604120006月12日05時20分)に変換
private String formatSchedule(String schedule) { private String formatSchedule(String schedule) {
String monthString = "0" + schedule.substring(0, 1); Log.d("Maps", "schedule: " + schedule);
String dayString = schedule.substring(1, 3); if (schedule.length() != 7) {
String hourString = schedule.substring(3, 5); schedule = "0" + schedule;
String minuteString = schedule.substring(5, 7); String monthString = schedule.substring(0, 2);
return monthString + "" + dayString + "" + hourString + "" + minuteString + ""; String dayString = schedule.substring(2, 4);
String hourString = "0" + schedule.substring(4, 5);
String minuteString = schedule.substring(5, 7);
return monthString + "" + dayString + "" + hourString + "" + minuteString + "";
} else {
String monthString = "0" + schedule.substring(0, 1);
String dayString = schedule.substring(1, 3);
String hourString = schedule.substring(3, 5);
String minuteString = schedule.substring(5, 7);
return monthString + "" + dayString + "" + hourString + "" + minuteString + "";
}
} }
// 共有プリファレンスからMyDataListを取得するメソッド // 共有プリファレンスからMyDataListを取得するメソッド