├── SendReduced
├── build.gradle
├── lint.xml
└── src
│ ├── free
│ └── res
│ │ ├── drawable-hdpi
│ │ └── icon.png
│ │ ├── drawable-ldpi
│ │ └── icon.png
│ │ ├── drawable-mdpi
│ │ └── icon.png
│ │ ├── drawable-xhdpi
│ │ └── icon.png
│ │ ├── drawable-xxhdpi
│ │ └── icon.png
│ │ ├── values
│ │ └── strings.xml
│ │ └── xml
│ │ └── paths.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── licenses.txt
│ ├── java
│ │ └── mobi
│ │ │ └── omegacentauri
│ │ │ └── SendReduced
│ │ │ ├── FileProvider.java
│ │ │ ├── GetReduced.java
│ │ │ ├── MarketDetector.java
│ │ │ ├── Options.java
│ │ │ ├── SendReduced.java
│ │ │ ├── ShowLicense.java
│ │ │ └── Utils.java
│ └── res
│ │ ├── values
│ │ └── strings.xml
│ │ └── xml
│ │ └── options.xml
│ └── pro
│ └── res
│ ├── drawable-hdpi
│ └── icon.png
│ ├── drawable-ldpi
│ └── icon.png
│ ├── drawable-mdpi
│ └── icon.png
│ ├── drawable-xhdpi
│ └── icon.png
│ ├── drawable-xxhdpi
│ └── icon.png
│ ├── values
│ └── strings.xml
│ └── xml
│ └── paths.xml
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── icon114free.png
├── icon135free.png
├── icon512free.png
├── images
├── Lens_and_wavefronts.xcf
├── Lens_and_wavefrontsfree.png
├── Lens_and_wavefrontsfree.svg
├── Lens_and_wavefrontsfree.xcf
└── Lens_and_wavefrontspro.png
├── import-summary.txt
├── license.txt
├── local.properties
├── scale.sh
└── settings.gradle
/SendReduced/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | signingConfigs {
5 | release {
6 | }
7 | }
8 | compileSdkVersion 29
9 | buildToolsVersion "30.0.3"
10 |
11 | defaultConfig {
12 | applicationId "mobi.omegacentauri.SendReduced"
13 | signingConfig signingConfigs.release
14 | minSdkVersion 14
15 | targetSdkVersion 30
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
22 | signingConfig signingConfigs.release
23 | }
24 | }
25 |
26 | productFlavors {
27 | pro {
28 | applicationId 'mobi.omegacentauri.SendReduced_pro'
29 | dimension 'pro_or_free'
30 | resValue 'string', 'license_intent', applicationId + ".LICENSE"
31 | }
32 | free {
33 | dimension 'pro_or_free'
34 | applicationId 'mobi.omegacentauri.SendReduced'
35 | resValue 'string', 'license_intent', applicationId + ".LICENSE"
36 | }
37 | }
38 | flavorDimensions 'pro_or_free'
39 |
40 | lintOptions {
41 | checkReleaseBuilds false
42 | //If you want to continue even if errors found use following line
43 | abortOnError false
44 | }
45 |
46 | allprojects {
47 | afterEvaluate { project ->
48 | def propsFile = rootProject.file('../SendReduced-keys.properties')
49 | def configName = 'release'
50 |
51 | if (propsFile.exists() && android.signingConfigs.hasProperty(configName)) {
52 | def props = new Properties()
53 | props.load(new FileInputStream(propsFile))
54 | android.signingConfigs[configName].storeFile = file(props['storeFile'])
55 | android.signingConfigs[configName].storePassword = props['storePassword']
56 | android.signingConfigs[configName].keyAlias = props['keyAlias']
57 | android.signingConfigs[configName].keyPassword = props['keyPassword']
58 | }
59 | }
60 | }
61 | }
62 | dependencies {
63 | implementation 'androidx.exifinterface:exifinterface:1.3.2'
64 | // compile 'com.android.support.exifinterface:25.1.0'
65 | }
--------------------------------------------------------------------------------
/SendReduced/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | Apache License
5 | Version 2.0, January 2004
6 | http://www.apache.org/licenses/
7 |
8 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9 |
10 | 1. Definitions.
11 |
12 | "License" shall mean the terms and conditions for use, reproduction,
13 | and distribution as defined by Sections 1 through 9 of this document.
14 |
15 | "Licensor" shall mean the copyright owner or entity authorized by
16 | the copyright owner that is granting the License.
17 |
18 | "Legal Entity" shall mean the union of the acting entity and all
19 | other entities that control, are controlled by, or are under common
20 | control with that entity. For the purposes of this definition,
21 | "control" means (i) the power, direct or indirect, to cause the
22 | direction or management of such entity, whether by contract or
23 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
24 | outstanding shares, or (iii) beneficial ownership of such entity.
25 |
26 | "You" (or "Your") shall mean an individual or Legal Entity
27 | exercising permissions granted by this License.
28 |
29 | "Source" form shall mean the preferred form for making modifications,
30 | including but not limited to software source code, documentation
31 | source, and configuration files.
32 |
33 | "Object" form shall mean any form resulting from mechanical
34 | transformation or translation of a Source form, including but
35 | not limited to compiled object code, generated documentation,
36 | and conversions to other media types.
37 |
38 | "Work" shall mean the work of authorship, whether in Source or
39 | Object form, made available under the License, as indicated by a
40 | copyright notice that is included in or attached to the work
41 | (an example is provided in the Appendix below).
42 |
43 | "Derivative Works" shall mean any work, whether in Source or Object
44 | form, that is based on (or derived from) the Work and for which the
45 | editorial revisions, annotations, elaborations, or other modifications
46 | represent, as a whole, an original work of authorship. For the purposes
47 | of this License, Derivative Works shall not include works that remain
48 | separable from, or merely link (or bind by name) to the interfaces of,
49 | the Work and Derivative Works thereof.
50 |
51 | "Contribution" shall mean any work of authorship, including
52 | the original version of the Work and any modifications or additions
53 | to that Work or Derivative Works thereof, that is intentionally
54 | submitted to Licensor for inclusion in the Work by the copyright owner
55 | or by an individual or Legal Entity authorized to submit on behalf of
56 | the copyright owner. For the purposes of this definition, "submitted"
57 | means any form of electronic, verbal, or written communication sent
58 | to the Licensor or its representatives, including but not limited to
59 | communication on electronic mailing lists, source code control systems,
60 | and issue tracking systems that are managed by, or on behalf of, the
61 | Licensor for the purpose of discussing and improving the Work, but
62 | excluding communication that is conspicuously marked or otherwise
63 | designated in writing by the copyright owner as "Not a Contribution."
64 |
65 | "Contributor" shall mean Licensor and any individual or Legal Entity
66 | on behalf of whom a Contribution has been received by Licensor and
67 | subsequently incorporated within the Work.
68 |
69 | 2. Grant of Copyright License. Subject to the terms and conditions of
70 | this License, each Contributor hereby grants to You a perpetual,
71 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72 | copyright license to reproduce, prepare Derivative Works of,
73 | publicly display, publicly perform, sublicense, and distribute the
74 | Work and such Derivative Works in Source or Object form.
75 |
76 | 3. Grant of Patent License. Subject to the terms and conditions of
77 | this License, each Contributor hereby grants to You a perpetual,
78 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79 | (except as stated in this section) patent license to make, have made,
80 | use, offer to sell, sell, import, and otherwise transfer the Work,
81 | where such license applies only to those patent claims licensable
82 | by such Contributor that are necessarily infringed by their
83 | Contribution(s) alone or by combination of their Contribution(s)
84 | with the Work to which such Contribution(s) was submitted. If You
85 | institute patent litigation against any entity (including a
86 | cross-claim or counterclaim in a lawsuit) alleging that the Work
87 | or a Contribution incorporated within the Work constitutes direct
88 | or contributory patent infringement, then any patent licenses
89 | granted to You under this License for that Work shall terminate
90 | as of the date such litigation is filed.
91 |
92 | 4. Redistribution. You may reproduce and distribute copies of the
93 | Work or Derivative Works thereof in any medium, with or without
94 | modifications, and in Source or Object form, provided that You
95 | meet the following conditions:
96 |
97 | (a) You must give any other recipients of the Work or
98 | Derivative Works a copy of this License; and
99 |
100 | (b) You must cause any modified files to carry prominent notices
101 | stating that You changed the files; and
102 |
103 | (c) You must retain, in the Source form of any Derivative Works
104 | that You distribute, all copyright, patent, trademark, and
105 | attribution notices from the Source form of the Work,
106 | excluding those notices that do not pertain to any part of
107 | the Derivative Works; and
108 |
109 | (d) If the Work includes a "NOTICE" text file as part of its
110 | distribution, then any Derivative Works that You distribute must
111 | include a readable copy of the attribution notices contained
112 | within such NOTICE file, excluding those notices that do not
113 | pertain to any part of the Derivative Works, in at least one
114 | of the following places: within a NOTICE text file distributed
115 | as part of the Derivative Works; within the Source form or
116 | documentation, if provided along with the Derivative Works; or,
117 | within a display generated by the Derivative Works, if and
118 | wherever such third-party notices normally appear. The contents
119 | of the NOTICE file are for informational purposes only and
120 | do not modify the License. You may add Your own attribution
121 | notices within Derivative Works that You distribute, alongside
122 | or as an addendum to the NOTICE text from the Work, provided
123 | that such additional attribution notices cannot be construed
124 | as modifying the License.
125 |
126 | You may add Your own copyright statement to Your modifications and
127 | may provide additional or different license terms and conditions
128 | for use, reproduction, or distribution of Your modifications, or
129 | for any such Derivative Works as a whole, provided Your use,
130 | reproduction, and distribution of the Work otherwise complies with
131 | the conditions stated in this License.
132 |
133 | 5. Submission of Contributions. Unless You explicitly state otherwise,
134 | any Contribution intentionally submitted for inclusion in the Work
135 | by You to the Licensor shall be under the terms and conditions of
136 | this License, without any additional terms or conditions.
137 | Notwithstanding the above, nothing herein shall supersede or modify
138 | the terms of any separate license agreement you may have executed
139 | with Licensor regarding such Contributions.
140 |
141 | 6. Trademarks. This License does not grant permission to use the trade
142 | names, trademarks, service marks, or product names of the Licensor,
143 | except as required for reasonable and customary use in describing the
144 | origin of the Work and reproducing the content of the NOTICE file.
145 |
146 | 7. Disclaimer of Warranty. Unless required by applicable law or
147 | agreed to in writing, Licensor provides the Work (and each
148 | Contributor provides its Contributions) on an "AS IS" BASIS,
149 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150 | implied, including, without limitation, any warranties or conditions
151 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152 | PARTICULAR PURPOSE. You are solely responsible for determining the
153 | appropriateness of using or redistributing the Work and assume any
154 | risks associated with Your exercise of permissions under this License.
155 |
156 | 8. Limitation of Liability. In no event and under no legal theory,
157 | whether in tort (including negligence), contract, or otherwise,
158 | unless required by applicable law (such as deliberate and grossly
159 | negligent acts) or agreed to in writing, shall any Contributor be
160 | liable to You for damages, including any direct, indirect, special,
161 | incidental, or consequential damages of any character arising as a
162 | result of this License or out of the use or inability to use the
163 | Work (including but not limited to damages for loss of goodwill,
164 | work stoppage, computer failure or malfunction, or any and all
165 | other commercial damages or losses), even if such Contributor
166 | has been advised of the possibility of such damages.
167 |
168 | 9. Accepting Warranty or Additional Liability. While redistributing
169 | the Work or Derivative Works thereof, You may choose to offer,
170 | and charge a fee for, acceptance of support, warranty, indemnity,
171 | or other liability obligations and/or rights consistent with this
172 | License. However, in accepting such obligations, You may act only
173 | on Your own behalf and on Your sole responsibility, not on behalf
174 | of any other Contributor, and only if You agree to indemnify,
175 | defend, and hold each Contributor harmless for any liability
176 | incurred by, or claims asserted against, such Contributor by reason
177 | of your accepting any such warranty or additional liability.
178 |
179 | END OF TERMS AND CONDITIONS
180 |
181 | APPENDIX: How to apply the Apache License to your work.
182 |
183 | To apply the Apache License to your work, attach the following
184 | boilerplate notice, with the fields enclosed by brackets "[]"
185 | replaced with your own identifying information. (Don't include
186 | the brackets!) The text should be enclosed in the appropriate
187 | comment syntax for the file format. We also recommend that a
188 | file or class name and description of purpose be included on the
189 | same "printed page" as the copyright notice for easier
190 | identification within third-party archives.
191 |
192 | Copyright [yyyy] [name of copyright owner]
193 |
194 | Licensed under the Apache License, Version 2.0 (the "License");
195 | you may not use this file except in compliance with the License.
196 | You may obtain a copy of the License at
197 |
198 | http://www.apache.org/licenses/LICENSE-2.0
199 |
200 | Unless required by applicable law or agreed to in writing, software
201 | distributed under the License is distributed on an "AS IS" BASIS,
202 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203 | See the License for the specific language governing permissions and
204 | limitations under the License.
205 |
--------------------------------------------------------------------------------
/SendReduced/src/main/java/mobi/omegacentauri/SendReduced/FileProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | s * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package mobi.omegacentauri.SendReduced;
17 | import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
18 | import static org.xmlpull.v1.XmlPullParser.START_TAG;
19 | import android.content.ContentProvider;
20 | import android.content.ContentValues;
21 | import android.content.Context;
22 | import android.content.Intent;
23 | import android.content.pm.PackageManager;
24 | import android.content.pm.ProviderInfo;
25 | import android.content.res.XmlResourceParser;
26 | import android.database.Cursor;
27 | import android.database.MatrixCursor;
28 | import android.net.Uri;
29 | import android.os.Environment;
30 | import android.os.ParcelFileDescriptor;
31 | import android.provider.OpenableColumns;
32 | import android.text.TextUtils;
33 | import android.util.Log;
34 | import android.webkit.MimeTypeMap;
35 | import org.xmlpull.v1.XmlPullParserException;
36 | import java.io.File;
37 | import java.io.FileNotFoundException;
38 | import java.io.IOException;
39 | import java.util.HashMap;
40 | import java.util.Map;
41 | /**
42 | * FileProvider is a special subclass of {@link ContentProvider} that facilitates secure sharing
43 | * of files associated with an app by creating a content://
{@link Uri} for a file
44 | * instead of a file:///
{@link Uri}.
45 | * 46 | * A content URI allows you to grant read and write access using 47 | * temporary access permissions. When you create an {@link Intent} containing 48 | * a content URI, in order to send the content URI 49 | * to a client app, you can also call {@link Intent#setFlags(int) Intent.setFlags()} to add 50 | * permissions. These permissions are available to the client app for as long as the stack for 51 | * a receiving {@link android.app.Activity} is active. For an {@link Intent} going to a 52 | * {@link android.app.Service}, the permissions are available as long as the 53 | * {@link android.app.Service} is running. 54 | *
55 | * In comparison, to control access to a file:///
{@link Uri} you have to modify the
56 | * file system permissions of the underlying file. The permissions you provide become available to
57 | * any app, and remain in effect until you change them. This level of access is
58 | * fundamentally insecure.
59 | *
60 | * The increased level of file access security offered by a content URI 61 | * makes FileProvider a key part of Android's security infrastructure. 62 | *
63 | * This overview of FileProvider includes the following topics: 64 | *
65 | *
74 | * Since the default functionality of FileProvider includes content URI generation for files, you
75 | * don't need to define a subclass in code. Instead, you can include a FileProvider in your app
76 | * by specifying it entirely in XML. To specify the FileProvider component itself, add a
77 | * <provider>
78 | * element to your app manifest. Set the android:name
attribute to
79 | * android.support.v4.content.FileProvider
. Set the android:authorities
80 | * attribute to a URI authority based on a domain you control; for example, if you control the
81 | * domain mydomain.com
you should use the authority
82 | * com.mydomain.fileprovider
. Set the android:exported
attribute to
83 | * false
; the FileProvider does not need to be public. Set the
84 | * android:grantUriPermissions attribute to true
, to allow you
86 | * to grant temporary access to files. For example:
87 | *
88 | *<manifest> 89 | * ... 90 | * <application> 91 | * ... 92 | * <provider 93 | * android:name="android.support.v4.content.FileProvider" 94 | * android:authorities="com.mydomain.fileprovider" 95 | * android:exported="false" 96 | * android:grantUriPermissions="true"> 97 | * ... 98 | * </provider> 99 | * ... 100 | * </application> 101 | *</manifest>102 | *
103 | * If you want to override any of the default behavior of FileProvider methods, extend
104 | * the FileProvider class and use the fully-qualified class name in the android:name
105 | * attribute of the <provider>
element.
106 | *
<paths>
element.
110 | * For example, the following paths
element tells FileProvider that you intend to
111 | * request content URIs for the images/
subdirectory of your private file area.
112 | * 113 | *<paths xmlns:android="http://schemas.android.com/apk/res/android"> 114 | * <files-path name="my_images" path="images/"/> 115 | * ... 116 | *</paths> 117 | *118 | *
119 | * The <paths>
element must contain one or more of the following child elements:
120 | *
124 | *<files-path name="name" path="path" /> 125 | *126 | *
files/
subdirectory of your app's internal storage
129 | * area. This subdirectory is the same as the value returned by {@link Context#getFilesDir()
130 | * Context.getFilesDir()}.
131 | * 133 | *<external-path name="name" path="path" /> 134 | *135 | *
files/
subdirectory of this this root.
140 | * 143 | *<cache-path name="name" path="path" /> 144 | *145 | *
153 | * These child elements all use the same attributes: 154 | *
155 | *name="name"
158 | * path
attribute.
163 | * path="path"
166 | * name
attribute is a URI path
169 | * segment, the path
value is an actual subdirectory name. Notice that the
170 | * value refers to a subdirectory, not an individual file or files. You can't
171 | * share a single file by its file name, nor can you specify a subset of files using
172 | * wildcards.
173 | *
176 | * You must specify a child element of <paths>
for each directory that contains
177 | * files for which you want content URIs. For example, these XML elements specify two directories:
178 | *
179 | *<paths xmlns:android="http://schemas.android.com/apk/res/android"> 180 | * <files-path name="my_images" path="images/"/> 181 | * <files-path name="my_docs" path="docs/"/> 182 | *</paths> 183 | *184 | *
185 | * Put the <paths>
element and its children in an XML file in your project.
186 | * For example, you can add them to a new file called res/xml/file_paths.xml
.
187 | * To link this file to the FileProvider, add a
188 | * <meta-data> element
189 | * as a child of the <provider>
element that defines the FileProvider. Set the
190 | * <meta-data>
element's "android:name" attribute to
191 | * android.support.FILE_PROVIDER_PATHS
. Set the element's "android:resource" attribute
192 | * to @xml/file_paths
(notice that you don't specify the .xml
193 | * extension). For example:
194 | *
195 | *<provider 196 | * android:name="android.support.v4.content.FileProvider" 197 | * android:authorities="com.mydomain.fileprovider" 198 | * android:exported="false" 199 | * android:grantUriPermissions="true"> 200 | * <meta-data 201 | * android:name="android.support.FILE_PROVIDER_PATHS" 202 | * android:resource="@xml/file_paths" /> 203 | *</provider> 204 | *205 | *
207 | * To share a file with another app using a content URI, your app has to generate the content URI. 208 | * To generate the content URI, create a new {@link File} for the file, then pass the {@link File} 209 | * to {@link #getUriForFile(Context, String, File) getUriForFile()}. You can send the content URI 210 | * returned by {@link #getUriForFile(Context, String, File) getUriForFile()} to another app in an 211 | * {@link android.content.Intent}. The client app that receives the content URI can open the file 212 | * and access its contents by calling 213 | * {@link android.content.ContentResolver#openFileDescriptor(Uri, String) 214 | * ContentResolver.openFileDescriptor} to get a {@link ParcelFileDescriptor}. 215 | *
216 | * For example, suppose your app is offering files to other apps with a FileProvider that has the
217 | * authority com.mydomain.fileprovider
. To get a content URI for the file
218 | * default_image.jpg
in the images/
subdirectory of your internal storage
219 | * add the following code:
220 | *
221 | *File imagePath = new File(Context.getFilesDir(), "images"); 222 | *File newFile = new File(imagePath, "default_image.jpg"); 223 | *Uri contentUri = getUriForFile(getContext(), "com.mydomain.fileprovider", newFile); 224 | *225 | * As a result of the previous snippet, 226 | * {@link #getUriForFile(Context, String, File) getUriForFile()} returns the content URI 227 | *
content://com.mydomain.fileprovider/my_images/default_image.jpg
.
228 | * content://
236 | * {@link Uri}, using the desired mode flags. This grants temporary access permission for the
237 | * content URI to the specified package, according to the value of the
238 | * the mode_flags
parameter, which you can set to
239 | * {@link Intent#FLAG_GRANT_READ_URI_PERMISSION}, {@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION}
240 | * or both. The permission remains in effect until you revoke it by calling
241 | * {@link Context#revokeUriPermission(Uri, int) revokeUriPermission()} or until the device
242 | * reboots.
243 | * 257 | * Permissions granted in an {@link Intent} remain in effect while the stack of the receiving 258 | * {@link android.app.Activity} is active. When the stack finishes, the permissions are 259 | * automatically removed. Permissions granted to one {@link android.app.Activity} in a client 260 | * app are automatically extended to other components of that app. 261 | *
262 | *266 | * There are a variety of ways to serve the content URI for a file to a client app. One common way 267 | * is for the client app to start your app by calling 268 | * {@link android.app.Activity#startActivityForResult(Intent, int, Bundle) startActivityResult()}, 269 | * which sends an {@link Intent} to your app to start an {@link android.app.Activity} in your app. 270 | * In response, your app can immediately return a content URI to the client app or present a user 271 | * interface that allows the user to pick a file. In the latter case, once the user picks the file 272 | * your app can return its content URI. In both cases, your app returns the content URI in an 273 | * {@link Intent} sent via {@link android.app.Activity#setResult(int, Intent) setResult()}. 274 | *
275 | *276 | * You can also put the content URI in a {@link android.content.ClipData} object and then add the 277 | * object to an {@link Intent} you send to a client app. To do this, call 278 | * {@link Intent#setClipData(ClipData) Intent.setClipData()}. When you use this approach, you can 279 | * add multiple {@link android.content.ClipData} objects to the {@link Intent}, each with its own 280 | * content URI. When you call {@link Intent#setFlags(int) Intent.setFlags()} on the {@link Intent} 281 | * to set temporary access permissions, the same permissions are applied to all of the content 282 | * URIs. 283 | *
284 | *285 | * Note: The {@link Intent#setClipData(ClipData) Intent.setClipData()} method is 286 | * only available in platform version 16 (Android 4.1) and later. If you want to maintain 287 | * compatibility with previous versions, you should send one content URI at a time in the 288 | * {@link Intent}. Set the action to {@link Intent#ACTION_SEND} and put the URI in data by calling 289 | * {@link Intent#setData setData()}. 290 | *
291 | *293 | * To learn more about FileProvider, see the Android training class 294 | * Sharing Files Securely with URIs. 295 | *
296 | */ 297 | public class FileProvider extends ContentProvider { 298 | private static final String[] COLUMNS = { 299 | OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE }; 300 | private static final String 301 | META_DATA_FILE_PROVIDER_PATHS = "android.support.FILE_PROVIDER_PATHS"; 302 | private static final String TAG_ROOT_PATH = "root-path"; 303 | private static final String TAG_FILES_PATH = "files-path"; 304 | private static final String TAG_CACHE_PATH = "cache-path"; 305 | private static final String TAG_EXTERNAL = "external-path"; 306 | private static final String ATTR_NAME = "name"; 307 | private static final String ATTR_PATH = "path"; 308 | private static final File DEVICE_ROOT = new File("/"); 309 | // @GuardedBy("sCache") 310 | private static HashMapcontent
{@link Uri} for file paths defined in their <paths>
348 | * meta-data element. See the Class Overview for more information.
349 | *
350 | * @param context A {@link Context} for the current component.
351 | * @param authority The authority of a {@link FileProvider} defined in a
352 | * {@code <provider>} element in your app's manifest.
353 | * @param file A {@link File} pointing to the filename for which you want a
354 | * content
{@link Uri}.
355 | * @return A content URI for the file.
356 | * @throws IllegalArgumentException When the given {@link File} is outside
357 | * the paths supported by the provider.
358 | */
359 | public static Uri getUriForFile(Context context, String authority, File file) {
360 | final PathStrategy strategy = getPathStrategy(context, authority);
361 | return strategy.getUriForFile(file);
362 | }
363 | /**
364 | * Use a content URI returned by
365 | * {@link #getUriForFile(Context, String, File) getUriForFile()} to get information about a file
366 | * managed by the FileProvider.
367 | * FileProvider reports the column names defined in {@link android.provider.OpenableColumns}:
368 | * application/octet-stream
.
425 | */
426 | @Override
427 | public String getType(Uri uri) {
428 | // ContentProvider has already checked granted permissions
429 | final File file = mStrategy.getFileForUri(uri);
430 | final int lastDot = file.getName().lastIndexOf('.');
431 | if (lastDot >= 0) {
432 | final String extension = file.getName().substring(lastDot + 1);
433 | final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
434 | if (mime != null) {
435 | return mime;
436 | }
437 | }
438 | return "application/octet-stream";
439 | }
440 | /**
441 | * By default, this method throws an {@link java.lang.UnsupportedOperationException}. You must
442 | * subclass FileProvider if you want to provide different functionality.
443 | */
444 | @Override
445 | public Uri insert(Uri uri, ContentValues values) {
446 | throw new UnsupportedOperationException("No external inserts");
447 | }
448 | /**
449 | * By default, this method throws an {@link java.lang.UnsupportedOperationException}. You must
450 | * subclass FileProvider if you want to provide different functionality.
451 | */
452 | @Override
453 | public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
454 | throw new UnsupportedOperationException("No external updates");
455 | }
456 | /**
457 | * Deletes the file associated with the specified content URI, as
458 | * returned by {@link #getUriForFile(Context, String, File) getUriForFile()}. Notice that this
459 | * method does not throw an {@link java.io.IOException}; you must check its return value.
460 | *
461 | * @param uri A content URI for a file, as returned by
462 | * {@link #getUriForFile(Context, String, File) getUriForFile()}.
463 | * @param selection Ignored. Set to {@code null}.
464 | * @param selectionArgs Ignored. Set to {@code null}.
465 | * @return 1 if the delete succeeds; otherwise, 0.
466 | */
467 | @Override
468 | public int delete(Uri uri, String selection, String[] selectionArgs) {
469 | // ContentProvider has already checked granted permissions
470 | final File file = mStrategy.getFileForUri(uri);
471 | return file.delete() ? 1 : 0;
472 | }
473 | /**
474 | * By default, FileProvider automatically returns the
475 | * {@link ParcelFileDescriptor} for a file associated with a content://
476 | * {@link Uri}. To get the {@link ParcelFileDescriptor}, call
477 | * {@link android.content.ContentResolver#openFileDescriptor(Uri, String)
478 | * ContentResolver.openFileDescriptor}.
479 | *
480 | * To override this method, you must provide your own subclass of FileProvider.
481 | *
482 | * @param uri A content URI associated with a file, as returned by
483 | * {@link #getUriForFile(Context, String, File) getUriForFile()}.
484 | * @param mode Access mode for the file. May be "r" for read-only access, "rw" for read and
485 | * write access, or "rwt" for read and write access that truncates any existing file.
486 | * @return A new {@link ParcelFileDescriptor} with which you can access the file.
487 | */
488 | @Override
489 | public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
490 | // ContentProvider has already checked granted permissions
491 | SendReduced.log("openFile "+uri);
492 | final File file = mStrategy.getFileForUri(uri);
493 | final int fileMode = modeToMode(mode);
494 | return ParcelFileDescriptor.open(file, fileMode);
495 | }
496 | /**
497 | * Return {@link PathStrategy} for given authority, either by parsing or
498 | * returning from cache.
499 | */
500 | private static PathStrategy getPathStrategy(Context context, String authority) {
501 | PathStrategy strat;
502 | synchronized (sCache) {
503 | strat = sCache.get(authority);
504 | if (strat == null) {
505 | try {
506 | strat = parsePathStrategy(context, authority);
507 | } catch (IOException e) {
508 | throw new IllegalArgumentException(
509 | "Failed to parse " + META_DATA_FILE_PROVIDER_PATHS + " meta-data", e);
510 | } catch (XmlPullParserException e) {
511 | throw new IllegalArgumentException(
512 | "Failed to parse " + META_DATA_FILE_PROVIDER_PATHS + " meta-data", e);
513 | }
514 | sCache.put(authority, strat);
515 | }
516 | }
517 | return strat;
518 | }
519 | /**
520 | * Parse and return {@link PathStrategy} for given authority as defined in
521 | * {@link #META_DATA_FILE_PROVIDER_PATHS} {@code <meta-data>}.
522 | *
523 | * @see #getPathStrategy(Context, String)
524 | */
525 | private static PathStrategy parsePathStrategy(Context context, String authority)
526 | throws IOException, XmlPullParserException {
527 | final SimplePathStrategy strat = new SimplePathStrategy(authority);
528 | final ProviderInfo info = context.getPackageManager()
529 | .resolveContentProvider(authority, PackageManager.GET_META_DATA);
530 | final XmlResourceParser in = info.loadXmlMetaData(
531 | context.getPackageManager(), META_DATA_FILE_PROVIDER_PATHS);
532 | if (in == null) {
533 | throw new IllegalArgumentException(
534 | "Missing " + META_DATA_FILE_PROVIDER_PATHS + " meta-data");
535 | }
536 | int type;
537 | while ((type = in.next()) != END_DOCUMENT) {
538 | if (type == START_TAG) {
539 | final String tag = in.getName();
540 | final String name = in.getAttributeValue(null, ATTR_NAME);
541 | String path = in.getAttributeValue(null, ATTR_PATH);
542 | File target = null;
543 | if (TAG_ROOT_PATH.equals(tag)) {
544 | target = buildPath(DEVICE_ROOT, path);
545 | } else if (TAG_FILES_PATH.equals(tag)) {
546 | target = buildPath(context.getFilesDir(), path);
547 | } else if (TAG_CACHE_PATH.equals(tag)) {
548 | target = buildPath(context.getCacheDir(), path);
549 | } else if (TAG_EXTERNAL.equals(tag)) {
550 | target = buildPath(Environment.getExternalStorageDirectory(), path);
551 | }
552 | if (target != null) {
553 | strat.addRoot(name, target);
554 | }
555 | }
556 | }
557 | return strat;
558 | }
559 | /**
560 | * Strategy for mapping between {@link File} and {@link Uri}.
561 | * 562 | * Strategies must be symmetric so that mapping a {@link File} to a 563 | * {@link Uri} and then back to a {@link File} points at the original 564 | * target. 565 | *
566 | * Strategies must remain consistent across app launches, and not rely on 567 | * dynamic state. This ensures that any generated {@link Uri} can still be 568 | * resolved if your process is killed and later restarted. 569 | * 570 | * @see SimplePathStrategy 571 | */ 572 | interface PathStrategy { 573 | /** 574 | * Return a {@link Uri} that represents the given {@link File}. 575 | */ 576 | public Uri getUriForFile(File file); 577 | /** 578 | * Return a {@link File} that represents the given {@link Uri}. 579 | */ 580 | public File getFileForUri(Uri uri); 581 | } 582 | /** 583 | * Strategy that provides access to files living under a narrow whitelist of 584 | * filesystem roots. It will throw {@link SecurityException} if callers try 585 | * accessing files outside the configured roots. 586 | *
587 | * For example, if configured with
588 | * {@code addRoot("myfiles", context.getFilesDir())}, then
589 | * {@code context.getFileStreamPath("foo.txt")} would map to
590 | * {@code content://myauthority/myfiles/foo.txt}.
591 | */
592 | static class SimplePathStrategy implements PathStrategy {
593 | private final String mAuthority;
594 | private final HashMap
4 | Apache License
5 | Version 2.0, January 2004
6 | http://www.apache.org/licenses/
7 |
8 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9 |
10 | 1. Definitions.
11 |
12 | "License" shall mean the terms and conditions for use, reproduction,
13 | and distribution as defined by Sections 1 through 9 of this document.
14 |
15 | "Licensor" shall mean the copyright owner or entity authorized by
16 | the copyright owner that is granting the License.
17 |
18 | "Legal Entity" shall mean the union of the acting entity and all
19 | other entities that control, are controlled by, or are under common
20 | control with that entity. For the purposes of this definition,
21 | "control" means (i) the power, direct or indirect, to cause the
22 | direction or management of such entity, whether by contract or
23 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
24 | outstanding shares, or (iii) beneficial ownership of such entity.
25 |
26 | "You" (or "Your") shall mean an individual or Legal Entity
27 | exercising permissions granted by this License.
28 |
29 | "Source" form shall mean the preferred form for making modifications,
30 | including but not limited to software source code, documentation
31 | source, and configuration files.
32 |
33 | "Object" form shall mean any form resulting from mechanical
34 | transformation or translation of a Source form, including but
35 | not limited to compiled object code, generated documentation,
36 | and conversions to other media types.
37 |
38 | "Work" shall mean the work of authorship, whether in Source or
39 | Object form, made available under the License, as indicated by a
40 | copyright notice that is included in or attached to the work
41 | (an example is provided in the Appendix below).
42 |
43 | "Derivative Works" shall mean any work, whether in Source or Object
44 | form, that is based on (or derived from) the Work and for which the
45 | editorial revisions, annotations, elaborations, or other modifications
46 | represent, as a whole, an original work of authorship. For the purposes
47 | of this License, Derivative Works shall not include works that remain
48 | separable from, or merely link (or bind by name) to the interfaces of,
49 | the Work and Derivative Works thereof.
50 |
51 | "Contribution" shall mean any work of authorship, including
52 | the original version of the Work and any modifications or additions
53 | to that Work or Derivative Works thereof, that is intentionally
54 | submitted to Licensor for inclusion in the Work by the copyright owner
55 | or by an individual or Legal Entity authorized to submit on behalf of
56 | the copyright owner. For the purposes of this definition, "submitted"
57 | means any form of electronic, verbal, or written communication sent
58 | to the Licensor or its representatives, including but not limited to
59 | communication on electronic mailing lists, source code control systems,
60 | and issue tracking systems that are managed by, or on behalf of, the
61 | Licensor for the purpose of discussing and improving the Work, but
62 | excluding communication that is conspicuously marked or otherwise
63 | designated in writing by the copyright owner as "Not a Contribution."
64 |
65 | "Contributor" shall mean Licensor and any individual or Legal Entity
66 | on behalf of whom a Contribution has been received by Licensor and
67 | subsequently incorporated within the Work.
68 |
69 | 2. Grant of Copyright License. Subject to the terms and conditions of
70 | this License, each Contributor hereby grants to You a perpetual,
71 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72 | copyright license to reproduce, prepare Derivative Works of,
73 | publicly display, publicly perform, sublicense, and distribute the
74 | Work and such Derivative Works in Source or Object form.
75 |
76 | 3. Grant of Patent License. Subject to the terms and conditions of
77 | this License, each Contributor hereby grants to You a perpetual,
78 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79 | (except as stated in this section) patent license to make, have made,
80 | use, offer to sell, sell, import, and otherwise transfer the Work,
81 | where such license applies only to those patent claims licensable
82 | by such Contributor that are necessarily infringed by their
83 | Contribution(s) alone or by combination of their Contribution(s)
84 | with the Work to which such Contribution(s) was submitted. If You
85 | institute patent litigation against any entity (including a
86 | cross-claim or counterclaim in a lawsuit) alleging that the Work
87 | or a Contribution incorporated within the Work constitutes direct
88 | or contributory patent infringement, then any patent licenses
89 | granted to You under this License for that Work shall terminate
90 | as of the date such litigation is filed.
91 |
92 | 4. Redistribution. You may reproduce and distribute copies of the
93 | Work or Derivative Works thereof in any medium, with or without
94 | modifications, and in Source or Object form, provided that You
95 | meet the following conditions:
96 |
97 | (a) You must give any other recipients of the Work or
98 | Derivative Works a copy of this License; and
99 |
100 | (b) You must cause any modified files to carry prominent notices
101 | stating that You changed the files; and
102 |
103 | (c) You must retain, in the Source form of any Derivative Works
104 | that You distribute, all copyright, patent, trademark, and
105 | attribution notices from the Source form of the Work,
106 | excluding those notices that do not pertain to any part of
107 | the Derivative Works; and
108 |
109 | (d) If the Work includes a "NOTICE" text file as part of its
110 | distribution, then any Derivative Works that You distribute must
111 | include a readable copy of the attribution notices contained
112 | within such NOTICE file, excluding those notices that do not
113 | pertain to any part of the Derivative Works, in at least one
114 | of the following places: within a NOTICE text file distributed
115 | as part of the Derivative Works; within the Source form or
116 | documentation, if provided along with the Derivative Works; or,
117 | within a display generated by the Derivative Works, if and
118 | wherever such third-party notices normally appear. The contents
119 | of the NOTICE file are for informational purposes only and
120 | do not modify the License. You may add Your own attribution
121 | notices within Derivative Works that You distribute, alongside
122 | or as an addendum to the NOTICE text from the Work, provided
123 | that such additional attribution notices cannot be construed
124 | as modifying the License.
125 |
126 | You may add Your own copyright statement to Your modifications and
127 | may provide additional or different license terms and conditions
128 | for use, reproduction, or distribution of Your modifications, or
129 | for any such Derivative Works as a whole, provided Your use,
130 | reproduction, and distribution of the Work otherwise complies with
131 | the conditions stated in this License.
132 |
133 | 5. Submission of Contributions. Unless You explicitly state otherwise,
134 | any Contribution intentionally submitted for inclusion in the Work
135 | by You to the Licensor shall be under the terms and conditions of
136 | this License, without any additional terms or conditions.
137 | Notwithstanding the above, nothing herein shall supersede or modify
138 | the terms of any separate license agreement you may have executed
139 | with Licensor regarding such Contributions.
140 |
141 | 6. Trademarks. This License does not grant permission to use the trade
142 | names, trademarks, service marks, or product names of the Licensor,
143 | except as required for reasonable and customary use in describing the
144 | origin of the Work and reproducing the content of the NOTICE file.
145 |
146 | 7. Disclaimer of Warranty. Unless required by applicable law or
147 | agreed to in writing, Licensor provides the Work (and each
148 | Contributor provides its Contributions) on an "AS IS" BASIS,
149 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150 | implied, including, without limitation, any warranties or conditions
151 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152 | PARTICULAR PURPOSE. You are solely responsible for determining the
153 | appropriateness of using or redistributing the Work and assume any
154 | risks associated with Your exercise of permissions under this License.
155 |
156 | 8. Limitation of Liability. In no event and under no legal theory,
157 | whether in tort (including negligence), contract, or otherwise,
158 | unless required by applicable law (such as deliberate and grossly
159 | negligent acts) or agreed to in writing, shall any Contributor be
160 | liable to You for damages, including any direct, indirect, special,
161 | incidental, or consequential damages of any character arising as a
162 | result of this License or out of the use or inability to use the
163 | Work (including but not limited to damages for loss of goodwill,
164 | work stoppage, computer failure or malfunction, or any and all
165 | other commercial damages or losses), even if such Contributor
166 | has been advised of the possibility of such damages.
167 |
168 | 9. Accepting Warranty or Additional Liability. While redistributing
169 | the Work or Derivative Works thereof, You may choose to offer,
170 | and charge a fee for, acceptance of support, warranty, indemnity,
171 | or other liability obligations and/or rights consistent with this
172 | License. However, in accepting such obligations, You may act only
173 | on Your own behalf and on Your sole responsibility, not on behalf
174 | of any other Contributor, and only if You agree to indemnify,
175 | defend, and hold each Contributor harmless for any liability
176 | incurred by, or claims asserted against, such Contributor by reason
177 | of your accepting any such warranty or additional liability.
178 |
179 | END OF TERMS AND CONDITIONS
180 |
181 | APPENDIX: How to apply the Apache License to your work.
182 |
183 | To apply the Apache License to your work, attach the following
184 | boilerplate notice, with the fields enclosed by brackets "[]"
185 | replaced with your own identifying information. (Don't include
186 | the brackets!) The text should be enclosed in the appropriate
187 | comment syntax for the file format. We also recommend that a
188 | file or class name and description of purpose be included on the
189 | same "printed page" as the copyright notice for easier
190 | identification within third-party archives.
191 |
192 | Copyright [yyyy] [name of copyright owner]
193 |
194 | Licensed under the Apache License, Version 2.0 (the "License");
195 | you may not use this file except in compliance with the License.
196 | You may obtain a copy of the License at
197 |
198 | http://www.apache.org/licenses/LICENSE-2.0
199 |
200 | Unless required by applicable law or agreed to in writing, software
201 | distributed under the License is distributed on an "AS IS" BASIS,
202 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203 | See the License for the specific language governing permissions and
204 | limitations under the License.
205 |
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | ## This file must *NOT* be checked into Version Control Systems,
2 | # as it contains information specific to your local configuration.
3 | #
4 | # Location of the SDK. This is only used by Gradle.
5 | #
6 | #Sat Apr 24 11:17:59 CDT 2021
7 | sdk.dir=C\:\\Users\\Alexander\\AppData\\Local\\Android\\Sdk
8 |
--------------------------------------------------------------------------------
/scale.sh:
--------------------------------------------------------------------------------
1 | R=SendReduced/src/$1/res
2 | convert images/Lens_and_wavefronts$1.png -resize 114x114 icon114$1.png
3 | convert images/Lens_and_wavefronts$1.png -resize 135x135 icon135$1.png
4 | convert images/Lens_and_wavefronts$1.png -resize 512x512 icon512$1.png
5 | convert images/Lens_and_wavefronts$1.png -resize 144x144 $R/drawable-xxhdpi/icon.png
6 | convert images/Lens_and_wavefronts$1.png -resize 96x96 $R/drawable-xhdpi/icon.png
7 | convert images/Lens_and_wavefronts$1.png -resize 72x72 $R/drawable-hdpi/icon.png
8 | convert images/Lens_and_wavefronts$1.png -resize 72x72 $R/drawable-hdpi/icon.png
9 | convert images/Lens_and_wavefronts$1.png -resize 48x48 $R/drawable-mdpi/icon.png
10 | convert images/Lens_and_wavefronts$1.png -resize 32x32 $R/drawable-ldpi/icon.png
11 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':SendReduced'
2 |
--------------------------------------------------------------------------------