Skip to content

Commit 385c24f

Browse files
committed
Clean up some lint warnings
1 parent 396f569 commit 385c24f

File tree

10 files changed

+26
-31
lines changed

10 files changed

+26
-31
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.commit451.adapterflowlayout">
3-
4-
<application />
5-
6-
</manifest>
2+
package="com.commit451.adapterflowlayout"/>

adapterflowlayout/src/main/java/com/commit451/adapterflowlayout/AdapterFlowLayout.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/**
1212
* {@link com.wefika.flowlayout.FlowLayout} with {@link android.support.v7.widget.RecyclerView.Adapter} support.
1313
*/
14+
@SuppressWarnings("unused")
1415
public class AdapterFlowLayout extends FlowLayout {
1516

1617
private AdapterLayoutDelegate adapterLayoutDelegate;
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.commit451.adapterlayout.kotlin">
3-
4-
<application />
5-
6-
</manifest>
1+
<manifest package="com.commit451.adapterlayout.kotlin" />

adapterlayout-kotlin/src/main/java/com/commit451/adapterlayout/kotlin/kotlin.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("unused")
2+
13
package com.commit451.adapterlayout.kotlin
24

35
import android.support.v7.widget.RecyclerView
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
<manifest package="com.commit451.adapterlayout">
2-
3-
<application />
4-
5-
</manifest>
1+
<manifest package="com.commit451.adapterlayout" />

adapterlayout/src/main/java/com/commit451/adapterlayout/AdapterLayoutDelegate.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class AdapterLayoutDelegate {
1818
/**
1919
* Checks for if the data changes and changes the views accordingly
2020
*/
21-
private RecyclerView.AdapterDataObserver mObserver = new RecyclerView.AdapterDataObserver() {
21+
private RecyclerView.AdapterDataObserver observer = new RecyclerView.AdapterDataObserver() {
2222
@Override
2323
public void onChanged() {
2424
super.onChanged();
@@ -30,14 +30,14 @@ public void onChanged() {
3030
@Override
3131
public void onItemRangeChanged(int positionStart, int itemCount) {
3232
super.onItemRangeChanged(positionStart, itemCount);
33-
updateViews(positionStart, itemCount, null);
33+
updateViews(positionStart, itemCount);
3434
reindex();
3535
}
3636

3737
@Override
3838
public void onItemRangeChanged(int positionStart, int itemCount, Object payload) {
3939
super.onItemRangeChanged(positionStart, itemCount, payload);
40-
updateViews(positionStart, itemCount, payload);
40+
updateViews(positionStart, itemCount);
4141
reindex();
4242
}
4343

@@ -58,7 +58,7 @@ public void onItemRangeRemoved(int positionStart, int itemCount) {
5858
@Override
5959
public void onItemRangeMoved(int fromPosition, int toPosition, int itemCount) {
6060
super.onItemRangeMoved(fromPosition, toPosition, itemCount);
61-
//TODO this should probably be smarter and just move relevant views
61+
// this should probably be smarter and just move relevant views
6262
recreateViews();
6363
reindex();
6464
}
@@ -81,14 +81,14 @@ public AdapterLayoutDelegate(ViewGroup viewGroup) {
8181
public void setAdapter(@Nullable RecyclerView.Adapter adapter) {
8282
if (this.adapter != null) {
8383
try {
84-
this.adapter.unregisterAdapterDataObserver(mObserver);
84+
this.adapter.unregisterAdapterDataObserver(observer);
8585
} catch (Exception ignored) {
8686
}
8787
}
8888

8989
this.adapter = adapter;
9090
if (this.adapter != null) {
91-
this.adapter.registerAdapterDataObserver(mObserver);
91+
this.adapter.registerAdapterDataObserver(observer);
9292
}
9393
recreateViews();
9494
}
@@ -135,13 +135,15 @@ private void addViewAt(int viewType, int index) {
135135
viewHolder.itemView.setTag(R.id.adapter_layout_list_view_type, viewType);
136136
viewHolder.itemView.setTag(R.id.adapter_layout_list_position, index);
137137
viewGroup.addView(viewHolder.itemView);
138+
//noinspection unchecked
138139
adapter.onBindViewHolder(viewHolder, index);
139140
}
140141

141-
private void updateViews(int positionStart, int itemCount, @Nullable Object payload) {
142+
private void updateViews(int positionStart, int itemCount) {
142143
final int end = positionStart + itemCount;
143144
for (int i = positionStart; i < end; i++) {
144145
RecyclerView.ViewHolder viewHolder = getViewHolderAt(i);
146+
//noinspection unchecked
145147
adapter.onBindViewHolder(viewHolder, i);
146148
}
147149
}
@@ -170,6 +172,7 @@ private void recreateViews() {
170172

171173
if (savedViewType != null && savedViewType == viewType && savedViewHolder != null) {
172174
//perfect, it exists and is the right type, so just bind it
175+
//noinspection unchecked
173176
adapter.onBindViewHolder(savedViewHolder, i);
174177
} else {
175178
//it already existed, but something was wrong. So remove it and recreate it

adapterlayout/src/main/java/com/commit451/adapterlayout/AdapterLinearLayout.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* the good bits, and follow the convention here to create your own {@link android.support.v7.widget.RecyclerView.Adapter}
1515
* backed {@link android.view.ViewGroup}
1616
*/
17+
@SuppressWarnings("unused")
1718
public class AdapterLinearLayout extends LinearLayout {
1819

1920
private AdapterLayoutDelegate adapterLayoutDelegate;
@@ -43,6 +44,7 @@ public void setAdapter(RecyclerView.Adapter adapter) {
4344
adapterLayoutDelegate.setAdapter(adapter);
4445
}
4546

47+
@Nullable
4648
public RecyclerView.Adapter getAdapter() {
4749
if (adapterLayoutDelegate != null) {
4850
return adapterLayoutDelegate.getAdapter();

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</intent-filter>
1717
</activity>
1818

19-
<activity android:name=".AdapterFlowLayoutActivity"/>
19+
<activity android:name=".AdapterFlowLayoutActivity" />
2020
</application>
2121

2222
</manifest>

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
apply plugin: 'com.github.ben-manes.versions'
22
buildscript {
3-
ext.kotlinVersion = '1.2.21'
3+
ext.kotlinVersion = '1.2.60'
44
repositories {
55
jcenter()
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.0.1'
9+
classpath 'com.android.tools.build:gradle:3.1.4'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
11-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
12-
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
11+
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
12+
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
1313
}
1414
}
1515

@@ -28,5 +28,5 @@ ext {
2828
minSdkVersion = 15
2929
compileSdkVersion = 27
3030
targetSdkVersion = compileSdkVersion
31-
supportLibVersion = '27.0.2'
31+
supportLibVersion = '27.1.1'
3232
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Sep 29 16:24:20 CDT 2017
1+
#Thu Aug 16 19:01:46 CDT 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 commit comments

Comments
 (0)