Created MainActivity's Tabs with the first tab having the bitshares logo and the other two their corresponding text names.
This commit is contained in:
parent
0155f1f9f8
commit
2ae5656c5c
7 changed files with 34 additions and 45 deletions
|
@ -7,7 +7,7 @@ apply plugin: 'kotlin-android-extensions'
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cy.agorise.bitsywallet"
|
applicationId "cy.agorise.bitsybitshareswallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cy.agorise.bitsywallet
|
package cy.agorise.bitsybitshareswallet
|
||||||
|
|
||||||
import android.support.test.InstrumentationRegistry
|
import android.support.test.InstrumentationRegistry
|
||||||
import android.support.test.runner.AndroidJUnit4
|
import android.support.test.runner.AndroidJUnit4
|
||||||
|
@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
|
||||||
fun useAppContext() {
|
fun useAppContext() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
val appContext = InstrumentationRegistry.getTargetContext()
|
val appContext = InstrumentationRegistry.getTargetContext()
|
||||||
assertEquals("cy.agorise.bitsywallet", appContext.packageName)
|
assertEquals("cy.agorise.bitsybitshareswallet", appContext.packageName)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools" package="cy.agorise.bitsywallet">
|
xmlns:tools="http://schemas.android.com/tools" package="cy.agorise.bitsybitshareswallet">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package cy.agorise.bitsywallet.activities
|
package cy.agorise.bitsybitshareswallet.activities
|
||||||
|
|
||||||
import android.support.design.widget.TabLayout
|
|
||||||
import android.support.design.widget.Snackbar
|
import android.support.design.widget.Snackbar
|
||||||
import android.support.v7.app.AppCompatActivity
|
import android.support.v7.app.AppCompatActivity
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import cy.agorise.bitsywallet.R
|
import cy.agorise.bitsybitshareswallet.R
|
||||||
|
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_main.view.*
|
import kotlinx.android.synthetic.main.fragment_main.view.*
|
||||||
|
@ -34,16 +33,17 @@ class MainActivity : AppCompatActivity() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
setSupportActionBar(toolbar)
|
//setSupportActionBar(toolbar)
|
||||||
// Create the adapter that will return a fragment for each of the three
|
// Create the adapter that will return a fragment for each of the three
|
||||||
// primary sections of the activity.
|
// primary sections of the activity.
|
||||||
mSectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager)
|
mSectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager)
|
||||||
|
|
||||||
// Set up the ViewPager with the sections adapter.
|
// Set up the ViewPager with the sections adapter.
|
||||||
container.adapter = mSectionsPagerAdapter
|
viewPager.adapter = mSectionsPagerAdapter
|
||||||
|
tabLayout.setupWithViewPager(viewPager)
|
||||||
|
|
||||||
container.addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener(tabs))
|
// Force first tab to show BTS icon
|
||||||
tabs.addOnTabSelectedListener(TabLayout.ViewPagerOnTabSelectedListener(container))
|
tabLayout.getTabAt(0)?.setIcon(R.drawable.bts_logo)
|
||||||
|
|
||||||
fab.setOnClickListener { view ->
|
fab.setOnClickListener { view ->
|
||||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||||
|
@ -89,6 +89,14 @@ class MainActivity : AppCompatActivity() {
|
||||||
// Show 3 total pages.
|
// Show 3 total pages.
|
||||||
return 3
|
return 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getPageTitle(position: Int): CharSequence? {
|
||||||
|
return when (position) {
|
||||||
|
0 -> ""
|
||||||
|
1 -> "Transactions"
|
||||||
|
else -> "Merchants"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -16,46 +16,27 @@
|
||||||
android:paddingTop="@dimen/appbar_padding_top"
|
android:paddingTop="@dimen/appbar_padding_top"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<!--<android.support.v7.widget.Toolbar-->
|
||||||
android:id="@+id/toolbar"
|
<!--android:id="@+id/toolbar"-->
|
||||||
app:title="@string/app_name"
|
<!--app:title="@string/app_name"-->
|
||||||
android:layout_width="match_parent"
|
<!--android:layout_width="match_parent"-->
|
||||||
android:layout_height="?attr/actionBarSize"
|
<!--android:layout_height="?attr/actionBarSize"-->
|
||||||
android:layout_weight="1"
|
<!--android:layout_weight="1"-->
|
||||||
android:background="?attr/colorPrimary"
|
<!--android:background="?attr/colorPrimary"-->
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
<!--app:popupTheme="@style/AppTheme.PopupOverlay"-->
|
||||||
app:layout_scrollFlags="scroll|enterAlways">
|
<!--app:layout_scrollFlags="scroll|enterAlways">-->
|
||||||
|
|
||||||
</android.support.v7.widget.Toolbar>
|
<!--</android.support.v7.widget.Toolbar>-->
|
||||||
|
|
||||||
<android.support.design.widget.TabLayout
|
<android.support.design.widget.TabLayout
|
||||||
android:id="@+id/tabs"
|
android:id="@+id/tabLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<android.support.design.widget.TabItem
|
|
||||||
android:id="@+id/tabItem"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/tab_text_1"/>
|
|
||||||
|
|
||||||
<android.support.design.widget.TabItem
|
|
||||||
android:id="@+id/tabItem2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/tab_text_2"/>
|
|
||||||
|
|
||||||
<android.support.design.widget.TabItem
|
|
||||||
android:id="@+id/tabItem3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/tab_text_3"/>
|
|
||||||
|
|
||||||
</android.support.design.widget.TabLayout>
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<android.support.v4.view.ViewPager
|
<android.support.v4.view.ViewPager
|
||||||
android:id="@+id/container"
|
android:id="@+id/viewPager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="cy.agorise.bitsywallet.activities.MainActivity">
|
tools:context="cy.agorise.bitsybitshareswallet.activities.MainActivity">
|
||||||
<item android:id="@+id/action_settings"
|
<item android:id="@+id/action_settings"
|
||||||
android:title="@string/action_settings"
|
android:title="@string/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cy.agorise.bitsywallet
|
package cy.agorise.bitsybitshareswallet
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
Loading…
Reference in a new issue