Skip to content

Commit 26998a8

Browse files
committed
add icon and comment
1 parent 004e7ed commit 26998a8

File tree

26 files changed

+117
-394
lines changed

26 files changed

+117
-394
lines changed

app/src/main/ic_launcher-web.png

19.8 KB
Loading

app/src/main/java/xyz/sangcomz/indicatordecoratorsample/MainActivity.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import androidx.core.content.ContextCompat
66
import androidx.recyclerview.widget.PagerSnapHelper
77
import kotlinx.android.synthetic.main.activity_main.*
88
import xyz.sangcomz.indicatordecorator.IndicatorItemDecoration
9+
import xyz.sangcomz.indicatordecorator.shape.CircleIndicator
910
import xyz.sangcomz.indicatordecorator.shape.DrawableIndicator
11+
import xyz.sangcomz.indicatordecorator.shape.SquareIndicator
1012

1113
class MainActivity : AppCompatActivity() {
1214

@@ -27,10 +29,15 @@ class MainActivity : AppCompatActivity() {
2729
super.onCreate(savedInstanceState)
2830
setContentView(R.layout.activity_main)
2931

30-
viewPager.adapter = adapter
31-
viewPager.addItemDecoration(IndicatorItemDecoration().apply {
32+
viewPager1.adapter = adapter
33+
viewPager1.addItemDecoration(IndicatorItemDecoration().apply {
34+
indicatorShape = CircleIndicator()
35+
})
36+
37+
viewPager2.adapter = adapter
38+
viewPager2.addItemDecoration(IndicatorItemDecoration().apply {
39+
indicatorShape = SquareIndicator()
3240
})
33-
// viewPager.addItemDecoration(LinePagerIndicatorDecoration())
3441

3542
recyclerView.adapter = adapter
3643
PagerSnapHelper().attachToRecyclerView(recyclerView)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="512"
6+
android:viewportHeight="512">
7+
<path
8+
android:pathData="M-0,-0l512,-0l-0,511.999l-512,0z">
9+
<aapt:attr name="android:fillColor">
10+
<gradient
11+
android:startY="256.00067"
12+
android:startX="3.0169793E-5"
13+
android:endY="256.00067"
14+
android:endX="511.9996"
15+
android:type="linear">
16+
<item android:offset="0" android:color="#FF43CBFF"/>
17+
<item android:offset="1" android:color="#FF9708CC"/>
18+
</gradient>
19+
</aapt:attr>
20+
</path>
21+
</vector>

app/src/main/res/drawable-v24/ic_launcher_foreground.xml

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/src/main/res/drawable/ic_launcher_background.xml

Lines changed: 0 additions & 170 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="108dp"
3+
android:height="108dp"
4+
android:viewportWidth="911.51514"
5+
android:viewportHeight="911.51514">
6+
<group android:translateX="199.75757"
7+
android:translateY="199.75757">
8+
<path
9+
android:fillColor="#FF000000"
10+
android:pathData="M476.126,256C476.126,211.772 440.218,175.864 395.99,175.864L116.008,175.864C71.78,175.864 35.872,211.772 35.872,256C35.872,300.228 71.78,336.136 116.008,336.136L395.99,336.136C440.218,336.136 476.126,300.228 476.126,256Z"
11+
android:fillAlpha="0.38"/>
12+
<path
13+
android:pathData="M70.081,256a55,55.001 90.044,1 0,110.001 0a55,55.001 90.044,1 0,-110.001 0z"
14+
android:fillColor="#ffffff"/>
15+
<path
16+
android:pathData="M213.5,256.001a42.5,42.5 90.054,1 0,85.001 0a42.5,42.5 90.054,1 0,-85.001 0z"
17+
android:fillColor="#ffffff"
18+
android:fillAlpha="0.51"/>
19+
<path
20+
android:pathData="M331.725,256.001a42.5,42.5 90.054,1 0,85.001 0a42.5,42.5 90.054,1 0,-85.001 0z"
21+
android:fillColor="#ffffff"
22+
android:fillAlpha="0.5"/>
23+
</group>
24+
</vector>

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,26 @@
1212
android:layout_height="0dp"
1313
android:orientation="horizontal"
1414
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
15-
app:layout_constraintBottom_toTopOf="@+id/viewPager"
15+
app:layout_constraintBottom_toTopOf="@+id/viewPager1"
1616
app:layout_constraintEnd_toEndOf="parent"
17-
app:layout_constraintHorizontal_bias="0.5"
1817
app:layout_constraintStart_toStartOf="parent"
1918
app:layout_constraintTop_toTopOf="parent" />
2019

2120
<androidx.viewpager2.widget.ViewPager2
22-
android:id="@+id/viewPager"
21+
android:id="@+id/viewPager1"
2322
android:layout_width="0dp"
2423
android:layout_height="0dp"
25-
app:layout_constraintBottom_toBottomOf="parent"
24+
app:layout_constraintBottom_toTopOf="@+id/viewPager2"
2625
app:layout_constraintEnd_toEndOf="parent"
27-
app:layout_constraintHorizontal_bias="0.5"
2826
app:layout_constraintStart_toStartOf="parent"
2927
app:layout_constraintTop_toBottomOf="@+id/recyclerView" />
28+
29+
<androidx.viewpager2.widget.ViewPager2
30+
android:id="@+id/viewPager2"
31+
android:layout_width="0dp"
32+
android:layout_height="0dp"
33+
app:layout_constraintBottom_toBottomOf="parent"
34+
app:layout_constraintEnd_toEndOf="parent"
35+
app:layout_constraintStart_toStartOf="parent"
36+
app:layout_constraintTop_toBottomOf="@+id/viewPager1" />
3037
</androidx.constraintlayout.widget.ConstraintLayout>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3-
<background android:drawable="@drawable/ic_launcher_background" />
4-
<foreground android:drawable="@drawable/ic_launcher_foreground" />
3+
<background android:drawable="@drawable/ic_launcher_background"/>
4+
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
55
</adaptive-icon>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3-
<background android:drawable="@drawable/ic_launcher_background" />
4-
<foreground android:drawable="@drawable/ic_launcher_foreground" />
3+
<background android:drawable="@drawable/ic_launcher_background"/>
4+
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
55
</adaptive-icon>
-486 Bytes
Loading

0 commit comments

Comments
 (0)