File tree 7 files changed +134
-9
lines changed
java/com/xmartlabs/xmartrecyclerview/sample 7 files changed +134
-9
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,8 @@ android {
7
7
defaultConfig {
8
8
minSdkVersion 14
9
9
targetSdkVersion project. ext. targetSdkVersion
10
- versionCode project. ext. versionCode
11
- versionName project. ext. versionName
12
- testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
10
+ versionCode 1
11
+ versionName ' 1.0.0'
13
12
}
14
13
buildTypes {
15
14
release {
@@ -20,10 +19,7 @@ android {
20
19
}
21
20
22
21
dependencies {
23
- androidTestImplementation " com.android.support.test:runner:${ libraryVersion.testRunner} "
24
- androidTestImplementation " com.android.support.test.espresso:espresso-core:${ libraryVersion.espresso} "
25
-
22
+ implementation project(' :library' )
26
23
implementation " com.android.support:appcompat-v7:${ libraryVersion.androidSupport} "
27
-
28
- testImplementation " junit:junit:${ libraryVersion.junit} "
24
+ implementation " com.android.support:recyclerview-v7:${ libraryVersion.androidSupport} "
29
25
}
Original file line number Diff line number Diff line change 1
1
<manifest
2
2
xmlns : android =" http://schemas.android.com/apk/res/android"
3
+ xmlns : tools =" http://schemas.android.com/tools"
3
4
package =" com.xmartlabs.xmartrecyclerview.sample"
4
5
>
5
6
9
10
android : roundIcon =" @mipmap/ic_launcher_round"
10
11
android : supportsRtl =" true"
11
12
android : theme =" @style/AppTheme"
12
- />
13
+ tools : ignore =" AllowBackup" >
14
+
15
+ <activity
16
+ android : name =" .MainActivity"
17
+ >
18
+
19
+ <intent-filter >
20
+ <action android : name =" android.intent.action.MAIN" />
21
+
22
+ <category android : name =" android.intent.category.LAUNCHER" />
23
+ </intent-filter >
24
+
25
+ </activity >
26
+
27
+ </application >
13
28
14
29
</manifest >
Original file line number Diff line number Diff line change
1
+ package com .xmartlabs .xmartrecyclerview .sample ;
2
+
3
+ import android .app .Activity ;
4
+ import android .os .Bundle ;
5
+ import android .support .annotation .Nullable ;
6
+
7
+ import com .xmartlabs .xmartrecyclerview .emptysupport .RecyclerViewEmptySupport ;
8
+
9
+ public class MainActivity extends Activity {
10
+ @ Override
11
+ protected void onCreate (@ Nullable Bundle savedInstanceState ) {
12
+ super .onCreate (savedInstanceState );
13
+ setContentView (R .layout .activity_main );
14
+ RecyclerViewEmptySupport recyclerView = findViewById (R .id .recyclerView );
15
+
16
+ MainAdapter adapter = new MainAdapter ();
17
+ recyclerView .setAdapter (adapter );
18
+
19
+ adapter .addItem ();
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ package com .xmartlabs .xmartrecyclerview .sample ;
2
+
3
+ import android .support .annotation .NonNull ;
4
+ import android .view .ViewGroup ;
5
+
6
+ import com .xmartlabs .xmartrecyclerview .adapter .SingleItemTypeRecyclerViewAdapter ;
7
+ import com .xmartlabs .xmartrecyclerview .adapter .SingleItemViewHolder ;
8
+
9
+ public class MainAdapter extends SingleItemTypeRecyclerViewAdapter <Person , SingleItemViewHolder <Person >> {
10
+ @ NonNull
11
+ @ Override
12
+ public SingleItemViewHolder <Person > onCreateViewHolder (@ NonNull ViewGroup parent ) {
13
+ return new SingleItemViewHolder <>(inflateView (parent , R .layout .item ));
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ package com .xmartlabs .xmartrecyclerview .sample ;
2
+
3
+ public class Person {
4
+ private int id ;
5
+ private String name ;
6
+
7
+ public int getId () {
8
+ return id ;
9
+ }
10
+
11
+ public void setId (int id ) {
12
+ this .id = id ;
13
+ }
14
+
15
+ public String getName () {
16
+ return name ;
17
+ }
18
+
19
+ public void setName (String name ) {
20
+ this .name = name ;
21
+ }
22
+
23
+ @ Override
24
+ public int hashCode () {
25
+ int result = id ;
26
+ result = 31 * result + name .hashCode ();
27
+ return result ;
28
+ }
29
+
30
+ @ Override
31
+ public boolean equals (Object o ) {
32
+ if (this == o ) {
33
+ return true ;
34
+ }
35
+ if (o == null || getClass () != o .getClass ()) {
36
+ return false ;
37
+ }
38
+
39
+ Person person = (Person ) o ;
40
+
41
+ if (id != person .id ) {
42
+ return false ;
43
+ }
44
+ return name .equals (person .name );
45
+ }
46
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <FrameLayout
3
+ xmlns : android =" http://schemas.android.com/apk/res/android"
4
+ android : layout_width =" match_parent"
5
+ android : layout_height =" match_parent"
6
+ >
7
+
8
+ <com .xmartlabs.xmartrecyclerview.RecyclerViewEmptySupport
9
+ android : id =" @+id/recyclerView"
10
+ android : layout_width =" match_parent"
11
+ android : layout_height =" match_parent"
12
+ />
13
+
14
+ </FrameLayout >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <LinearLayout
3
+ xmlns : android =" http://schemas.android.com/apk/res/android"
4
+ xmlns : tools =" http://schemas.android.com/tools"
5
+ android : layout_width =" match_parent"
6
+ android : layout_height =" match_parent"
7
+ android : orientation =" vertical"
8
+ android : padding =" 16dp"
9
+ >
10
+
11
+ <TextView
12
+ android : id =" @android:id/text1"
13
+ android : layout_width =" wrap_content"
14
+ android : layout_height =" wrap_content"
15
+ tools : text =" Homer Simpson"
16
+ />
17
+
18
+ </LinearLayout >
You can’t perform that action at this time.
0 commit comments