|
|
@@ -1,9 +1,13 @@
|
1
|
1
|
package ai.pai.client.fragments;
|
2
|
2
|
|
|
3
|
+import android.Manifest;
|
3
|
4
|
import android.content.Context;
|
4
|
5
|
import android.content.Intent;
|
|
6
|
+import android.content.pm.PackageManager;
|
5
|
7
|
import android.os.AsyncTask;
|
6
|
8
|
import android.os.Bundle;
|
|
9
|
+import android.support.v4.app.ActivityCompat;
|
|
10
|
+import android.support.v4.content.ContextCompat;
|
7
|
11
|
import android.support.v4.widget.SwipeRefreshLayout;
|
8
|
12
|
import android.support.v7.widget.DefaultItemAnimator;
|
9
|
13
|
import android.support.v7.widget.RecyclerView;
|
|
|
@@ -177,6 +181,7 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
|
177
|
181
|
Intent intent = new Intent(context, MyLocationService.class);
|
178
|
182
|
intent.putExtra("command",MyLocationService.COMMAND_START_LOCATION);
|
179
|
183
|
context.startService(intent);
|
|
184
|
+ checkLocationPermission();
|
180
|
185
|
}else{
|
181
|
186
|
Intent intent = new Intent(context, MyLocationService.class);
|
182
|
187
|
intent.putExtra("command",MyLocationService.COMMAND_DESTROY_LOCATION);
|
|
|
@@ -188,6 +193,14 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
|
188
|
193
|
|
189
|
194
|
}
|
190
|
195
|
|
|
196
|
+ private void checkLocationPermission(){
|
|
197
|
+ if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)
|
|
198
|
+ != PackageManager.PERMISSION_GRANTED) {
|
|
199
|
+ ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
|
|
200
|
+ 2001);
|
|
201
|
+ }
|
|
202
|
+ }
|
|
203
|
+
|
191
|
204
|
private void initBanner(){
|
192
|
205
|
if(TextUtils.isEmpty(images[0]) && TextUtils.isEmpty(images[1])){
|
193
|
206
|
banner.setVisibility(View.GONE);
|