Showing
11 changed files
with
519 additions
and
57 deletions
... | @@ -39,6 +39,8 @@ dependencies { | ... | @@ -39,6 +39,8 @@ dependencies { |
39 | compile 'com.squareup.picasso:picasso:2.5.2' | 39 | compile 'com.squareup.picasso:picasso:2.5.2' |
40 | compile 'com.google.firebase:firebase-messaging:11.0.2' | 40 | compile 'com.google.firebase:firebase-messaging:11.0.2' |
41 | compile 'com.google.android.gms:play-services-maps:11.0.2' | 41 | compile 'com.google.android.gms:play-services-maps:11.0.2' |
42 | + compile 'com.google.android.gms:play-services-location:11.0.2' | ||
43 | + compile 'com.google.android.gms:play-services-places:11.0.2' | ||
42 | testCompile 'junit:junit:4.12' | 44 | testCompile 'junit:junit:4.12' |
43 | } | 45 | } |
44 | 46 | ... | ... |
... | @@ -6,13 +6,11 @@ | ... | @@ -6,13 +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" /> | ||
10 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
11 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
12 | + <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> | ||
9 | 13 | ||
10 | - <!-- | ||
11 | - The ACCESS_COARSE/FINE_LOCATION permissions are not required to use | ||
12 | - Google Maps Android API v2, but you must specify either coarse or fine | ||
13 | - location permissions for the 'MyLocation' functionality. | ||
14 | - --> | ||
15 | - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | ||
16 | 14 | ||
17 | <application | 15 | <application |
18 | android:allowBackup="true" | 16 | android:allowBackup="true" | ... | ... |
... | @@ -9,39 +9,66 @@ public class Blog | ... | @@ -9,39 +9,66 @@ public class Blog |
9 | private String title; | 9 | private String title; |
10 | private String desc; | 10 | private String desc; |
11 | private String image; | 11 | private String image; |
12 | + private String nickname; | ||
12 | 13 | ||
13 | - public Blog(){ | 14 | + public Blog() |
15 | + { | ||
14 | 16 | ||
15 | } | 17 | } |
16 | 18 | ||
17 | - public Blog(String title, String desc, String image) { | 19 | + public Blog(String title, String desc, String image) |
20 | + { | ||
18 | this.title = title; | 21 | this.title = title; |
19 | this.desc = desc; | 22 | this.desc = desc; |
20 | this.image = image; | 23 | this.image = image; |
21 | } | 24 | } |
22 | 25 | ||
23 | - public String getDesc() { | 26 | + public Blog(String title, String desc, String image, String nickname) |
27 | + { | ||
28 | + this.title = title; | ||
29 | + this.desc = desc; | ||
30 | + this.image = image; | ||
31 | + this.nickname = nickname; | ||
32 | + } | ||
33 | + | ||
34 | + public String getDesc() | ||
35 | + { | ||
24 | return desc; | 36 | return desc; |
25 | } | 37 | } |
26 | 38 | ||
27 | - public void setDesc(String desc) { | 39 | + public void setDesc(String desc) |
40 | + { | ||
28 | this.desc = desc; | 41 | this.desc = desc; |
29 | } | 42 | } |
30 | 43 | ||
31 | - public String getImage() { | 44 | + public String getImage() |
45 | + { | ||
32 | return image; | 46 | return image; |
33 | } | 47 | } |
34 | 48 | ||
35 | - public void setImage(String image) { | 49 | + public void setImage(String image) |
50 | + { | ||
36 | this.image = image; | 51 | this.image = image; |
37 | } | 52 | } |
38 | 53 | ||
39 | - public String getTitle() { | 54 | + public String getTitle() |
55 | + { | ||
40 | return title; | 56 | return title; |
41 | } | 57 | } |
42 | 58 | ||
43 | - public void setTitle(String title) { | 59 | + public void setTitle(String title) |
60 | + { | ||
44 | this.title = title; | 61 | this.title = title; |
45 | } | 62 | } |
46 | 63 | ||
64 | + public String getNickname() | ||
65 | + { | ||
66 | + return nickname; | ||
67 | + } | ||
68 | + | ||
69 | + public void setNickname(String nickname) | ||
70 | + { | ||
71 | + this.nickname = nickname; | ||
72 | + } | ||
73 | + | ||
47 | } | 74 | } | ... | ... |
... | @@ -7,6 +7,7 @@ import android.support.annotation.Nullable; | ... | @@ -7,6 +7,7 @@ import android.support.annotation.Nullable; |
7 | import android.support.v4.app.Fragment; | 7 | import android.support.v4.app.Fragment; |
8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
9 | import android.support.v7.widget.RecyclerView; | 9 | import android.support.v7.widget.RecyclerView; |
10 | +import android.util.Log; | ||
10 | import android.view.LayoutInflater; | 11 | import android.view.LayoutInflater; |
11 | import android.view.Menu; | 12 | import android.view.Menu; |
12 | import android.view.MenuInflater; | 13 | import android.view.MenuInflater; |
... | @@ -21,8 +22,10 @@ import com.google.firebase.database.DatabaseReference; | ... | @@ -21,8 +22,10 @@ import com.google.firebase.database.DatabaseReference; |
21 | import com.google.firebase.database.FirebaseDatabase; | 22 | import com.google.firebase.database.FirebaseDatabase; |
22 | import com.squareup.picasso.Picasso; | 23 | import com.squareup.picasso.Picasso; |
23 | 24 | ||
25 | +import org.w3c.dom.Text; | ||
26 | + | ||
24 | /** | 27 | /** |
25 | - * Created by HYB on 2017. 10. 11.. | 28 | + * Created by HYB on 2017. 10 . 11.. |
26 | */ | 29 | */ |
27 | 30 | ||
28 | public class Community extends Fragment | 31 | public class Community extends Fragment |
... | @@ -37,14 +40,17 @@ public class Community extends Fragment | ... | @@ -37,14 +40,17 @@ public class Community extends Fragment |
37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) | 40 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) |
38 | { | 41 | { |
39 | setHasOptionsMenu(true); | 42 | setHasOptionsMenu(true); |
40 | - | 43 | + LinearLayoutManager lm = new LinearLayoutManager(getActivity()); |
41 | View view = inflater.inflate(R.layout.community, container, false); | 44 | View view = inflater.inflate(R.layout.community, container, false); |
42 | 45 | ||
43 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Blog"); | 46 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Blog"); |
44 | 47 | ||
48 | + lm.setReverseLayout(true); | ||
49 | + lm.setStackFromEnd(true); | ||
50 | + | ||
45 | mBlogList = (RecyclerView) view.findViewById(R.id.blog_list); | 51 | mBlogList = (RecyclerView) view.findViewById(R.id.blog_list); |
46 | mBlogList.setHasFixedSize(true); | 52 | mBlogList.setHasFixedSize(true); |
47 | - mBlogList.setLayoutManager(new LinearLayoutManager(getActivity())); | 53 | + mBlogList.setLayoutManager(lm); |
48 | 54 | ||
49 | return view; | 55 | return view; |
50 | } | 56 | } |
... | @@ -54,9 +60,8 @@ public class Community extends Fragment | ... | @@ -54,9 +60,8 @@ public class Community extends Fragment |
54 | { | 60 | { |
55 | super.onStart(); | 61 | super.onStart(); |
56 | 62 | ||
57 | - FirebaseRecyclerAdapter<Blog, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Blog, BlogViewHolder>( | 63 | + FirebaseRecyclerAdapter<Blog, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Blog, BlogViewHolder> |
58 | - | 64 | + ( Blog.class, R.layout.blog_row, BlogViewHolder.class, mDatabase) |
59 | - Blog.class, R.layout.blog_row, BlogViewHolder.class, mDatabase) | ||
60 | { | 65 | { |
61 | @Override | 66 | @Override |
62 | protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) | 67 | protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) |
... | @@ -64,6 +69,7 @@ public class Community extends Fragment | ... | @@ -64,6 +69,7 @@ public class Community extends Fragment |
64 | viewHolder.setTitle(model.getTitle()); | 69 | viewHolder.setTitle(model.getTitle()); |
65 | viewHolder.setDesc(model.getDesc()); | 70 | viewHolder.setDesc(model.getDesc()); |
66 | viewHolder.setImage(getActivity().getApplicationContext(), model.getImage()); | 71 | viewHolder.setImage(getActivity().getApplicationContext(), model.getImage()); |
72 | + viewHolder.setNickname(model.getNickname()); | ||
67 | } | 73 | } |
68 | }; | 74 | }; |
69 | mBlogList.setAdapter(firebaseRecyclerAdapter); | 75 | mBlogList.setAdapter(firebaseRecyclerAdapter); |
... | @@ -112,6 +118,12 @@ public class Community extends Fragment | ... | @@ -112,6 +118,12 @@ public class Community extends Fragment |
112 | Picasso.with(ctx).load(image).into(post_image); | 118 | Picasso.with(ctx).load(image).into(post_image); |
113 | 119 | ||
114 | } | 120 | } |
121 | + public void setNickname(String nickname) | ||
122 | + { | ||
123 | + TextView nick_title = (TextView)mView.findViewById(R.id.nick_Title); | ||
124 | + nick_title.setText(nickname); | ||
125 | + | ||
126 | + } | ||
115 | 127 | ||
116 | } | 128 | } |
117 | 129 | ... | ... |
1 | package com.example.user.firebaseauthdemo; | 1 | package com.example.user.firebaseauthdemo; |
2 | 2 | ||
3 | +import android.*; | ||
3 | import android.app.ProgressDialog; | 4 | import android.app.ProgressDialog; |
4 | import android.content.Intent; | 5 | import android.content.Intent; |
6 | +import android.content.pm.PackageManager; | ||
7 | +import android.os.Build; | ||
5 | import android.os.Bundle; | 8 | import android.os.Bundle; |
6 | import android.support.annotation.NonNull; | 9 | import android.support.annotation.NonNull; |
10 | +import android.support.v4.app.ActivityCompat; | ||
11 | +import android.support.v4.content.ContextCompat; | ||
7 | import android.support.v7.app.AppCompatActivity; | 12 | import android.support.v7.app.AppCompatActivity; |
8 | import android.text.TextUtils; | 13 | import android.text.TextUtils; |
14 | +import android.util.Log; | ||
9 | import android.view.View; | 15 | import android.view.View; |
10 | import android.widget.Button; | 16 | import android.widget.Button; |
11 | import android.widget.EditText; | 17 | import android.widget.EditText; |
... | @@ -27,6 +33,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -27,6 +33,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
27 | private EditText editTextEmail; | 33 | private EditText editTextEmail; |
28 | private EditText editTextPassword; | 34 | private EditText editTextPassword; |
29 | private TextView textViewSignIn; | 35 | private TextView textViewSignIn; |
36 | + public static final int REQUEST_LOCATION_CODE = 99; | ||
30 | 37 | ||
31 | private ProgressDialog progressDialog; | 38 | private ProgressDialog progressDialog; |
32 | 39 | ||
... | @@ -43,6 +50,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -43,6 +50,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
43 | firebaseAuth = FirebaseAuth.getInstance(); | 50 | firebaseAuth = FirebaseAuth.getInstance(); |
44 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Users"); | 51 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Users"); |
45 | 52 | ||
53 | + Log.d("", "퍼미션 체크전"); | ||
54 | + checkLocationPermission(); | ||
55 | + | ||
46 | if(firebaseAuth.getCurrentUser() != null){ | 56 | if(firebaseAuth.getCurrentUser() != null){ |
47 | //profile activity here | 57 | //profile activity here |
48 | finish(); | 58 | finish(); |
... | @@ -121,4 +131,34 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe | ... | @@ -121,4 +131,34 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe |
121 | startActivity(new Intent(this, LoginActivity.class)); | 131 | startActivity(new Intent(this, LoginActivity.class)); |
122 | } | 132 | } |
123 | } | 133 | } |
134 | + | ||
135 | + | ||
136 | + | ||
137 | + public boolean checkLocationPermission() | ||
138 | + { | ||
139 | + | ||
140 | + Log.d("", "퍼미션 체크안"); | ||
141 | + if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED) | ||
142 | + { | ||
143 | + Log.d("", "퍼미션 받음"); | ||
144 | + if(ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION)) | ||
145 | + { | ||
146 | + Log.d("", "리퀘ㅡ트 띠움"); | ||
147 | + ActivityCompat.requestPermissions(this, new String[] {android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_CODE); | ||
148 | + } | ||
149 | + else | ||
150 | + { | ||
151 | + Log.d("", "리퀘ㅡ트 띠움"); | ||
152 | + ActivityCompat.requestPermissions(this, new String[] {android.Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_CODE); | ||
153 | + | ||
154 | + } | ||
155 | + return false; | ||
156 | + } | ||
157 | + else | ||
158 | + { | ||
159 | + return true; | ||
160 | + } | ||
161 | + | ||
162 | + } | ||
163 | + | ||
124 | } | 164 | } | ... | ... |
1 | package com.example.user.firebaseauthdemo; | 1 | package com.example.user.firebaseauthdemo; |
2 | 2 | ||
3 | +import android.content.Context; | ||
4 | +import android.content.DialogInterface; | ||
5 | +import android.content.Intent; | ||
6 | +import android.content.pm.PackageManager; | ||
7 | +import android.location.Location; | ||
8 | +import android.location.LocationListener; | ||
9 | +import android.location.LocationManager; | ||
10 | +import android.os.Build; | ||
3 | import android.os.Bundle; | 11 | import android.os.Bundle; |
12 | +import android.provider.Settings; | ||
13 | +import android.support.annotation.NonNull; | ||
4 | import android.support.annotation.Nullable; | 14 | import android.support.annotation.Nullable; |
15 | +import android.support.v4.app.ActivityCompat; | ||
5 | import android.support.v4.app.Fragment; | 16 | import android.support.v4.app.Fragment; |
17 | +import android.support.v4.content.ContextCompat; | ||
18 | +import android.support.v7.app.AlertDialog; | ||
19 | +import android.util.Log; | ||
6 | import android.view.LayoutInflater; | 20 | import android.view.LayoutInflater; |
7 | import android.view.View; | 21 | import android.view.View; |
8 | import android.view.ViewGroup; | 22 | import android.view.ViewGroup; |
9 | 23 | ||
24 | +import com.google.android.gms.common.ConnectionResult; | ||
25 | +import com.google.android.gms.common.api.GoogleApi; | ||
26 | +import com.google.android.gms.common.api.GoogleApiClient; | ||
27 | +import com.google.android.gms.common.api.PendingResult; | ||
28 | +import com.google.android.gms.common.api.ResultCallback; | ||
29 | +import com.google.android.gms.common.api.Status; | ||
30 | +import com.google.android.gms.location.LocationRequest; | ||
31 | +import com.google.android.gms.location.LocationServices; | ||
32 | +import com.google.android.gms.location.places.Place; | ||
33 | +import com.google.android.gms.location.places.PlaceLikelihood; | ||
34 | +import com.google.android.gms.location.places.PlaceLikelihoodBuffer; | ||
35 | +import com.google.android.gms.location.places.Places; | ||
36 | +import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment; | ||
37 | +import com.google.android.gms.location.places.ui.PlaceSelectionListener; | ||
10 | import com.google.android.gms.maps.CameraUpdateFactory; | 38 | import com.google.android.gms.maps.CameraUpdateFactory; |
11 | import com.google.android.gms.maps.GoogleMap; | 39 | import com.google.android.gms.maps.GoogleMap; |
12 | import com.google.android.gms.maps.MapView; | 40 | import com.google.android.gms.maps.MapView; |
41 | +import com.google.android.gms.maps.MapsInitializer; | ||
13 | import com.google.android.gms.maps.OnMapReadyCallback; | 42 | import com.google.android.gms.maps.OnMapReadyCallback; |
43 | +import com.google.android.gms.maps.model.BitmapDescriptorFactory; | ||
14 | import com.google.android.gms.maps.model.LatLng; | 44 | import com.google.android.gms.maps.model.LatLng; |
45 | +import com.google.android.gms.maps.model.Marker; | ||
15 | import com.google.android.gms.maps.model.MarkerOptions; | 46 | import com.google.android.gms.maps.model.MarkerOptions; |
16 | 47 | ||
17 | /** | 48 | /** |
18 | * Created by HYB on 2017. 10. 11.. | 49 | * Created by HYB on 2017. 10. 11.. |
19 | */ | 50 | */ |
20 | 51 | ||
21 | -public class Map extends Fragment implements OnMapReadyCallback | 52 | +public class Map extends Fragment |
53 | + implements OnMapReadyCallback , | ||
54 | + GoogleApiClient.ConnectionCallbacks, | ||
55 | + GoogleApiClient.OnConnectionFailedListener, | ||
56 | + LocationListener | ||
22 | { | 57 | { |
58 | + | ||
59 | + private static final LatLng DEFAULT_LOCATION = new LatLng(37.56, 126.97); | ||
60 | + private static final String TAG = "googlemap_example"; | ||
61 | + private static final int GPS_ENABLE_REQUEST_CODE = 2001; | ||
62 | + private static final int PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 2002; | ||
63 | + private static final int UPDATE_INTERVAL_MS = 15000; | ||
64 | + private static final int FASTEST_UPDATE_INTERVAL_MS = 15000; | ||
65 | + | ||
66 | + private GoogleMap googleMap = null; | ||
23 | private MapView mapView = null; | 67 | private MapView mapView = null; |
68 | + private GoogleApiClient googleApiClient = null; | ||
69 | + private Marker currentMarker = null; | ||
70 | + | ||
71 | + private final static int MAXENTRIES = 5; | ||
72 | + private String[] LikelyPlaceNames = null; | ||
73 | + private String[] LikelyAddresses = null; | ||
74 | + private String[] LikelyAttributions = null; | ||
75 | + private LatLng[] LikelyLatLngs = null; | ||
76 | + | ||
77 | + public Map() | ||
78 | + { | ||
79 | + | ||
80 | + } | ||
81 | + | ||
82 | + public void setCurrentLocation(Location location, String markerTitle, String markerSnippet) { | ||
83 | + if ( currentMarker != null ) currentMarker.remove(); | ||
84 | + | ||
85 | + if ( location != null) { | ||
86 | + //현재위치의 위도 경도 가져옴 | ||
87 | + LatLng currentLocation = new LatLng( location.getLatitude(), location.getLongitude()); | ||
88 | + | ||
89 | + MarkerOptions markerOptions = new MarkerOptions(); | ||
90 | + markerOptions.position(currentLocation); | ||
91 | + markerOptions.title(markerTitle); | ||
92 | + markerOptions.snippet(markerSnippet); | ||
93 | + markerOptions.draggable(true); | ||
94 | + markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); | ||
95 | + currentMarker = this.googleMap.addMarker(markerOptions); | ||
96 | + | ||
97 | + this.googleMap.moveCamera(CameraUpdateFactory.newLatLng(currentLocation)); | ||
98 | + return; | ||
99 | + } | ||
100 | + | ||
101 | + MarkerOptions markerOptions = new MarkerOptions(); | ||
102 | + markerOptions.position(DEFAULT_LOCATION); | ||
103 | + markerOptions.title(markerTitle); | ||
104 | + markerOptions.snippet(markerSnippet); | ||
105 | + markerOptions.draggable(true); | ||
106 | + markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); | ||
107 | + currentMarker = this.googleMap.addMarker(markerOptions); | ||
108 | + | ||
109 | + this.googleMap.moveCamera(CameraUpdateFactory.newLatLng(DEFAULT_LOCATION)); | ||
110 | + } | ||
24 | 111 | ||
25 | @Override | 112 | @Override |
26 | - public void onCreate(@Nullable Bundle savedInstanceState) { | 113 | + public void onCreate(@Nullable Bundle savedInstanceState) |
114 | + { | ||
27 | super.onCreate(savedInstanceState); | 115 | super.onCreate(savedInstanceState); |
28 | } | 116 | } |
29 | 117 | ||
30 | @Nullable | 118 | @Nullable |
31 | @Override | 119 | @Override |
32 | - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 120 | + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) |
121 | + { | ||
33 | View layout = inflater.inflate(R.layout.map, container, false); | 122 | View layout = inflater.inflate(R.layout.map, container, false); |
34 | 123 | ||
35 | mapView = (MapView)layout.findViewById(R.id.mapView); | 124 | mapView = (MapView)layout.findViewById(R.id.mapView); |
36 | mapView.getMapAsync(this); | 125 | mapView.getMapAsync(this); |
37 | 126 | ||
127 | + PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) | ||
128 | + getActivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); | ||
129 | + autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { | ||
130 | + @Override | ||
131 | + public void onPlaceSelected(Place place) { | ||
132 | + Location location = new Location(""); | ||
133 | + location.setLatitude(place.getLatLng().latitude); | ||
134 | + location.setLongitude(place.getLatLng().longitude); | ||
135 | + | ||
136 | + setCurrentLocation(location, place.getName().toString(), place.getAddress().toString()); | ||
137 | + } | ||
138 | + | ||
139 | + @Override | ||
140 | + public void onError(Status status) { | ||
141 | + Log.i(TAG, "An error occurred: " + status); | ||
142 | + } | ||
143 | + }); | ||
144 | + | ||
38 | return layout; | 145 | return layout; |
39 | } | 146 | } |
40 | 147 | ||
41 | @Override | 148 | @Override |
42 | - public void onStart() { | 149 | + public void onStart() |
150 | + { | ||
43 | super.onStart(); | 151 | super.onStart(); |
44 | mapView.onStart(); | 152 | mapView.onStart(); |
45 | } | 153 | } |
46 | 154 | ||
47 | @Override | 155 | @Override |
48 | - public void onStop() { | 156 | + public void onStop() |
157 | + { | ||
49 | super.onStop(); | 158 | super.onStop(); |
50 | mapView.onStop(); | 159 | mapView.onStop(); |
160 | + | ||
161 | + if ( googleApiClient != null && googleApiClient.isConnected()) | ||
162 | + googleApiClient.disconnect(); | ||
51 | } | 163 | } |
52 | 164 | ||
53 | @Override | 165 | @Override |
54 | - public void onSaveInstanceState(Bundle outState) { | 166 | + public void onSaveInstanceState(Bundle outState) |
167 | + { | ||
55 | super.onSaveInstanceState(outState); | 168 | super.onSaveInstanceState(outState); |
56 | mapView.onSaveInstanceState(outState); | 169 | mapView.onSaveInstanceState(outState); |
57 | } | 170 | } |
58 | 171 | ||
59 | @Override | 172 | @Override |
60 | - public void onResume() { | 173 | + public void onResume() |
174 | + { | ||
61 | super.onResume(); | 175 | super.onResume(); |
62 | mapView.onResume(); | 176 | mapView.onResume(); |
177 | + | ||
178 | + if ( googleApiClient != null) | ||
179 | + googleApiClient.connect(); | ||
63 | } | 180 | } |
64 | 181 | ||
65 | @Override | 182 | @Override |
66 | - public void onPause() { | 183 | + public void onPause() |
184 | + { | ||
67 | super.onPause(); | 185 | super.onPause(); |
68 | mapView.onPause(); | 186 | mapView.onPause(); |
187 | + | ||
188 | + if ( googleApiClient != null && googleApiClient.isConnected()) { | ||
189 | + LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, (com.google.android.gms.location.LocationListener) this); | ||
190 | + googleApiClient.disconnect(); | ||
191 | + } | ||
69 | } | 192 | } |
70 | 193 | ||
71 | @Override | 194 | @Override |
72 | - public void onLowMemory() { | 195 | + public void onLowMemory() |
196 | + { | ||
73 | super.onLowMemory(); | 197 | super.onLowMemory(); |
74 | mapView.onLowMemory(); | 198 | mapView.onLowMemory(); |
75 | } | 199 | } |
76 | 200 | ||
77 | @Override | 201 | @Override |
78 | - public void onDestroy() { | 202 | + public void onDestroy() |
203 | + { | ||
79 | super.onDestroy(); | 204 | super.onDestroy(); |
80 | mapView.onLowMemory(); | 205 | mapView.onLowMemory(); |
206 | + | ||
207 | + if ( googleApiClient != null ) { | ||
208 | + googleApiClient.unregisterConnectionCallbacks(this); | ||
209 | + googleApiClient.unregisterConnectionFailedListener(this); | ||
210 | + | ||
211 | + if ( googleApiClient.isConnected()) { | ||
212 | + LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, (com.google.android.gms.location.LocationListener) this); | ||
213 | + googleApiClient.disconnect(); | ||
214 | + } | ||
215 | + } | ||
81 | } | 216 | } |
82 | 217 | ||
83 | @Override | 218 | @Override |
84 | - public void onActivityCreated(@Nullable Bundle savedInstanceState) { | 219 | + public void onActivityCreated(@Nullable Bundle savedInstanceState) |
220 | + { | ||
85 | super.onActivityCreated(savedInstanceState); | 221 | super.onActivityCreated(savedInstanceState); |
86 | 222 | ||
87 | //액티비티가 처음 생성될 때 실행되는 함수 | 223 | //액티비티가 처음 생성될 때 실행되는 함수 |
224 | + MapsInitializer.initialize(getActivity().getApplicationContext()); | ||
88 | 225 | ||
89 | - if(mapView != null) | 226 | + if (mapView != null) |
90 | { | 227 | { |
91 | mapView.onCreate(savedInstanceState); | 228 | mapView.onCreate(savedInstanceState); |
92 | } | 229 | } |
93 | } | 230 | } |
94 | 231 | ||
95 | @Override | 232 | @Override |
96 | - public void onMapReady(GoogleMap googleMap) { | 233 | + public void onMapReady(GoogleMap googleMap) |
97 | - LatLng SEOUL = new LatLng(37.56, 126.97); | 234 | + { |
98 | - MarkerOptions markerOptions = new MarkerOptions(); | 235 | +// |
99 | - markerOptions.position(SEOUL); | 236 | +// LatLng SEOUL = new LatLng(37.56, 126.97); |
100 | - markerOptions.title("서울"); | 237 | +// MarkerOptions markerOptions = new MarkerOptions(); |
101 | - markerOptions.snippet("수도"); | 238 | +// markerOptions.position(SEOUL); |
102 | - googleMap.addMarker(markerOptions); | 239 | +// markerOptions.title("서울"); |
103 | - googleMap.moveCamera(CameraUpdateFactory.newLatLng(SEOUL)); | 240 | +// markerOptions.snippet("수도"); |
104 | - googleMap.animateCamera(CameraUpdateFactory.zoomTo(13)); | 241 | +// googleMap.addMarker(markerOptions); |
242 | +// googleMap.moveCamera(CameraUpdateFactory.newLatLng(SEOUL)); | ||
243 | +// googleMap.animateCamera(CameraUpdateFactory.zoomTo(13)); | ||
244 | + | ||
245 | + | ||
246 | + // OnMapReadyCallback implements 해야 mapView.getMapAsync(this); 사용가능. this 가 OnMapReadyCallback | ||
247 | + | ||
248 | + this.googleMap = googleMap; | ||
249 | + | ||
250 | + //런타임 퍼미션 요청 대화상자나 GPS 활성 요청 대화상자 보이기전에 지도의 초기위치를 서울로 이동 | ||
251 | + setCurrentLocation(null, "위치정보 가져올 수 없음", "위치 퍼미션과 GPS 활성 여부 확인"); | ||
252 | + | ||
253 | + //나침반이 나타나도록 설정 | ||
254 | + googleMap.getUiSettings().setCompassEnabled(true); | ||
255 | + // 매끄럽게 이동함 | ||
256 | + googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); | ||
257 | + | ||
258 | + // API 23 이상이면 런타임 퍼미션 처리 필요 | ||
259 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
260 | + // 사용권한체크 | ||
261 | + int hasFineLocationPermission = ContextCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION); | ||
262 | + | ||
263 | + if ( hasFineLocationPermission == PackageManager.PERMISSION_DENIED) { | ||
264 | + //사용권한이 없을경우 | ||
265 | + //권한 재요청 | ||
266 | + ActivityCompat.requestPermissions(getActivity(), new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION); | ||
267 | + } else { | ||
268 | + //사용권한이 있는경우 | ||
269 | + if ( googleApiClient == null) { | ||
270 | + buildGoogleApiClient(); | ||
271 | + } | ||
272 | + | ||
273 | + if ( ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) | ||
274 | + { | ||
275 | + googleMap.setMyLocationEnabled(true); | ||
276 | + } | ||
277 | + } | ||
278 | + } else { | ||
279 | + | ||
280 | + if ( googleApiClient == null) { | ||
281 | + buildGoogleApiClient(); | ||
282 | + } | ||
283 | + | ||
284 | + googleMap.setMyLocationEnabled(true); | ||
285 | + } | ||
286 | + | ||
287 | + | ||
105 | } | 288 | } |
106 | 289 | ||
290 | + private void buildGoogleApiClient() | ||
291 | + { | ||
292 | + googleApiClient = new GoogleApiClient.Builder(getActivity()) | ||
293 | + .addConnectionCallbacks(this) | ||
294 | + .addOnConnectionFailedListener(this) | ||
295 | + .addApi(LocationServices.API) | ||
296 | + .addApi(Places.GEO_DATA_API) | ||
297 | + .addApi(Places.PLACE_DETECTION_API) | ||
298 | + .enableAutoManage(getActivity(), this) | ||
299 | + .build(); | ||
300 | + googleApiClient.connect(); | ||
301 | + } | ||
302 | + | ||
303 | + public boolean checkLocationServicesStatus() { | ||
304 | + LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); | ||
305 | + | ||
306 | + return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || | ||
307 | + locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); | ||
308 | + } | ||
309 | + @Override | ||
310 | + public void onLocationChanged(Location location) | ||
311 | + { | ||
312 | + Log.i(TAG, "onLocationChanged call.."); | ||
313 | + searchCurrentPlaces(); | ||
314 | + } | ||
315 | + | ||
316 | + private void searchCurrentPlaces() | ||
317 | + { | ||
318 | + | ||
319 | + @SuppressWarnings("MissingPermission") PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi | ||
320 | + .getCurrentPlace(googleApiClient, null); | ||
321 | + result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>(){ | ||
322 | + | ||
323 | + @Override | ||
324 | + public void onResult(@NonNull PlaceLikelihoodBuffer placeLikelihoods) { | ||
325 | + int i = 0; | ||
326 | + LikelyPlaceNames = new String[MAXENTRIES]; | ||
327 | + LikelyAddresses = new String[MAXENTRIES]; | ||
328 | + LikelyAttributions = new String[MAXENTRIES]; | ||
329 | + LikelyLatLngs = new LatLng[MAXENTRIES]; | ||
330 | + | ||
331 | + for(PlaceLikelihood placeLikelihood : placeLikelihoods) { | ||
332 | + LikelyPlaceNames[i] = (String) placeLikelihood.getPlace().getName(); | ||
333 | + LikelyAddresses[i] = (String) placeLikelihood.getPlace().getAddress(); | ||
334 | + LikelyAttributions[i] = (String) placeLikelihood.getPlace().getAttributions(); | ||
335 | + LikelyLatLngs[i] = placeLikelihood.getPlace().getLatLng(); | ||
336 | + | ||
337 | + i++; | ||
338 | + if(i > MAXENTRIES - 1 ) { | ||
339 | + break; | ||
340 | + } | ||
341 | + } | ||
342 | + | ||
343 | + placeLikelihoods.release(); | ||
344 | + | ||
345 | + Location location = new Location(""); | ||
346 | + location.setLatitude(LikelyLatLngs[0].latitude); | ||
347 | + location.setLongitude(LikelyLatLngs[0].longitude); | ||
348 | + | ||
349 | + setCurrentLocation(location, LikelyPlaceNames[0], LikelyAddresses[0]); | ||
350 | + } | ||
351 | + }); | ||
352 | + | ||
353 | + } | ||
354 | + | ||
355 | + @Override | ||
356 | + public void onStatusChanged(String provider, int status, Bundle extras) | ||
357 | + { | ||
358 | + | ||
359 | + } | ||
360 | + | ||
361 | + @Override | ||
362 | + public void onProviderEnabled(String provider) | ||
363 | + { | ||
364 | + | ||
365 | + } | ||
366 | + | ||
367 | + @Override | ||
368 | + public void onProviderDisabled(String provider) | ||
369 | + { | ||
370 | + | ||
371 | + } | ||
372 | + | ||
373 | + @Override | ||
374 | + public void onConnected(@Nullable Bundle bundle) | ||
375 | + { | ||
376 | + | ||
377 | + if ( !checkLocationServicesStatus()) { | ||
378 | + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | ||
379 | + builder.setTitle("위치 서비스 비활성화"); | ||
380 | + builder.setMessage("앱을 사용하기 위해서는 위치 서비스가 필요합니다.\n" + | ||
381 | + "위치 설정을 수정하십시오."); | ||
382 | + builder.setCancelable(true); | ||
383 | + builder.setPositiveButton("설정", new DialogInterface.OnClickListener() { | ||
384 | + @Override | ||
385 | + public void onClick(DialogInterface dialogInterface, int i) { | ||
386 | + Intent callGPSSettingIntent = | ||
387 | + new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
388 | + startActivityForResult(callGPSSettingIntent, GPS_ENABLE_REQUEST_CODE); | ||
389 | + } | ||
390 | + }); | ||
391 | + builder.setNegativeButton("취소", new DialogInterface.OnClickListener(){ | ||
392 | + @Override | ||
393 | + public void onClick(DialogInterface dialogInterface, int i) { | ||
394 | + dialogInterface.cancel(); | ||
395 | + } | ||
396 | + }); | ||
397 | + builder.create().show(); | ||
398 | + } | ||
399 | + | ||
400 | + LocationRequest locationRequest = new LocationRequest(); | ||
401 | + locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); | ||
402 | + locationRequest.setInterval(UPDATE_INTERVAL_MS); | ||
403 | + locationRequest.setFastestInterval(FASTEST_UPDATE_INTERVAL_MS); | ||
404 | + | ||
405 | + if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
406 | + if ( ActivityCompat.checkSelfPermission(getActivity(), | ||
407 | + android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { | ||
408 | + | ||
409 | + LocationServices.FusedLocationApi | ||
410 | + .requestLocationUpdates(googleApiClient, locationRequest, (com.google.android.gms.location.LocationListener) this); | ||
411 | + } | ||
412 | + } else { | ||
413 | + LocationServices.FusedLocationApi | ||
414 | + .requestLocationUpdates(googleApiClient, locationRequest, (com.google.android.gms.location.LocationListener) this); | ||
415 | + | ||
416 | + this.googleMap.getUiSettings().setCompassEnabled(true); | ||
417 | + this.googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); | ||
418 | + } | ||
419 | + | ||
420 | + } | ||
421 | + | ||
422 | + @Override | ||
423 | + public void onConnectionSuspended(int i) | ||
424 | + { | ||
425 | + if ( i == CAUSE_NETWORK_LOST ) | ||
426 | + Log.e(TAG, "onConnectionSuspended(): Google Play services " + | ||
427 | + "connection lost. Cause: network lost."); | ||
428 | + else if (i == CAUSE_SERVICE_DISCONNECTED ) | ||
429 | + Log.e(TAG,"onConnectionSuspended(): Google Play services " + | ||
430 | + "connection lost. Cause: service disconnected"); | ||
431 | + | ||
432 | + } | ||
433 | + | ||
434 | + @Override | ||
435 | + public void onConnectionFailed(@NonNull ConnectionResult connectionResult) | ||
436 | + { | ||
437 | + Location location = new Location(""); | ||
438 | + location.setLatitude(DEFAULT_LOCATION.latitude); | ||
439 | + location.setLongitude((DEFAULT_LOCATION.longitude)); | ||
440 | + | ||
441 | + setCurrentLocation(location, "위치정보 가져올 수 없음", | ||
442 | + "위치 퍼미션과 GPS활성 여부 확인"); | ||
443 | + } | ||
107 | } | 444 | } | ... | ... |
... | @@ -37,7 +37,15 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService | ... | @@ -37,7 +37,15 @@ public class MyFirebaseMessagingService extends FirebaseMessagingService |
37 | PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); | 37 | PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); |
38 | 38 | ||
39 | Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); | 39 | Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); |
40 | - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.common_google_signin_btn_icon_dark).setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)).setContentTitle("Push Title ").setContentText(message).setAutoCancel(true).setSound(defaultSoundUri).setLights(000000255, 500, 2000).setContentIntent(pendingIntent); | 40 | + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) |
41 | + .setSmallIcon(R.drawable.common_google_signin_btn_icon_dark) | ||
42 | + .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) | ||
43 | + .setContentTitle("Admin") | ||
44 | + .setContentText(message) | ||
45 | + .setAutoCancel(true) | ||
46 | + .setSound(defaultSoundUri) | ||
47 | + .setLights(000000255, 500, 2000) | ||
48 | + .setContentIntent(pendingIntent); | ||
41 | 49 | ||
42 | NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | 50 | NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); |
43 | 51 | ... | ... |
... | @@ -20,6 +20,7 @@ import android.widget.Toast; | ... | @@ -20,6 +20,7 @@ import android.widget.Toast; |
20 | import com.google.android.gms.tasks.OnSuccessListener; | 20 | import com.google.android.gms.tasks.OnSuccessListener; |
21 | import com.google.firebase.auth.FirebaseAuth; | 21 | import com.google.firebase.auth.FirebaseAuth; |
22 | import com.google.firebase.auth.FirebaseUser; | 22 | import com.google.firebase.auth.FirebaseUser; |
23 | +import com.google.firebase.auth.UserInfo; | ||
23 | import com.google.firebase.database.DatabaseReference; | 24 | import com.google.firebase.database.DatabaseReference; |
24 | import com.google.firebase.database.FirebaseDatabase; | 25 | import com.google.firebase.database.FirebaseDatabase; |
25 | import com.google.firebase.storage.FirebaseStorage; | 26 | import com.google.firebase.storage.FirebaseStorage; |
... | @@ -78,7 +79,6 @@ public class PostActivity extends AppCompatActivity { | ... | @@ -78,7 +79,6 @@ public class PostActivity extends AppCompatActivity { |
78 | startActivityForResult(gallaryIntent, GALLARY_REQUEST); | 79 | startActivityForResult(gallaryIntent, GALLARY_REQUEST); |
79 | } | 80 | } |
80 | }); | 81 | }); |
81 | - | ||
82 | mSubmitBtn.setOnClickListener(new View.OnClickListener() { | 82 | mSubmitBtn.setOnClickListener(new View.OnClickListener() { |
83 | @Override | 83 | @Override |
84 | public void onClick(View view) { | 84 | public void onClick(View view) { |
... | @@ -105,6 +105,7 @@ public class PostActivity extends AppCompatActivity { | ... | @@ -105,6 +105,7 @@ public class PostActivity extends AppCompatActivity { |
105 | newPost.child("title").setValue(title_val); | 105 | newPost.child("title").setValue(title_val); |
106 | newPost.child("desc").setValue(desc_val); | 106 | newPost.child("desc").setValue(desc_val); |
107 | newPost.child("uid").setValue(mCurrentUser.getUid()); | 107 | newPost.child("uid").setValue(mCurrentUser.getUid()); |
108 | + newPost.child("nickname").setValue(mCurrentUser.getDisplayName()); | ||
108 | 109 | ||
109 | mProgress.dismiss(); | 110 | mProgress.dismiss(); |
110 | } | 111 | } |
... | @@ -123,6 +124,7 @@ public class PostActivity extends AppCompatActivity { | ... | @@ -123,6 +124,7 @@ public class PostActivity extends AppCompatActivity { |
123 | newPost.child("desc").setValue(desc_val); | 124 | newPost.child("desc").setValue(desc_val); |
124 | newPost.child("image").setValue(downloadUrl.toString()); | 125 | newPost.child("image").setValue(downloadUrl.toString()); |
125 | newPost.child("uid").setValue(mCurrentUser.getUid()); | 126 | newPost.child("uid").setValue(mCurrentUser.getUid()); |
127 | + newPost.child("nickname").setValue(mCurrentUser.getDisplayName()); | ||
126 | 128 | ||
127 | mProgress.dismiss(); | 129 | mProgress.dismiss(); |
128 | 130 | ||
... | @@ -130,9 +132,6 @@ public class PostActivity extends AppCompatActivity { | ... | @@ -130,9 +132,6 @@ public class PostActivity extends AppCompatActivity { |
130 | } | 132 | } |
131 | }); | 133 | }); |
132 | } | 134 | } |
133 | - android.support.v4.app.FragmentManager fm = getSupportFragmentManager(); | ||
134 | - android.support.v4.app.FragmentTransaction ft = fm.beginTransaction(); | ||
135 | - | ||
136 | finish(); | 135 | finish(); |
137 | Toast.makeText(PostActivity.this, "Success!", Toast.LENGTH_LONG).show(); | 136 | Toast.makeText(PostActivity.this, "Success!", Toast.LENGTH_LONG).show(); |
138 | 137 | ... | ... |
... | @@ -17,14 +17,14 @@ | ... | @@ -17,14 +17,14 @@ |
17 | <ImageButton | 17 | <ImageButton |
18 | android:id="@+id/imageSelect" | 18 | android:id="@+id/imageSelect" |
19 | android:layout_width="match_parent" | 19 | android:layout_width="match_parent" |
20 | - android:layout_height="204dp" | 20 | + android:layout_height="match_parent" |
21 | - app:srcCompat="@mipmap/add_btn" | 21 | + android:layout_weight="0.05" |
22 | - android:layout_weight="0.05" /> | 22 | + app:srcCompat="@mipmap/add_btn"/> |
23 | 23 | ||
24 | <EditText | 24 | <EditText |
25 | android:id="@+id/titleField" | 25 | android:id="@+id/titleField" |
26 | android:layout_width="match_parent" | 26 | android:layout_width="match_parent" |
27 | - android:layout_height="45dp" | 27 | + android:layout_height="match_parent" |
28 | android:layout_gravity="center_horizontal" | 28 | android:layout_gravity="center_horizontal" |
29 | android:layout_margin="15dp" | 29 | android:layout_margin="15dp" |
30 | android:background="@drawable/input_outline" | 30 | android:background="@drawable/input_outline" |
... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
33 | android:inputType="textPersonName" | 33 | android:inputType="textPersonName" |
34 | android:singleLine="true" | 34 | android:singleLine="true" |
35 | tools:layout_editor_absoluteX="0dp" | 35 | tools:layout_editor_absoluteX="0dp" |
36 | - tools:layout_editor_absoluteY="0dp" /> | 36 | + tools:layout_editor_absoluteY="0dp"/> |
37 | 37 | ||
38 | <EditText | 38 | <EditText |
39 | android:id="@+id/descField" | 39 | android:id="@+id/descField" |
... | @@ -43,7 +43,7 @@ | ... | @@ -43,7 +43,7 @@ |
43 | android:background="@drawable/input_outline" | 43 | android:background="@drawable/input_outline" |
44 | android:ems="10" | 44 | android:ems="10" |
45 | android:hint=" Post Descriptions..." | 45 | android:hint=" Post Descriptions..." |
46 | - android:inputType="textMultiLine" /> | 46 | + android:inputType="textMultiLine"/> |
47 | 47 | ||
48 | <Button | 48 | <Button |
49 | android:id="@+id/submitBtn" | 49 | android:id="@+id/submitBtn" | ... | ... |
... | @@ -19,12 +19,28 @@ | ... | @@ -19,12 +19,28 @@ |
19 | android:scaleType="centerCrop" | 19 | android:scaleType="centerCrop" |
20 | app:srcCompat="@mipmap/add_btn" /> | 20 | app:srcCompat="@mipmap/add_btn" /> |
21 | 21 | ||
22 | + <LinearLayout | ||
23 | + android:layout_width="match_parent" | ||
24 | + android:layout_height="match_parent" | ||
25 | + android:orientation="horizontal"> | ||
26 | + | ||
22 | <TextView | 27 | <TextView |
23 | android:id="@+id/post_title" | 28 | android:id="@+id/post_title" |
24 | android:layout_width="match_parent" | 29 | android:layout_width="match_parent" |
25 | android:layout_height="wrap_content" | 30 | android:layout_height="wrap_content" |
31 | + android:layout_weight="1" | ||
32 | + android:padding="15dp" | ||
33 | + android:text="post title in here"/> | ||
34 | + | ||
35 | + <TextView | ||
36 | + android:id="@+id/nick_Title" | ||
37 | + android:gravity="right" | ||
38 | + android:layout_width="110dp" | ||
39 | + android:layout_height="wrap_content" | ||
26 | android:padding="15dp" | 40 | android:padding="15dp" |
27 | - android:text="post title in here" /> | 41 | + android:text="Nickname" |
42 | + /> | ||
43 | + </LinearLayout> | ||
28 | 44 | ||
29 | <TextView | 45 | <TextView |
30 | android:id="@+id/post_desc" | 46 | android:id="@+id/post_desc" |
... | @@ -33,6 +49,8 @@ | ... | @@ -33,6 +49,8 @@ |
33 | android:padding="10dp" | 49 | android:padding="10dp" |
34 | android:paddingLeft="5dp" | 50 | android:paddingLeft="5dp" |
35 | android:paddingRight="5dp" | 51 | android:paddingRight="5dp" |
36 | - android:text="post description" /> | 52 | + android:text="post description"/> |
53 | + | ||
37 | </LinearLayout> | 54 | </LinearLayout> |
55 | + | ||
38 | </android.support.v7.widget.CardView> | 56 | </android.support.v7.widget.CardView> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 | + xmlns:card_view="http://schemas.android.com/apk/res-auto" | ||
3 | android:orientation="vertical" android:layout_width="match_parent" | 4 | android:orientation="vertical" android:layout_width="match_parent" |
4 | - android:layout_height="match_parent"> | 5 | + android:layout_height="match_parent" |
6 | + android:weightSum="1"> | ||
5 | <TextView | 7 | <TextView |
6 | android:id="@+id/map" | 8 | android:id="@+id/map" |
7 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
8 | - android:layout_height="wrap_content" | 10 | + android:layout_height="82dp" |
9 | android:layout_centerHorizontal="true" | 11 | android:layout_centerHorizontal="true" |
10 | android:text="Terror inform is displayed in here." | 12 | android:text="Terror inform is displayed in here." |
11 | android:textAppearance="@style/TextAppearance.AppCompat.Headline" /> | 13 | android:textAppearance="@style/TextAppearance.AppCompat.Headline" /> |
... | @@ -13,6 +15,25 @@ | ... | @@ -13,6 +15,25 @@ |
13 | <com.google.android.gms.maps.MapView | 15 | <com.google.android.gms.maps.MapView |
14 | android:id="@+id/mapView" | 16 | android:id="@+id/mapView" |
15 | android:layout_width="match_parent" | 17 | android:layout_width="match_parent" |
16 | - android:layout_height="match_parent"/> | 18 | + android:layout_height="250dp" |
19 | + android:layout_weight="0.93"/> | ||
20 | + | ||
21 | + <android.support.v7.widget.CardView | ||
22 | + android:name="@+id/card_view" | ||
23 | + android:layout_width="400dp" | ||
24 | + android:layout_height="40dp" | ||
25 | + android:layout_gravity="center" | ||
26 | + card_view:cardCornerRadius="4dp" | ||
27 | + > | ||
28 | + | ||
29 | + <fragment | ||
30 | + android:id="@+id/place_autocomplete_fragment" | ||
31 | + android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" | ||
32 | + android:layout_width="match_parent" | ||
33 | + android:layout_height="wrap_content" | ||
34 | + > | ||
35 | + </fragment> | ||
36 | + | ||
37 | + </android.support.v7.widget.CardView> | ||
17 | 38 | ||
18 | </LinearLayout> | 39 | </LinearLayout> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment