ボタンのインテント調整
バグの修正を入れました。確認をお願いします
This commit is contained in:
oKikuti 2024-06-19 15:16:32 +09:00
parent eec3846eb4
commit f7d955c4a6
9 changed files with 141 additions and 440 deletions

View File

@ -80,20 +80,22 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
if(view == creatUUID){ if(view == creatUUID){
imageUuid.setImageResource(R.drawable.ischecked_uuid); imageUuid.setImageResource(R.drawable.ischecked_uuid);
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
finish();
} }
// セットアップのクリック処理 // セットアップのクリック処理
if(view == setUp){ if(view == setUp){
imageSetup.setImageResource(R.drawable.ischecked_uuid); imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this,SetUpActivity.class); Intent toSetup = new Intent(MainActivity.this,SetUpActivity.class);
startActivity(toSetup); startActivity(toSetup);
finish();
} }
// ルート作成のクリック処理 // ルート作成のクリック処理
if(view == root){ if(view == root){
imageRoot.setImageResource(R.drawable.pin); imageRoot.setImageResource(R.drawable.pin);
Intent toRoot = new Intent(MainActivity.this,Maps.class); Intent toRoot = new Intent(MainActivity.this,Maps.class);
startActivity(toRoot); startActivity(toRoot);
} }
// 提出状況のクリック処理 // 提出状況のクリック処理
if(view == submission){ if(view == submission){

View File

@ -1,21 +1,36 @@
package com.example.oplogy; package com.example.oplogy;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import android.content.Intent;
import android.media.Image;
import android.os.Bundle; 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.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment; 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.LatLng;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import com.example.oplogy.databinding.MapsBinding; import com.example.oplogy.databinding.MapsBinding;
public class Maps extends FragmentActivity implements OnMapReadyCallback { import java.util.Locale;
import java.util.Map;
public class Maps extends FragmentActivity implements OnMapReadyCallback,View.OnClickListener{
// ボタンの戻る処理
ImageView backMain;
private GoogleMap mMap; private GoogleMap mMap;
private MapsBinding binding; private MapsBinding binding;
private LatLng location;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -27,8 +42,13 @@ private MapsBinding binding;
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map); .findFragmentById(R.id.map);
mapFragment.getMapAsync(this); mapFragment.getMapAsync(this);
backMain = findViewById(R.id.BackMain);
backMain.setOnClickListener(this);
} }
/** /**
* Manipulates the map once available. * Manipulates the map once available.
* This callback is triggered when the map is ready to be used. * This callback is triggered when the map is ready to be used.
@ -42,9 +62,37 @@ private MapsBinding binding;
public void onMapReady(GoogleMap googleMap) { public void onMapReady(GoogleMap googleMap) {
mMap = googleMap; mMap = googleMap;
// Add a marker in Sydney and move the camera // ここに地点の処理を書いておく
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); location = new LatLng(35.09050879999539, 136.87845379325216);
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); mMap.addMarker(new MarkerOptions().position(location).title("名古屋港水族館"));
/// 地図の倍率を指定
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 17));
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setOnMapClickListener(tapLocation -> {
// tapされた位置の緯度経度
location = new LatLng(tapLocation.latitude, tapLocation.longitude);
String str = String.format(Locale.JAPAN, "%f, %f", tapLocation.latitude, tapLocation.longitude);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 17));
// ピンの処理
mMap.addMarker(new MarkerOptions()
.position(location)
.title(str)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_CYAN))
.anchor(0.5f, 0.5f)
);
});
}
@Override
public void onClick(View view) {
if(view == backMain){
Intent backMain = new Intent(Maps.this,MainActivity.class);
startActivity(backMain);
}
} }
} }

View File

@ -6,9 +6,11 @@ import android.annotation.SuppressLint;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.Intent; import android.content.Intent;
import android.graphics.Paint; import android.graphics.Paint;
import android.media.Image;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.TimePicker; import android.widget.TimePicker;
@ -75,11 +77,11 @@ public class SetUpActivity extends FragmentActivity
startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン
endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン
TextView backMain = findViewById(R.id.backMain); ImageView toMain = findViewById(R.id.toMain);
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
Button reset = findViewById(R.id.resetButton); Button reset = findViewById(R.id.resetButton);
backMain.setOnClickListener(view -> { toMain.setOnClickListener(view -> {
Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理 Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理
startActivity(intent); startActivity(intent);
}); });

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10"
tools:context=".MapsActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/toMain"
android:layout_width="40dp"
android:layout_height="90dp"
android:src="@drawable/back_button"
android:layout_weight="5"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付"
android:textSize="40dp"
/>
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/map_fragment_container"
tools:context=".Map"
android:layout_weight="6"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
<ScrollView
android:id="@+id/scrollName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
/>
</LinearLayout>

View File

@ -9,15 +9,24 @@
android:gravity="center"> android:gravity="center">
<TextView <!-- <TextView-->
android:id="@+id/backMain" <!-- android:id="@+id/backMain"-->
android:layout_width="wrap_content" <!-- android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="left"-->
<!-- android:paddingStart="20dp"-->
<!-- android:text="@string/Back"-->
<!-- android:textSize="50sp"-->
<!-- tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />-->
<ImageView
android:id="@+id/toMain"
android:layout_width="100dp"
android:layout_height="90dp"
android:layout_gravity="left" android:layout_gravity="left"
android:paddingStart="20dp" android:layout_marginLeft="20dp"
android:text="@string/Back" android:src="@drawable/back_button"/>
android:textSize="50sp"
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10"
tools:context=".Map_Activity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/toMain"
android:layout_width="40dp"
android:layout_height="90dp"
android:src="@drawable/back_button"
android:layout_weight="5"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付"
android:textSize="40dp"
/>
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/map_fragment_container"
tools:context=".Map"
android:layout_weight="6"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
<ScrollView
android:id="@+id/scrollName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
/>
</LinearLayout>

View File

@ -1,9 +1,61 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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_width="match_parent"
android:layout_height="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"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/BackMain"
android:layout_width="40dp"
android:layout_height="90dp"
android:src="@drawable/back_button"
android:layout_weight="5"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付"
android:textSize="40dp"
/>
</LinearLayout>
<fragment
android:id="@+id/map" android:id="@+id/map"
tools:context=".Maps" android:name="com.google.android.gms.maps.SupportMapFragment"
android:name="com.google.android.gms.maps.SupportMapFragment"/> android:layout_width="match_parent"
android:layout_height="0dp"
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"
/>
</LinearLayout>

View File

@ -1,296 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SetUpActivity"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/toMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingStart="20dp"
android:text="@string/Back"
android:textSize="50sp"
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="@string/setUp"
android:textSize="30sp"/>
<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="@string/teacherName"
android:gravity="center"/>
<EditText
android:id="@+id/teacherName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
</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="@string/startPoint"
android:gravity="center"/>
<EditText
android:id="@+id/startPoint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/startpoint"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
</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="@string/startTime"
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/startTimeSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="65dp"
android:layout_marginEnd="65dp"
android:text="@string/timeSet"
tools:ignore="DuplicateIds" />
</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="@string/endTime"
android:gravity="center"/>
<TextView
android:id="@+id/endTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="   "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<Button
android:id="@+id/endTimeSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/timeSet"
android:layout_marginStart="65dp"
android:layout_marginEnd="65dp"
tools:ignore="DuplicateIds" />
</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="@string/intervalTime"
android:gravity="center"/>
<RadioGroup
android:id="@+id/timeInterval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<RadioButton
android:id="@+id/tenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/fifteenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/fifteenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/thirtyMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/thirtyMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:orientation="horizontal"
android:weightSum="10"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:text="@string/breakTime" />
<TextView
android:id="@+id/startBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint=" から "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
android:inputType=""
tools:ignore="LabelFor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="30sp"
android:paddingStart="30dp"
android:paddingEnd="30dp" />
<TextView
android:id="@+id/endBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:hint=" まで "
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
android:inputType=""
tools:ignore="LabelFor"/>
</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="@string/totalStudent"
android:gravity="center"/>
<EditText
android:id="@+id/totalStudent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="例30人➝30"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:layout_marginTop="20sp">
<Button
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:layout_marginEnd="100dp"
style="?android:attr/buttonBarButtonStyle" />
<Button
android:id="@+id/setUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setUp"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="date" type="id" />
</resources>