diff --git a/app/src/main/assets/calculators/REALGX.KML b/app/src/main/assets/calculators/REALGX.KML deleted file mode 100644 index 3aa25f5..0000000 --- a/app/src/main/assets/calculators/REALGX.KML +++ /dev/null @@ -1,722 +0,0 @@ -Global - Print "==========================================================" - Print "" - Print "This graphic is by Casey Patterson." - Print "pattersc@gulftel.com" - Print "" - Print "Come to my page to get more graphics for your Win48!!!" - Print "" - Print "http://www.gulftel.com/~pattersc/win48/" - Print "" - Print "==========================================================" - Title "Casey's Real Gx" - Author "Casey Patterson" - Model "G" - Rom "ROM.48G" - Patch "BEEP.48" - Bitmap "realgx.bmp" - Debug 0 -End - -Background - Offset 0 0 - Size 183 400 -End - -Lcd - Zoom 1 - Offset 27 53 - Color 0 123 132 99 - Color 1 123 132 99 - Color 2 123 132 99 - Color 3 123 132 99 - Color 4 123 132 99 - Color 5 123 132 99 - Color 6 123 132 99 - Color 7 123 132 99 - Color 8 123 132 99 - Color 9 116 124 96 - Color 10 109 116 93 - Color 11 102 108 90 - Color 12 95 100 87 - Color 13 88 92 84 - Color 14 81 84 78 - Color 15 74 76 75 - Color 16 67 68 72 - Color 17 60 60 69 - Color 18 53 52 66 - Color 19 46 44 63 - Color 20 39 36 60 - Color 21 32 28 57 - Color 22 25 20 54 - Color 23 18 12 51 - Color 24 11 4 48 - Color 25 4 0 45 - Color 26 0 0 42 - Color 27 0 0 39 - Color 28 0 0 36 - Color 29 0 0 33 - Color 30 0 0 30 - Color 31 0 0 27 -End - -Annunciator 1 - Size 8 6 - Offset 40 45 - Down 0 400 -End - -Annunciator 2 - Size 8 6 - Offset 60 45 - Down 9 400 -End - -Annunciator 3 - Size 8 6 - Offset 80 45 - Down 17 400 -End - -Annunciator 4 - Size 10 6 - Offset 100 45 - Down 25 400 -End - -Annunciator 5 - Size 5 6 - Offset 120 45 - Down 35 400 -End - -Annunciator 6 - Size 7 6 - Offset 140 45 - Down 43 400 -End - -Button 11 - Type 1 - Size 19 13 - Offset 18 156 - OutIn 1 16 -End -Button 12 - Type 1 - Size 19 13 - Offset 44 156 - OutIn 8 16 -End -Button 13 - Type 1 - Size 19 13 - Offset 70 156 - OutIn 8 8 -End -Button 14 - Type 1 - Size 19 13 - Offset 95 156 - OutIn 8 4 -End -Button 15 - Type 1 - Size 19 13 - Offset 121 156 - OutIn 8 2 -End -Button 16 - Type 1 - Size 19 13 - Offset 147 156 - OutIn 8 1 -End - -Button 21 - Type 1 - Size 19 15 - Offset 18 182 - OutIn 2 16 -End -Button 22 - Type 1 - Size 19 15 - Offset 44 182 - OutIn 7 16 -End -Button 23 - Type 1 - Size 19 15 - Offset 70 182 - OutIn 7 8 -End -Button 24 - Type 1 - Size 19 15 - Offset 95 182 - OutIn 7 4 -End -Button 25 - Type 1 - Size 19 15 - Offset 121 182 - OutIn 7 2 -End -Button 26 - Type 1 - Size 19 15 - Offset 147 182 - OutIn 7 1 -End - -Button 31 - Type 1 - Size 19 15 - Offset 18 208 - OutIn 0 16 -End -Button 32 - Type 1 - Size 19 15 - Offset 44 208 - OutIn 6 16 -End -Button 33 - Type 1 - Size 19 15 - Offset 70 208 - OutIn 6 8 -End -Button 34 - Type 1 - Size 19 15 - Offset 95 208 - OutIn 6 4 -End -Button 35 - Type 1 - Size 19 15 - Offset 121 208 - OutIn 6 2 -End -Button 36 - Type 1 - Size 19 15 - Offset 147 208 - OutIn 6 1 -End - -Button 41 - Type 1 - Size 19 15 - Offset 18 233 - OutIn 3 16 -End -Button 42 - Type 1 - Size 19 15 - Offset 44 233 - OutIn 5 16 -End -Button 43 - Type 1 - Size 19 15 - Offset 70 233 - OutIn 5 8 -End -Button 44 - Type 1 - Size 19 15 - Offset 95 233 - OutIn 5 4 -End -Button 45 - Type 1 - Size 19 15 - Offset 121 233 - OutIn 5 2 -End -Button 46 - Type 1 - Size 19 15 - Offset 147 233 - OutIn 5 1 -End - -Button 51 - Type 1 - Size 45 15 - Offset 18 259 - OutIn 4 16 -End -Button 52 - Type 1 - Size 19 15 - Offset 70 259 - OutIn 4 8 -End -Button 53 - Type 1 - Size 19 15 - Offset 95 259 - OutIn 4 4 -End -Button 54 - Type 1 - Size 19 15 - Offset 121 259 - OutIn 4 2 -End -Button 55 - Type 1 - Size 19 15 - Offset 147 259 - OutIn 4 1 -End - -Button 61 - Type 1 - Size 18 15 - Offset 19 284 - OutIn 3 32 -End -Button 62 - Type 1 - Size 24 15 - Offset 48 284 - OutIn 3 8 -End -Button 63 - Type 1 - Size 24 15 - Offset 79 284 - OutIn 3 4 -End -Button 64 - Type 1 - Size 24 15 - Offset 110 284 - OutIn 3 2 -End -Button 65 - Type 1 - Size 24 15 - Offset 141 284 - OutIn 3 1 -End - -Button 71 - Type 1 - Size 18 15 - Offset 19 310 - OutIn 2 32 -End -Button 72 - Type 1 - Size 24 15 - Offset 48 310 - OutIn 2 8 -End -Button 73 - Type 1 - Size 24 15 - Offset 79 310 - OutIn 2 4 -End -Button 74 - Type 1 - Size 24 15 - Offset 110 310 - OutIn 2 2 -End -Button 75 - Type 1 - Size 24 15 - Offset 141 310 - OutIn 2 1 -End - -Button 81 - Type 1 - Size 18 15 - Offset 19 335 - OutIn 1 32 -End -Button 82 - Type 1 - Size 24 15 - Offset 48 335 - OutIn 1 8 -End -Button 83 - Type 1 - Size 24 15 - Offset 79 335 - OutIn 1 4 -End -Button 84 - Type 1 - Size 24 15 - Offset 110 335 - OutIn 1 2 -End -Button 85 - Type 1 - Size 24 15 - Offset 141 335 - OutIn 1 1 -End - -Button 91 - Type 1 - Size 18 15 - Offset 19 361 - OutIn 0 32768 -End -Button 92 - Type 1 - Size 24 15 - Offset 48 361 - OutIn 0 8 -End -Button 93 - Type 1 - Size 24 15 - Offset 79 361 - OutIn 0 4 -End -Button 94 - Type 1 - Size 24 15 - Offset 110 361 - OutIn 0 2 -End -Button 95 - Type 1 - Size 24 15 - Offset 141 361 - OutIn 0 1 -End - - -Scancode 8 - Map 8 55 -End - -Scancode 13 - Map 13 51 -End - -Scancode 16 - IfPressed 16 - SetFlag 0 - Else - ResetFlag 0 - End -End - -Scancode 17 - IfPressed 17 - SetFlag 1 - Else - ResetFlag 1 - End -End - -Scancode 27 - Map 27 91 -End - -Scancode 37 - Map 37 34 -End - -Scancode 38 - Map 38 25 -End - -Scancode 39 - Map 39 36 -End - -Scancode 40 - Map 40 35 -End - -Scancode 49 - IfFlag 0 - Map 49 71 - Map 49 54 - Else - Map 49 82 - End -End - -Scancode 50 - Map 50 83 -End - -Scancode 51 - IfFlag 0 - Map 51 81 - Map 51 65 - Else - Map 51 84 - End -End - -Scancode 52 - Map 52 72 -End - -Scancode 53 - Map 53 73 -End - -Scancode 54 - Map 54 74 -End - -Scancode 55 - Map 55 62 -End - -Scancode 56 - IfFlag 0 - Map 56 75 - Else - Map 56 63 - End -End - -Scancode 57 - IfFlag 0 - Map 57 71 - Map 57 65 - Else - Map 57 64 - End -End - -Scancode 65 - Map 65 11 -End - -Scancode 66 - Map 66 12 -End - -Scancode 67 - Map 67 13 -End - -Scancode 68 - Map 68 14 -End - -Scancode 69 - Map 69 15 -End - -Scancode 70 - Map 70 16 -End - -Scancode 71 - Map 71 21 -End - -Scancode 72 - Map 72 22 -End - -Scancode 73 - Map 73 23 -End - -Scancode 74 - Map 74 24 -End - -Scancode 75 - Map 75 25 -End - -Scancode 76 - Map 76 26 -End - -Scancode 77 - Map 77 31 -End - -Scancode 78 - IfFlag 1 - MenuItem 1 - Else - Map 78 32 - End -End - -Scancode 79 - Map 79 33 -End - -Scancode 80 - Map 80 34 -End - -Scancode 81 - Map 81 35 -End - -Scancode 82 - Map 82 36 -End - -Scancode 83 - Map 83 41 -End - -Scancode 84 - Map 84 42 -End - -Scancode 85 - Map 85 43 -End - -Scancode 86 - Map 86 44 -End - -Scancode 87 - Map 87 45 -End - -Scancode 88 - Map 88 46 -End - -Scancode 89 - Map 89 52 -End - -Scancode 90 - Map 90 53 -End - -Scancode 96 - Map 96 92 -End - -Scancode 97 - Map 97 82 -End - -Scancode 98 - Map 98 83 -End - -Scancode 99 - Map 99 84 -End - -Scancode 100 - Map 100 72 -End - -Scancode 101 - Map 101 73 -End - -Scancode 102 - Map 102 74 -End - -Scancode 103 - Map 103 62 -End - -Scancode 104 - Map 104 63 -End - -Scancode 105 - Map 105 64 -End - -Scancode 106 - Map 106 75 -End - -Scancode 107 - Map 107 95 -End - -Scancode 109 - Map 109 85 -End - -Scancode 110 - Map 110 93 -End - -Scancode 111 - Map 111 65 -End - -Scancode 186 - IfFlag 0 - Map 186 81 - Map 186 95 - End -End - -Scancode 188 - Map 188 71 - Map 188 93 -End - -Scancode 190 - Map 190 93 -End - -Scancode 191 - IfFlag 0 - Map 191 71 - Map 191 55 - Else - Map 191 65 - End -End - -Scancode 219 - IfFlag 0 - Map 219 71 - Map 219 95 - Else - Map 219 71 - Map 219 75 - End -End - -Scancode 220 - Map 220 54 -End - -Scancode 222 - IfFlag 0 - Map 222 81 - Map 222 85 - Else - Map 222 31 - End -End - - - - - - diff --git a/app/src/main/assets/calculators/REALSX.KML b/app/src/main/assets/calculators/REALSX.KML deleted file mode 100644 index 1a5bac7..0000000 --- a/app/src/main/assets/calculators/REALSX.KML +++ /dev/null @@ -1,722 +0,0 @@ -Global - Print "==========================================================" - Print "" - Print "This graphic is by Casey Patterson." - Print "pattersc@gulftel.com" - Print "" - Print "Come to my page to get more graphics for your Win48!!!" - Print "" - Print "http://www.gulftel.com/~pattersc/win48/" - Print "" - Print "==========================================================" - Title "Casey's Real Sx" - Author "Casey Patterson" - Model "S" - Rom "ROM.48S" - Patch "BEEP.48" - Bitmap "realsx.bmp" - Debug 0 -End - -Background - Offset 0 0 - Size 183 400 -End - -Lcd - Zoom 1 - Offset 26 53 - Color 0 161 173 130 - Color 1 0 0 0 - Color 2 0 0 0 - Color 3 0 0 0 - Color 4 0 0 0 - Color 5 0 0 0 - Color 6 0 0 0 - Color 7 0 0 0 - Color 8 0 0 0 - Color 9 0 0 0 - Color 10 0 0 0 - Color 11 0 0 0 - Color 12 0 0 0 - Color 13 0 0 0 - Color 14 0 0 0 - Color 15 0 0 0 - Color 16 0 0 0 - Color 17 0 0 0 - Color 18 0 0 0 - Color 19 0 0 0 - Color 20 0 0 0 - Color 21 0 0 0 - Color 22 0 0 0 - Color 23 0 0 0 - Color 24 0 0 0 - Color 25 0 0 0 - Color 26 0 0 0 - Color 27 0 0 0 - Color 28 0 0 0 - Color 29 0 0 0 - Color 30 0 0 0 - Color 31 0 0 0 -End - -Annunciator 1 - Size 8 6 - Offset 40 45 - Down 0 400 -End - -Annunciator 2 - Size 8 6 - Offset 60 45 - Down 9 400 -End - -Annunciator 3 - Size 8 6 - Offset 80 45 - Down 17 400 -End - -Annunciator 4 - Size 10 6 - Offset 100 45 - Down 25 400 -End - -Annunciator 5 - Size 5 6 - Offset 120 45 - Down 35 400 -End - -Annunciator 6 - Size 7 6 - Offset 140 45 - Down 43 400 -End - -Button 11 - Type 1 - Size 19 13 - Offset 18 156 - OutIn 1 16 -End -Button 12 - Type 1 - Size 19 13 - Offset 44 156 - OutIn 8 16 -End -Button 13 - Type 1 - Size 19 13 - Offset 70 156 - OutIn 8 8 -End -Button 14 - Type 1 - Size 19 13 - Offset 95 156 - OutIn 8 4 -End -Button 15 - Type 1 - Size 19 13 - Offset 121 156 - OutIn 8 2 -End -Button 16 - Type 1 - Size 19 13 - Offset 147 156 - OutIn 8 1 -End - -Button 21 - Type 1 - Size 19 15 - Offset 18 182 - OutIn 2 16 -End -Button 22 - Type 1 - Size 19 15 - Offset 44 182 - OutIn 7 16 -End -Button 23 - Type 1 - Size 19 15 - Offset 70 182 - OutIn 7 8 -End -Button 24 - Type 1 - Size 19 15 - Offset 95 182 - OutIn 7 4 -End -Button 25 - Type 1 - Size 19 15 - Offset 121 182 - OutIn 7 2 -End -Button 26 - Type 1 - Size 19 15 - Offset 147 182 - OutIn 7 1 -End - -Button 31 - Type 1 - Size 19 15 - Offset 18 208 - OutIn 0 16 -End -Button 32 - Type 1 - Size 19 15 - Offset 44 208 - OutIn 6 16 -End -Button 33 - Type 1 - Size 19 15 - Offset 70 208 - OutIn 6 8 -End -Button 34 - Type 1 - Size 19 15 - Offset 95 208 - OutIn 6 4 -End -Button 35 - Type 1 - Size 19 15 - Offset 121 208 - OutIn 6 2 -End -Button 36 - Type 1 - Size 19 15 - Offset 147 208 - OutIn 6 1 -End - -Button 41 - Type 1 - Size 19 15 - Offset 18 233 - OutIn 3 16 -End -Button 42 - Type 1 - Size 19 15 - Offset 44 233 - OutIn 5 16 -End -Button 43 - Type 1 - Size 19 15 - Offset 70 233 - OutIn 5 8 -End -Button 44 - Type 1 - Size 19 15 - Offset 95 233 - OutIn 5 4 -End -Button 45 - Type 1 - Size 19 15 - Offset 121 233 - OutIn 5 2 -End -Button 46 - Type 1 - Size 19 15 - Offset 147 233 - OutIn 5 1 -End - -Button 51 - Type 1 - Size 45 15 - Offset 18 259 - OutIn 4 16 -End -Button 52 - Type 1 - Size 19 15 - Offset 70 259 - OutIn 4 8 -End -Button 53 - Type 1 - Size 19 15 - Offset 95 259 - OutIn 4 4 -End -Button 54 - Type 1 - Size 19 15 - Offset 121 259 - OutIn 4 2 -End -Button 55 - Type 1 - Size 19 15 - Offset 147 259 - OutIn 4 1 -End - -Button 61 - Type 1 - Size 18 15 - Offset 19 284 - OutIn 3 32 -End -Button 62 - Type 1 - Size 24 15 - Offset 48 284 - OutIn 3 8 -End -Button 63 - Type 1 - Size 24 15 - Offset 79 284 - OutIn 3 4 -End -Button 64 - Type 1 - Size 24 15 - Offset 110 284 - OutIn 3 2 -End -Button 65 - Type 1 - Size 24 15 - Offset 141 284 - OutIn 3 1 -End - -Button 71 - Type 1 - Size 18 15 - Offset 19 310 - OutIn 2 32 -End -Button 72 - Type 1 - Size 24 15 - Offset 48 310 - OutIn 2 8 -End -Button 73 - Type 1 - Size 24 15 - Offset 79 310 - OutIn 2 4 -End -Button 74 - Type 1 - Size 24 15 - Offset 110 310 - OutIn 2 2 -End -Button 75 - Type 1 - Size 24 15 - Offset 141 310 - OutIn 2 1 -End - -Button 81 - Type 1 - Size 18 15 - Offset 19 335 - OutIn 1 32 -End -Button 82 - Type 1 - Size 24 15 - Offset 48 335 - OutIn 1 8 -End -Button 83 - Type 1 - Size 24 15 - Offset 79 335 - OutIn 1 4 -End -Button 84 - Type 1 - Size 24 15 - Offset 110 335 - OutIn 1 2 -End -Button 85 - Type 1 - Size 24 15 - Offset 141 335 - OutIn 1 1 -End - -Button 91 - Type 1 - Size 18 15 - Offset 19 361 - OutIn 0 32768 -End -Button 92 - Type 1 - Size 24 15 - Offset 48 361 - OutIn 0 8 -End -Button 93 - Type 1 - Size 24 15 - Offset 79 361 - OutIn 0 4 -End -Button 94 - Type 1 - Size 24 15 - Offset 110 361 - OutIn 0 2 -End -Button 95 - Type 1 - Size 24 15 - Offset 141 361 - OutIn 0 1 -End - - -Scancode 8 - Map 8 55 -End - -Scancode 13 - Map 13 51 -End - -Scancode 16 - IfPressed 16 - SetFlag 0 - Else - ResetFlag 0 - End -End - -Scancode 17 - IfPressed 17 - SetFlag 1 - Else - ResetFlag 1 - End -End - -Scancode 27 - Map 27 91 -End - -Scancode 37 - Map 37 34 -End - -Scancode 38 - Map 38 25 -End - -Scancode 39 - Map 39 36 -End - -Scancode 40 - Map 40 35 -End - -Scancode 49 - IfFlag 0 - Map 49 71 - Map 49 54 - Else - Map 49 82 - End -End - -Scancode 50 - Map 50 83 -End - -Scancode 51 - IfFlag 0 - Map 51 81 - Map 51 65 - Else - Map 51 84 - End -End - -Scancode 52 - Map 52 72 -End - -Scancode 53 - Map 53 73 -End - -Scancode 54 - Map 54 74 -End - -Scancode 55 - Map 55 62 -End - -Scancode 56 - IfFlag 0 - Map 56 75 - Else - Map 56 63 - End -End - -Scancode 57 - IfFlag 0 - Map 57 71 - Map 57 65 - Else - Map 57 64 - End -End - -Scancode 65 - Map 65 11 -End - -Scancode 66 - Map 66 12 -End - -Scancode 67 - Map 67 13 -End - -Scancode 68 - Map 68 14 -End - -Scancode 69 - Map 69 15 -End - -Scancode 70 - Map 70 16 -End - -Scancode 71 - Map 71 21 -End - -Scancode 72 - Map 72 22 -End - -Scancode 73 - Map 73 23 -End - -Scancode 74 - Map 74 24 -End - -Scancode 75 - Map 75 25 -End - -Scancode 76 - Map 76 26 -End - -Scancode 77 - Map 77 31 -End - -Scancode 78 - IfFlag 1 - MenuItem 1 - Else - Map 78 32 - End -End - -Scancode 79 - Map 79 33 -End - -Scancode 80 - Map 80 34 -End - -Scancode 81 - Map 81 35 -End - -Scancode 82 - Map 82 36 -End - -Scancode 83 - Map 83 41 -End - -Scancode 84 - Map 84 42 -End - -Scancode 85 - Map 85 43 -End - -Scancode 86 - Map 86 44 -End - -Scancode 87 - Map 87 45 -End - -Scancode 88 - Map 88 46 -End - -Scancode 89 - Map 89 52 -End - -Scancode 90 - Map 90 53 -End - -Scancode 96 - Map 96 92 -End - -Scancode 97 - Map 97 82 -End - -Scancode 98 - Map 98 83 -End - -Scancode 99 - Map 99 84 -End - -Scancode 100 - Map 100 72 -End - -Scancode 101 - Map 101 73 -End - -Scancode 102 - Map 102 74 -End - -Scancode 103 - Map 103 62 -End - -Scancode 104 - Map 104 63 -End - -Scancode 105 - Map 105 64 -End - -Scancode 106 - Map 106 75 -End - -Scancode 107 - Map 107 95 -End - -Scancode 109 - Map 109 85 -End - -Scancode 110 - Map 110 93 -End - -Scancode 111 - Map 111 65 -End - -Scancode 186 - IfFlag 0 - Map 186 81 - Map 186 95 - End -End - -Scancode 188 - Map 188 71 - Map 188 93 -End - -Scancode 190 - Map 190 93 -End - -Scancode 191 - IfFlag 0 - Map 191 71 - Map 191 55 - Else - Map 191 65 - End -End - -Scancode 219 - IfFlag 0 - Map 219 71 - Map 219 95 - Else - Map 219 71 - Map 219 75 - End -End - -Scancode 220 - Map 220 54 -End - -Scancode 222 - IfFlag 0 - Map 222 81 - Map 222 85 - Else - Map 222 31 - End -End - - - - - - diff --git a/app/src/main/assets/calculators/realgx.bmp b/app/src/main/assets/calculators/realgx.bmp deleted file mode 100644 index 89bcde4..0000000 Binary files a/app/src/main/assets/calculators/realgx.bmp and /dev/null differ diff --git a/app/src/main/assets/calculators/realsx.bmp b/app/src/main/assets/calculators/realsx.bmp deleted file mode 100644 index 683854b..0000000 Binary files a/app/src/main/assets/calculators/realsx.bmp and /dev/null differ diff --git a/app/src/main/java/org/emulator/forty/eight/MainActivity.java b/app/src/main/java/org/emulator/forty/eight/MainActivity.java index b1c5d49..6c17047 100644 --- a/app/src/main/java/org/emulator/forty/eight/MainActivity.java +++ b/app/src/main/java/org/emulator/forty/eight/MainActivity.java @@ -66,6 +66,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On public static final int INTENT_OBJECT_SAVE = 4; public static final int INTENT_SETTINGS = 5; public static final int INTENT_PORT2LOAD = 6; + public static final int INTENT_PICK_KML_FILE = 7; public static MainActivity mainActivity; @@ -555,13 +556,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On @Override public void onClick(DialogInterface dialog, int which) { if(which == lastIndex) { - + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("file/*"); + startActivityForResult(intent, INTENT_PICK_KML_FILE); } else { String kmlScriptFilename = kmlScripts.get(which).filename; - NativeLib.onFileNew(kmlScriptFilename); - displayFilename(""); - showKMLLog(); - updateNavigationDrawerItems(); + newFileFromKML(kmlScriptFilename); } } }).show(); @@ -569,6 +569,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On }); } + private void newFileFromKML(String kmlScriptFilename) { + NativeLib.onFileNew(kmlScriptFilename); + displayFilename(""); + showKMLLog(); + updateNavigationDrawerItems(); + } + private void OnFileOpen() { ensureDocumentSaved(new Runnable() { @Override @@ -771,52 +778,52 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - if(resultCode == Activity.RESULT_OK) { - - if(requestCode == INTENT_GETOPENFILENAME) { - Uri uri = data.getData(); - - //just as an example, I am writing a String to the Uri I received from the user: - Log.d(TAG, "onActivityResult INTENT_GETOPENFILENAME " + uri.toString()); - - String url = uri.toString(); - if(onFileOpen(url) != 0) { - saveLastDocument(url); - makeUriPersistable(data, uri); + if(resultCode == Activity.RESULT_OK && data != null) { + Uri uri = data.getData(); + String url = null; + if(uri != null) + url = uri.toString(); + if(url != null) + switch (requestCode) { + case INTENT_GETOPENFILENAME: { + Log.d(TAG, "onActivityResult INTENT_GETOPENFILENAME " + url); + if (onFileOpen(url) != 0) { + saveLastDocument(url); + makeUriPersistable(data, uri); + } + break; + } + case INTENT_GETSAVEFILENAME: { + Log.d(TAG, "onActivityResult INTENT_GETSAVEFILENAME " + url); + if (NativeLib.onFileSaveAs(url) != 0) { + showAlert("State saved"); + saveLastDocument(url); + makeUriPersistable(data, uri); + displayFilename(url); + if (fileSaveAsCallback != null) + fileSaveAsCallback.run(); + } + break; + } + case INTENT_OBJECT_LOAD: { + Log.d(TAG, "onActivityResult INTENT_OBJECT_LOAD " + url); + NativeLib.onObjectLoad(url); + break; + } + case INTENT_OBJECT_SAVE: { + Log.d(TAG, "onActivityResult INTENT_OBJECT_SAVE " + url); + NativeLib.onObjectSave(url); + break; + } + case INTENT_SETTINGS: + break; + case INTENT_PICK_KML_FILE: + Log.d(TAG, "onActivityResult INTENT_OBJECT_SAVE " + url); + newFileFromKML(url); + break; + default: + break; } - } else if(requestCode == INTENT_GETSAVEFILENAME) { - Uri uri = data.getData(); - - //just as an example, I am writing a String to the Uri I received from the user: - Log.d(TAG, "onActivityResult INTENT_GETSAVEFILENAME " + uri.toString()); - - String url = uri.toString(); - if(NativeLib.onFileSaveAs(url) != 0) { - showAlert("State saved"); - saveLastDocument(url); - makeUriPersistable(data, uri); - displayFilename(url); - if(fileSaveAsCallback != null) - fileSaveAsCallback.run(); - } - } else if(requestCode == INTENT_OBJECT_LOAD) { - Uri uri = data.getData(); - - //just as an example, I am writing a String to the Uri I received from the user: - Log.d(TAG, "onActivityResult INTENT_OBJECT_LOAD " + uri.toString()); - - String url = uri.toString(); - NativeLib.onObjectLoad(url); - } else if(requestCode == INTENT_OBJECT_SAVE) { - Uri uri = data.getData(); - - //just as an example, I am writing a String to the Uri I received from the user: - Log.d(TAG, "onActivityResult INTENT_OBJECT_SAVE " + uri.toString()); - - String url = uri.toString(); - NativeLib.onObjectSave(url); - } else if(requestCode == INTENT_SETTINGS) { - } } fileSaveAsCallback = null; super.onActivityResult(requestCode, resultCode, data);