Merge pull request 'datePicker' (#30) from datePicker into master
Reviewed-on: #30
This commit is contained in:
commit
09d0c2d259
|
@ -1,6 +1,6 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.example.oplogy;
|
|||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
@Database(entities = {SetUpTable.class}, version = 3, exportSchema = false)
|
||||
@Database(entities = {SetUpTable.class}, version = 2, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
// データベースにアクセスするためのメソッドを提供する
|
||||
public abstract SetUpTableDao setUpTableDao();
|
||||
|
|
|
@ -3,11 +3,14 @@ package com.example.oplogy;
|
|||
import android.content.Context;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.room.Room;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.firebase.Timestamp;
|
||||
|
||||
|
@ -41,13 +44,25 @@ public class CreateRoot {
|
|||
boolean Duplicates=true;
|
||||
boolean secondDuplicates=false;
|
||||
|
||||
private Context context;
|
||||
|
||||
|
||||
String[] testdata = {"20240604", "20240605", "20240606"};
|
||||
// String testdata[] = {"20240604", "20240605", "20240606"};
|
||||
String[] testdata;
|
||||
|
||||
|
||||
public CreateRoot(AppCompatActivity activity) {
|
||||
this.db = Room.databaseBuilder(activity.getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
||||
SharedPreferences sharedPreferences= activity.getSharedPreferences("visitingDate", Context.MODE_PRIVATE);
|
||||
String day1=sharedPreferences.getString("day1",null);
|
||||
String day2=sharedPreferences.getString("day2",null);
|
||||
String day3=sharedPreferences.getString("day3",null);
|
||||
|
||||
testdata= new String[]{day1, day2, day3};
|
||||
|
||||
for(String day:testdata){
|
||||
Log.d("sharepre","day"+day);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Boolean receiveData(List<MyDataClass> myDataList,Context context) {
|
||||
|
|
|
@ -5,12 +5,12 @@ import java.util.List;
|
|||
|
||||
public class CreateUUID {
|
||||
|
||||
public static int generateUUID(List<Integer> classIdList ){
|
||||
public static int generateUUID(List<String> classIdList ){
|
||||
while (true){
|
||||
int uuid = (int) (Math.random() * 100000);
|
||||
String uuid = String.valueOf((int)(Math.random() * 1000000));
|
||||
boolean isDuplicate = false;
|
||||
for(int classId : classIdList){
|
||||
if(classId==uuid){
|
||||
for(String classId : classIdList){
|
||||
if(classId.equals(uuid)){
|
||||
//重複があればフラグを立て、ループを抜ける
|
||||
isDuplicate = true;
|
||||
break;
|
||||
|
@ -19,11 +19,9 @@ public class CreateUUID {
|
|||
//重複がなければ生成したUUIDを返す
|
||||
if (!isDuplicate) {
|
||||
//firestoreに挿入処理
|
||||
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
|
||||
insertClassIdforFirebase.insertClassId(uuid);
|
||||
//テスト用
|
||||
uuid=100;
|
||||
return uuid;
|
||||
uuid="100";
|
||||
return Integer.parseInt(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
35
app/src/main/java/com/example/oplogy/DatePick.java
Normal file
35
app/src/main/java/com/example/oplogy/DatePick.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.widget.DatePicker;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import java.util.Calendar;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DatePick extends DialogFragment implements
|
||||
DatePickerDialog.OnDateSetListener {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstantState) {
|
||||
|
||||
//デフォルトのタイムゾーンおよびロケールを使用してカレンダを取得
|
||||
final Calendar c = Calendar.getInstance();
|
||||
int year = c.get(Calendar.YEAR);
|
||||
int month = c.get(Calendar.MONTH);
|
||||
int day = c.get(Calendar.DAY_OF_MONTH);
|
||||
|
||||
return new DatePickerDialog(requireActivity(), (DatePickerDialog.OnDateSetListener) getActivity(), year, month, day);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,14 +17,14 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
public class FirestoreReception_classIdDatabase {
|
||||
private FirebaseFirestore db;
|
||||
private List<Integer> classIdList= new ArrayList<>();
|
||||
private List<String> classIdList= new ArrayList<>();
|
||||
|
||||
public FirestoreReception_classIdDatabase() {
|
||||
db = FirebaseFirestore.getInstance();
|
||||
}
|
||||
|
||||
|
||||
public List<Integer> getAllDocumentsFromClassIdDatabase() {
|
||||
public List<String> getAllDocumentsFromClassIdDatabase() {
|
||||
db.collection("classId_Database")
|
||||
.get()
|
||||
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
|
||||
|
@ -34,7 +34,8 @@ public class FirestoreReception_classIdDatabase {
|
|||
for (QueryDocumentSnapshot document : task.getResult()) {
|
||||
Log.d("結果", document.getId() + " => " + document.getData());
|
||||
//データをListに追加
|
||||
classIdList.add(((Long) document.get("classId")).intValue()); }
|
||||
classIdList.add((String) document.get("classId"));
|
||||
}
|
||||
} else {
|
||||
Log.d("結果", "Error getting documents: ", task.getException());
|
||||
}
|
||||
|
@ -44,7 +45,7 @@ public class FirestoreReception_classIdDatabase {
|
|||
return classIdList;
|
||||
}
|
||||
|
||||
public List<Integer> getClassIdList() {
|
||||
public List<String> getClassIdList() {
|
||||
return classIdList;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import com.google.firebase.firestore.FirebaseFirestore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class InsertClassIdforFirebase {
|
||||
public void insertClassId(int classId) {
|
||||
FirebaseFirestore db = FirebaseFirestore.getInstance();
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("classId", classId); // classId is inserted as a number
|
||||
|
||||
db.collection("classId_Database").add(data)
|
||||
.addOnSuccessListener(documentReference -> System.out.println("DocumentSnapshot added with ID: " + documentReference.getId()))
|
||||
.addOnFailureListener(e -> System.err.println("Error adding document: " + e));
|
||||
}
|
||||
}
|
|
@ -162,7 +162,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
//UUIDを表示するかのダイアログ
|
||||
private void showUUIDYesNoDialog() {
|
||||
firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase();
|
||||
List<Integer> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase();
|
||||
List<String> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase();
|
||||
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
|
@ -197,9 +197,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
|
||||
// タスク1: ローカルDBから生徒数を取得してtotalStudentと比較
|
||||
executor.execute(() -> {
|
||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable")
|
||||
.fallbackToDestructiveMigration()
|
||||
.build();
|
||||
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
|
||||
SetUpTableDao setUpTableDao = db.setUpTableDao();
|
||||
|
||||
Log.d("MainActivity", "db" + setUpTableDao.getAll());
|
||||
|
|
|
@ -1,23 +1,44 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.media.Image;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.example.oplogy.databinding.MapsBinding;
|
||||
import com.google.android.gms.maps.model.Polyline;
|
||||
import com.google.android.gms.maps.model.PolylineOptions;
|
||||
import com.google.maps.DirectionsApi;
|
||||
import com.google.maps.DirectionsApiRequest;
|
||||
import com.google.maps.GeoApiContext;
|
||||
import com.google.maps.model.DirectionsResult;
|
||||
|
||||
public class Maps extends FragmentActivity implements View.OnClickListener {
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
private WebView webView;
|
||||
public class Maps extends FragmentActivity implements OnMapReadyCallback,View.OnClickListener{
|
||||
|
||||
// ボタンの戻る処理
|
||||
ImageView backMain;
|
||||
private GoogleMap mMap;
|
||||
private MapsBinding binding;
|
||||
|
||||
private LatLng loc;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -25,50 +46,74 @@ public class Maps extends FragmentActivity implements View.OnClickListener {
|
|||
binding = MapsBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
mapFragment.getMapAsync(this);
|
||||
|
||||
backMain = findViewById(R.id.BackMain);
|
||||
backMain.setOnClickListener(this);
|
||||
|
||||
webView = findViewById(R.id.webView);
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webView.setWebViewClient(new WebViewClient());
|
||||
|
||||
// ここにデータを入れておいてください、処理は[/]で区切っています
|
||||
loadMapInWebView("35.09050879999539,136.87845379325216/35.09284820618655,136.88165119390393/35.09364708442631,136.88171563326418");
|
||||
}
|
||||
|
||||
// WebViewの処理です(Mapの中の処理をやっています)
|
||||
private void loadMapInWebView(String locations) {
|
||||
// 区切ることで、追加の地点を入れて、最終地点にピンを打ってある状態です
|
||||
String[] locArray = locations.split("/");
|
||||
// ↓URLで経路案内(車)での表示をしています
|
||||
StringBuilder urlBuilder = new StringBuilder("https://www.google.com/maps/dir/?api=1&travelmode=driving");
|
||||
|
||||
if (locArray.length > 0) {
|
||||
urlBuilder.append("&origin=").append(locArray[0]);
|
||||
|
||||
if (locArray.length > 1) {
|
||||
urlBuilder.append("&destination=").append(locArray[locArray.length - 1]);
|
||||
/**
|
||||
* Manipulates the map once available.
|
||||
* This callback is triggered when the map is ready to be used.
|
||||
* This is where we can add markers or lines, add listeners or move the camera. In this case,
|
||||
* we just add a marker near Sydney, Australia.
|
||||
* If Google Play services is not installed on the device, the user will be prompted to install
|
||||
* it inside the SupportMapFragment. This method will only be triggered once the user has
|
||||
* installed Google Play services and returned to the app.
|
||||
*/
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
|
||||
if (locArray.length > 2) {
|
||||
urlBuilder.append("&waypoints=");
|
||||
for (int i = 1; i < locArray.length - 1; i++) {
|
||||
urlBuilder.append(locArray[i]);
|
||||
if (i < locArray.length - 2) {
|
||||
urlBuilder.append("|");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// 地図の倍率を指定
|
||||
|
||||
// ↓ここに地点の処理を書いておく↓
|
||||
// Add a marker in Sydney and move the camera
|
||||
loc = new LatLng(35.09050879999539, 136.87845379325216);
|
||||
mMap.addMarker(new MarkerOptions().position(loc).title("名古屋港水族館"));
|
||||
/// 表示位置を地図に指定
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));
|
||||
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 17));
|
||||
|
||||
LatLng startLatLng = new LatLng(35.09050879999539, 136.87845379325216);
|
||||
LatLng secandLatLng = new LatLng(35.09284820618655, 136.88165119390393);
|
||||
LatLng thirdLatLng = new LatLng(35.09364708442631, 136.88171563326418);
|
||||
|
||||
|
||||
Marker startMaker = mMap.addMarker(new MarkerOptions()
|
||||
.position(startLatLng)
|
||||
.title("名古屋港水族館")
|
||||
);
|
||||
|
||||
Marker secondMaker = mMap.addMarker(new MarkerOptions()
|
||||
.position(secandLatLng)
|
||||
.title("2番目")
|
||||
);
|
||||
|
||||
Marker thirdMaker = mMap.addMarker(new MarkerOptions()
|
||||
.position(thirdLatLng)
|
||||
.title("3番目")
|
||||
);
|
||||
|
||||
drowRoute(startLatLng,secandLatLng,thirdLatLng);
|
||||
}
|
||||
|
||||
webView.loadUrl(urlBuilder.toString());
|
||||
private void drowRoute(LatLng startLatLng,LatLng secondLatLung,LatLng thirdLatLng){
|
||||
GeoApiContext context = new GeoApiContext.Builder()
|
||||
.apiKey("AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (view == backMain) {
|
||||
Intent backMain = new Intent(Maps.this, MainActivity.class);
|
||||
if(view == backMain){
|
||||
Intent backMain = new Intent(Maps.this,MainActivity.class);
|
||||
startActivity(backMain);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,17 @@ package com.example.oplogy;
|
|||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Paint;
|
||||
import android.media.Image;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
@ -26,10 +29,13 @@ import java.util.concurrent.Executors;
|
|||
|
||||
|
||||
public class SetUpActivity extends FragmentActivity
|
||||
implements TimePickerDialog.OnTimeSetListener {
|
||||
implements TimePickerDialog.OnTimeSetListener, DatePickerDialog.OnDateSetListener {
|
||||
|
||||
String teacherName;
|
||||
String startPoint;
|
||||
String firstDay;
|
||||
String secondDay;
|
||||
String thirdDay;
|
||||
String startTime;
|
||||
String endTime;
|
||||
String intervalTime;
|
||||
|
@ -43,17 +49,22 @@ public class SetUpActivity extends FragmentActivity
|
|||
private TextView setStartBreakTime;
|
||||
private TextView setEndBreakTime;
|
||||
private TextView setTotalStudent;
|
||||
private int isDateSelected;
|
||||
private int isStartTimeSelected;
|
||||
|
||||
String stringYear;
|
||||
String stringMonth;
|
||||
String stringDayOfMonth;
|
||||
|
||||
|
||||
String stringHourOfDay;
|
||||
String stringMinute;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Button startTimeSetButton;
|
||||
Button endTimeSetButton;
|
||||
Button setFirstDay;
|
||||
Button setSecondDay;
|
||||
Button setThirdDay;
|
||||
Button setStartTimeButton;
|
||||
Button setEndTimeButton;
|
||||
|
||||
|
||||
|
||||
|
@ -68,10 +79,14 @@ public class SetUpActivity extends FragmentActivity
|
|||
setTeacherName = findViewById(R.id.teacherName); //先生の名前
|
||||
setStartPoint = findViewById(R.id.startPoint); //開始地点
|
||||
|
||||
setStartTime = findViewById(R.id.startTime); //開始時刻
|
||||
setStartTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); //下線を引く
|
||||
setEndTime = findViewById(R.id.endTime); //終了時刻
|
||||
setEndTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
setFirstDay = findViewById(R.id.setFirstDayButton); //1日目の日付
|
||||
setSecondDay = findViewById(R.id.setSecondDayButton); //2日目の日付
|
||||
setThirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付
|
||||
|
||||
setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン
|
||||
setStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
|
||||
setEndTimeButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するボタン
|
||||
setEndTime = findViewById(R.id.endTime); //終了時刻を出力するTextView
|
||||
|
||||
RadioButton setTenMinute = findViewById(R.id.tenMinute); //訪問間隔(10分)
|
||||
RadioButton setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔(15分)
|
||||
|
@ -84,9 +99,6 @@ public class SetUpActivity extends FragmentActivity
|
|||
|
||||
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
|
||||
|
||||
startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン
|
||||
endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン
|
||||
|
||||
ImageView toMain = findViewById(R.id.toMain);
|
||||
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
|
||||
Button reset = findViewById(R.id.resetButton);
|
||||
|
@ -95,7 +107,6 @@ public class SetUpActivity extends FragmentActivity
|
|||
Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理
|
||||
startActivity(intent);
|
||||
});
|
||||
//TODO:.SetUpの際に、classIdを挿入すること
|
||||
|
||||
setUp.setOnClickListener(view -> {
|
||||
|
||||
|
@ -103,6 +114,9 @@ public class SetUpActivity extends FragmentActivity
|
|||
Log.d(TAG, "Teacher Name: " + teacherName);
|
||||
startPoint = setStartPoint.getText().toString();
|
||||
Log.d(TAG, "Start Point: " + startPoint);
|
||||
Log.d(TAG, "First Day:" + firstDay);
|
||||
Log.d(TAG, "Second Day:" + secondDay);
|
||||
Log.d(TAG, "Third Day:" + thirdDay);
|
||||
Log.d(TAG, "Start Time" + startTime);
|
||||
Log.d(TAG, "End Time" + endTime);
|
||||
if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得
|
||||
|
@ -157,17 +171,42 @@ public class SetUpActivity extends FragmentActivity
|
|||
setUpTableDao.insertAll(setUpTable);
|
||||
runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "登録しました", Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
//家庭訪問日を保存する共有プリファレンス
|
||||
SharedPreferences sharedPreferences=getSharedPreferences("visitingDate",MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor= sharedPreferences.edit();
|
||||
|
||||
editor.putString("day1",firstDay);
|
||||
editor.putString("day2",secondDay);
|
||||
editor.putString("day3",thirdDay);
|
||||
|
||||
editor.apply();
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
startTimeSetButton.setOnClickListener(v -> {
|
||||
|
||||
setFirstDay.setOnClickListener(v ->{
|
||||
isDateSelected = 1;
|
||||
showDatePickerDialog(); //DatePickerの表示
|
||||
});
|
||||
|
||||
setSecondDay.setOnClickListener(v ->{
|
||||
isDateSelected = 2;
|
||||
showDatePickerDialog();
|
||||
});
|
||||
|
||||
setThirdDay.setOnClickListener(v ->{
|
||||
isDateSelected = 3;
|
||||
showDatePickerDialog();
|
||||
});
|
||||
|
||||
setStartTimeButton.setOnClickListener(v -> {
|
||||
isStartTimeSelected = 1; //ボタンの判別
|
||||
showTimePickerDialog(); //TimePeckerの表示
|
||||
showTimePickerDialog(); //TimePickerの表示
|
||||
});
|
||||
|
||||
endTimeSetButton.setOnClickListener(v -> {
|
||||
setEndTimeButton.setOnClickListener(v -> {
|
||||
isStartTimeSelected = 2;
|
||||
showTimePickerDialog();
|
||||
});
|
||||
|
@ -187,8 +226,6 @@ public class SetUpActivity extends FragmentActivity
|
|||
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
|
||||
setTeacherName.setText("");
|
||||
setStartPoint.setText("");
|
||||
setStartTime.setText("");
|
||||
setEndTime.setText("");
|
||||
setTenMinute.setChecked(false);
|
||||
setFifteenMinute.setChecked(false);
|
||||
setThirtyMinute.setChecked(false);
|
||||
|
@ -205,22 +242,51 @@ public class SetUpActivity extends FragmentActivity
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) { //Dateを成形する
|
||||
// DatePickerDialogで選択された日付を処理する
|
||||
String str = String.format(Locale.JAPAN, "%02d/%02d", month + 1, dayOfMonth); // TextViewに表示する日付の形式を設定
|
||||
|
||||
if (isDateSelected == 1) {
|
||||
stringYear = String.valueOf(year); //年
|
||||
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1); //月
|
||||
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth); //日
|
||||
firstDay = stringYear + stringMonth + stringDayOfMonth;
|
||||
setFirstDay.setText(str);
|
||||
} else if (isDateSelected == 2) {
|
||||
stringYear = String.valueOf(year);
|
||||
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1);
|
||||
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth);
|
||||
secondDay = stringYear + stringMonth + stringDayOfMonth;
|
||||
setSecondDay.setText(str);
|
||||
|
||||
|
||||
} else if (isDateSelected == 3) {
|
||||
stringYear = String.valueOf(year);
|
||||
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1);
|
||||
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth);
|
||||
thirdDay = stringYear + stringMonth + stringDayOfMonth;
|
||||
setThirdDay.setText(str);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"DefaultLocale", "SetTextI18n"})
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
String str = String.format(Locale.US, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
|
||||
String str = String.format(Locale.JAPAN, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
|
||||
|
||||
if (isStartTimeSelected == 1) { //押した場所を判定して、押したほうにだけ挿入する
|
||||
stringHourOfDay = String.format("%02d", hourOfDay); //時を取得
|
||||
stringMinute = String.format("%02d", minute); //分を取得
|
||||
startTime = stringHourOfDay + stringMinute; //時と分を結合し四桁の文字列に
|
||||
setStartTime.setText(" " + str + " "); //画面に出力
|
||||
if (isStartTimeSelected == 1) {
|
||||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
stringMinute = String.format("%02d", minute);
|
||||
startTime = stringHourOfDay + stringMinute;
|
||||
setStartTime.setText(str);
|
||||
|
||||
} else if (isStartTimeSelected == 2) {
|
||||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
stringMinute = String.format("%02d", minute);
|
||||
endTime = stringHourOfDay + stringMinute;
|
||||
setEndTime.setText(" " + str + " ");
|
||||
setEndTime.setText(str);
|
||||
|
||||
} else if (isStartTimeSelected == 3) {
|
||||
stringHourOfDay = String.format("%02d", hourOfDay);
|
||||
|
@ -236,9 +302,14 @@ public class SetUpActivity extends FragmentActivity
|
|||
}
|
||||
}
|
||||
|
||||
private void showDatePickerDialog() {
|
||||
DialogFragment newFragment = new DatePick();
|
||||
newFragment.show(getSupportFragmentManager(), "datePicker");
|
||||
}
|
||||
|
||||
private void showTimePickerDialog() { // Dialogを表示する
|
||||
DialogFragment newFragment = new TimePick();
|
||||
newFragment.show(getSupportFragmentManager(), "timePicker");
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 48 KiB |
|
@ -21,17 +21,16 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/toMain"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="left"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:src="@drawable/back_button"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:text="@string/setUp"
|
||||
android:textSize="30sp"/>
|
||||
|
||||
|
@ -82,6 +81,59 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="90sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="日付設定"
|
||||
android:gravity="center"/>
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/startTime"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text=" "-->
|
||||
<!-- android:textSize="20sp"-->
|
||||
<!-- android:textAlignment="center"-->
|
||||
<!-- android:autofillHints=""-->
|
||||
<!-- android:inputType=""-->
|
||||
<!-- tools:ignore="HardcodedText,LabelFor"/>-->
|
||||
|
||||
<Button
|
||||
android:id="@+id/setFirstDayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1日目"
|
||||
android:layout_marginStart="7sp"
|
||||
android:layout_marginEnd="7sp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/setSecondDayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2日目"
|
||||
android:layout_marginStart="7sp"
|
||||
android:layout_marginEnd="7sp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/setThirdDayButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3日目"
|
||||
android:layout_marginStart="7sp"
|
||||
android:layout_marginEnd="7sp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -99,20 +151,20 @@
|
|||
android:id="@+id/startTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" "
|
||||
android:hint="未設定"
|
||||
android:textSize="20sp"
|
||||
android:textAlignment="center"
|
||||
android:autofillHints=""
|
||||
android:inputType=""
|
||||
tools:ignore="HardcodedText,LabelFor"/>
|
||||
tools:ignore="LabelFor"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/startTimeSetButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/timeSet"
|
||||
android:layout_marginStart="65dp"
|
||||
android:layout_marginEnd="65dp"
|
||||
android:text="@string/timeSet"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -134,7 +186,7 @@
|
|||
android:id="@+id/endTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" "
|
||||
android:hint="未設定"
|
||||
android:textSize="20sp"
|
||||
android:textAlignment="center"
|
||||
android:autofillHints=""
|
||||
|
@ -149,6 +201,7 @@
|
|||
android:layout_marginStart="65dp"
|
||||
android:layout_marginEnd="65dp"
|
||||
tools:ignore="DuplicateIds" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"/>
|
||||
android:layout_weight="2"/>
|
||||
|
||||
|
||||
<!-- ID作成のレイアウト-->
|
||||
|
@ -43,7 +43,6 @@
|
|||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<!-- セットアップのレイアウト-->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -73,15 +72,8 @@
|
|||
</LinearLayout>
|
||||
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"/>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ルート表示のレイアウト-->
|
||||
<!-- ルート表示のレイアウト-->
|
||||
<LinearLayout
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="0dp"
|
||||
|
@ -110,6 +102,12 @@
|
|||
android:layout_gravity="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"/>
|
||||
|
||||
|
||||
<!-- 提出状況のレイアウト-->
|
||||
<LinearLayout
|
||||
android:layout_width="350dp"
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:weightSum="10"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
tools:context=".Maps">
|
||||
|
||||
<!-- <fragment xmlns:android="http://schemas.android.com/apk/res/android"-->
|
||||
<!-- xmlns:tools="http://schemas.android.com/tools"-->
|
||||
<!-- xmlns:map="http://schemas.android.com/apk/res-auto"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:id="@+id/map"-->
|
||||
<!-- android:name="com.google.android.gms.maps.SupportMapFragment"/>-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -20,28 +28,34 @@
|
|||
android:layout_width="40dp"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_weight="5" />
|
||||
android:layout_weight="5"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="4"
|
||||
android:id="@+id/date"
|
||||
android:hint="今日の日付"
|
||||
android:textSize="40dp" />
|
||||
android:textSize="40dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Webの処理 -->
|
||||
<WebView
|
||||
android:id="@+id/webView"
|
||||
<fragment
|
||||
android:id="@+id/map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="6" />
|
||||
android:layout_weight="6"
|
||||
tools:context=".Maps" />
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3" />
|
||||
android:layout_weight="3"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
}
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '8.0.2' apply false
|
||||
id 'com.android.library' version '8.0.2' apply false
|
||||
id 'com.android.application' version '8.1.4' apply false
|
||||
id 'com.android.library' version '8.1.4' apply false
|
||||
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user