diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a3b1ec3..6c23cf9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,7 @@ + xmlns:tools="http://schemas.android.com/tools" + package="cy.agorise.bitsybitshareswallet"> - - + + + + + \ No newline at end of file diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt index b4c7747..6974b68 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt @@ -1,13 +1,12 @@ package cy.agorise.bitsybitshareswallet.activities +import android.content.Intent import android.support.v7.app.AppCompatActivity import android.support.v4.app.Fragment import android.support.v4.app.FragmentManager import android.support.v4.app.FragmentPagerAdapter import android.os.Bundle -import android.view.Menu -import android.view.MenuItem import cy.agorise.bitsybitshareswallet.BuildConfig import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.fragments.BalancesFragment @@ -32,7 +31,6 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - //setSupportActionBar(toolbar) // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager) @@ -44,29 +42,23 @@ class MainActivity : AppCompatActivity() { // Force first tab to show BTS icon tabLayout.getTabAt(0)?.setIcon(R.drawable.tab_home_selector) - tvBuildVersion.text = String.format("v%s", BuildConfig.VERSION_NAME) - } + initBottomBar() - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - // Inflate the menu; this adds items to the action bar if it is present. - menuInflater.inflate(R.menu.menu_main, menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - val id = item.itemId - - if (id == R.id.action_settings) { - return true + ivSettings.setOnClickListener { + val intent = Intent(this, SettingsActivity::class.java) + startActivity(intent) } - - return super.onOptionsItemSelected(item) } + private fun initBottomBar() { + // Show app version number in bottom bar + tvBuildVersion.text = String.format("v%s", BuildConfig.VERSION_NAME) + + // Show block number in bottom bar + tvBlockNumber.text = getString(R.string.block_number_bottom_bar, "-----") + + // TODO add listener to update block number + } /** * A [FragmentPagerAdapter] that returns a fragment corresponding to diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/SettingsActivity.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/SettingsActivity.kt new file mode 100644 index 0000000..550c620 --- /dev/null +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/SettingsActivity.kt @@ -0,0 +1,32 @@ +package cy.agorise.bitsybitshareswallet.activities + +import android.os.Bundle +import android.view.MenuItem +import android.support.v7.app.AppCompatActivity + +/** + * A simple activity for the user to select his preferences + */ +class SettingsActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setupActionBar() + } + + /** + * Set up the [android.app.ActionBar], if the API is available. + */ + private fun setupActionBar() { + supportActionBar?.setDisplayHomeAsUpEnabled(true) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == android.R.id.home) { + onBackPressed() + return true + } + return super.onOptionsItemSelected(item) + } + +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 364e067..60e5cb1 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -66,7 +66,7 @@ android:id="@+id/tvBlockNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Block: ----" + tools:text="Block: ----" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -92,7 +92,8 @@ android:src="@drawable/ic_settings" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent"/> + app:layout_constraintTop_toTopOf="parent" + android:contentDescription="@string/title_settings"/> diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml deleted file mode 100644 index 0af865e..0000000 --- a/app/src/main/res/menu/menu_main.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6893cbf..52379d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,10 +1,11 @@ BiTSy - Tab 1 - Tab 2 - Tab 3 - Settings - Hello World from section: %1$d + + Transactions Merchants + Block: %1$s + + + Settings