diff --git a/app/build.gradle b/app/build.gradle index a7db911..8f90306 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,16 +1,19 @@ plugins { id 'com.android.application' + id 'com.google.gms.google-services' + + id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' } android { namespace 'com.example.oplogy' - compileSdk 33 + compileSdk 34 defaultConfig { applicationId "com.example.oplogy" minSdk 26 - targetSdk 33 + targetSdk 34 versionCode 1 versionName "1.0" @@ -27,6 +30,9 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + buildFeatures { + viewBinding true + } } dependencies { @@ -35,6 +41,7 @@ dependencies { implementation 'com.google.android.material:material:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.google.firebase:firebase-firestore:24.4.1' + implementation 'com.google.android.gms:play-services-maps:18.2.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f1bbbad..a476460 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,33 @@ android:supportsRtl="true" android:theme="@style/Theme.Oplogy" tools:targetApi="31"> + + + + + + + + + + + + diff --git a/app/src/main/java/com/example/oplogy/MainActivity.java b/app/src/main/java/com/example/oplogy/MainActivity.java index 30ba0e1..a401e2b 100644 --- a/app/src/main/java/com/example/oplogy/MainActivity.java +++ b/app/src/main/java/com/example/oplogy/MainActivity.java @@ -3,7 +3,9 @@ package com.example.oplogy; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; +import android.annotation.SuppressLint; +import androidd.os.Bunle; + import android.util.Log; import android.view.View; import android.widget.Button; @@ -30,11 +32,20 @@ public class MainActivity extends AppCompatActivity { private EditText time; private FirebaseFirestore db = FirebaseFirestore.getInstance(); + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + + + Button button; +// TextView textView; + EditText editText; + @SuppressLint("MissingInflatedId") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + textView=findViewById(R.id.showText); btnShow=findViewById(R.id.btnShow); btnAdd=findViewById(R.id.btnAdd); @@ -81,6 +92,21 @@ public class MainActivity extends AppCompatActivity { }); + + + + findViewById(R.id.mapmapcreate).setOnClickListener( + view->{ + + + } + ); + } + + @Override + public void onClick(View v) { + + } } class User { diff --git a/app/src/main/java/com/example/oplogy/MapsActivity.java b/app/src/main/java/com/example/oplogy/MapsActivity.java new file mode 100644 index 0000000..51d8b34 --- /dev/null +++ b/app/src/main/java/com/example/oplogy/MapsActivity.java @@ -0,0 +1,56 @@ +package com.example.oplogy; + +import androidx.fragment.app.FragmentActivity; + +import android.os.Bundle; + +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.LatLng; +import com.google.android.gms.maps.model.MarkerOptions; +import com.example.oplogy.databinding.ActivityMapsBinding; + +public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { + + private GoogleMap mMap; + private ActivityMapsBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + binding = ActivityMapsBinding.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); + } + + /** + * 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; + + // Add a marker in Sydney and move the camera + /// 緯度経度 + LatLng loc = new LatLng(35.17260398479137, 136.88635173557998); + /// マーカーオプションを設定(情報ウィンドウ) + mMap.addMarker(new MarkerOptions().position(loc).title("トライデントコンピュータ専門学校")); + /// 表示位置を地図に指定 + mMap.moveCamera(CameraUpdateFactory.newLatLng(loc)); + /// 地図の倍率を指定 + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 17)); + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 039dfbc..1d78a77 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,6 +7,7 @@ tools:context=".MainActivity" android:orientation="vertical"> + +======= +