diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 97989d1..572ce2d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -28,8 +28,6 @@
-
-
\ 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 7ba4517..684d8c2 100644
--- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt
+++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/MainActivity.kt
@@ -8,11 +8,14 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import androidx.collection.LongSparseArray
+import androidx.fragment.app.Fragment
import com.google.android.material.bottomnavigation.BottomNavigationView
import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.database.entities.Balance
import cy.agorise.bitsybitshareswallet.fragments.BalancesFragment
import cy.agorise.bitsybitshareswallet.fragments.MerchantsFragment
+import cy.agorise.bitsybitshareswallet.fragments.ReceiveTransactionFragment
+import cy.agorise.bitsybitshareswallet.fragments.SendTransactionFragment
import cy.agorise.bitsybitshareswallet.processors.TransfersLoader
import cy.agorise.bitsybitshareswallet.repositories.BalanceRepository
import cy.agorise.bitsybitshareswallet.utils.Constants
@@ -39,19 +42,19 @@ class MainActivity : ConnectedActivity() {
private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item ->
when (item.itemId) {
R.id.navigation_receive -> {
- Toast.makeText(this, "Receive Fragment", Toast.LENGTH_SHORT).show()
+ loadFragment(ReceiveTransactionFragment())
return@OnNavigationItemSelectedListener true
}
R.id.navigation_balances -> {
- loadBalancesFragment()
+ loadFragment(BalancesFragment())
return@OnNavigationItemSelectedListener true
}
R.id.navigation_merchants -> {
- loadMerchantsFragment()
+ loadFragment(MerchantsFragment())
return@OnNavigationItemSelectedListener true
}
R.id.navigation_send -> {
- Toast.makeText(this, "Send Fragment", Toast.LENGTH_SHORT).show()
+ loadFragment(SendTransactionFragment())
return@OnNavigationItemSelectedListener true
}
}
@@ -73,15 +76,9 @@ class MainActivity : ConnectedActivity() {
mBalanceRepository = BalanceRepository(this)
}
- private fun loadBalancesFragment() {
+ private fun loadFragment(fragment: Fragment) {
val ft = supportFragmentManager.beginTransaction()
- ft.replace(R.id.fragment_frame, BalancesFragment())
- ft.commit()
- }
-
- private fun loadMerchantsFragment() {
- val ft = supportFragmentManager.beginTransaction()
- ft.replace(R.id.fragment_frame, MerchantsFragment())
+ ft.replace(R.id.fragment_frame, fragment)
ft.commit()
}
diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ReceiveTransactionActivity.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ReceiveTransactionActivity.kt
deleted file mode 100644
index 841493c..0000000
--- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ReceiveTransactionActivity.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package cy.agorise.bitsybitshareswallet.activities
-
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import cy.agorise.bitsybitshareswallet.R
-
-class ReceiveTransactionActivity : AppCompatActivity() {
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_receive_transaction)
- }
-}
diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/SendTransactionActivity.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/SendTransactionActivity.kt
deleted file mode 100644
index a6969d6..0000000
--- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/SendTransactionActivity.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package cy.agorise.bitsybitshareswallet.activities
-
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
-import cy.agorise.bitsybitshareswallet.R
-
-class SendTransactionActivity : AppCompatActivity() {
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_send_transaction)
- }
-}
diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt
new file mode 100644
index 0000000..d981593
--- /dev/null
+++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt
@@ -0,0 +1,19 @@
+package cy.agorise.bitsybitshareswallet.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import cy.agorise.bitsybitshareswallet.R
+
+class ReceiveTransactionFragment : Fragment() {
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ return inflater.inflate(R.layout.fragment_receive_transaction, container, false)
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt
new file mode 100644
index 0000000..a3f3b2a
--- /dev/null
+++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt
@@ -0,0 +1,19 @@
+package cy.agorise.bitsybitshareswallet.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import cy.agorise.bitsybitshareswallet.R
+
+class SendTransactionFragment : Fragment() {
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ return inflater.inflate(R.layout.fragment_send_transaction, container, false)
+ }
+
+}
diff --git a/app/src/main/res/layout/activity_send_transaction.xml b/app/src/main/res/layout/fragment_receive_transaction.xml
similarity index 65%
rename from app/src/main/res/layout/activity_send_transaction.xml
rename to app/src/main/res/layout/fragment_receive_transaction.xml
index 5500336..91f8797 100644
--- a/app/src/main/res/layout/activity_send_transaction.xml
+++ b/app/src/main/res/layout/fragment_receive_transaction.xml
@@ -5,6 +5,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".activities.SendTransactionActivity">
+ tools:context=".fragments.ReceiveTransactionFragment">
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_receive_transaction.xml b/app/src/main/res/layout/fragment_send_transaction.xml
similarity index 65%
rename from app/src/main/res/layout/activity_receive_transaction.xml
rename to app/src/main/res/layout/fragment_send_transaction.xml
index d1b31e3..3a186ed 100644
--- a/app/src/main/res/layout/activity_receive_transaction.xml
+++ b/app/src/main/res/layout/fragment_send_transaction.xml
@@ -5,6 +5,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".activities.ReceiveTransactionActivity">
+ tools:context=".fragments.SendTransactionFragment">
+
+
\ No newline at end of file