Skip to content

Commit 1785a75

Browse files
committed
Merge branch 'develop'
2 parents 9ee7771 + fbb9670 commit 1785a75

31 files changed

+444
-277
lines changed

.github/FUNDING.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# These are supported funding model platforms
2+
3+
ko_fi: nisrulz
4+
liberapay: nisrulz
5+
custom: https://www.paypal.me/nisrulz/5usd

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where `{latest version}` corresponds to published version in [ ![Download](https
9595

9696
Usage Example:
9797
```gradle
98-
def recyclerViewVersion="1.0.0"
98+
def recyclerViewVersion="1.1.0"
9999
// Required
100100
implementation "androidx.recyclerview:recyclerview:${recyclerViewVersion}"
101101

app/build.gradle

+9-34
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,28 @@
1515
*/
1616

1717
apply plugin: 'com.android.application'
18-
apply from: '../dependencies.gradle'
1918

20-
android {
21-
compileSdkVersion versions.compileSdk
19+
// Configs
20+
apply from: "$rootProject.projectDir/configs/common.gradle"
2221

22+
android {
2323
defaultConfig {
24-
minSdkVersion versions.minSdk
25-
targetSdkVersion versions.targetSdk
2624
applicationId "github.nisrulz.projectrecyclerviewhelper"
27-
versionCode versions.appVersionCode
28-
versionName versions.appVersionName
29-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30-
}
31-
buildTypes {
32-
release {
33-
minifyEnabled false
34-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
35-
}
36-
}
3725

38-
lintOptions {
39-
textOutput "stdout"
40-
textReport true
41-
checkAllWarnings true
42-
warningsAsErrors true
43-
showAll true
44-
explainIssues true
45-
abortOnError false
46-
lintConfig file("$projectDir/lint.xml")
26+
versionCode Versions.appCode
27+
versionName Versions.appName
4728
}
4829
}
4930

5031
dependencies {
51-
implementation fileTree(include: ['*.jar'], dir: 'libs')
52-
53-
// Testing
54-
testImplementation unitTestLibs
55-
androidTestImplementation androidTestsLibs
32+
// Appcompat
33+
implementation Dependencies.appCompat
5634

5735
// Card View
58-
implementation supportDeps.cardView
59-
60-
// Support Appcompat
61-
implementation "androidx.appcompat:appcompat:$versions.supportAppCompat"
36+
implementation Dependencies.cardview
6237

6338
// Required
64-
implementation "androidx.recyclerview:recyclerview:$versions.supportRecyclerView"
39+
implementation Dependencies.recyclerView
6540

6641
// ---------- RecyclerViewHelper ----------
6742
// From Maven Repo

app/src/main/AndroidManifest.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
-->
1616

1717
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18-
package="github.nisrulz.projectrecyclerviewhelper">
18+
package="github.nisrulz.projectrecyclerviewhelper">
1919

2020
<application
21-
android:allowBackup="true"
22-
android:icon="@mipmap/ic_launcher"
23-
android:label="@string/app_name"
24-
android:supportsRtl="true"
25-
android:theme="@style/AppTheme">
21+
android:allowBackup="true"
22+
android:icon="@mipmap/ic_launcher"
23+
android:label="@string/app_name"
24+
android:supportsRtl="true"
25+
android:theme="@style/AppTheme">
2626
<activity android:name=".MainActivity">
2727
<intent-filter>
2828
<action android:name="android.intent.action.MAIN" />

app/src/main/java/github/nisrulz/projectrecyclerviewhelper/MainActivity.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@
1717
package github.nisrulz.projectrecyclerviewhelper;
1818

1919
import android.os.Bundle;
20-
import androidx.appcompat.app.AppCompatActivity;
21-
import androidx.recyclerview.widget.LinearLayoutManager;
22-
import androidx.recyclerview.widget.RecyclerView;
23-
import androidx.recyclerview.widget.ItemTouchHelper;
2420
import android.util.Log;
2521
import android.view.View;
2622
import android.widget.Toast;
23+
24+
import androidx.appcompat.app.AppCompatActivity;
25+
import androidx.recyclerview.widget.ItemTouchHelper;
26+
import androidx.recyclerview.widget.LinearLayoutManager;
27+
import androidx.recyclerview.widget.RecyclerView;
28+
29+
import java.util.ArrayList;
30+
2731
import github.nisrulz.recyclerviewhelper.RVHItemClickListener;
2832
import github.nisrulz.recyclerviewhelper.RVHItemDividerDecoration;
2933
import github.nisrulz.recyclerviewhelper.RVHItemTouchHelperCallback;
30-
import java.util.ArrayList;
3134

3235
public class MainActivity extends AppCompatActivity {
3336

app/src/main/java/github/nisrulz/projectrecyclerviewhelper/MyAdapter.java

+26-23
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,22 @@
1616

1717
package github.nisrulz.projectrecyclerviewhelper;
1818

19-
import androidx.recyclerview.widget.RecyclerView;
2019
import android.view.LayoutInflater;
2120
import android.view.View;
2221
import android.view.ViewGroup;
2322
import android.widget.TextView;
24-
import github.nisrulz.recyclerviewhelper.RVHAdapter;
25-
import github.nisrulz.recyclerviewhelper.RVHViewHolder;
23+
24+
import androidx.recyclerview.widget.RecyclerView;
25+
2626
import java.util.Collections;
2727
import java.util.List;
2828

29+
import github.nisrulz.recyclerviewhelper.RVHAdapter;
30+
import github.nisrulz.recyclerviewhelper.RVHViewHolder;
31+
2932
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ItemViewHolder>
3033
implements RVHAdapter {
3134

32-
public class ItemViewHolder extends RecyclerView.ViewHolder implements RVHViewHolder {
33-
34-
final TextView txt;
35-
36-
public ItemViewHolder(View itemView) {
37-
super(itemView);
38-
txt = itemView.findViewById(R.id.txt);
39-
}
40-
41-
@Override
42-
public void onItemClear() {
43-
System.out.println("Item is unselected");
44-
}
45-
46-
@Override
47-
public void onItemSelected(int actionstate) {
48-
System.out.println("Item is selected");
49-
}
50-
}
51-
5235
private final List<String> dataList;
5336

5437
public MyAdapter(List<String> dataList) {
@@ -94,4 +77,24 @@ private void swap(int firstPosition, int secondPosition) {
9477
Collections.swap(dataList, firstPosition, secondPosition);
9578
notifyItemMoved(firstPosition, secondPosition);
9679
}
80+
81+
public class ItemViewHolder extends RecyclerView.ViewHolder implements RVHViewHolder {
82+
83+
final TextView txt;
84+
85+
public ItemViewHolder(View itemView) {
86+
super(itemView);
87+
txt = itemView.findViewById(R.id.txt);
88+
}
89+
90+
@Override
91+
public void onItemClear() {
92+
System.out.println("Item is unselected");
93+
}
94+
95+
@Override
96+
public void onItemSelected(int actionstate) {
97+
System.out.println("Item is selected");
98+
}
99+
}
97100
}

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
-->
1616

1717
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
18-
xmlns:tools="http://schemas.android.com/tools"
19-
android:layout_width="match_parent"
20-
android:layout_height="match_parent"
21-
tools:context=".MainActivity">
18+
xmlns:tools="http://schemas.android.com/tools"
19+
android:layout_width="match_parent"
20+
android:layout_height="match_parent"
21+
tools:context=".MainActivity">
2222

2323
<androidx.recyclerview.widget.RecyclerView
24-
android:id="@+id/rv_fruits"
25-
android:layout_width="match_parent"
26-
android:layout_height="match_parent" />
24+
android:id="@+id/rv_fruits"
25+
android:layout_width="match_parent"
26+
android:layout_height="match_parent" />
2727
</RelativeLayout>

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

+21-21
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,35 @@
1515
-->
1616

1717
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:layout_width="match_parent"
19-
android:layout_height="wrap_content">
18+
android:layout_width="match_parent"
19+
android:layout_height="wrap_content">
2020

2121
<LinearLayout
22-
android:layout_width="match_parent"
23-
android:layout_height="wrap_content"
24-
android:weightSum="3">
22+
android:layout_width="match_parent"
23+
android:layout_height="wrap_content"
24+
android:weightSum="3">
2525

2626
<ImageView
27-
android:layout_width="wrap_content"
28-
android:layout_height="match_parent"
29-
android:padding="10dp"
30-
android:src="@drawable/ic_reorder_grey_600_24dp"
31-
android:contentDescription="Reorder Handle" />
27+
android:layout_width="wrap_content"
28+
android:layout_height="match_parent"
29+
android:contentDescription="Reorder Handle"
30+
android:padding="10dp"
31+
android:src="@drawable/ic_reorder_grey_600_24dp" />
3232

3333
<TextView
34-
android:id="@+id/txt"
35-
android:layout_width="0dp"
36-
android:layout_height="wrap_content"
37-
android:layout_weight="3"
38-
android:padding="20dp"
39-
android:textColor="@color/colorAccent" />
34+
android:id="@+id/txt"
35+
android:layout_width="0dp"
36+
android:layout_height="wrap_content"
37+
android:layout_weight="3"
38+
android:padding="20dp"
39+
android:textColor="@color/colorAccent" />
4040

4141
<ImageView
42-
android:layout_width="wrap_content"
43-
android:layout_height="match_parent"
44-
android:padding="10dp"
45-
android:src="@drawable/ic_compare_arrows_indigo_a400_24dp"
46-
android:contentDescription="Swipe Direction icon" />
42+
android:layout_width="wrap_content"
43+
android:layout_height="match_parent"
44+
android:contentDescription="Swipe Direction icon"
45+
android:padding="10dp"
46+
android:src="@drawable/ic_compare_arrows_indigo_a400_24dp" />
4747
</LinearLayout>
4848

4949
</androidx.cardview.widget.CardView>

app/src/test/java/github/nisrulz/projectrecyclerviewhelper/ExampleUnitTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package github.nisrulz.projectrecyclerviewhelper;
1818

19-
import static org.junit.Assert.*;
19+
import org.junit.Test;
2020

21-
import org.junit.*;
21+
import static org.junit.Assert.assertEquals;
2222

2323
/**
2424
* To work on unit tests, switch the Test Artifact in the Build Variants view.

build.gradle

+13-10
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,24 @@
1717
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1818

1919
buildscript {
20-
// Gradle will not find vars defined in an external file when referring to them
21-
// in the buildscript block, unless you link it from the buildscript block, too.
22-
apply from: 'dependencies.gradle'
2320

2421
repositories {
2522
google()
2623
jcenter()
2724
}
25+
2826
dependencies {
29-
// See dependencies.gradle for declaration of plugins.
30-
classpath gradlePlugins
27+
classpath Plugins.android
28+
29+
// Publish to Jcenter/Bintray
30+
classpath Plugins.bintray
31+
classpath Plugins.androidMaven
32+
33+
// Kotlin Plugin
34+
classpath Plugins.kotlin
35+
36+
// NOTE: Do not place your application dependencies here; they belong
37+
// in the individual module build.gradle files
3138
}
3239
}
3340

@@ -36,8 +43,4 @@ allprojects {
3643
google()
3744
jcenter()
3845
}
39-
}
40-
41-
task clean(type: Delete) {
42-
delete rootProject.buildDir
43-
}
46+
}

buildSrc/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.iml
2+
.gradle
3+
/.idea
4+
/build
5+
gradle.properties

buildSrc/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repositories {
2+
jcenter()
3+
}
4+
5+
plugins {
6+
`kotlin-dsl`
7+
}

buildSrc/src/main/java/Config.kt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (C) 2016 Nishant Srivastava
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
object Config {
18+
const val testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
}

0 commit comments

Comments
 (0)