Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c594cc

Browse files
committed
Updated project settings for Android API 20
1 parent c047d57 commit 4c594cc

File tree

4 files changed

+34
-30
lines changed

4 files changed

+34
-30
lines changed

AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<uses-sdk
1111
android:minSdkVersion="8"
12-
android:targetSdkVersion="19" />
12+
android:targetSdkVersion="20" />
1313

1414
<application
1515
android:allowBackup="true"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add the following:
3434
<service
3535
android:name="com.alexbbb.uploadservice.UploadService"
3636
android:enabled="true"
37-
android:exported="true" >
37+
android:exported="false" >
3838
<intent-filter>
3939
<action android:name="com.alexbbb.uploadservice.action.upload"/>
4040
</intent-filter>

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
mavenCentral()
44
}
55
dependencies {
6-
classpath 'com.android.tools.build:gradle:0.8.+'
6+
classpath 'com.android.tools.build:gradle:0.12.+'
77
}
88
}
99
apply plugin: 'android-library'
@@ -14,7 +14,7 @@ dependencies {
1414

1515
android {
1616
compileSdkVersion 19
17-
buildToolsVersion "19.1.0"
17+
buildToolsVersion "20.0.0"
1818

1919
sourceSets {
2020
main {

src/com/alexbbb/uploadservice/UploadRequest.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
/**
1111
* Represents an upload request.
12-
*
12+
*
1313
* @author alexbbb (Alex Gotev)
1414
* @author eliasnaur
15-
*
15+
*
1616
*/
1717
public class UploadRequest {
1818

@@ -29,13 +29,13 @@ public class UploadRequest {
2929
* Creates a new upload request.
3030
*
3131
* @param context application context
32-
* @param uploadId unique ID to assign to this upload request.
33-
* It's used in the broadcast receiver when receiving updates.
32+
* @param uploadId unique ID to assign to this upload request. It's used in the broadcast receiver when receiving
33+
* updates.
3434
* @param serverUrl URL of the server side script that handles the multipart form upload
3535
*/
3636
public UploadRequest(final Context context, final String uploadId, final String serverUrl) {
3737
this.context = context;
38-
this.uploadId = uploadId;
38+
this.uploadId = uploadId;
3939
notificationConfig = new UploadNotificationConfig();
4040
url = serverUrl;
4141
filesToUpload = new ArrayList<FileToUpload>();
@@ -49,26 +49,19 @@ public UploadRequest(final Context context, final String uploadId, final String
4949
* @param iconResourceID ID of the notification icon. You can use your own app's R.drawable.your_resource
5050
* @param title Notification title
5151
* @param message Text displayed in the notification when the upload is in progress
52-
* @param completed Text displayed in the notification then the upload is completed successfully
52+
* @param completed Text displayed in the notification when the upload is completed successfully
5353
* @param error Text displayed in the notification when an error occurs
54-
* @param autoClearOnSuccess true if you want to automatically clear the notification when the upload gets
55-
* completed successfully
56-
*/
57-
public void setNotificationConfig(final int iconResourceID,
58-
final String title,
59-
final String message,
60-
final String completed,
61-
final String error,
62-
final boolean autoClearOnSuccess) {
63-
notificationConfig = new UploadNotificationConfig(iconResourceID,
64-
title, message,
65-
completed, error,
54+
* @param autoClearOnSuccess true if you want to automatically clear the notification when the upload gets completed
55+
* successfully
56+
*/
57+
public void setNotificationConfig(final int iconResourceID, final String title, final String message,
58+
final String completed, final String error, final boolean autoClearOnSuccess) {
59+
notificationConfig = new UploadNotificationConfig(iconResourceID, title, message, completed, error,
6660
autoClearOnSuccess);
6761
}
6862

6963
/**
70-
* Validates the upload request and throws exceptions if one or more parameters
71-
* are not properly set.
64+
* Validates the upload request and throws exceptions if one or more parameters are not properly set.
7265
*
7366
* @throws IllegalArgumentException if request protocol or URL are not correctly set
7467
* @throws MalformedURLException if the provided server URL is not valid
@@ -82,7 +75,7 @@ public void validate() throws IllegalArgumentException, MalformedURLException {
8275
throw new IllegalArgumentException("Specify either http:// or https:// as protocol");
8376
}
8477

85-
//Check if the URL is valid
78+
// Check if the URL is valid
8679
new URL(url);
8780

8881
if (filesToUpload.isEmpty()) {
@@ -92,21 +85,20 @@ public void validate() throws IllegalArgumentException, MalformedURLException {
9285

9386
/**
9487
* Adds a file to this upload request.
88+
*
9589
* @param path Absolute path to the file that you want to upload
9690
* @param parameterName Name of the form parameter that will contain file's data
9791
* @param fileName File name seen by the server side script
98-
* @param contentType Content type of the file. Set this to null if you don't want to
99-
* set a content type.
92+
* @param contentType Content type of the file. Set this to null if you don't want to set a content type.
10093
*/
101-
public void addFileToUpload(final String path,
102-
final String parameterName,
103-
final String fileName,
94+
public void addFileToUpload(final String path, final String parameterName, final String fileName,
10495
final String contentType) {
10596
filesToUpload.add(new FileToUpload(path, parameterName, fileName, contentType));
10697
}
10798

10899
/**
109100
* Adds a header to this upload request.
101+
*
110102
* @param headerName header name
111103
* @param headerValue header value
112104
*/
@@ -116,6 +108,7 @@ public void addHeader(final String headerName, final String headerValue) {
116108

117109
/**
118110
* Adds a parameter to this upload request.
111+
*
119112
* @param paramName parameter name
120113
* @param paramValue parameter value
121114
*/
@@ -125,6 +118,7 @@ public void addParameter(final String paramName, final String paramValue) {
125118

126119
/**
127120
* Adds a parameter with multiple values to this upload request.
121+
*
128122
* @param paramName parameter name
129123
* @param array values
130124
*/
@@ -136,6 +130,7 @@ public void addArrayParameter(final String paramName, final String... array) {
136130

137131
/**
138132
* Adds a parameter with multiple values to this upload request.
133+
*
139134
* @param paramName parameter name
140135
* @param list values
141136
*/
@@ -147,6 +142,7 @@ public void addArrayParameter(final String paramName, final List<String> list) {
147142

148143
/**
149144
* Sets the HTTP method to use. By default it's set to POST.
145+
*
150146
* @param method new HTTP method to use
151147
*/
152148
public void setMethod(final String method) {
@@ -156,6 +152,7 @@ public void setMethod(final String method) {
156152

157153
/**
158154
* Gets the HTTP method to use.
155+
*
159156
* @return
160157
*/
161158
protected String getMethod() {
@@ -164,6 +161,7 @@ protected String getMethod() {
164161

165162
/**
166163
* Gets the upload ID of this request.
164+
*
167165
* @return
168166
*/
169167
protected String getUploadId() {
@@ -172,6 +170,7 @@ protected String getUploadId() {
172170

173171
/**
174172
* Gets the URL of the server side script that will handle the multipart form upload.
173+
*
175174
* @return
176175
*/
177176
protected String getServerUrl() {
@@ -180,6 +179,7 @@ protected String getServerUrl() {
180179

181180
/**
182181
* Gets the list of the files that has to be uploaded.
182+
*
183183
* @return
184184
*/
185185
protected ArrayList<FileToUpload> getFilesToUpload() {
@@ -188,6 +188,7 @@ protected ArrayList<FileToUpload> getFilesToUpload() {
188188

189189
/**
190190
* Gets the list of the headers.
191+
*
191192
* @return
192193
*/
193194
protected ArrayList<NameValue> getHeaders() {
@@ -196,6 +197,7 @@ protected ArrayList<NameValue> getHeaders() {
196197

197198
/**
198199
* Gets the list of the parameters.
200+
*
199201
* @return
200202
*/
201203
protected ArrayList<NameValue> getParameters() {
@@ -204,6 +206,7 @@ protected ArrayList<NameValue> getParameters() {
204206

205207
/**
206208
* Gets the upload notification configuration.
209+
*
207210
* @return
208211
*/
209212
protected UploadNotificationConfig getNotificationConfig() {
@@ -212,6 +215,7 @@ protected UploadNotificationConfig getNotificationConfig() {
212215

213216
/**
214217
* Gets the application context.
218+
*
215219
* @return
216220
*/
217221
protected Context getContext() {

0 commit comments

Comments
 (0)