Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amitshekhariitbhu committed Jan 30, 2017
1 parent 856abba commit d353a49
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package="com.networking">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".MyApplication"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* * Copyright (C) 2016 Amit Shekhar
* * Copyright (C) 2011 Android Open Source Project
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package com.rx2androidnetworking;

import android.graphics.Bitmap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* * Copyright (C) 2016 Amit Shekhar
* * Copyright (C) 2011 Android Open Source Project
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package com.rx2androidnetworking;

import android.net.TrafficStats;
Expand Down Expand Up @@ -92,7 +111,7 @@ public static <T> Observable<T> generateSimpleObservable(Rx2ANRequest request) {
request.setCall(InternalNetworking.sHttpClient.newCall(okHttpRequest));
}
ANLog.d("call generated successfully for simple observable");
return new SimpleANObservable<T>(request);
return new SimpleANObservable<>(request);
}

public static <T> Observable<T> generateDownloadObservable(final Rx2ANRequest request) {
Expand Down Expand Up @@ -158,7 +177,7 @@ protected void subscribeActual(Observer<? super T> observer) {
observer.onSubscribe(new ANDisposable(this.call));
boolean dontSwallowError = false;
Response okHttpResponse = null;
try{
try {
ANLog.d("initiate simple network call observable");
final long startTime = System.currentTimeMillis();
final long startBytes = TrafficStats.getTotalRxBytes();
Expand Down Expand Up @@ -329,7 +348,7 @@ static final class MultipartANObservable<T> extends Observable<T> {

@Override
protected void subscribeActual(Observer<? super T> observer) {
boolean dontSwallowError = false;
boolean doNotSwallowError = false;
Response okHttpResponse = null;
Request okHttpRequest;
try {
Expand Down Expand Up @@ -385,7 +404,7 @@ protected void subscribeActual(Observer<? super T> observer) {
observer.onNext(response.getResult());
}
if (!request.getCall().isCanceled()) {
dontSwallowError = true;
doNotSwallowError = true;
observer.onComplete();
}
}
Expand All @@ -396,7 +415,7 @@ protected void subscribeActual(Observer<? super T> observer) {
}
} catch (Exception e) {
Exceptions.throwIfFatal(e);
if (dontSwallowError) {
if (doNotSwallowError) {
RxJavaPlugins.onError(e);
} else if (!request.getCall().isCanceled()) {
try {
Expand Down
2 changes: 1 addition & 1 deletion rx2sampleapp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.rx2sampleapp">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".Rx2MyApplication"
Expand Down
2 changes: 1 addition & 1 deletion rxsampleapp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package="com.rxsampleapp">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".RxMyApplication"
Expand Down

0 comments on commit d353a49

Please sign in to comment.