Showing
12 changed files
with
205 additions
and
118 deletions
... | @@ -6,12 +6,11 @@ | ... | @@ -6,12 +6,11 @@ |
6 | 6 | ||
7 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | 7 | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> |
8 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | 8 | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
9 | - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | 9 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> |
10 | - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | 10 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> |
11 | - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 11 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
12 | <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> | 12 | <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> |
13 | 13 | ||
14 | - | ||
15 | <application | 14 | <application |
16 | android:allowBackup="true" | 15 | android:allowBackup="true" |
17 | android:icon="@mipmap/ic_launcher" | 16 | android:icon="@mipmap/ic_launcher" |
... | @@ -19,30 +18,32 @@ | ... | @@ -19,30 +18,32 @@ |
19 | android:roundIcon="@mipmap/ic_launcher_round" | 18 | android:roundIcon="@mipmap/ic_launcher_round" |
20 | android:supportsRtl="true" | 19 | android:supportsRtl="true" |
21 | android:theme="@style/AppTheme"> | 20 | android:theme="@style/AppTheme"> |
22 | - <activity android:name=".MainActivity"> | 21 | + <activity android:name=".WelcomActivity"> |
23 | <intent-filter> | 22 | <intent-filter> |
24 | - <action android:name="android.intent.action.MAIN"/> | 23 | + <action android:name="android.intent.action.MAIN"/>\ |
25 | <category android:name="android.intent.category.LAUNCHER"/> | 24 | <category android:name="android.intent.category.LAUNCHER"/> |
26 | </intent-filter> | 25 | </intent-filter> |
27 | </activity> | 26 | </activity> |
28 | <activity android:name=".LoginActivity"/> | 27 | <activity android:name=".LoginActivity"/> |
29 | <activity android:name=".ProfileActivity"/> | 28 | <activity android:name=".ProfileActivity"/> |
29 | + <activity android:name=".MainActivity"/> | ||
30 | <activity | 30 | <activity |
31 | + | ||
31 | android:name=".Main2Activity" | 32 | android:name=".Main2Activity" |
32 | android:label="@string/title_activity_main2" | 33 | android:label="@string/title_activity_main2" |
33 | android:theme="@style/AppTheme.NoActionBar"/> | 34 | android:theme="@style/AppTheme.NoActionBar"/> |
34 | <activity android:name=".PostActivity"/> | 35 | <activity android:name=".PostActivity"/> |
36 | + | ||
35 | <meta-data | 37 | <meta-data |
36 | android:name="com.google.android.geo.API_KEY" | 38 | android:name="com.google.android.geo.API_KEY" |
37 | android:value="@string/google_maps_key"/> | 39 | android:value="@string/google_maps_key"/> |
38 | - <service | 40 | + |
39 | - android:name=".MyFirebaseInstanceIDService"> | 41 | + <service android:name=".MyFirebaseInstanceIDService"> |
40 | <intent-filter> | 42 | <intent-filter> |
41 | <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> | 43 | <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> |
42 | </intent-filter> | 44 | </intent-filter> |
43 | </service> | 45 | </service> |
44 | - <service | 46 | + <service android:name=".MyFirebaseMessagingService"> |
45 | - android:name=".MyFirebaseMessagingService"> | ||
46 | <intent-filter> | 47 | <intent-filter> |
47 | <action android:name="com.google.firebase.MESSAGING_EVENT"/> | 48 | <action android:name="com.google.firebase.MESSAGING_EVENT"/> |
48 | </intent-filter> | 49 | </intent-filter> | ... | ... |
... | @@ -111,6 +111,7 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList | ... | @@ -111,6 +111,7 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList |
111 | private void signIn() { | 111 | private void signIn() { |
112 | Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); | 112 | Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); |
113 | startActivityForResult(signInIntent, RC_SIGN_IN); | 113 | startActivityForResult(signInIntent, RC_SIGN_IN); |
114 | + finish(); | ||
114 | } | 115 | } |
115 | 116 | ||
116 | @Override | 117 | @Override |
... | @@ -203,7 +204,6 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList | ... | @@ -203,7 +204,6 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList |
203 | } | 204 | } |
204 | if(view == textViewSignUp){ | 205 | if(view == textViewSignUp){ |
205 | finish(); | 206 | finish(); |
206 | - startActivity(new Intent(this, MainActivity.class)); | ||
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ... | ... |
... | @@ -13,6 +13,7 @@ import android.support.v7.app.AppCompatActivity; | ... | @@ -13,6 +13,7 @@ import android.support.v7.app.AppCompatActivity; |
13 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
14 | import android.util.Log; | 14 | import android.util.Log; |
15 | import android.view.View; | 15 | import android.view.View; |
16 | +import android.view.WindowManager; | ||
16 | import android.widget.Button; | 17 | import android.widget.Button; |
17 | import android.widget.EditText; | 18 | import android.widget.EditText; |
18 | import android.widget.TextView; | 19 | import android.widget.TextView; |
... | @@ -25,7 +26,8 @@ import com.google.firebase.auth.FirebaseAuth; | ... | @@ -25,7 +26,8 @@ import com.google.firebase.auth.FirebaseAuth; |
25 | import com.google.firebase.database.DatabaseReference; | 26 | import com.google.firebase.database.DatabaseReference; |
26 | import com.google.firebase.database.FirebaseDatabase; | 27 | import com.google.firebase.database.FirebaseDatabase; |
27 | 28 | ||
28 | -public class MainActivity extends AppCompatActivity implements View.OnClickListener{ | 29 | +public class MainActivity extends AppCompatActivity implements View.OnClickListener |
30 | +{ | ||
29 | 31 | ||
30 | private Button buttonRegister; | 32 | private Button buttonRegister; |
31 | 33 | ||
... | @@ -41,22 +43,26 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -41,22 +43,26 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
41 | private DatabaseReference mDatabase; | 43 | private DatabaseReference mDatabase; |
42 | 44 | ||
43 | @Override | 45 | @Override |
44 | - protected void onCreate(Bundle savedInstanceState) { | 46 | + protected void onCreate(Bundle savedInstanceState) |
47 | + { | ||
45 | 48 | ||
46 | super.onCreate(savedInstanceState); | 49 | super.onCreate(savedInstanceState); |
47 | setContentView(R.layout.activity_main); | 50 | setContentView(R.layout.activity_main); |
48 | 51 | ||
52 | + this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); | ||
53 | + | ||
49 | progressDialog = new ProgressDialog(MainActivity.this); | 54 | progressDialog = new ProgressDialog(MainActivity.this); |
50 | firebaseAuth = FirebaseAuth.getInstance(); | 55 | firebaseAuth = FirebaseAuth.getInstance(); |
51 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Users"); | 56 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Users"); |
52 | 57 | ||
53 | - Log.d("", "퍼미션 체크전"); | ||
54 | checkLocationPermission(); | 58 | checkLocationPermission(); |
55 | 59 | ||
56 | - if(firebaseAuth.getCurrentUser() != null){ | 60 | + if (firebaseAuth.getCurrentUser() != null) |
61 | + { | ||
57 | //profile activity here | 62 | //profile activity here |
58 | finish(); | 63 | finish(); |
59 | startActivity(new Intent(getApplicationContext(), Main2Activity.class)); | 64 | startActivity(new Intent(getApplicationContext(), Main2Activity.class)); |
65 | + | ||
60 | } | 66 | } |
61 | 67 | ||
62 | buttonRegister = (Button) findViewById(R.id.buttonRegister); | 68 | buttonRegister = (Button) findViewById(R.id.buttonRegister); |
... | @@ -71,24 +77,28 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -71,24 +77,28 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
71 | textViewSignIn.setOnClickListener(this); | 77 | textViewSignIn.setOnClickListener(this); |
72 | } | 78 | } |
73 | 79 | ||
74 | - private void registerUser(){ | 80 | + private void registerUser() |
81 | + { | ||
75 | final String name = editTextName.getText().toString().trim(); | 82 | final String name = editTextName.getText().toString().trim(); |
76 | final String email = editTextEmail.getText().toString().trim(); | 83 | final String email = editTextEmail.getText().toString().trim(); |
77 | final String password = editTextPassword.getText().toString().trim(); | 84 | final String password = editTextPassword.getText().toString().trim(); |
78 | 85 | ||
79 | - if(TextUtils.isEmpty(name)){ | 86 | + if (TextUtils.isEmpty(name)) |
87 | + { | ||
80 | Toast.makeText(this, "이름을 입력하세요", Toast.LENGTH_SHORT).show(); | 88 | Toast.makeText(this, "이름을 입력하세요", Toast.LENGTH_SHORT).show(); |
81 | return; | 89 | return; |
82 | } | 90 | } |
83 | 91 | ||
84 | - if(TextUtils.isEmpty(email)){ | 92 | + if (TextUtils.isEmpty(email)) |
93 | + { | ||
85 | //email is empty | 94 | //email is empty |
86 | Toast.makeText(this, "이메일을 입력하세요요", Toast.LENGTH_SHORT).show(); | 95 | Toast.makeText(this, "이메일을 입력하세요요", Toast.LENGTH_SHORT).show(); |
87 | //stopping the function execution further | 96 | //stopping the function execution further |
88 | return; | 97 | return; |
89 | } | 98 | } |
90 | 99 | ||
91 | - if(TextUtils.isEmpty(password)) { | 100 | + if (TextUtils.isEmpty(password)) |
101 | + { | ||
92 | //password is empty | 102 | //password is empty |
93 | Toast.makeText(this, "패스워드를 입력하세요", Toast.LENGTH_SHORT).show(); | 103 | Toast.makeText(this, "패스워드를 입력하세요", Toast.LENGTH_SHORT).show(); |
94 | //stopping the function execution further | 104 | //stopping the function execution further |
... | @@ -102,17 +112,21 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -102,17 +112,21 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
102 | progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); | 112 | progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); |
103 | progressDialog.show(); | 113 | progressDialog.show(); |
104 | //creating a new user | 114 | //creating a new user |
105 | - firebaseAuth.createUserWithEmailAndPassword(email,password) | 115 | + firebaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() |
106 | - .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { | 116 | + { |
107 | @Override | 117 | @Override |
108 | - public void onComplete(@NonNull Task<AuthResult> task) { | 118 | + public void onComplete(@NonNull Task<AuthResult> task) |
109 | - if(task.isSuccessful()){ | 119 | + { |
120 | + if (task.isSuccessful()) | ||
121 | + { | ||
110 | finish(); | 122 | finish(); |
111 | DatabaseReference newPost = mDatabase.push(); | 123 | DatabaseReference newPost = mDatabase.push(); |
112 | newPost.child("name").setValue(name); | 124 | newPost.child("name").setValue(name); |
113 | newPost.child("email").setValue(email); | 125 | newPost.child("email").setValue(email); |
114 | startActivity(new Intent(getApplicationContext(), Main2Activity.class)); | 126 | startActivity(new Intent(getApplicationContext(), Main2Activity.class)); |
115 | - }else{ | 127 | + } |
128 | + else | ||
129 | + { | ||
116 | Toast.makeText(MainActivity.this, "등록할 수 없습니다.", Toast.LENGTH_SHORT).show(); | 130 | Toast.makeText(MainActivity.this, "등록할 수 없습니다.", Toast.LENGTH_SHORT).show(); |
117 | } | 131 | } |
118 | progressDialog.dismiss(); | 132 | progressDialog.dismiss(); |
... | @@ -121,36 +135,32 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -121,36 +135,32 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
121 | } | 135 | } |
122 | 136 | ||
123 | @Override | 137 | @Override |
124 | - public void onClick(View view) { | 138 | + public void onClick(View view) |
125 | - if(view == buttonRegister){ | 139 | + { |
140 | + if (view == buttonRegister) | ||
141 | + { | ||
126 | registerUser(); | 142 | registerUser(); |
127 | } | 143 | } |
128 | 144 | ||
129 | - if(view == textViewSignIn){ | 145 | + if (view == textViewSignIn) |
146 | + { | ||
130 | //will open login activity here | 147 | //will open login activity here |
131 | startActivity(new Intent(this, LoginActivity.class)); | 148 | startActivity(new Intent(this, LoginActivity.class)); |
132 | } | 149 | } |
133 | } | 150 | } |
134 | 151 | ||
135 | 152 | ||
136 | - | ||
137 | public boolean checkLocationPermission() | 153 | public boolean checkLocationPermission() |
138 | { | 154 | { |
139 | - | 155 | + if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) |
140 | - Log.d("", "퍼미션 체크안"); | ||
141 | - if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED) | ||
142 | { | 156 | { |
143 | - Log.d("", "퍼미션 받음"); | 157 | + if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION)) |
144 | - if(ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION)) | ||
145 | { | 158 | { |
146 | - Log.d("", "리퀘ㅡ트 띠움"); | 159 | + ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_CODE); |
147 | - ActivityCompat.requestPermissions(this, new String[] {android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_CODE); | ||
148 | } | 160 | } |
149 | else | 161 | else |
150 | { | 162 | { |
151 | - Log.d("", "리퀘ㅡ트 띠움"); | 163 | + ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_CODE); |
152 | - ActivityCompat.requestPermissions(this, new String[] {android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_CODE); | ||
153 | - | ||
154 | } | 164 | } |
155 | return false; | 165 | return false; |
156 | } | 166 | } | ... | ... |
... | @@ -47,10 +47,6 @@ import com.google.android.gms.maps.model.LatLng; | ... | @@ -47,10 +47,6 @@ import com.google.android.gms.maps.model.LatLng; |
47 | import com.google.android.gms.maps.model.Marker; | 47 | import com.google.android.gms.maps.model.Marker; |
48 | import com.google.android.gms.maps.model.MarkerOptions; | 48 | import com.google.android.gms.maps.model.MarkerOptions; |
49 | 49 | ||
50 | -/** | ||
51 | - * Created by HYB on 2017. 10. 11.. | ||
52 | - */ | ||
53 | - | ||
54 | public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener | 50 | public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener |
55 | { | 51 | { |
56 | 52 | ||
... | @@ -59,32 +55,22 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -59,32 +55,22 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
59 | private static final String TAG = "googlemap_example"; | 55 | private static final String TAG = "googlemap_example"; |
60 | private static final int GPS_ENABLE_REQUEST_CODE = 2001; | 56 | private static final int GPS_ENABLE_REQUEST_CODE = 2001; |
61 | private static final int PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 2002; | 57 | private static final int PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 2002; |
62 | - private static final int UPDATE_INTERVAL_MS = 15000; | 58 | + private static final int UPDATE_INTERVAL_MS = 5000; |
63 | - private static final int FASTEST_UPDATE_INTERVAL_MS = 15000; | 59 | + private static final int FASTEST_UPDATE_INTERVAL_MS = 5000; |
64 | 60 | ||
65 | private GoogleMap googleMap = null; | 61 | private GoogleMap googleMap = null; |
66 | private MapView mapView = null; | 62 | private MapView mapView = null; |
67 | private GoogleApiClient googleApiClient = null; | 63 | private GoogleApiClient googleApiClient = null; |
68 | private Marker currentMarker = null; | 64 | private Marker currentMarker = null; |
69 | 65 | ||
70 | - private final static int MAXENTRIES = 5; | ||
71 | - private String[] LikelyPlaceNames = null; | ||
72 | - private String[] LikelyAddresses = null; | ||
73 | - private String[] LikelyAttributions = null; | ||
74 | - private LatLng[] LikelyLatLngs = null; | ||
75 | - | ||
76 | - public Map() | ||
77 | - { | ||
78 | - | ||
79 | - } | ||
80 | - | ||
81 | public void setCurrentLocation(Location location, String markerTitle, String markerSnippet) | 66 | public void setCurrentLocation(Location location, String markerTitle, String markerSnippet) |
82 | { | 67 | { |
83 | if (currentMarker != null) | 68 | if (currentMarker != null) |
84 | - { currentMarker.remove(); } | 69 | + { |
70 | + currentMarker.remove(); | ||
71 | + } | ||
85 | if (location != null) | 72 | if (location != null) |
86 | { | 73 | { |
87 | - Log.i(TAG, " Got my Loc!! "); | ||
88 | //현재위치의 위도 경도 가져옴 | 74 | //현재위치의 위도 경도 가져옴 |
89 | LatLng currentLocation = new LatLng(location.getLatitude(), location.getLongitude()); | 75 | LatLng currentLocation = new LatLng(location.getLatitude(), location.getLongitude()); |
90 | 76 | ||
... | @@ -139,7 +125,6 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -139,7 +125,6 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
139 | 125 | ||
140 | setCurrentLocation(location, place.getName().toString(), place.getAddress().toString()); | 126 | setCurrentLocation(location, place.getName().toString(), place.getAddress().toString()); |
141 | } | 127 | } |
142 | - | ||
143 | @Override | 128 | @Override |
144 | public void onError(Status status) | 129 | public void onError(Status status) |
145 | { | 130 | { |
... | @@ -331,9 +316,9 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -331,9 +316,9 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
331 | { | 316 | { |
332 | Log.i(TAG, "onLocationChanged call.."); | 317 | Log.i(TAG, "onLocationChanged call.."); |
333 | lastLocation = location; | 318 | lastLocation = location; |
334 | - if(currentMarker != null) | 319 | + if (currentMarker != null) |
335 | { | 320 | { |
336 | - currentMarker .remove(); | 321 | + currentMarker.remove(); |
337 | } | 322 | } |
338 | LatLng mlanglang = new LatLng(location.getLatitude(), location.getLongitude()); | 323 | LatLng mlanglang = new LatLng(location.getLatitude(), location.getLongitude()); |
339 | MarkerOptions markerOptions = new MarkerOptions(); | 324 | MarkerOptions markerOptions = new MarkerOptions(); |
... | @@ -344,14 +329,12 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -344,14 +329,12 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
344 | currentMarker = googleMap.addMarker(markerOptions); | 329 | currentMarker = googleMap.addMarker(markerOptions); |
345 | googleMap.moveCamera(CameraUpdateFactory.newLatLng(mlanglang)); | 330 | googleMap.moveCamera(CameraUpdateFactory.newLatLng(mlanglang)); |
346 | googleMap.animateCamera(CameraUpdateFactory.zoomBy(10)); | 331 | googleMap.animateCamera(CameraUpdateFactory.zoomBy(10)); |
347 | - | 332 | + googleMap.animateCamera(CameraUpdateFactory.zoomTo((17.0f))); |
348 | } | 333 | } |
349 | 334 | ||
350 | @Override | 335 | @Override |
351 | public void onConnected(@Nullable Bundle bundle) | 336 | public void onConnected(@Nullable Bundle bundle) |
352 | { | 337 | { |
353 | - | ||
354 | - Log.i(TAG, "An error occurred: onConnected"); | ||
355 | if (!checkLocationServicesStatus()) | 338 | if (!checkLocationServicesStatus()) |
356 | { | 339 | { |
357 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | 340 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); |
... | @@ -378,7 +361,6 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -378,7 +361,6 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
378 | builder.create().show(); | 361 | builder.create().show(); |
379 | } | 362 | } |
380 | 363 | ||
381 | - Log.i(TAG, "An error occurred: onConnected2"); | ||
382 | LocationRequest locationRequest = new LocationRequest(); | 364 | LocationRequest locationRequest = new LocationRequest(); |
383 | locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); | 365 | locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); |
384 | locationRequest.setInterval(UPDATE_INTERVAL_MS); | 366 | locationRequest.setInterval(UPDATE_INTERVAL_MS); |
... | @@ -390,6 +372,8 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -390,6 +372,8 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
390 | { | 372 | { |
391 | 373 | ||
392 | LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this); | 374 | LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this); |
375 | + this.googleMap.getUiSettings().setCompassEnabled(true); | ||
376 | + this.googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); | ||
393 | } | 377 | } |
394 | } | 378 | } |
395 | else | 379 | else |
... | @@ -400,8 +384,6 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient | ... | @@ -400,8 +384,6 @@ public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient |
400 | this.googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); | 384 | this.googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); |
401 | } | 385 | } |
402 | 386 | ||
403 | - Log.i(TAG, "An error occurred: onConnected3"); | ||
404 | - | ||
405 | } | 387 | } |
406 | 388 | ||
407 | @Override | 389 | @Override | ... | ... |
1 | +package com.example.user.firebaseauthdemo; | ||
2 | + | ||
3 | +import android.content.Intent; | ||
4 | +import android.os.Bundle; | ||
5 | +import android.os.Handler; | ||
6 | +import android.support.v7.app.AppCompatActivity; | ||
7 | +import android.view.Window; | ||
8 | +import android.view.WindowManager; | ||
9 | + | ||
10 | +public class WelcomActivity extends AppCompatActivity | ||
11 | +{ | ||
12 | + private static int SPLASH_TIME_OUT = 2000; | ||
13 | + | ||
14 | + @Override | ||
15 | + protected void onCreate(Bundle savedInstanceState) | ||
16 | + { | ||
17 | + super.onCreate(savedInstanceState); | ||
18 | + requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
19 | + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, | ||
20 | + WindowManager.LayoutParams.FLAG_FULLSCREEN); | ||
21 | + setContentView(R.layout.activity_welcom); | ||
22 | + new Handler().postDelayed(new Runnable() | ||
23 | + { | ||
24 | + @Override | ||
25 | + public void run() | ||
26 | + { | ||
27 | + Intent myintent = new Intent(WelcomActivity.this, MainActivity.class); | ||
28 | + startActivity(myintent); | ||
29 | + finish(); | ||
30 | + } | ||
31 | + } | ||
32 | + , SPLASH_TIME_OUT); | ||
33 | + | ||
34 | + } | ||
35 | +} |
... | @@ -7,63 +7,76 @@ | ... | @@ -7,63 +7,76 @@ |
7 | tools:context="com.example.user.firebaseauthdemo.LoginActivity"> | 7 | tools:context="com.example.user.firebaseauthdemo.LoginActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | + android:layout_width="0dp" | ||
11 | + android:layout_height="match_parent" | ||
10 | android:layout_centerHorizontal="true" | 12 | android:layout_centerHorizontal="true" |
11 | android:layout_centerVertical="true" | 13 | android:layout_centerVertical="true" |
14 | + android:layout_marginBottom="8dp" | ||
15 | + android:layout_marginLeft="8dp" | ||
16 | + android:layout_marginRight="8dp" | ||
17 | + android:layout_marginTop="8dp" | ||
12 | android:orientation="vertical" | 18 | android:orientation="vertical" |
13 | - android:layout_width="368dp" | 19 | + app:layout_constraintBottom_toBottomOf="parent" |
20 | + app:layout_constraintLeft_toLeftOf="parent" | ||
21 | + app:layout_constraintRight_toRightOf="parent" | ||
22 | + app:layout_constraintTop_toTopOf="parent"> | ||
23 | + | ||
24 | + <ImageView | ||
25 | + android:id="@+id/imageView3" | ||
26 | + android:layout_width="match_parent" | ||
14 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
15 | - tools:layout_editor_absoluteY="0dp" | 28 | + app:srcCompat="@drawable/common_google_signin_btn_icon_dark"/> |
16 | - tools:layout_editor_absoluteX="8dp" > | ||
17 | 29 | ||
18 | <TextView | 30 | <TextView |
19 | android:id="@+id/textView" | 31 | android:id="@+id/textView" |
20 | - android:layout_width="wrap_content" | 32 | + android:layout_width="match_parent" |
21 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
22 | android:layout_gravity="center_horizontal" | 34 | android:layout_gravity="center_horizontal" |
23 | android:layout_margin="30dp" | 35 | android:layout_margin="30dp" |
24 | android:text="HELPLIST" | 36 | android:text="HELPLIST" |
25 | - android:textAppearance="?android:attr/textAppearanceLarge" /> | 37 | + android:textAlignment="center" |
38 | + android:textAppearance="?android:attr/textAppearanceLarge"/> | ||
26 | 39 | ||
27 | <EditText | 40 | <EditText |
28 | - android:layout_margin="15dp" | ||
29 | - android:inputType="textEmailAddress" | ||
30 | - android:hint="이메일을 입력하세요" | ||
31 | android:id="@+id/editTextEmail" | 41 | android:id="@+id/editTextEmail" |
32 | - android:layout_width="368dp" | 42 | + android:layout_width="match_parent" |
33 | android:layout_height="wrap_content" | 43 | android:layout_height="wrap_content" |
34 | - tools:layout_editor_absoluteY="0dp" | 44 | + android:layout_margin="15dp" |
35 | - tools:layout_editor_absoluteX="8dp" /> | 45 | + android:hint="이메일을 입력하세요" |
46 | + android:inputType="textEmailAddress" | ||
47 | + tools:layout_editor_absoluteX="8dp" | ||
48 | + tools:layout_editor_absoluteY="0dp"/> | ||
36 | 49 | ||
37 | <EditText | 50 | <EditText |
38 | - android:layout_margin="15dp" | ||
39 | - android:inputType="textPassword" | ||
40 | - android:hint="패스워드를 입력하세요" | ||
41 | android:id="@+id/editTextPassword" | 51 | android:id="@+id/editTextPassword" |
42 | android:layout_width="match_parent" | 52 | android:layout_width="match_parent" |
43 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
44 | - tools:layout_editor_absoluteY="0dp" | 54 | + android:layout_margin="15dp" |
45 | - tools:layout_editor_absoluteX="8dp" /> | 55 | + android:hint="패스워드를 입력하세요" |
56 | + android:inputType="textPassword" | ||
57 | + tools:layout_editor_absoluteX="8dp" | ||
58 | + tools:layout_editor_absoluteY="0dp"/> | ||
46 | 59 | ||
47 | <Button | 60 | <Button |
48 | android:id="@+id/buttonSignIn" | 61 | android:id="@+id/buttonSignIn" |
49 | android:layout_width="match_parent" | 62 | android:layout_width="match_parent" |
50 | android:layout_height="wrap_content" | 63 | android:layout_height="wrap_content" |
51 | android:layout_margin="15dp" | 64 | android:layout_margin="15dp" |
52 | - android:text="로그인" /> | 65 | + android:text="로그인"/> |
53 | 66 | ||
54 | <com.google.android.gms.common.SignInButton | 67 | <com.google.android.gms.common.SignInButton |
68 | + android:id="@+id/buttonGoogleSignIn" | ||
55 | android:layout_width="match_parent" | 69 | android:layout_width="match_parent" |
56 | - android:layout_height="wrap_content" | 70 | + android:layout_height="wrap_content"> |
57 | - android:id="@+id/buttonGoogleSignIn"> | ||
58 | </com.google.android.gms.common.SignInButton> | 71 | </com.google.android.gms.common.SignInButton> |
59 | 72 | ||
60 | <TextView | 73 | <TextView |
61 | - android:textAlignment="center" | ||
62 | android:id="@+id/textViewSignUp" | 74 | android:id="@+id/textViewSignUp" |
63 | android:layout_width="match_parent" | 75 | android:layout_width="match_parent" |
64 | android:layout_height="wrap_content" | 76 | android:layout_height="wrap_content" |
65 | android:layout_margin="15dp" | 77 | android:layout_margin="15dp" |
66 | - android:text="계정이 없나요? 이곳을 클릭하세요" /> | 78 | + android:text="계정이 없나요? 이곳을 클릭하세요" |
79 | + android:textAlignment="center"/> | ||
67 | 80 | ||
68 | </LinearLayout> | 81 | </LinearLayout> |
69 | </android.support.constraint.ConstraintLayout> | 82 | </android.support.constraint.ConstraintLayout> | ... | ... |
... | @@ -7,67 +7,81 @@ | ... | @@ -7,67 +7,81 @@ |
7 | tools:context="com.example.user.firebaseauthdemo.MainActivity"> | 7 | tools:context="com.example.user.firebaseauthdemo.MainActivity"> |
8 | 8 | ||
9 | <LinearLayout | 9 | <LinearLayout |
10 | + android:layout_width="0dp" | ||
11 | + android:layout_height="match_parent" | ||
10 | android:layout_centerHorizontal="true" | 12 | android:layout_centerHorizontal="true" |
11 | android:layout_centerVertical="true" | 13 | android:layout_centerVertical="true" |
14 | + android:layout_marginBottom="8dp" | ||
15 | + android:layout_marginTop="8dp" | ||
12 | android:orientation="vertical" | 16 | android:orientation="vertical" |
13 | - android:layout_width="368dp" | 17 | + app:layout_constraintBottom_toBottomOf="parent" |
18 | + app:layout_constraintHorizontal_bias="0.0" | ||
19 | + app:layout_constraintLeft_toLeftOf="parent" | ||
20 | + app:layout_constraintRight_toRightOf="parent" | ||
21 | + app:layout_constraintTop_toTopOf="parent" | ||
22 | + app:layout_constraintVertical_bias="0.495"> | ||
23 | + | ||
24 | + <ImageView | ||
25 | + android:id="@+id/imageView2" | ||
26 | + android:layout_width="match_parent" | ||
14 | android:layout_height="wrap_content" | 27 | android:layout_height="wrap_content" |
15 | - tools:layout_editor_absoluteY="0dp" | 28 | + app:srcCompat="@drawable/common_google_signin_btn_icon_dark_normal"/> |
16 | - tools:layout_editor_absoluteX="8dp" > | ||
17 | 29 | ||
18 | <TextView | 30 | <TextView |
19 | - android:layout_margin="30dp" | ||
20 | - android:text="환영합니다" | ||
21 | android:id="@+id/textView" | 31 | android:id="@+id/textView" |
22 | android:layout_width="wrap_content" | 32 | android:layout_width="wrap_content" |
23 | - android:textAppearance="?android:attr/textAppearanceLarge" | ||
24 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
25 | - android:layout_gravity="center_horizontal"/> | 34 | + android:layout_gravity="center_horizontal" |
35 | + android:layout_margin="30dp" | ||
36 | + android:text="환영합니다" | ||
37 | + android:textAppearance="?android:attr/textAppearanceLarge"/> | ||
26 | 38 | ||
27 | <EditText | 39 | <EditText |
28 | - android:layout_margin="15dp" | ||
29 | - android:inputType="textPersonName" | ||
30 | - android:hint="Enter your name" | ||
31 | android:id="@+id/editTextName" | 40 | android:id="@+id/editTextName" |
32 | android:layout_width="match_parent" | 41 | android:layout_width="match_parent" |
33 | android:layout_height="wrap_content" | 42 | android:layout_height="wrap_content" |
34 | - tools:layout_editor_absoluteY="0dp" | 43 | + android:layout_margin="15dp" |
35 | - tools:layout_editor_absoluteX="8dp" /> | 44 | + android:hint="Enter your name" |
45 | + android:inputType="textPersonName" | ||
46 | + android:singleLine="false" | ||
47 | + tools:layout_editor_absoluteX="8dp" | ||
48 | + tools:layout_editor_absoluteY="0dp"/> | ||
36 | 49 | ||
37 | <EditText | 50 | <EditText |
38 | - android:layout_margin="15dp" | ||
39 | - android:inputType="textEmailAddress" | ||
40 | - android:hint="Enter your email" | ||
41 | android:id="@+id/editTextEmail" | 51 | android:id="@+id/editTextEmail" |
42 | - android:layout_width="368dp" | 52 | + android:layout_width="match_parent" |
43 | android:layout_height="wrap_content" | 53 | android:layout_height="wrap_content" |
44 | - tools:layout_editor_absoluteY="0dp" | 54 | + android:layout_margin="15dp" |
45 | - tools:layout_editor_absoluteX="8dp" /> | 55 | + android:hint="Enter your email" |
56 | + android:inputType="textEmailAddress" | ||
57 | + tools:layout_editor_absoluteX="8dp" | ||
58 | + tools:layout_editor_absoluteY="0dp"/> | ||
46 | 59 | ||
47 | <EditText | 60 | <EditText |
48 | - android:layout_margin="15dp" | ||
49 | - android:inputType="textPassword" | ||
50 | - android:hint="Enter your password" | ||
51 | android:id="@+id/editTextPassword" | 61 | android:id="@+id/editTextPassword" |
52 | android:layout_width="match_parent" | 62 | android:layout_width="match_parent" |
53 | android:layout_height="wrap_content" | 63 | android:layout_height="wrap_content" |
54 | - tools:layout_editor_absoluteY="0dp" | 64 | + android:layout_margin="15dp" |
55 | - tools:layout_editor_absoluteX="8dp" /> | 65 | + android:hint="Enter your password" |
66 | + android:inputType="textPassword" | ||
67 | + tools:layout_editor_absoluteX="8dp" | ||
68 | + tools:layout_editor_absoluteY="0dp"/> | ||
56 | 69 | ||
57 | 70 | ||
58 | <Button | 71 | <Button |
59 | - android:layout_margin="15dp" | ||
60 | android:id="@+id/buttonRegister" | 72 | android:id="@+id/buttonRegister" |
61 | - android:text="가입" | ||
62 | android:layout_width="match_parent" | 73 | android:layout_width="match_parent" |
63 | - android:layout_height="wrap_content" /> | 74 | + android:layout_height="wrap_content" |
75 | + android:layout_margin="15dp" | ||
76 | + android:text="가입"/> | ||
64 | 77 | ||
65 | <TextView | 78 | <TextView |
66 | - android:textAlignment="center" | ||
67 | - android:text="이미 가입했나요? 이곳을 클릭하세요" | ||
68 | android:id="@+id/textViewSignIn" | 79 | android:id="@+id/textViewSignIn" |
69 | android:layout_width="match_parent" | 80 | android:layout_width="match_parent" |
70 | - android:layout_height="wrap_content" /> | 81 | + android:layout_height="wrap_content" |
82 | + android:text="이미 가입했나요? 이곳을 클릭하세요" | ||
83 | + android:textAlignment="center" | ||
84 | + android:textAppearance="@style/TextAppearance.AppCompat.Body2"/> | ||
71 | 85 | ||
72 | </LinearLayout> | 86 | </LinearLayout> |
73 | </android.support.constraint.ConstraintLayout> | 87 | </android.support.constraint.ConstraintLayout> | ... | ... |
app/src/main/res/layout/activity_welcom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.design.widget.CoordinatorLayout | ||
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | ||
4 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
5 | + xmlns:tools="http://schemas.android.com/tools" | ||
6 | + android:layout_width="match_parent" | ||
7 | + android:layout_height="match_parent" | ||
8 | + android:fitsSystemWindows="false" | ||
9 | + android:visibility="visible" | ||
10 | + app:layout_collapseParallaxMultiplier="1.0" | ||
11 | + tools:context="com.example.user.firebaseauthdemo.WelcomActivity"> | ||
12 | + | ||
13 | + <ImageView | ||
14 | + android:id="@+id/imageView4" | ||
15 | + android:layout_width="match_parent" | ||
16 | + android:layout_height="match_parent" | ||
17 | + app:srcCompat="@drawable/common_google_signin_btn_icon_light_normal"/> | ||
18 | +</android.support.design.widget.CoordinatorLayout> |
app/src/main/res/layout/content_welcom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.constraint.ConstraintLayout | ||
3 | + xmlns:android="http://schemas.android.com/apk/res/android" | ||
4 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
5 | + xmlns:tools="http://schemas.android.com/tools" | ||
6 | + android:layout_width="match_parent" | ||
7 | + android:layout_height="match_parent" | ||
8 | + android:theme="@android:style/Theme.NoTitleBar" | ||
9 | + app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||
10 | + tools:context="com.example.user.firebaseauthdemo.WelcomActivity" | ||
11 | + tools:showIn="@layout/activity_welcom"> | ||
12 | +</android.support.constraint.ConstraintLayout> |
... | @@ -7,4 +7,5 @@ | ... | @@ -7,4 +7,5 @@ |
7 | 7 | ||
8 | <string name="action_settings">Settings</string> | 8 | <string name="action_settings">Settings</string> |
9 | <string name="title_activity_maps">Map</string> | 9 | <string name="title_activity_maps">Map</string> |
10 | + <string name="title_activity_welcom">WelcomActivity</string> | ||
10 | </resources> | 11 | </resources> | ... | ... |
... | @@ -13,8 +13,8 @@ | ... | @@ -13,8 +13,8 @@ |
13 | <item name="windowNoTitle">true</item> | 13 | <item name="windowNoTitle">true</item> |
14 | </style> | 14 | </style> |
15 | 15 | ||
16 | - <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> | 16 | + <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/> |
17 | 17 | ||
18 | - <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> | 18 | + <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/> |
19 | 19 | ||
20 | </resources> | 20 | </resources> | ... | ... |
-
Please register or login to post a comment