diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9a78e8d..7f0f6a7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,17 +4,17 @@ package="cy.agorise.bitsybitshareswallet"> - + android:roundIcon="@drawable/bts_logo" + android:supportsRtl="true" + android:theme="@style/Theme.Bitsy" + tools:ignore="GoogleAppIndexingWarning"> + @@ -22,8 +22,8 @@ + android:name=".activities.SettingsActivity" + android:label="@string/title_settings"> 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 be29647..6ee7bc9 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt @@ -1,90 +1,54 @@ package cy.agorise.bitsybitshareswallet.activities -import android.content.Intent -import androidx.appcompat.app.AppCompatActivity - -import androidx.fragment.app.FragmentPagerAdapter import android.os.Bundle -import androidx.fragment.app.Fragment -import androidx.fragment.app.FragmentManager -import cy.agorise.bitsybitshareswallet.BuildConfig +import android.widget.Toast +import com.google.android.material.bottomnavigation.BottomNavigationView +import androidx.appcompat.app.AppCompatActivity import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.fragments.BalancesFragment import cy.agorise.bitsybitshareswallet.fragments.MerchantsFragment -import cy.agorise.bitsybitshareswallet.fragments.TransactionsFragment - import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { - /** - * The [androidx.fragment.app.FragmentPagerAdapter] that will provide - * fragments for each of the sections. We use a - * {@link FragmentPagerAdapter} derivative, which will keep every - * loaded fragment in memory. If this becomes too memory intensive, it - * may be best to switch to a - * [androidx.fragment.app.FragmentStatePagerAdapter]. - */ - private var mSectionsPagerAdapter: SectionsPagerAdapter? = null + private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item -> + when (item.itemId) { + R.id.navigation_receive -> { + Toast.makeText(this, "Receive Fragment", Toast.LENGTH_SHORT).show() + return@OnNavigationItemSelectedListener true + } + R.id.navigation_balances -> { + loadBalancesFragment() + return@OnNavigationItemSelectedListener true + } + R.id.navigation_merchants -> { + loadMerchantsFragment() + return@OnNavigationItemSelectedListener true + } + R.id.navigation_send -> { + Toast.makeText(this, "Send Fragment", Toast.LENGTH_SHORT).show() + return@OnNavigationItemSelectedListener true + } + } + false + } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - // Create the adapter that will return a fragment for each of the three - // primary sections of the activity. - mSectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager) - - // Set up the ViewPager with the sections adapter. - viewPager.adapter = mSectionsPagerAdapter - tabLayout.setupWithViewPager(viewPager) - - // Force first tab to show BTS icon - tabLayout.getTabAt(0)?.setIcon(R.drawable.tab_home_selector) - - initBottomBar() - - ivSettings.setOnClickListener { - val intent = Intent(this, SettingsActivity::class.java) - startActivity(intent) - } + navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) } - 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 + private fun loadBalancesFragment() { + val ft = supportFragmentManager.beginTransaction() + ft.replace(R.id.fragment_frame, BalancesFragment()) + ft.commit() } - /** - * A [FragmentPagerAdapter] that returns a fragment corresponding to - * one of the sections/tabs/pages. - */ - inner class SectionsPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) { - - override fun getItem(position: Int): Fragment { - return when (position) { - 0 -> BalancesFragment() - 1 -> TransactionsFragment() - else -> MerchantsFragment() - } - } - - override fun getCount(): Int { - // Show 3 total pages. - return 3 - } - - override fun getPageTitle(position: Int): CharSequence? { - return when (position) { - 0 -> "" - 1 -> getString(R.string.title_transactions) - else -> getString(R.string.title_merchants) - } - } + private fun loadMerchantsFragment() { + val ft = supportFragmentManager.beginTransaction() + ft.replace(R.id.fragment_frame, MerchantsFragment()) + ft.commit() } } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BalancesFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BalancesFragment.kt index 7d6f00e..ba0bed2 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BalancesFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/BalancesFragment.kt @@ -34,19 +34,4 @@ class BalancesFragment : Fragment() { viewModel = ViewModelProviders.of(this).get(BalancesViewModel::class.java) // TODO: Use the ViewModel } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - - btnReceive.setOnClickListener { - val intent = Intent(view.context, ReceiveTransactionActivity::class.java) - startActivity(intent) - } - - btnSend.setOnClickListener { - val intent = Intent(view.context, SendTransactionActivity::class.java) - startActivity(intent) - } - } - } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt deleted file mode 100644 index 68f9083..0000000 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt +++ /dev/null @@ -1,34 +0,0 @@ -package cy.agorise.bitsybitshareswallet.fragments - -import androidx.lifecycle.ViewModelProviders -import android.os.Bundle -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup - -import cy.agorise.bitsybitshareswallet.R -import cy.agorise.bitsybitshareswallet.viewmodels.TransactionsViewModel - -class TransactionsFragment : Fragment() { - - companion object { - fun newInstance() = TransactionsFragment() - } - - private lateinit var viewModel: TransactionsViewModel - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - return inflater.inflate(R.layout.fragment_transactions, container, false) - } - - override fun onActivityCreated(savedInstanceState: Bundle?) { - super.onActivityCreated(savedInstanceState) - viewModel = ViewModelProviders.of(this).get(TransactionsViewModel::class.java) - // TODO: Use the ViewModel - } - -} diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Constants.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Constants.kt index 728cbfb..6ace6c8 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Constants.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Constants.kt @@ -6,5 +6,5 @@ object Constants { /** * Key used to store the night mode setting into the shared preferences */ - val KEY_NIGHT_MODE_ACTIVATED = "key_night_mode_activated" + const val KEY_NIGHT_MODE_ACTIVATED = "key_night_mode_activated" } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransactionsViewModel.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransactionsViewModel.kt deleted file mode 100644 index 12df4e4..0000000 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransactionsViewModel.kt +++ /dev/null @@ -1,7 +0,0 @@ -package cy.agorise.bitsybitshareswallet.viewmodels - -import androidx.lifecycle.ViewModel; - -class TransactionsViewModel : ViewModel() { - // TODO: Implement the ViewModel -} diff --git a/app/src/main/res/drawable/bts_logo_unselected.xml b/app/src/main/res/drawable/bts_logo_unselected.xml deleted file mode 100644 index 8173798..0000000 --- a/app/src/main/res/drawable/bts_logo_unselected.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_balances.xml b/app/src/main/res/drawable/ic_balances.xml new file mode 100644 index 0000000..326c11a --- /dev/null +++ b/app/src/main/res/drawable/ic_balances.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_merchants.xml b/app/src/main/res/drawable/ic_merchants.xml new file mode 100644 index 0000000..806e675 --- /dev/null +++ b/app/src/main/res/drawable/ic_merchants.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_receive.xml b/app/src/main/res/drawable/ic_receive.xml new file mode 100644 index 0000000..8b18a9d --- /dev/null +++ b/app/src/main/res/drawable/ic_receive.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_send.xml b/app/src/main/res/drawable/ic_send.xml new file mode 100644 index 0000000..9dd0116 --- /dev/null +++ b/app/src/main/res/drawable/ic_send.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_camera.png b/app/src/main/res/drawable/icon_camera.png deleted file mode 100644 index 744d1dd..0000000 Binary files a/app/src/main/res/drawable/icon_camera.png and /dev/null differ diff --git a/app/src/main/res/drawable/icon_receive.png b/app/src/main/res/drawable/icon_receive.png deleted file mode 100644 index 9e6e211..0000000 Binary files a/app/src/main/res/drawable/icon_receive.png and /dev/null differ diff --git a/app/src/main/res/drawable/icon_send.png b/app/src/main/res/drawable/icon_send.png deleted file mode 100644 index 3896ad1..0000000 Binary files a/app/src/main/res/drawable/icon_send.png and /dev/null differ diff --git a/app/src/main/res/drawable/loader_homescreen.xml b/app/src/main/res/drawable/loader_homescreen.xml deleted file mode 100644 index 5abd1b9..0000000 --- a/app/src/main/res/drawable/loader_homescreen.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/tab_home_selector.xml b/app/src/main/res/drawable/tab_home_selector.xml deleted file mode 100644 index 0af9508..0000000 --- a/app/src/main/res/drawable/tab_home_selector.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 603f11e..c2bbe0d 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,100 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent" + tools:context=".activities.MainActivity"> - - - - - - - + app:layout_constraintBottom_toTopOf="@id/navigation"/> - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_balances.xml b/app/src/main/res/layout/fragment_balances.xml index d6b044c..f1a11d5 100644 --- a/app/src/main/res/layout/fragment_balances.xml +++ b/app/src/main/res/layout/fragment_balances.xml @@ -1,146 +1,14 @@ - - - + - - + - - + android:layout_height="match_parent" + android:text="@string/title_balances"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_merchants.xml b/app/src/main/res/layout/fragment_merchants.xml index bdd66aa..5c18a04 100644 --- a/app/src/main/res/layout/fragment_merchants.xml +++ b/app/src/main/res/layout/fragment_merchants.xml @@ -9,6 +9,6 @@ + android:text="@string/title_merchants"/> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_transactions.xml b/app/src/main/res/layout/fragment_transactions.xml deleted file mode 100644 index 743ce9d..0000000 --- a/app/src/main/res/layout/fragment_transactions.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/navigation.xml b/app/src/main/res/menu/navigation.xml new file mode 100644 index 0000000..c6aff5f --- /dev/null +++ b/app/src/main/res/menu/navigation.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9d4109e..932a805 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,38 +2,14 @@ BiTSy - Transactions + MainActivity + Receive + Balances Merchants - Block: %1$s + Send Settings Night mode - CANCEL - - to - from - - accountId - - language - - NEXT - - From - To - - Amount - - Loyalty Points - Backup Asset - Memo - Donate 2 BTS to the Support Developers at - Send - v 1.0 beta - block# ------- - No amount requested - Amount -