diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index dc3df27..53aecf0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -41,13 +41,12 @@
android:name=".SignUpActivity"
android:exported="true"
android:label="@string/title_activity_sign_up">
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/app/src/main/java/com/example/nemophila/FriendActivity.java b/app/src/main/java/com/example/nemophila/FriendActivity.java
index 718a01c..ad12256 100644
--- a/app/src/main/java/com/example/nemophila/FriendActivity.java
+++ b/app/src/main/java/com/example/nemophila/FriendActivity.java
@@ -10,5 +10,6 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friend);
+
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/nemophila/MainActivity.java b/app/src/main/java/com/example/nemophila/MainActivity.java
index c3769c7..2fa42ac 100644
--- a/app/src/main/java/com/example/nemophila/MainActivity.java
+++ b/app/src/main/java/com/example/nemophila/MainActivity.java
@@ -1,6 +1,5 @@
package com.example.nemophila;
-import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.activity.result.ActivityResultLauncher;
@@ -8,19 +7,14 @@
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Point;
-import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.widget.ImageButton;
import android.widget.Toast;
import android.annotation.SuppressLint;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
-import android.widget.TextView;
import android.content.Intent;
import android.provider.Settings;
import android.util.Log;
@@ -28,12 +22,10 @@
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
-import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
-import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.GroundOverlay;
import com.google.android.gms.maps.model.GroundOverlayOptions;
import com.google.android.gms.maps.model.LatLng;
@@ -41,21 +33,19 @@
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.example.nemophila.databinding.ActivityMainBinding;
-import com.google.firebase.firestore.GeoPoint;
-
-import java.util.Map;
public class MainActivity extends FragmentActivity implements OnMapReadyCallback,LocationListener {
private GoogleMap mMap;
private ActivityMainBinding binding;
- private LatLng latlng;
- private LatLng latlng2;
+ private LatLng currentLatlng;
+ private LatLng testLatlng;
+ private LatLng testLatlng2;
- private GroundOverlay current_overlay;
+ private GroundOverlay currentOverlay;
LocationManager locationManager;
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -65,6 +55,24 @@
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
+ //現在地ボタン
+ ImageButton button1 = findViewById(R.id.currentButton);
+ // lambda式
+ button1.setOnClickListener( v -> {
+ Log.d("debug", "currentbutton, 現在地にカメラを移動");
+ //現在地にカメラを移動
+ zoomMap(currentLatlng.latitude, currentLatlng.longitude);
+ });
+
+ ImageButton myPageButton = findViewById(R.id.myPageButton);
+ // lambda式
+ myPageButton.setOnClickListener( v -> {
+ Log.d("debug", "myPageButton, マイページに画面遷移");
+ Intent intent = new Intent(MainActivity.this, MyPageActivity.class);
+ startActivity(intent);
+ });
+
+
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
@@ -93,9 +101,9 @@
double latitude = 34.7308032;
double longitude = 135.2630272;
- //テスト用
- latlng = new LatLng(latitude, longitude);
- latlng2 = new LatLng(34.74, 135.26);
+ //テスト用,仮ピン立て
+ testLatlng = new LatLng(latitude, longitude);
+ testLatlng2 = new LatLng(34.74, 135.26);
//標準のマーカー(店用のピン)
setMarker(latitude, longitude);
@@ -168,12 +176,12 @@
MarkerOptions markerOptions = new MarkerOptions();
MarkerOptions markerOptions2 = new MarkerOptions();
- markerOptions.position(latlng);
+ markerOptions.position(testLatlng);
markerOptions.title("ntlab");
mMap.addMarker(markerOptions);
//テスト用
- markerOptions2.position(latlng2);
+ markerOptions2.position(testLatlng2);
markerOptions2.title(null);
mMap.addMarker(markerOptions2);
@@ -189,6 +197,8 @@
double north = latitude * (1+0.00005);
double east = longitude * (1+0.00005);
+ LatLng latlng = new LatLng(latitude,longitude);
+
// LatLngBounds (LatLng southwest, LatLng northeast)
//左下、右上
LatLngBounds bounds = LatLngBounds.builder()
@@ -207,11 +217,12 @@
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15f));
}
+ //現在地の表示
private void setIcon(double latitude, double longitude){
//Drawable ic_current = ResourcesCompat.getDrawable(getResources(),R.drawable.icon_current,null);
//更新前の現在地アイコンを消去
- if(current_overlay != null) {
- current_overlay.remove();
+ if(currentOverlay != null) {
+ currentOverlay.remove();
}
LatLng current_location = new LatLng(latitude,longitude);
@@ -233,14 +244,14 @@
overlayOptions.position(current_location, 200f, 200f);
// マップに貼り付け・アルファを設定
- current_overlay = mMap.addGroundOverlay(overlayOptions);
+ currentOverlay = mMap.addGroundOverlay(overlayOptions);
// カメラを移動
- zoomMap(latitude, longitude);
+ //zoomMap(latitude, longitude);
// 透明度
- assert current_overlay != null;
- current_overlay.setTransparency(0.8F);
+ assert currentOverlay != null;
+ currentOverlay.setTransparency(0.8F);
}
@@ -301,25 +312,27 @@
public void onLocationChanged(Location location) {
//現在地が変更されるたびに現在地アイコンを移動
//LatLng型で一応受け取っておく
- latlng = new LatLng(location.getLatitude(), location.getLongitude());
+ currentLatlng = new LatLng(location.getLatitude(), location.getLongitude());
/*
テスト用。現在座標を画面に表示
*/
- // 緯度の表示
- TextView textView1 = findViewById(R.id.text_view1);
- String str1 = "Latitude:"+location.getLatitude();
- textView1.setText(str1);
-
- // 経度の表示
- TextView textView2 = findViewById(R.id.text_view2);
- String str2 = "Longitude:"+location.getLongitude();
- textView2.setText(str2);
+// // 緯度の表示
+// TextView textView1 = findViewById(R.id.text_view1);
+// String str1 = "Latitude:"+location.getLatitude();
+// textView1.setText(str1);
+//
+// // 経度の表示
+// TextView textView2 = findViewById(R.id.text_view2);
+// String str2 = "Longitude:"+location.getLongitude();
+// textView2.setText(str2);
//現在地アイコンを表示.このsetIcon内にzoomMap処理もあるので注意
setIcon(location.getLatitude(),location.getLongitude());
}
+
+
@Override
public void onProviderEnabled(String provider) {
@@ -329,4 +342,5 @@
public void onProviderDisabled(String provider) {
}
+
}
diff --git a/app/src/main/java/com/example/nemophila/MyPageActivity.java b/app/src/main/java/com/example/nemophila/MyPageActivity.java
index a2f9074..82b4397 100644
--- a/app/src/main/java/com/example/nemophila/MyPageActivity.java
+++ b/app/src/main/java/com/example/nemophila/MyPageActivity.java
@@ -60,9 +60,11 @@
AccountViewModel accountViewModel = new ViewModelProvider(this).get(AccountViewModel.class);
Nemophila nemophila = (Nemophila) getApplication();
String uid = nemophila.getUid();
-// String name = nemophila.
-// TextView name = (TextView) findViewById(R.id.name);
-// TextView id = (TextView) findViewById(R.id.id);
+ String name = nemophila.getName();
+ TextView myname = (TextView) findViewById(R.id.name);
+ myname.setText(name);
+ TextView id = (TextView) findViewById(R.id.id);
+ id.setText(uid);
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java b/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java
index b9b46be..393e666 100644
--- a/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java
+++ b/app/src/main/java/com/example/nemophila/MyPageEditorActivity.java
@@ -8,6 +8,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.TextView;
import com.example.nemophila.viewmodels.AccountViewModel;
@@ -19,6 +20,7 @@
setContentView(R.layout.activity_my_page_editor);
//AccountViewModelとの通信
AccountViewModel accountViewModel = new ViewModelProvider(this).get(AccountViewModel.class);
+ EditText name = (EditText) findViewById(R.id.editName);
//MyPageに戻るボタン
Button backButton = (Button) findViewById(R.id.backMyPage);
backButton.setOnClickListener(new View.OnClickListener() {
@@ -54,5 +56,16 @@
startActivity(intent);
}
});
+// 削除ボタンを押したときの処理
+ Button deleteAccountButton = (Button) findViewById(R.id.deleteAccount);
+ deleteAccountButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Nemophila nemophila = (Nemophila) getApplication();
+ String uid = nemophila.getUid();
+ String token = nemophila.getToken();
+ Intent intent = new Intent(MyPageEditorActivity.this, LoginActivity.class);
+ startActivity(intent);
+ }
+ });
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/example/nemophila/Nemophila.java b/app/src/main/java/com/example/nemophila/Nemophila.java
index 61ae16c..6b8c2be 100644
--- a/app/src/main/java/com/example/nemophila/Nemophila.java
+++ b/app/src/main/java/com/example/nemophila/Nemophila.java
@@ -18,21 +18,21 @@
public String getName() {
if(name == null){
SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE);
- name = preferences.getString("name", "");
+ name = preferences.getString("name", null);
}
return name;
}
public String getUid() {
if(uid == null){
SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE);
- uid = preferences.getString("uid", "");
+ uid = preferences.getString("uid", null);
}
return uid;
}
public String getToken() {
if(token == null){
SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE);
- token = preferences.getString("token", "");
+ token = preferences.getString("token", null);
}
return token;
}
diff --git a/app/src/main/res/layout/activity_friend.xml b/app/src/main/res/layout/activity_friend.xml
index 560f9dd..51e2fcb 100644
--- a/app/src/main/res/layout/activity_friend.xml
+++ b/app/src/main/res/layout/activity_friend.xml
@@ -6,4 +6,29 @@
android:layout_height="match_parent"
tools:context=".FriendActivity">
+
+
+
+
+
\ 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 95d4392..ebbd728 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -13,17 +13,49 @@
android:layout_height="match_parent"
tools:context=".MainActivity" />
-
+ android:layout_height="match_parent">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file