Skip to content

Commit 62871a8

Browse files
committed
Remove compatibility code for JellyBean, fix Lint warnings
1 parent 74ad17f commit 62871a8

22 files changed

+29
-65
lines changed

app/src/main/java/de/Maxr1998/xposed/maxlock/hooks/SystemUI.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
package de.Maxr1998.xposed.maxlock.hooks;
1919

20+
import android.annotation.TargetApi;
2021
import android.content.Intent;
2122
import android.content.SharedPreferences;
22-
import android.graphics.Bitmap;
2323
import android.graphics.Canvas;
2424
import android.graphics.Color;
2525
import android.graphics.Paint;
@@ -69,6 +69,7 @@ protected void afterHookedMethod(MethodHookParam param) {
6969
}
7070
});
7171
findAndHookMethod(PACKAGE_NAME + ".recents.views.TaskViewThumbnail", lPParam.classLoader, "onDraw", Canvas.class, new XC_MethodHook() {
72+
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
7273
@Override
7374
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
7475
if (Boolean.TRUE.equals(((View) param.thisObject).getTag())) {
@@ -87,7 +88,7 @@ protected void beforeHookedMethod(MethodHookParam param) {
8788
if (iModActive(packageName, prefsApps, prefsHistory))
8889
return;
8990
if (prefs.getBoolean(Common.HIDE_RECENTS_THUMBNAILS, false) && prefsApps.getBoolean(packageName, false)) {
90-
param.setResult(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? new ColorDrawable(color.getAsColor()) : Bitmap.createBitmap(new int[]{color.getAsColor()}, 1, 1, Bitmap.Config.RGB_565));
91+
param.setResult(new ColorDrawable(color.getAsColor()));
9192
}
9293
}
9394
});

app/src/main/java/de/Maxr1998/xposed/maxlock/preference/ExpandingLicensePreference.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package de.Maxr1998.xposed.maxlock.preference;
1919

2020
import android.content.Context;
21-
import android.os.Build;
2221
import android.preference.Preference;
2322
import android.support.annotation.NonNull;
2423
import android.util.AttributeSet;
@@ -63,9 +62,7 @@ protected void onClick() {
6362
int endMargin = view.getResources().getDimensionPixelSize(R.dimen.preference_margin) * 2;
6463
titleContainerParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
6564
titleContainerParams.rightMargin = endMargin;
66-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
67-
titleContainerParams.setMarginEnd(endMargin);
68-
}
65+
titleContainerParams.setMarginEnd(endMargin);
6966
view.setOrientation(LinearLayout.VERTICAL);
7067
licenseTextView.setVisibility(View.VISIBLE);
7168
break;
@@ -74,9 +71,7 @@ protected void onClick() {
7471
titleContainerParams.width = 0;
7572
titleContainerParams.weight = 1;
7673
titleContainerParams.rightMargin = 0;
77-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
78-
titleContainerParams.setMarginEnd(0);
79-
}
74+
titleContainerParams.setMarginEnd(0);
8075
view.setOrientation(LinearLayout.HORIZONTAL);
8176
expandIcon.setVisibility(View.VISIBLE);
8277
break;

app/src/main/java/de/Maxr1998/xposed/maxlock/preference/SeekBarPreference.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.content.Context;
44
import android.content.res.TypedArray;
5-
import android.os.Build;
65
import android.preference.Preference;
76
import android.support.annotation.NonNull;
87
import android.support.v7.widget.AppCompatSeekBar;
@@ -76,9 +75,7 @@ protected View onCreateView(ViewGroup v) {
7675
LinearLayout.LayoutParams textContainer = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
7776
int endMargin = (int) (16 * view.getContext().getResources().getDisplayMetrics().density);
7877
textContainer.setMargins(0, 0, endMargin, 0);
79-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
80-
textContainer.setMarginEnd(endMargin);
81-
}
78+
textContainer.setMarginEnd(endMargin);
8279
layout.getChildAt(0).setLayoutParams(textContainer);
8380
return view;
8481
}

app/src/main/java/de/Maxr1998/xposed/maxlock/ui/SettingsActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ protected void onStart() {
249249
@Override
250250
protected void onResume() {
251251
super.onResume();
252-
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
252+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
253253
StatusBarTintApi.sendColorChangeIntent(ContextCompat.getColor(this, R.color.primary_red_dark), -3, Color.BLACK, -3, this);
254254
}
255255
}

app/src/main/java/de/Maxr1998/xposed/maxlock/ui/settings/DonateActivity.kt

+1-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import android.content.ComponentName
2323
import android.content.Context
2424
import android.content.Loader
2525
import android.graphics.Color
26-
import android.os.Build
2726
import android.os.Bundle
2827
import android.os.Handler
2928
import android.support.customtabs.*
@@ -131,11 +130,7 @@ class DonateActivity : AppCompatActivity(), LoaderManager.LoaderCallbacks<Billin
131130
return v
132131
}
133132
tv.text = productName
134-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
135-
tv.setCompoundDrawablesRelativeWithIntrinsicBounds(productIcons[position], 0, 0, 0)
136-
} else {
137-
tv.setCompoundDrawablesWithIntrinsicBounds(productIcons[position], 0, 0, 0)
138-
}
133+
tv.setCompoundDrawablesRelativeWithIntrinsicBounds(productIcons[position], 0, 0, 0)
139134
tv.compoundDrawablePadding = Util.dpToPx(this@DonateActivity, 12)
140135
return v
141136
}

app/src/main/java/de/Maxr1998/xposed/maxlock/ui/settings/applist/AppListAdapter.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import android.content.pm.ApplicationInfo;
2727
import android.content.pm.PackageManager;
2828
import android.os.AsyncTask;
29-
import android.os.Build;
3029
import android.os.Bundle;
3130
import android.support.annotation.NonNull;
3231
import android.support.v4.app.Fragment;
@@ -324,9 +323,7 @@ private static class ActivityListViewHolder extends RecyclerView.ViewHolder {
324323
ActivityListViewHolder(View itemView) {
325324
super(itemView);
326325
switchCompat = itemView.findViewById(R.id.activity_switch);
327-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
328-
switchCompat.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
329-
}
326+
switchCompat.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
330327
}
331328
}
332329

app/src/main/java/de/Maxr1998/xposed/maxlock/util/NotificationHelper.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ public static void postIModNotification(Context context) {
7272
.setSmallIcon(R.drawable.ic_apps_24dp)
7373
.setContentIntent(PendingIntent.getActivity(context.getApplicationContext(), 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT))
7474
.setOngoing(true)
75-
.setAutoCancel(true);
76-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
77-
builder.setShowWhen(false);
78-
}
75+
.setAutoCancel(true)
76+
.setShowWhen(false);
7977
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
8078
builder.setPriority(NotificationCompat.PRIORITY_MIN)
8179
.setCategory(NotificationCompat.CATEGORY_STATUS)

app/src/main/res/layout-w600dp-land/settings_fragment_containers.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<merge xmlns:android="http://schemas.android.com/apk/res/android">
2+
<merge xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
34

45
<LinearLayout
56
android:layout_width="match_parent"
@@ -12,13 +13,13 @@
1213
android:layout_width="0dp"
1314
android:layout_height="match_parent"
1415
android:layout_weight="1"
15-
android:visibility="gone" />
16+
android:visibility="gone"
17+
tools:ignore="InconsistentLayout" />
1618

1719
<View
1820
android:id="@+id/fragment_container_divider"
1921
android:layout_width="1dp"
2022
android:layout_height="match_parent"
21-
android:layout_marginLeft="-1dp"
2223
android:layout_marginStart="-1dp"
2324
android:background="?dividerColor" />
2425

app/src/main/res/layout/activity_action_config.xml

-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
<TextView
6060
android:layout_width="match_parent"
6161
android:layout_height="wrap_content"
62-
android:layout_marginLeft="32dp"
6362
android:layout_marginStart="32dp"
6463
android:text="@string/tasker_imod_reset_summary"
6564
android:textSize="12sp" />
@@ -74,7 +73,6 @@
7473
android:layout_width="wrap_content"
7574
android:layout_height="wrap_content"
7675
android:layout_alignParentEnd="true"
77-
android:layout_alignParentRight="true"
7876
android:text="@string/tasker_button_apply" />
7977
</RelativeLayout>
8078
</LinearLayout>

app/src/main/res/layout/app_list_item.xml

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="@dimen/toolbar_height"
7-
android:layout_marginEnd="20dp"
8-
android:layout_marginLeft="8dp"
9-
android:layout_marginRight="20dp"
107
android:layout_marginStart="8dp"
8+
android:layout_marginEnd="20dp"
119
android:baselineAligned="false"
1210
android:gravity="center_vertical"
1311
android:orientation="horizontal">
@@ -17,7 +15,6 @@
1715
android:layout_width="@dimen/toolbar_height"
1816
android:layout_height="match_parent"
1917
android:layout_marginEnd="8dp"
20-
android:layout_marginRight="8dp"
2118
android:gravity="center"
2219
android:padding="8dp"
2320
tools:ignore="ContentDescription" />
@@ -28,19 +25,17 @@
2825
android:layout_height="wrap_content"
2926
android:layout_gravity="center_vertical"
3027
android:layout_marginEnd="8dp"
31-
android:layout_marginRight="8dp"
3228
android:layout_weight="1"
3329
android:ellipsize="marquee"
3430
android:fontFamily="sans-serif"
35-
android:maxLines="1"
31+
android:singleLine="true"
3632
android:textAppearance="?textAppearanceListItem" />
3733

3834
<ImageButton
3935
android:id="@+id/edit"
4036
android:layout_width="48dp"
4137
android:layout_height="48dp"
4238
android:layout_marginEnd="16dp"
43-
android:layout_marginRight="16dp"
4439
android:background="@drawable/applist_gear_background"
4540
android:padding="6dp"
4641
app:srcCompat="@drawable/ic_settings_36dp"

app/src/main/res/layout/dialog_implementation.xml

-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
android:layout_width="match_parent"
1313
android:layout_height="wrap_content"
1414
android:layout_marginBottom="12dp"
15-
android:layout_marginLeft="4dp"
1615
android:layout_marginStart="4dp"
17-
android:drawableLeft="@drawable/ic_check_circle_green_24dp_wrapper"
1816
android:drawablePadding="4dp"
1917
android:drawableStart="@drawable/ic_check_circle_green_24dp_wrapper"
2018
android:gravity="center_vertical"
@@ -45,10 +43,8 @@
4543
android:id="@+id/implementation_error"
4644
android:layout_width="match_parent"
4745
android:layout_height="wrap_content"
48-
android:layout_marginLeft="4dp"
4946
android:layout_marginStart="4dp"
5047
android:layout_marginTop="8dp"
51-
android:drawableLeft="@drawable/ic_error_outline_red_24dp_wrapper"
5248
android:drawablePadding="4dp"
5349
android:drawableStart="@drawable/ic_error_outline_red_24dp_wrapper"
5450
android:gravity="center_vertical"
@@ -60,7 +56,6 @@
6056
android:id="@+id/implementation_alert"
6157
android:layout_width="match_parent"
6258
android:layout_height="wrap_content"
63-
android:layout_marginLeft="4dp"
6459
android:layout_marginStart="4dp"
6560
android:layout_marginTop="12dp"
6661
android:gravity="center_vertical"

app/src/main/res/layout/dialog_like_app.xml

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
android:id="@+id/dialog_like_app_text"
99
android:layout_width="wrap_content"
1010
android:layout_height="wrap_content"
11-
android:layout_marginLeft="@dimen/activity_horizontal_margin"
1211
android:layout_marginStart="@dimen/activity_horizontal_margin"
1312
android:layout_marginTop="@dimen/activity_vertical_margin"
1413
android:text="@string/dialog_like_app_text"
@@ -19,7 +18,6 @@
1918
android:id="@+id/dialog_cb_never_again"
2019
android:layout_width="wrap_content"
2120
android:layout_height="wrap_content"
22-
android:layout_marginLeft="@dimen/activity_horizontal_margin"
2321
android:layout_marginStart="@dimen/activity_horizontal_margin"
2422
android:text="@string/dialog_cb_never_again" />
2523
</LinearLayout>

app/src/main/res/layout/dialog_set_password.xml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
android:id="@+id/edt_password"
2020
android:layout_width="match_parent"
2121
android:layout_height="wrap_content"
22+
android:autofillHints="password"
2223
android:inputType="textPassword"
2324
android:padding="5dp" />
2425
</LinearLayout>
@@ -38,6 +39,7 @@
3839
android:id="@+id/edt_re_password"
3940
android:layout_width="match_parent"
4041
android:layout_height="wrap_content"
42+
android:autofillHints="password"
4143
android:inputType="textPassword"
4244
android:padding="5dp" />
4345
</LinearLayout>

app/src/main/res/layout/expanding_license_preference.xml

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
1313
android:layout_marginEnd="@dimen/preference_margin"
14-
android:layout_marginLeft="8dp"
15-
android:layout_marginRight="@dimen/preference_margin"
1614
android:layout_marginStart="8dp"
1715
android:contentDescription="expand"
1816
android:scaleType="center"

app/src/main/res/layout/fragment_lock_setup.xml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
android:textColor="?android:textColorPrimary" />
2020

2121
<EditText
22+
android:autofillHints="password"
2223
android:id="@+id/pin_input_view"
2324
android:layout_width="match_parent"
2425
android:layout_height="wrap_content"

app/src/main/res/layout/fs_config_box.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
android:background="@android:color/white"
1111
android:isScrollContainer="true"
1212
android:orientation="vertical"
13-
android:padding="@dimen/activity_horizontal_margin">
13+
android:padding="@dimen/activity_horizontal_margin"
14+
tools:ignore="ObsoleteLayoutParam">
1415

1516
<android.support.v7.widget.AppCompatCheckBox
1617
android:id="@+id/first_start_app_package"

app/src/main/res/layout/list_activities_item.xml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
android:id="@+id/activity_switch"
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent"
12-
android:layout_marginLeft="8dp"
1312
android:layout_marginStart="8dp"
1413
android:maxLines="3"
1514
android:padding="8dp"

app/src/main/res/layout/list_log_item.xml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
android:layout_height="wrap_content"
3535
android:layout_gravity="center"
3636
android:layout_marginEnd="16dp"
37-
android:layout_marginRight="16dp"
3837
android:textAppearance="?textAppearanceListItem"
3938
android:textColor="?android:textColorSecondary" />
4039

app/src/main/res/layout/master_switch_widget.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
34
xmlns:tools="http://schemas.android.com/tools"
45
android:layout_width="match_parent"
56
android:layout_height="match_parent"
@@ -28,6 +29,6 @@
2829
android:clickable="false"
2930
android:focusable="false"
3031
android:scaleType="fitCenter"
31-
android:src="@drawable/ic_lock_48dp"
32+
app:srcCompat="@drawable/ic_lock_48dp"
3233
tools:ignore="ContentDescription" />
3334
</RelativeLayout>

app/src/main/res/layout/seek_bar_preference.xml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
1313
android:layout_alignParentEnd="true"
14-
android:layout_alignParentRight="true"
1514
android:gravity="end"
1615
tools:text="10:00" />
1716

app/src/main/res/values-v19/styles.xml

-10
This file was deleted.

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@
9090

9191
<style name="FakeDieDialog" parent="android:Theme.DeviceDefault.Dialog.NoActionBar" />
9292

93-
<style name="TranslucentStatusBar" parent="AppTheme.Dark" />
93+
<style name="TranslucentStatusBar" parent="AppTheme.Dark">
94+
<item name="android:windowTranslucentNavigation">true</item>
95+
<item name="android:windowTranslucentStatus">true</item>
96+
<item name="android:windowContentOverlay">@null</item>
97+
</style>
9498

9599
<style name="TranslucentStatusBar.Full" parent="TranslucentStatusBar">
96100
<item name="android:windowFullscreen">true</item>

0 commit comments

Comments
 (0)