35
35
import com .loopj .android .http .ResponseHandlerInterface ;
36
36
import com .loopj .android .http .sample .util .SampleJSON ;
37
37
import java .util .List ;
38
+ import java .util .Locale ;
38
39
import org .apache .http .Header ;
39
40
import org .apache .http .HttpEntity ;
40
41
import org .apache .http .message .BasicHeader ;
44
45
*
45
46
* @author Noor Dawod <[email protected] >
46
47
*/
47
- public class Http401Auth extends GetSample {
48
+ public class Http401AuthSample extends GetSample {
48
49
49
50
private static final String LOG_TAG = "Http401Auth" ;
50
51
private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate" ;
@@ -129,7 +130,7 @@ public void onFailure(int statusCode, Header[] headers, Throwable throwable, Str
129
130
String headerName = header .getName ();
130
131
if (HEADER_WWW_AUTHENTICATE .equalsIgnoreCase (headerName )) {
131
132
String headerValue = header .getValue ().trim ();
132
- String headerValueLowerCase = headerValue .toLowerCase ();
133
+ String headerValueLowerCase = headerValue .toLowerCase (Locale . US );
133
134
134
135
// Get the type of auth requested.
135
136
int charPos = headerValueLowerCase .indexOf (' ' );
@@ -175,7 +176,9 @@ private class DialogRunnable implements Runnable, DialogInterface.OnClickListene
175
176
176
177
public DialogRunnable (String realm ) {
177
178
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 );
179
182
180
183
// Update the preface text with correct credentials.
181
184
TextView preface = (TextView )dialogView .findViewById (R .id .label_credentials );
@@ -187,7 +190,7 @@ public DialogRunnable(String realm) {
187
190
188
191
@ Override
189
192
public void run () {
190
- AlertDialog .Builder builder = new AlertDialog .Builder (Http401Auth .this );
193
+ AlertDialog .Builder builder = new AlertDialog .Builder (Http401AuthSample .this );
191
194
builder .setTitle (realm );
192
195
builder .setView (dialogView );
193
196
builder .setPositiveButton (android .R .string .ok , this );
0 commit comments