1
1
package de .hauke_stieler .geonotes .map ;
2
2
3
- import android .content .ContentResolver ;
4
3
import android .content .Context ;
5
4
import android .content .Intent ;
6
- import android .database .Cursor ;
7
- import android .graphics .Bitmap ;
8
- import android .graphics .BitmapFactory ;
9
- import android .media .ThumbnailUtils ;
10
- import android .net .Uri ;
11
- import android .provider .MediaStore ;
12
5
import android .text .Editable ;
13
6
import android .text .Html ;
14
7
import android .text .Spanned ;
15
8
import android .text .TextWatcher ;
16
9
import android .text .format .DateFormat ;
17
10
import android .util .Log ;
18
- import android .util .Size ;
19
11
import android .view .MotionEvent ;
20
12
import android .view .View ;
21
13
import android .view .ViewGroup ;
26
18
import android .widget .LinearLayout ;
27
19
import android .widget .Space ;
28
20
import android .widget .TextView ;
29
- import android .widget .Toast ;
30
-
31
- import androidx .core .content .FileProvider ;
32
21
33
22
import org .apache .commons .text .StringEscapeUtils ;
34
23
import org .osmdroid .api .IMapView ;
37
26
import org .osmdroid .views .overlay .infowindow .InfoWindow ;
38
27
39
28
import java .io .File ;
40
- import java .text .ParseException ;
41
29
import java .util .Date ;
42
- import java .util .List ;
43
30
44
31
import de .hauke_stieler .geonotes .R ;
32
+ import de .hauke_stieler .geonotes .common .FileHelper ;
45
33
import de .hauke_stieler .geonotes .database .Database ;
46
34
import de .hauke_stieler .geonotes .notes .Note ;
47
35
import de .hauke_stieler .geonotes .photo .ThumbnailUtil ;
48
36
49
- import static android .content .ContentResolver .EXTRA_SIZE ;
50
-
51
37
public class MarkerWindow extends InfoWindow {
52
38
private RequestPhotoEventHandler requestPhotoHandler ;
53
39
@@ -231,7 +217,7 @@ public void onClose() {
231
217
232
218
public void resetImageList () {
233
219
// When the user rotates the device, this may be called before creating the UI.
234
- if (getView () == null ){
220
+ if (getView () == null ) {
235
221
return ;
236
222
}
237
223
@@ -258,9 +244,7 @@ public void addPhoto(File photo) {
258
244
imageButton .setOnClickListener (v -> {
259
245
Intent intent = new Intent ();
260
246
intent .setAction (Intent .ACTION_VIEW );
261
- intent .setDataAndType (FileProvider .getUriForFile (getView ().getContext (),
262
- getView ().getContext ().getPackageName () + ".provider" ,
263
- photo ), "image/jpg" );
247
+ intent .setDataAndType (FileHelper .getFileUri (getView ().getContext (), photo ), "image/jpg" );
264
248
intent .addFlags (Intent .FLAG_GRANT_READ_URI_PERMISSION );
265
249
getView ().getContext ().startActivity (intent );
266
250
});
0 commit comments