Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 7cc5dae

Browse files
author
Evgenii Kanivets
committed
#95. Add tabs to EditAccountActivity.
1 parent 3c75b2c commit 7cc5dae

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/account/edit/EditAccountActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class EditAccountActivity : BaseBackActivity() {
3939
override fun initViews() {
4040
super.initViews()
4141

42+
tabLayout.setupWithViewPager(viewPager)
4243
viewPager.adapter = EditAccountFragmentPagerAdapter(supportFragmentManager, account)
4344
}
4445

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/account/edit/adapter/EditAccountFragmentPagerAdapter.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class EditAccountFragmentPagerAdapter(fragmentManager: FragmentManager, private
1818
}
1919
}
2020

21+
override fun getPageTitle(position: Int): CharSequence? {
22+
return when (position) {
23+
0 -> "Information"
24+
1 -> "Operations"
25+
else -> ""
26+
}
27+
}
28+
2129
override fun getCount(): Int = 2
2230

2331
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
app:popupTheme="@style/AppTheme.PopupOverlay"
2424
/>
2525

26+
<android.support.design.widget.TabLayout
27+
android:id="@+id/tabLayout"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content"
30+
app:tabGravity="fill"
31+
app:tabIndicatorColor="@color/white"
32+
app:tabMode="fixed"
33+
/>
34+
2635
</android.support.design.widget.AppBarLayout>
2736

2837
<android.support.v4.view.ViewPager

0 commit comments

Comments
 (0)