-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 40bb895
Showing
48 changed files
with
1,403 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Android template | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
.idea/modules.xml | ||
app/build | ||
# Keystore files | ||
# Uncomment the following line if you do not want to check your keystore files in. | ||
#*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
### Kotlin template | ||
# Compiled class file | ||
|
||
# Log file | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# CMake | ||
cmake-build-debug/ | ||
|
||
|
||
## File-based project format: | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
|
||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
vcs.xml | ||
|
||
workspace.xml | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff: | ||
|
||
# Sensitive or high-churn files: | ||
|
||
# Gradle: | ||
|
||
# CMake | ||
cmake-build-release/ | ||
|
||
# Mongo Explorer plugin: | ||
|
||
## File-based project format: | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
|
||
# JIRA plugin | ||
|
||
# Cursive Clojure plugin | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
### Android template | ||
# Built application files | ||
|
||
# Files for the ART/Dalvik VM | ||
|
||
# Java class files | ||
|
||
# Generated files | ||
|
||
# Gradle files | ||
|
||
# Local configuration file (sdk path, etc) | ||
|
||
# Proguard folder generated by Eclipse | ||
|
||
# Log Files | ||
|
||
# Android Studio Navigation editor temp files | ||
|
||
# Android Studio captures folder | ||
|
||
# IntelliJ | ||
|
||
# Keystore files | ||
# Uncomment the following line if you do not want to check your keystore files in. | ||
#*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
|
||
# Freeline | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff: | ||
|
||
# Sensitive or high-churn files: | ||
|
||
# Gradle: | ||
|
||
# CMake | ||
|
||
# Mongo Explorer plugin: | ||
|
||
## File-based project format: | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
|
||
# JIRA plugin | ||
|
||
# Cursive Clojure plugin | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
### Android template | ||
# Built application files | ||
|
||
# Files for the ART/Dalvik VM | ||
|
||
# Java class files | ||
|
||
# Generated files | ||
|
||
# Gradle files | ||
|
||
# Local configuration file (sdk path, etc) | ||
|
||
# Proguard folder generated by Eclipse | ||
|
||
# Log Files | ||
|
||
# Android Studio Navigation editor temp files | ||
|
||
# Android Studio captures folder | ||
|
||
# IntelliJ | ||
|
||
# Keystore files | ||
# Uncomment the following line if you do not want to check your keystore files in. | ||
#*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 28 | ||
defaultConfig { | ||
applicationId "com.kodmap.app.kmrecyclerviewstickyheader" | ||
minSdkVersion 16 | ||
targetSdkVersion 28 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support:recyclerview-v7:28.0.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
implementation project(':kmrecyclerviewstickyheader') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
...c/androidTest/java/com/kodmap/app/kmrecyclerviewstickyheader/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.kodmap.app.kmrecyclerviewstickyheader; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.kodmap.app.kmrecyclerviewstickyheader", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.kodmap.app.kmrecyclerviewstickyheader"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/kodmap/app/kmrecyclerviewstickyheader/ItemType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.kodmap.app.kmrecyclerviewstickyheader; | ||
|
||
public class ItemType { | ||
public static final Integer Post = 1; | ||
public static final Integer Header = 2; | ||
} |
51 changes: 51 additions & 0 deletions
51
app/src/main/java/com/kodmap/app/kmrecyclerviewstickyheader/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.kodmap.app.kmrecyclerviewstickyheader; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.support.v7.widget.LinearLayoutManager; | ||
import android.support.v7.widget.RecyclerView; | ||
|
||
|
||
import com.kodmap.library.kmrecyclerviewstickyheader.KmHeaderItemDecoration; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
private RecyclerViewAdapter adapter; | ||
private RecyclerView recyclerView; | ||
private LinearLayoutManager layoutManager; | ||
private KmHeaderItemDecoration kmHeaderItemDecoration; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
initAdapter(); | ||
initData(); | ||
} | ||
|
||
private void initAdapter() { | ||
adapter = new RecyclerViewAdapter(); | ||
layoutManager = new LinearLayoutManager(this); | ||
recyclerView = (RecyclerView) findViewById(R.id.recyclerView); | ||
recyclerView.setLayoutManager(layoutManager); | ||
kmHeaderItemDecoration = new KmHeaderItemDecoration(adapter); | ||
recyclerView.setAdapter(adapter); | ||
} | ||
|
||
private void initData() { | ||
List<Model> modelList = new ArrayList<>(); | ||
for (Integer i = 1; i < 10; i++) { | ||
Model headerModel = new Model("Header " + i, ItemType.Header); | ||
modelList.add(headerModel); | ||
for (Integer j = 1; j < 8; j++) { | ||
Model model = new Model("Post " + i + " " + j, ItemType.Post); | ||
modelList.add(model); | ||
} | ||
} | ||
adapter.submitList(modelList); | ||
} | ||
} |
Oops, something went wrong.