Skip to content

Commit 1e64da7

Browse files
author
Noor Dawod
committed
Fixed LINT issues + renamed Http401Auth class.
1 parent 34331df commit 1e64da7

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

sample/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<activity android:name=".CustomCASample"/>
3636
<activity android:name=".RetryRequestSample"/>
3737
<activity android:name=".RangeResponseSample"/>
38-
<activity android:name=".Http401Auth"/>
38+
<activity android:name=".Http401AuthSample"/>
3939

4040
<service android:name=".services.ExampleIntentService"/>
4141
</application>

sample/src/main/java/com/loopj/android/http/sample/Http401Auth.java renamed to sample/src/main/java/com/loopj/android/http/sample/Http401AuthSample.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.loopj.android.http.ResponseHandlerInterface;
3636
import com.loopj.android.http.sample.util.SampleJSON;
3737
import java.util.List;
38+
import java.util.Locale;
3839
import org.apache.http.Header;
3940
import org.apache.http.HttpEntity;
4041
import org.apache.http.message.BasicHeader;
@@ -44,7 +45,7 @@
4445
*
4546
* @author Noor Dawod <[email protected]>
4647
*/
47-
public class Http401Auth extends GetSample {
48+
public class Http401AuthSample extends GetSample {
4849

4950
private static final String LOG_TAG = "Http401Auth";
5051
private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
@@ -129,7 +130,7 @@ public void onFailure(int statusCode, Header[] headers, Throwable throwable, Str
129130
String headerName = header.getName();
130131
if (HEADER_WWW_AUTHENTICATE.equalsIgnoreCase(headerName)) {
131132
String headerValue = header.getValue().trim();
132-
String headerValueLowerCase = headerValue.toLowerCase();
133+
String headerValueLowerCase = headerValue.toLowerCase(Locale.US);
133134

134135
// Get the type of auth requested.
135136
int charPos = headerValueLowerCase.indexOf(' ');
@@ -175,7 +176,9 @@ private class DialogRunnable implements Runnable, DialogInterface.OnClickListene
175176

176177
public DialogRunnable(String realm) {
177178
this.realm = realm;
178-
this.dialogView = LayoutInflater.from(Http401Auth.this).inflate(R.layout.credentials, null);
179+
this.dialogView = LayoutInflater
180+
.from(Http401AuthSample.this)
181+
.inflate(R.layout.credentials, null, false);
179182

180183
// Update the preface text with correct credentials.
181184
TextView preface = (TextView)dialogView.findViewById(R.id.label_credentials);
@@ -187,7 +190,7 @@ public DialogRunnable(String realm) {
187190

188191
@Override
189192
public void run() {
190-
AlertDialog.Builder builder = new AlertDialog.Builder(Http401Auth.this);
193+
AlertDialog.Builder builder = new AlertDialog.Builder(Http401AuthSample.this);
191194
builder.setTitle(realm);
192195
builder.setView(dialogView);
193196
builder.setPositiveButton(android.R.string.ok, this);

sample/src/main/java/com/loopj/android/http/sample/WaypointsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class WaypointsActivity extends ListActivity {
5151
new SampleConfig(R.string.title_custom_ca, CustomCASample.class),
5252
new SampleConfig(R.string.title_retry_handler, RetryRequestSample.class),
5353
new SampleConfig(R.string.title_range_sample, RangeResponseSample.class),
54-
new SampleConfig(R.string.title_401_unauth, Http401Auth.class)
54+
new SampleConfig(R.string.title_401_unauth, Http401AuthSample.class)
5555
};
5656

5757
@Override

0 commit comments

Comments
 (0)