Skip to content

Commit

Permalink
Merge branch 'release/r0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sangcomz committed Sep 6, 2020
2 parents 6012b89 + 78c3f9d commit fa1a0e8
Show file tree
Hide file tree
Showing 21 changed files with 674 additions and 192 deletions.
56 changes: 29 additions & 27 deletions README.md
Expand Up @@ -4,10 +4,20 @@

StickyTimeLine is timeline view for android.

## What's New in 0.0.20? :tada:
- change DotDrawable for each row of items[(#16)](https://github.com/sangcomz/StickyTimeLine/issues/16)
- add java example[(#9)](https://github.com/sangcomz/StickyTimeLine/issues/9)
- migrate to AndroidX
## What's New in 0.1.0? :tada:
- Add Horizontal Mode
- Fix DEMO app
- change attribute name
- `timeLineCircleColor` -> `timeLineDotColor`
- `timeLineCircleStrokeColor` -> `timeLineDotStrokeColor`

## Result Screen

Feel free to send me a pull request with your app and I'll link you here:

| Sample <p style="float:left;"> <a href="https://play.google.com/store/apps/details?id=xyz.sangcomz.stickytimeline"> <img HEIGHT="40" WIDTH="135" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a></p> | AlleysMap <p style="float:left;"> <a href="https://play.google.com/store/apps/details?id=co.alleys.android"> <img HEIGHT="40" WIDTH="135" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a></p> |
|:---------------------------------:|:--------------------------------:|
| <img src="/pic/sample_result.gif">|<img src="/pic/alleys_result.gif">|

## How to Use

Expand All @@ -19,7 +29,7 @@ StickyTimeLine is timeline view for android.
dependencies {
//StickyTimeLine v0.0.20 and above only supports projects that have been migrated to androidx.
compile 'com.github.sangcomz:StickyTimeLine:v0.0.20'
compile 'com.github.sangcomz:StickyTimeLine:v0.1.0'
}
```
### Usage
Expand Down Expand Up @@ -189,28 +199,20 @@ public class JavaExampleActivity extends AppCompatActivity {

#### attribute

| Method Name | Description | Default Value |
|:------------------------:|------------------------------------------------|:-------------:|
| sectionBackgroundColor | To change section section background color | #f9f9f9 |
| sectionTitleTextColor | To change section title color | #414fca |
| sectionSubTitleTextColor | To change section sub title color | #d16767 |
| timeLineColor | To change line color in timeline | #51ae45 |
| timeLineCircleColor | To change circle color in timeline | #51ae45 |
| timeLineCircleStrokeColor| To change circle stroke color in timeline | #f9f9f9 |
| sectionTitleTextSize | To change section title text size | 14sp |
| sectionSubTitleTextSize | To change section sub title text size | 12sp |
| timeLineWidth | To change line width in timeline | 4dp |
| isSticky | To change Sticky functionality in the Timeline | true |
| customDotDrawable | To change the circle to custom drawable | null |

## Result Screen

Feel free to send me a pull request with your app and I'll link you here:

| Project Name | Result Screen |
|:---------:|---|
| Sample <p style="float:left;"> <a href="https://play.google.com/store/apps/details?id=xyz.sangcomz.stickytimeline"> <img HEIGHT="40" WIDTH="135" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a></p> | <img src="/pic/sample_result.gif"> |
| AlleysMap <p style="float:left;"> <a href="https://play.google.com/store/apps/details?id=co.alleys.android"> <img HEIGHT="40" WIDTH="135" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge.png" /></a></p> | <img src="/pic/alleys_result.gif"> |
| Method Name | Description | Default Value |
|:------------------------:|-------------------------------------------------------|:-------------:|
| sectionBackgroundColor | To change section section background color | #f9f9f9 |
| sectionTitleTextColor | To change section title color | #414fca |
| sectionSubTitleTextColor | To change section sub title color | #d16767 |
| timeLineColor | To change line color in timeline | #51ae45 |
| timeLineDotColor | To change dot color in timeline | #51ae45 |
| timeLineCircleStrokeColor| To change dot stroke color in timeline | #f9f9f9 |
| sectionTitleTextSize | To change section title text size | 14sp |
| sectionSubTitleTextSize | To change section sub title text size | 12sp |
| timeLineWidth | To change line width in timeline | 4dp |
| isSticky | To change Sticky functionality in the Timeline | true |
| customDotDrawable | To change the circle to custom drawable | null |
|sectionBackgroundColorMode| To change section background area(for horizontal mode)| MODE_FULL |

# Contribute
We welcome any contributions.
Expand Down
14 changes: 7 additions & 7 deletions app/build.gradle
Expand Up @@ -44,15 +44,15 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.appcompat:appcompat:$support_version"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:$constraint_version"
implementation "androidx.recyclerview:recyclerview:$support_version"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation 'androidx.cardview:cardview:1.0.0'
implementation project(':stickytimelineview')

implementation "androidx.appcompat:appcompat:$support_version"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
implementation "androidx.appcompat:appcompat:1.2.0"
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Expand Up @@ -3,16 +3,17 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;

import org.jetbrains.annotations.Nullable;

import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import xyz.sangcomz.stickytimelineview.RecyclerSectionItemDecoration;

import org.jetbrains.annotations.Nullable;

import java.util.List;

import xyz.sangcomz.stickytimelineview.TimeLineRecyclerView;
import xyz.sangcomz.stickytimelineview.callback.SectionCallback;
import xyz.sangcomz.stickytimelineview.model.SectionInfo;

public class JavaExampleActivity extends AppCompatActivity {
Expand All @@ -25,7 +26,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
initDrawable();

TimeLineRecyclerView recyclerView = findViewById(R.id.recycler_view);
TimeLineRecyclerView recyclerView = findViewById(R.id.vertical_recycler_view);

recyclerView.setLayoutManager(new LinearLayoutManager(this,
RecyclerView.VERTICAL,
Expand All @@ -35,11 +36,11 @@ protected void onCreate(Bundle savedInstanceState) {

recyclerView.addItemDecoration(getSectionCallback(singerList));

recyclerView.setAdapter(new SingerAdapter(getLayoutInflater(), singerList, R.layout.recycler_row));
recyclerView.setAdapter(new SingerAdapter(getLayoutInflater(), singerList, R.layout.recycler_vertical_row));
}

private RecyclerSectionItemDecoration.SectionCallback getSectionCallback(final List<Singer> singerList) {
return new RecyclerSectionItemDecoration.SectionCallback() {
private SectionCallback getSectionCallback(final List<Singer> singerList) {
return new SectionCallback() {

@Nullable
@Override
Expand Down
59 changes: 45 additions & 14 deletions app/src/main/java/xyz/sangcomz/stickytimeline/MainActivity.kt
Expand Up @@ -6,8 +6,9 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.content.res.AppCompatResources
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import xyz.sangcomz.stickytimelineview.RecyclerSectionItemDecoration
import xyz.sangcomz.stickytimelineview.TimeLineRecyclerView
import kotlinx.android.synthetic.main.activity_main.*
import xyz.sangcomz.stickytimelineview.callback.SectionCallback
import xyz.sangcomz.stickytimelineview.decoration.VerticalSectionItemDecoration
import xyz.sangcomz.stickytimelineview.model.SectionInfo

class MainActivity : AppCompatActivity() {
Expand All @@ -28,41 +29,71 @@ class MainActivity : AppCompatActivity() {
AppCompatResources.getDrawable(this@MainActivity, R.drawable.ic_solo)
}


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initVerticalRecyclerView()
initHorizontalRecyclerView()
}

val recyclerView: TimeLineRecyclerView = findViewById(R.id.recycler_view)
private fun initVerticalRecyclerView() {
val singerList = getSingerList()
vertical_recycler_view.adapter = SingerAdapter(
layoutInflater,
singerList,
R.layout.recycler_vertical_row
)

//Currently only LinearLayoutManager is supported.
recyclerView.layoutManager = LinearLayoutManager(
vertical_recycler_view.layoutManager = LinearLayoutManager(
this,
RecyclerView.VERTICAL,
false
)

//Get data
val singerList = getSingerList()

vertical_recycler_view.addItemDecoration(getSectionCallback(singerList))
}

//Add RecyclerSectionItemDecoration.SectionCallback
recyclerView.addItemDecoration(getSectionCallback(singerList))
private fun initHorizontalRecyclerView() {
val singerList = getSingerList()
horizontal_recycler_view.adapter = SingerAdapter(
layoutInflater,
singerList,
R.layout.recycler_horizontal_row
)

//Set Adapter
recyclerView.adapter = SingerAdapter(
horizontal_recycler_view2.adapter = SingerAdapter(
layoutInflater,
singerList,
R.layout.recycler_row
R.layout.recycler_horizontal_row
)


//Currently only LinearLayoutManager is supported.
horizontal_recycler_view.layoutManager = LinearLayoutManager(
this,
RecyclerView.HORIZONTAL,
false
)

horizontal_recycler_view2.layoutManager = LinearLayoutManager(
this,
RecyclerView.HORIZONTAL,
false
)

horizontal_recycler_view.addItemDecoration(getSectionCallback(singerList))
horizontal_recycler_view2.addItemDecoration(getSectionCallback(singerList))
}

//Get data method
private fun getSingerList(): List<Singer> = SingerRepo().singerList


//Get SectionCallback method
private fun getSectionCallback(singerList: List<Singer>): RecyclerSectionItemDecoration.SectionCallback {
return object : RecyclerSectionItemDecoration.SectionCallback {
private fun getSectionCallback(singerList: List<Singer>): SectionCallback {
return object : SectionCallback {
//In your data, implement a method to determine if this is a section.
override fun isSection(position: Int): Boolean =
singerList[position].debuted != singerList[position - 1].debuted
Expand Down
44 changes: 22 additions & 22 deletions app/src/main/java/xyz/sangcomz/stickytimeline/SingerRepo.kt
Expand Up @@ -11,23 +11,23 @@ class SingerRepo {
val singerList: List<Singer>
get() {
val singerList = ArrayList<Singer>()
singerList.add(Singer("Solo", "1995.04", "Lim Chang Jung"))
singerList.add(Singer("Solo", "1995.04", "Lim ChangJung"))

singerList.add(Singer("FIN.K.L", "1998.05", "Lee Jin"))
singerList.add(Singer("FIN.K.L", "1998.05", "Sung Yu Ri"))
singerList.add(Singer("FIN.K.L", "1998.05", "Oak Joo Hyun"))
singerList.add(Singer("FIN.K.L", "1998.05", "Lee Hyo Ri"))
singerList.add(Singer("FIN.K.L", "1998.05", "Sung YuRi"))
singerList.add(Singer("FIN.K.L", "1998.05", "Oak JooHyun"))
singerList.add(Singer("FIN.K.L", "1998.05", "Lee HyoRi"))

singerList.add(Singer("Solo", "1999.04", "Kim Bumsoo"))
singerList.add(Singer("Solo", "1999.04", "Kim BumSoo"))

singerList.add(Singer("Solo", "1999.11", "Park Hyo Shin"))
singerList.add(Singer("Solo", "1999.11", "Lee Soo Young"))
singerList.add(Singer("Solo", "2000.11", "Sung Si Kyung"))
singerList.add(Singer("Solo", "1999.11", "Park HyoShin"))
singerList.add(Singer("Solo", "1999.11", "Lee SooYoung"))
singerList.add(Singer("Solo", "2000.11", "Sung SiKyung"))

singerList.add(Singer("Buzz", "2003.10", "Kim Yeah"))
singerList.add(Singer("Buzz", "2003.10", "Yun Woo Hyun"))
singerList.add(Singer("Buzz", "2003.10", "Sin Jun Ki"))
singerList.add(Singer("Buzz", "2003.10", "Min Kyung Hoon"))
singerList.add(Singer("Buzz", "2003.10", "Yun WooHyun"))
singerList.add(Singer("Buzz", "2003.10", "Sin JunKi"))
singerList.add(Singer("Buzz", "2003.10", "Min KyungHoon"))

singerList.add(Singer("Solo", "2006.06", "Yunha"))

Expand All @@ -42,17 +42,17 @@ class SingerRepo {

singerList.add(Singer("Wanna One", "2017.08", "Kang Daniel"))
singerList.add(Singer("Wanna One", "2017.08", "Lai Kuan Lin"))
singerList.add(Singer("Wanna One", "2017.08", "Ong Seong Wu"))
singerList.add(Singer("Wanna One", "2017.08", "Ha Sung Woon"))
singerList.add(Singer("Wanna One", "2017.08", "Yoon Ji Sung"))
singerList.add(Singer("Wanna One", "2017.08", "Park Woo Jin"))
singerList.add(Singer("Wanna One", "2017.08", "Lee Dae Hwi"))
singerList.add(Singer("Wanna One", "2017.08", "Kim Jae Hwan"))
singerList.add(Singer("Wanna One", "2017.08", "Bae Jin Young"))
singerList.add(Singer("Wanna One", "2017.08", "Hwang Min Hyun"))
singerList.add(Singer("Wanna One", "2017.08", "Park Ji Hoon"))

singerList.add(Singer("Solo", "2017.11", "Woo Won Jae"))
singerList.add(Singer("Wanna One", "2017.08", "Ong SeongWu"))
singerList.add(Singer("Wanna One", "2017.08", "Ha SungWoon"))
singerList.add(Singer("Wanna One", "2017.08", "Yoon JiSung"))
singerList.add(Singer("Wanna One", "2017.08", "Park WooJin"))
singerList.add(Singer("Wanna One", "2017.08", "Lee DaeHwi"))
singerList.add(Singer("Wanna One", "2017.08", "Kim JaeHwan"))
singerList.add(Singer("Wanna One", "2017.08", "Bae JinYoung"))
singerList.add(Singer("Wanna One", "2017.08", "Hwang MinHyun"))
singerList.add(Singer("Wanna One", "2017.08", "Park JiHoon"))

singerList.add(Singer("Solo", "2017.11", "Woo WonJae"))

return singerList
}
Expand Down

0 comments on commit fa1a0e8

Please sign in to comment.