Skip to content

Commit 0897e54

Browse files
committed
lint fixes for api 14
1 parent dbfd73a commit 0897e54

File tree

11 files changed

+41
-195
lines changed

11 files changed

+41
-195
lines changed

sample/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
android:fullBackupContent="true"
1414
android:icon="@drawable/ic_launcher"
1515
android:label="@string/app_name"
16-
android:theme="@style/AppTheme">
16+
android:theme="@style/AppBaseTheme">
1717

1818
<activity android:name=".WaypointsActivity">
1919
<intent-filter>

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
import cz.msebera.android.httpclient.message.BasicHeader;
5757
import cz.msebera.android.httpclient.protocol.HttpContext;
5858

59-
import static android.os.Build.VERSION.SDK_INT;
60-
6159
public abstract class SampleParentActivity extends Activity implements SampleInterface {
6260

6361
protected static final String PROTOCOL_HTTP = "http://";
@@ -415,9 +413,7 @@ public void setAsyncHttpClient(AsyncHttpClient client) {
415413
}
416414

417415
private void setHomeAsUpEnabled() {
418-
if (SDK_INT >= 11) {
419-
if (getActionBar() != null)
420-
getActionBar().setDisplayHomeAsUpEnabled(true);
421-
}
416+
if (getActionBar() != null)
417+
getActionBar().setDisplayHomeAsUpEnabled(true);
422418
}
423419
}

sample/src/main/res/layout-v14/parent_layout.xml

Lines changed: 0 additions & 108 deletions
This file was deleted.

sample/src/main/res/layout/parent_layout.xml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,35 @@
1313

1414
<requestFocus />
1515

16+
<EditText
17+
android:id="@+id/edit_url"
18+
android:layout_width="fill_parent"
19+
android:layout_height="wrap_content"
20+
android:hint="@string/label_url_address"
21+
android:importantForAutofill="no"
22+
android:inputType="textUri" />
23+
1624
<LinearLayout
1725
android:id="@+id/layout_url"
1826
android:layout_width="fill_parent"
1927
android:layout_height="wrap_content"
2028
android:orientation="horizontal">
2129

22-
<EditText
23-
android:id="@+id/edit_url"
24-
android:layout_width="0dp"
30+
<Button
31+
android:id="@+id/button_cancel"
32+
style="?android:attr/buttonBarButtonStyle"
33+
android:layout_width="wrap_content"
2534
android:layout_height="wrap_content"
2635
android:layout_weight="1"
27-
android:hint="@string/label_url_address"
28-
android:inputType="textUri"
29-
android:importantForAutofill="no" />
36+
android:text="@string/button_cancel" />
3037

3138
<Button
3239
android:id="@+id/button_run"
40+
style="?android:attr/buttonBarButtonStyle"
3341
android:layout_width="wrap_content"
3442
android:layout_height="wrap_content"
43+
android:layout_weight="1"
3544
android:text="@string/button_run" />
36-
37-
<Button
38-
android:id="@+id/button_cancel"
39-
android:layout_width="wrap_content"
40-
android:layout_height="wrap_content"
41-
android:text="@string/button_cancel"
42-
android:visibility="gone" />
4345
</LinearLayout>
4446

4547
<LinearLayout
@@ -56,13 +58,13 @@
5658

5759
<EditText
5860
android:id="@+id/edit_headers"
59-
android:hint="@string/label_headers"
6061
android:layout_width="fill_parent"
6162
android:layout_height="wrap_content"
63+
android:hint="@string/label_headers"
64+
android:importantForAutofill="no"
6265
android:inputType="textMultiLine"
6366
android:minLines="3"
64-
android:singleLine="false"
65-
android:importantForAutofill="no" />
67+
android:singleLine="false" />
6668

6769
</LinearLayout>
6870

@@ -75,17 +77,18 @@
7577
<TextView
7678
android:layout_width="fill_parent"
7779
android:layout_height="wrap_content"
80+
android:labelFor="@id/edit_body"
7881
android:text="@string/label_req_body" />
7982

8083
<EditText
8184
android:id="@+id/edit_body"
8285
android:layout_width="fill_parent"
8386
android:layout_height="wrap_content"
87+
android:hint="@string/label_req_body"
88+
android:importantForAutofill="no"
8489
android:inputType="textMultiLine"
8590
android:minLines="3"
86-
android:hint="@string/label_req_body"
87-
android:singleLine="false"
88-
android:importantForAutofill="no" />
91+
android:singleLine="false" />
8992

9093
</LinearLayout>
9194

sample/src/main/res/values-v11/colors.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

sample/src/main/res/values-v11/styles.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

sample/src/main/res/values-v14/colors.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

sample/src/main/res/values-v14/styles.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

sample/src/main/res/values/colors.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<resources>
22

3-
<color name="dialog_color">#FFFFFFFF</color>
3+
<color name="dialog_color">#FF333333</color>
44

55
</resources>

sample/src/main/res/values/styles.xml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
<resources>
22

33
<!--
4-
Base application theme, dependent on API level. This theme is replaced
5-
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
4+
Base application theme for API 14+. This theme completely replaces
5+
AppBaseTheme from BOTH res/values/styles.xml and
6+
res/values-v11/styles.xml on API 14+ devices.
67
-->
7-
<style name="AppBaseTheme" parent="android:Theme.Light">
8-
<!--
9-
Theme customizations available in newer API levels can go in
10-
res/values-vXX/styles.xml, while customizations related to
11-
backward-compatibility can go here.
12-
-->
13-
</style>
14-
15-
<!-- Application theme. -->
16-
<style name="AppTheme" parent="AppBaseTheme">
17-
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
8+
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
9+
<!-- API 14 theme customizations can go here. -->
1810
</style>
1911

2012
</resources>

sample/src/standard/java/com/loopj/android/http/sample/SampleApplication.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import android.os.StrictMode;
77
import android.util.Log;
88

9-
import static android.os.Build.VERSION.SDK_INT;
10-
119
public class SampleApplication extends Application {
1210

1311
private static final String LOG_TAG = "SampleApplication";
@@ -20,17 +18,15 @@ public void onCreate() {
2018

2119
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
2220
private void setStrictMode() {
23-
if (SDK_INT > 3) {
24-
Log.d(LOG_TAG, "Enabling StrictMode policy over Sample application");
25-
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
26-
.detectAll()
27-
.penaltyLog()
28-
.permitDiskReads()
29-
.build());
30-
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
31-
.detectAll()
32-
.penaltyLog()
33-
.build());
34-
}
21+
Log.d(LOG_TAG, "Enabling StrictMode policy over Sample application");
22+
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
23+
.detectAll()
24+
.penaltyLog()
25+
.permitDiskReads()
26+
.build());
27+
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
28+
.detectAll()
29+
.penaltyLog()
30+
.build());
3531
}
3632
}

0 commit comments

Comments
 (0)